diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-01-09 08:52:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 08:52:15 -0500 |
commit | 123d43bb16cd6807ad6de3e83316191a58505d5b (patch) | |
tree | 1bb3050695e0c2df00d9a8f111a75c30cb24e3ee /components/canvas/webgl_limits.rs | |
parent | ff6ddb4b613b8028bd16fb2355c539dc14bec7a6 (diff) | |
parent | da94f8d0e78546a40972596ad0ae4ded510057de (diff) | |
download | servo-123d43bb16cd6807ad6de3e83316191a58505d5b.tar.gz servo-123d43bb16cd6807ad6de3e83316191a58505d5b.zip |
Auto merge of #25229 - mmatyas:webgl_fns_ubo, r=jdm
Add initial support for WebGL2 uniform buffer functions
This *work-in-progress* patch 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
However, indexed uniforms and `getIndexedParameter`, which would be used by some of the functions (and transform feedback) is still missing. Also this patch depends on:
- https://github.com/servo/sparkle/pull/16
- https://github.com/servo/servo/issues/25034
(required for both building and running the tests).
cc @jdm @zakorgy @imiklos
<!-- Please describe your changes on the following line: -->
---
<!-- 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
- [ ] These changes fix #___ (GitHub issue number if applicable)
<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- 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. -->
Diffstat (limited to 'components/canvas/webgl_limits.rs')
-rw-r--r-- | components/canvas/webgl_limits.rs | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/components/canvas/webgl_limits.rs b/components/canvas/webgl_limits.rs index d910be71d99..1a08dfea945 100644 --- a/components/canvas/webgl_limits.rs +++ b/components/canvas/webgl_limits.rs @@ -65,14 +65,24 @@ impl GLLimitsDetect for GLLimits { }; let ( + max_uniform_block_size, max_uniform_buffer_bindings, min_program_texel_offset, max_program_texel_offset, max_transform_feedback_separate_attribs, max_draw_buffers, max_color_attachments, + max_combined_uniform_blocks, + max_combined_vertex_uniform_components, + max_combined_fragment_uniform_components, + max_vertex_uniform_blocks, + max_vertex_uniform_components, + max_fragment_uniform_blocks, + max_fragment_uniform_components, + uniform_buffer_offset_alignment, ); if webgl_version == WebGLVersion::WebGL2 { + max_uniform_block_size = gl.get_integer(gl::MAX_UNIFORM_BLOCK_SIZE); max_uniform_buffer_bindings = gl.get_integer(gl::MAX_UNIFORM_BUFFER_BINDINGS); min_program_texel_offset = gl.get_integer(gl::MIN_PROGRAM_TEXEL_OFFSET); max_program_texel_offset = gl.get_integer(gl::MAX_PROGRAM_TEXEL_OFFSET); @@ -81,14 +91,33 @@ impl GLLimitsDetect for GLLimits { max_color_attachments = gl.get_integer(gl::MAX_COLOR_ATTACHMENTS); max_draw_buffers = gl .get_integer(gl::MAX_DRAW_BUFFERS) - .min(max_color_attachments) + .min(max_color_attachments); + max_combined_uniform_blocks = gl.get_integer(gl::MAX_COMBINED_UNIFORM_BLOCKS); + max_combined_vertex_uniform_components = + gl.get_integer(gl::MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS); + max_combined_fragment_uniform_components = + gl.get_integer(gl::MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS); + max_vertex_uniform_blocks = gl.get_integer(gl::MAX_VERTEX_UNIFORM_BLOCKS); + max_vertex_uniform_components = gl.get_integer(gl::MAX_VERTEX_UNIFORM_COMPONENTS); + max_fragment_uniform_blocks = gl.get_integer(gl::MAX_FRAGMENT_UNIFORM_BLOCKS); + max_fragment_uniform_components = gl.get_integer(gl::MAX_FRAGMENT_UNIFORM_COMPONENTS); + uniform_buffer_offset_alignment = gl.get_integer(gl::UNIFORM_BUFFER_OFFSET_ALIGNMENT); } else { + max_uniform_block_size = 0; max_uniform_buffer_bindings = 0; min_program_texel_offset = 0; max_program_texel_offset = 0; max_transform_feedback_separate_attribs = 0; max_color_attachments = 1; max_draw_buffers = 1; + max_combined_uniform_blocks = 0; + max_combined_vertex_uniform_components = 0; + max_combined_fragment_uniform_components = 0; + max_vertex_uniform_blocks = 0; + max_vertex_uniform_components = 0; + max_fragment_uniform_blocks = 0; + max_fragment_uniform_components = 0; + uniform_buffer_offset_alignment = 0; } GLLimits { @@ -111,6 +140,15 @@ impl GLLimitsDetect for GLLimits { max_program_texel_offset, max_color_attachments, max_draw_buffers, + max_uniform_block_size, + max_combined_uniform_blocks, + max_combined_vertex_uniform_components, + max_combined_fragment_uniform_components, + max_vertex_uniform_blocks, + max_vertex_uniform_components, + max_fragment_uniform_blocks, + max_fragment_uniform_components, + uniform_buffer_offset_alignment, } } } |