Add initial support for WebGL2 uniform buffer functions

Adds initial support for the following WebGL2 calls:

- bindBufferBase
- bindBufferRange
- getUniformIndices
- getUniformBlockIndex
- getActiveUniforms
- getActiveUniformBlockParameter
- getActiveUniformBlockName
- uniformBlockBinding

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.16
This commit is contained in:
Mátyás Mustoha 2019-11-25 11:09:24 +01:00
parent f8c957dc1b
commit da94f8d0e7
33 changed files with 891 additions and 228 deletions

View file

@ -462,6 +462,12 @@ pub enum WebGLCommand {
GetUniformFloat4(WebGLProgramId, i32, WebGLSender<[f32; 4]>),
GetUniformFloat9(WebGLProgramId, i32, WebGLSender<[f32; 9]>),
GetUniformFloat16(WebGLProgramId, i32, WebGLSender<[f32; 16]>),
GetUniformBlockIndex(WebGLProgramId, String, WebGLSender<u32>),
GetUniformIndices(WebGLProgramId, Vec<String>, WebGLSender<Vec<u32>>),
GetActiveUniforms(WebGLProgramId, Vec<u32>, u32, WebGLSender<Vec<i32>>),
GetActiveUniformBlockName(WebGLProgramId, u32, WebGLSender<String>),
GetActiveUniformBlockParameter(WebGLProgramId, u32, u32, WebGLSender<Vec<i32>>),
UniformBlockBinding(WebGLProgramId, u32, u32),
InitializeFramebuffer {
color: bool,
depth: bool,
@ -479,6 +485,8 @@ pub enum WebGLCommand {
SetSamplerParameterInt(WebGLSamplerId, u32, i32),
GetSamplerParameterFloat(WebGLSamplerId, u32, WebGLSender<f32>),
GetSamplerParameterInt(WebGLSamplerId, u32, WebGLSender<i32>),
BindBufferBase(u32, u32, Option<WebGLBufferId>),
BindBufferRange(u32, u32, Option<WebGLBufferId>, i64, i64),
}
macro_rules! nonzero_type {
@ -671,6 +679,8 @@ pub struct ProgramLinkInfo {
pub active_attribs: Box<[ActiveAttribInfo]>,
/// The list of active uniforms.
pub active_uniforms: Box<[ActiveUniformInfo]>,
/// The list of active uniform blocks.
pub active_uniform_blocks: Box<[ActiveUniformBlockInfo]>,
/// The number of varying variables
pub transform_feedback_length: i32,
/// The buffer mode used when transform feedback is active
@ -713,6 +723,15 @@ impl ActiveUniformInfo {
}
}
/// Description of a single uniform block.
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct ActiveUniformBlockInfo {
/// The name of the uniform block.
pub name: String,
/// The size of the uniform block.
pub size: i32,
}
macro_rules! parameters {
($name:ident { $(
$variant:ident($kind:ident { $(
@ -999,4 +1018,13 @@ pub struct GLLimits {
pub max_uniform_buffer_bindings: u32,
pub min_program_texel_offset: u32,
pub max_program_texel_offset: u32,
pub max_uniform_block_size: u32,
pub max_combined_uniform_blocks: u32,
pub max_combined_vertex_uniform_components: u32,
pub max_combined_fragment_uniform_components: u32,
pub max_vertex_uniform_blocks: u32,
pub max_vertex_uniform_components: u32,
pub max_fragment_uniform_blocks: u32,
pub max_fragment_uniform_components: u32,
pub uniform_buffer_offset_alignment: u32,
}