-
Notifications
You must be signed in to change notification settings - Fork 689
Platform and browser inconsistencies rendering to 3D textures #2558
Description
There are sharp inconsistencies in how rendering to 3D textures works across platforms and browsers, and it's unclear what the correct behaviour is since it isn't specified in much detail in the either WebGL 2 or OpenGL ES 3.0 specifications.
I've tested Chrome 62/Firefox 57 on Ubuntu 16.04/Quadro M1000 and Windows 10/GT 750m using the following scenes (also available in rt-3Dtexture-bug.tar.gz):
- Render to TEXTURE_2D color attachment/TEXTURE_2D depth: https://tsherif.github.io/webgl2bugs/unknown/render-to-texture2D.html
- Render to TEXTURE_3D color attachment/TEXTURE_2D depth: https://tsherif.github.io/webgl2bugs/unknown/render-to-texture3D.html
- Render to TEXTURE_3D color attachment/TEXTURE_2D_ARRAY depth: https://tsherif.github.io/webgl2bugs/unknown/render-to-texture3D-array-depth.html
The first works everywhere and demonstrates what the scene should look like:
- "This is WebGL" texture used for offscreen draw
- Gray bar is the clear color for the offscreen draw
- Black bar is the clear color for the main draw
The second works in both browsers on Ubuntu, but fails in both on Windows. Chrome reports FRAMEBUFFER_UNSUPPORTED as the framebuffer status. Firefox reports no errors, and seems to do the clear (gray), but doesn't draw.
The third works in both browsers on Ubuntu and fixes things in Chrome on Windows. Firefox behaves the same on Windows as for the previous example.
I was tipped off to trying the third setup by the following language from the OpenGL 4.6 spec (section 9.4.2): "If any framebuffer attachment is layered, all populated attachments must be layered. Additionally, all populated color attachments must be from textures of the same target (three-dimensional, one- or two-dimensional array, cube map, or cube map array textures)."
However, neither the ES 3.0, nor the WebGL 2 spec mention any such restriction. @shannonwoods brought it to my attention that it does appear in section 9.4.2 of the ES 3.2 spec.