[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Restricting WebGL exposure of OES_depth_texture
On Tue, Jun 5, 2012 at 12:37 PM, Florian Bösch <firstname.lastname@example.org>
On Tue, Jun 5, 2012 at 9:29 PM, Gregg Tavares (社用) <email@example.com>
In trying to implement this I'm running into issues
#1) it looks like we'll need to restrict depth textures to level 0 only.
Reason: WebGL requires that we clear textures. Otherwise you could potential read uninitialized memory.
We can clear a depth texture by attaching to an FBO and calling glClear but we can only attach to level 0
in OpenGL ES 2.0 which means it's impossible to clear levels > 0.
I think that's fine, you can also only render to level 0 to other textures unless you have that other extension. Afaik the oes depth texture extension makes no mention that you should be able to render to level 1 and upwards.
#2) What should we do about GL_DEPTH_STENCIL format?
WebGL requires support for GL_DEPTH_STENCIL as a renderbuffer format.
It seems like it also needs to require support for GL_DEPTH_STENCIL as a texture format for WEBGL_depth_texture
otherwise it's possible you can't use stencils with depth textures.
I'm not sure what issues that brings up.
I don't think it is required that any combination of things you attach to an FBO does work. Some combinations will fail (they're also failing right now). It is required that at least some combination allows you to render to a stencil, depth and color buffer, but unless you try and validate the FBO, you're not gonna know.
It's not required. The question is do we want to support stencils at all used with depth textures? IIRC Desktop GLs don't support creating a separate depth and stencil and attaching both. The only way to get both depth and stencil at the same time is to use DEPTH_STENCIL. So, if we don't add DEPTH_STENCIL support to WEBGL_depth_texture then there will effectively be no way to use a stencil with a depth texture. Of course maybe my memory is bad. I thought that's why we added DEPTH_STENCIL in the first place to WebGL but I could be remembering incorrectly.