-
Notifications
You must be signed in to change notification settings - Fork 668
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
Depth Textures need more tests/specs? #3353
Comments
Sized depth or depth-stencil formats are not filterable in GLES 3.0.6 p161:
However we marked these as filterable in Firefox a couple years back:
I believe all texture formats in WebGL1 (es2) were filterable, and there wasn't a concept of a non-filterable format. I believe that the specs say that d32f should not be filterable, and that this should have a test. Good news: D32F uploads do indeed work, but sampling from a depth format always clamps to [0,1.0], so you were actually just re-scaling too late, versus this modification: https://jsfiddle.net/mzadun4L/ |
Going in reverse order: (2) This is probably a bug, but I'm not sure whether there are restrictions in the underlying APIs (in particular, D3D) which caused the WebGL working group to land on the current behavior. In WebGL 1.0, the WEBGL_depth_texture extension explicitly forbade trying to upload CPU-side data to depth, stencil, or depth/stencil textures. I think this decision was made because of restrictions in D3D9. Presumably D3D11 would have lifted any such restrictions. The I'm personally not sure whether we should strive to fix this on all browsers and platforms given that it's been broken for this long. Most WebGL applications are probably only rendering to depth textures and don't expect CPU-side uploading of depth data to work. At least we should investigate in Chromium how feasible it is to get this working on Windows, Mac and Linux - all three platforms will soon be using different backend APIs. If it looks difficult to make this behavior portable then we should probably just specify and test that uploading CPU-side depth data is not allowed, like the (1) From my reading of the OpenGL ES spec, depth textures are considered incomplete if they don't use NEAREST filtering. See section 3.8.13 "Texture Completeness" of the ES 3.0.6 spec, or section 8.17 "Texture Completeness" of the ES 3.2 spec (more recent). The ES 3.2 spec says the texture's incomplete because:
I think the depth texture's supposed to be incomplete when linear filtering's applied to it. |
FWIW, Firefox without ANGLE on Windows does indeed filter d16, though this is desktop GL. Trying on an Android Adreno device, d16 does not filter. |
Like @jdashg pointed out, for (2) that was my bug, D32F is clamped 0,1. R32F is not so that's working now that the bug in my sample is fixed.
for (1) yes, I guess FF should not filter. |
OK, great that there aren't that many behavioral differences! It would be good to expand the testing in this area. |
I've started writing a test, but if anyone is *even more excited*, happy to
let you commandeer!
…On Tue, Nov 2, 2021 at 5:27 PM Ken Russell ***@***.***> wrote:
OK, great that there aren't that many behavioral differences!
It would be good to expand the testing in this area.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3353 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALHJDM62S7HMXHP7CUPX4TUKCFZJANCNFSM5HHQO56A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I think with the tests in #3357, we'll be all set! |
I ran into 2 issues related to depth textures.
(1) Chrome doesn't allow filtering DEPTH_COMPONENT16 textures, Firefox does on Mac Only
Firefox MacOS
![Screen Shot 2021-11-02 at 2 59 31 PM](https://user-images.githubusercontent.com/234804/139957848-d71d3437-17c7-452a-ab80-d426b8542869.png)
Chrome Mac/Win (or Firefox Win)
![Screen Shot 2021-11-02 at 3 01 57 PM](https://user-images.githubusercontent.com/234804/139957962-1a61f500-f416-4cd7-a52d-74ca05d52749.png)
Does the spec need to specify which of those 2 is correct?
(2) Neither browser on either OS seems to allow uploading data to a D32F texture.
See the screenshots above, the first square D32F seems like it should match R32F. In fact those 2 formats seem like they are supposed be pretty similar except D32F can be used as a depth attachment and R32F as a color attachment.
There's no error trying to upload the data to the D32F texture (same data as the R32F texture) but it doesn't appear. And in fact the spec 3.7.2 specifies what values to use a for texImage2D and a DEPTH_COMPONENT32F texture.
Is this a bug?
Live version: https://jsgist.org/?src=493218139726a53b7b3affbb636148e9
The text was updated successfully, but these errors were encountered: