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

Fix conflict with depth sampler #30113

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

Spiri0
Copy link
Contributor

@Spiri0 Spiri0 commented Dec 12, 2024

The depth textures were excluded from the sampling by the compare. But depth textures are sampleable in WebGPU. But even if you don't sample, you can use the sampler for textureSampleLevel. Instead of screen coordinates like you have to use in the case of textureLoad, you can use uv coordinates with textureSampleLevel and mip 0, which is very practical.

Related issue: #30033 #30023

Spiri0 added 10 commits December 2, 2024 07:48
Arrays are not currently taken into account by the wgslTypeLib. However, with the struct extension mrdoob#29908, arrays will also become important as a type.
Since textureSampleLevel is usable in compute shaders, this small PR allows sampler to be used in compute shaders for this purpose
enables the use of samplers in compute shaders
…ilder.js

The depth textures were excluded from the sampling by the compare. But depth textures are sampleable in WebGPU. But even if you don't sample, you can use the sampler for textureSampleLevel. Instead of screen coordinates like you have to use in the case of textureLoad, you can use uv coordinates with textureSampleLevel and mip 0, which is very practical.
Copy link

github-actions bot commented Dec 12, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.21
79.01
339.21
79.01
+0 B
+0 B
WebGPU 486.17
134.91
486.1
134.9
-66 B
-17 B
WebGPU Nodes 485.63
134.81
485.57
134.8
-66 B
-16 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.1
112.06
465.1
112.06
+0 B
+0 B
WebGPU 555.31
150.34
555.25
150.32
-64 B
-16 B
WebGPU Nodes 511.22
140.1
511.16
140.08
-64 B
-18 B

@sunag
Copy link
Collaborator

sunag commented Dec 13, 2024

But depth textures are sampleable in WebGPU.

This would not be contrary to this issue? #29852

@Spiri0
Copy link
Contributor Author

Spiri0 commented Dec 13, 2024

I only use the NearestFilter for depthTextures. That would be compatible with the warning that is there in #29852. The sampler no longer works with the line, although NearestFilter is set by me.

What are the filters for depth textures set by default? I can take a look at that later. I could also switch to textureLoad for the time being, but in the long run it would of course be better if the textureSampleLevel could be used for compute shaders, because uv coordinates are already practical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants