Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement WEBGL_depth_texture extension #22796

Open
jdm opened this issue Jan 31, 2019 · 6 comments
Open

Implement WEBGL_depth_texture extension #22796

jdm opened this issue Jan 31, 2019 · 6 comments

Comments

@jdm
Copy link
Member

jdm commented Jan 31, 2019

https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_depth_texture

@jdm jdm added the A-content/webgl 3d canvas API label Jan 31, 2019
@jdm jdm added this to To do in High priority WebGL work Jan 31, 2019
@atouchet atouchet added this to To do in WebGL content Feb 13, 2019
@jdm
Copy link
Member Author

jdm commented Jan 23, 2020

Right now https://threejs.org/examples/webgl_depth_texture.html doesn't run in Servo. To implement the missing extension, we need to:

  • add the new WebIDL from https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/ to components/script/dom/webidls/WEBGL_depth_texture.webidl
  • add a new extension implementation in components/script/dom/webgl_extensions/ext/, and make it be supported if the ANGLE_depth_texture GL extension is supported
  • add the new formats and data types to the TexFormat/TexDataType enums in components/canvas_traits/webgl.rs
  • add the new type values to the list DEFAULT_DISABLED_TEX_TYPES_WEBGL1 in components/script/dom/webgl_extensions/extensions.rs, and enable these types as part of enabling the new webgl extension (WebGLExtensions::enable_tex_type)
  • update the implementation of WebGLRenderingContext::validate_tex_image_2d_data to support the Uint32 type
  • update the implementation of WebGLRenderingContext::FramebufferTexture2D to support the new allowed target values when this extension is enabled
  • update WebGLFramebuffer::texture2d to pass the actual desired target value instead of constants::FRAMEBUFFER, and validate the internal format of the texture is appropriate for non-FRAMEBUFFER targets
  • implement the error conditions described in "Errors" in https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/ for the APIs listed

If everything goes correctly, there should be more passing tests in ./mach test-wpt tests/wpt/webgl/tests/conformance/extensions/webgl-depth-texture.html and https://threejs.org/examples/webgl_depth_texture.html should match Firefox's output.

@ivanshen
Copy link

ivanshen commented Feb 3, 2020

I've created the new extension implementation following the webglcolorbufferfloat.rs file. For the new data types, if the idl contained const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;, is this what I should add to the enum TexDataType? Something like UnsignedInt248 = gl::UNSIGNED_INT_24_8_WEBGL?

@jdm
Copy link
Member Author

jdm commented Feb 10, 2020

You will need to use UnsignedInt24_8 = gl::UNSIGNED_INT_24_8.

@jdm
Copy link
Member Author

jdm commented Feb 21, 2020

This extension is used in lots of cables.gl content like https://holon.drastic.net/view/moron/ and https://cables.gl/p/9CHVn1.

@jdm
Copy link
Member Author

jdm commented May 20, 2020

We will need to expose this extension's behaviour by default in webgl2 as well.

@jdm
Copy link
Member Author

jdm commented Jul 22, 2020

Playing around with trying to implement this at https://github.com/jdm/servo/tree/depth-texture. texImage2D and framebufferTexture2D no longer trigger WebGL errors, but the actual pixel tests are still failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/webgl 3d canvas API
Projects
Status: To do
Status: To do
Development

No branches or pull requests

2 participants