mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #25543 - szeged:mmatyas__webgl_fns_uniforms_p3, r=jdm
Add support for WebGL2 uniform matrix operations Adds support for the `uniformMatrix[234]x[234]fv` WebGL2 functions. See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8 <!-- Please describe your changes on the following line: --> Note: Similarly to #25538, some of the functions here also overlap with their WebGL 1 variant. cc @jdm @zakorgy @imiklos --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
f200e21064
10 changed files with 398 additions and 219 deletions
|
@ -34,7 +34,7 @@ num-traits = "0.2"
|
|||
raqote = {git = "https://github.com/jrmuizel/raqote", optional = true}
|
||||
pixels = {path = "../pixels"}
|
||||
servo_config = {path = "../config"}
|
||||
sparkle = "0.1.14"
|
||||
sparkle = "0.1.16"
|
||||
webrender = {git = "https://github.com/servo/webrender"}
|
||||
webrender_api = {git = "https://github.com/servo/webrender"}
|
||||
webrender_traits = {path = "../webrender_traits"}
|
||||
|
|
|
@ -1343,6 +1343,24 @@ impl WebGLImpl {
|
|||
WebGLCommand::UniformMatrix4fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_4fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix3x2fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_3x2fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix4x2fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_4x2fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix2x3fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_2x3fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix4x3fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_4x3fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix2x4fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_2x4fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::UniformMatrix3x4fv(uniform_id, ref v) => {
|
||||
gl.uniform_matrix_3x4fv(uniform_id, false, v)
|
||||
},
|
||||
WebGLCommand::ValidateProgram(program_id) => gl.validate_program(program_id.get()),
|
||||
WebGLCommand::VertexAttrib(attrib_id, x, y, z, w) => {
|
||||
gl.vertex_attrib_4f(attrib_id, x, y, z, w)
|
||||
|
@ -1783,6 +1801,48 @@ impl WebGLImpl {
|
|||
}
|
||||
sender.send(value).unwrap();
|
||||
},
|
||||
WebGLCommand::GetUniformFloat2x3(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 2 * 3];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformFloat2x4(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 2 * 4];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformFloat3x2(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 3 * 2];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformFloat3x4(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 3 * 4];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformFloat4x2(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 4 * 2];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformFloat4x3(program_id, loc, ref sender) => {
|
||||
let mut value = [0.; 4 * 3];
|
||||
unsafe {
|
||||
gl.get_uniform_fv(program_id.get(), loc, &mut value);
|
||||
}
|
||||
sender.send(value).unwrap()
|
||||
},
|
||||
WebGLCommand::GetUniformBlockIndex(program_id, ref name, ref sender) => {
|
||||
let name = to_name_in_compiled_shader(name);
|
||||
let index = gl.get_uniform_block_index(program_id.get(), &name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue