diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-03-04 08:20:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 08:20:52 -0500 |
commit | 301980c840237b19c609eb4155f15b25a5928b04 (patch) | |
tree | 10e60c9ee0869f63b349c3e5b401e572ad697896 /components/canvas | |
parent | 61cf25c98ae73f5c1d9c7fac7dd02f83dbfeb703 (diff) | |
parent | 8389189d943dfd5b404401ae41e73da71ec774be (diff) | |
download | servo-301980c840237b19c609eb4155f15b25a5928b04.tar.gz servo-301980c840237b19c609eb4155f15b25a5928b04.zip |
Auto merge of #25814 - szeged:mmatyas__webgl_fns_framebuf_texlayer, r=jdm
Add support for WebGL2 FramebufferTextureLayer
Adds support for `FramebufferTextureLayer` WebGL2 call.
See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.4
<!-- Please describe your changes on the following line: -->
Depends on #25798.
cc @jdm @zakorgy
---
<!-- 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. -->
Diffstat (limited to 'components/canvas')
-rw-r--r-- | components/canvas/Cargo.toml | 2 | ||||
-rw-r--r-- | components/canvas/webgl_limits.rs | 8 | ||||
-rw-r--r-- | components/canvas/webgl_thread.rs | 13 |
3 files changed, 22 insertions, 1 deletions
diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 941eca52df2..08c060e5364 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -35,7 +35,7 @@ raqote = {git = "https://github.com/jrmuizel/raqote"} time = { version = "0.1.0", optional = true } pixels = {path = "../pixels"} servo_config = {path = "../config"} -sparkle = "0.1.19" +sparkle = "0.1.20" webrender = {git = "https://github.com/servo/webrender"} webrender_api = {git = "https://github.com/servo/webrender"} webrender_traits = {path = "../webrender_traits"} diff --git a/components/canvas/webgl_limits.rs b/components/canvas/webgl_limits.rs index 1a08dfea945..27a5b0e56dc 100644 --- a/components/canvas/webgl_limits.rs +++ b/components/canvas/webgl_limits.rs @@ -79,6 +79,8 @@ impl GLLimitsDetect for GLLimits { max_vertex_uniform_components, max_fragment_uniform_blocks, max_fragment_uniform_components, + max_3d_texture_size, + max_array_texture_layers, uniform_buffer_offset_alignment, ); if webgl_version == WebGLVersion::WebGL2 { @@ -102,6 +104,8 @@ impl GLLimitsDetect for GLLimits { 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); + max_3d_texture_size = gl.get_integer(gl::MAX_3D_TEXTURE_SIZE); + max_array_texture_layers = gl.get_integer(gl::MAX_ARRAY_TEXTURE_LAYERS) } else { max_uniform_block_size = 0; max_uniform_buffer_bindings = 0; @@ -118,6 +122,8 @@ impl GLLimitsDetect for GLLimits { max_fragment_uniform_blocks = 0; max_fragment_uniform_components = 0; uniform_buffer_offset_alignment = 0; + max_3d_texture_size = 0; + max_array_texture_layers = 0; } GLLimits { @@ -148,6 +154,8 @@ impl GLLimitsDetect for GLLimits { max_vertex_uniform_components, max_fragment_uniform_blocks, max_fragment_uniform_components, + max_3d_texture_size, + max_array_texture_layers, uniform_buffer_offset_alignment, } } diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index 1c0d7ed498f..f01380bfbed 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -1974,6 +1974,19 @@ impl WebGLImpl { WebGLCommand::InvalidateSubFramebuffer(target, ref attachments, x, y, w, h) => { gl.invalidate_sub_framebuffer(target, attachments, x, y, w, h) }, + WebGLCommand::FramebufferTextureLayer(target, attachment, tex_id, level, layer) => { + let tex_id = tex_id.map_or(0, WebGLTextureId::get); + let attach = |attachment| { + gl.framebuffer_texture_layer(target, attachment, tex_id, level, layer) + }; + + if attachment == gl::DEPTH_STENCIL_ATTACHMENT { + attach(gl::DEPTH_ATTACHMENT); + attach(gl::STENCIL_ATTACHMENT); + } else { + attach(attachment) + } + }, } // If debug asertions are enabled, then check the error state. |