-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
WebGPURenderer: Add Storage3DTexture and StorageArrayTexture
#31175
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
Changes from 1 commit
a167227
a62fcf8
da2caad
540c1d1
6f7c308
21f8d30
1d18ef1
f471b4d
44ab9fa
a295334
efe63ff
f32ec26
6478e35
bb35de5
8395fb2
5ad8c2e
912b3c3
c26fab3
dafe742
e5643c4
a1e9f0b
6db99f1
2d97903
177c903
8f89039
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,7 +208,7 @@ class WebGPUBindingUtils { | |
|
|
||
| texture.viewDimension = GPUTextureViewDimension.Cube; | ||
|
|
||
| } else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) { | ||
| } else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture || binding.texture.isTextureArray ) { | ||
|
||
|
|
||
| texture.viewDimension = GPUTextureViewDimension.TwoDArray; | ||
|
|
||
|
|
@@ -438,7 +438,7 @@ class WebGPUBindingUtils { | |
|
|
||
| dimensionViewGPU = GPUTextureViewDimension.ThreeD; | ||
|
|
||
| } else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture || ( binding.texture.isStorageTexture && binding.texture.isTextureArray ) ) { | ||
| } else if ( binding.texture.isArrayTexture || binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture || binding.texture.isTextureArray ) { | ||
|
|
||
| dimensionViewGPU = GPUTextureViewDimension.TwoDArray; | ||
|
|
||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default should be 1? and array more than 1...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I chose 0 was because someone might come up with the idea of wanting to define an array with a length of 1, for example, when providing an app with a dynamic image array length, because that's possible, and then complain that it doesn't work.
If you're working with a TextureArray on the Threejs side and the WGSLNodeBuilder suddenly wants to use a normal texture because of the length 1, it crashes because of the wrong shader texture format.
A value of 0 clearly defines a normal texture, and a depth > 0 clearly defines a TextureArray.
But if you'd like, I can set that to 1.
In this case, it can be argued that the user has to take this into account on the threejs side, but this significantly increases the effort.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this spec,
3DTexturedoes not support array, so the fact that it hascountdoes not seem to make sense.*ArrayTextureand*3DTextureare distinct and should exist individually.I think that #30959 needs to be reviewed or the other textures need to be, as there seems to be an incompatibility.
Textures
RenderTarget
RenderTarget (Currently)
I have a feeling we should go back to
RenderTargetArrayand its logic but now preserve the functionality of thecountproperty so we can have Multi Render Target Arrays.So I would go back in the same way so that we have a
StorageArrayTextureand soonStorage3DTexturetoo.Changing texture properties I imagine could be a lot of work for us and the users, and this seems like it can be avoided.
@Mugen87 @RenaudRohlinger any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, should we go back to a separate class like I originally had?
I would prefer that because it allows the user to clearly define the texture format by choosing the respective class:
StorageTexture,
StorageArrayTexture
Storage3DTexture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, the places for the case distinction in the WGSLNodeBuilder and WebGPUBindingUtils are the same, which makes things easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it seems like the best way to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take care of it in the new week. I'll also validate the Storage3DTexture in my app.
Then we have elegantly covered all three variants, because I think the separate classes make things very clear for the user.