webgpu
webgpu copied to clipboard
How to use descriptor indexing for texture?
Now I'm implementing Path Tracer refer to your WebGPU-Path-Tracer. Your project is using array texture, but I want to use descriptor indexing to support unbound texture!
I know you have already implemet it in your dawn fork, can you give me a example to show how to use descriptor indexing with this project(webgpu node)?
Thanks very much!
I'm not sure what you're referring to, do you mean this?
I refer to the VK_EXT_descriptor_indexing extension, How to use it with webgpu node?
I don't remember if I actually enabled this extension, why do you need unbound textures?
in https://github.com/maierfelix/webgpu/issues/23#issuecomment-641824422 , you say:
the current alternative is descriptor indexing which is enabled in my fork
I want to sample textures with different sizes. I don't know what's your meaning:
If you want to sample textures with different sizes, then use a plain buffer and do the texture filtering (e.g. linear) inside the shader
storage all textures with different size into one plain buffer(uniform buffer?)? how to do the texture filtering?
I see, so you can use NonUniformEXT
as a workaround as I did here for example. The problem is that this approach doesn't support textures of different sizes.
storage all textures with different size into one plain buffer(uniform buffer?)? how to do the texture filtering?
You can do the texture filtering yourself in the shader (though that probably looses hardware acceleration). Just search for e.g. bilinear or trilinear glsl texture filtering
OK, I know how to use NonUniformEXT. Can you give some references(or the example code) to show how to do the "storage all textures with different size into one plain buffer"?
There are different ways to implement it, here is an idea:
- 1 shader array containing texture information (
width
,height
,offset
) - 1 shader array containing the texture data. Each texture is referenced through
offset
in the first shader array
Another way is to dynamically generate the shaders based on the used materials/textures which is not an uncommon practice.
I understand your solution, Thanks very much~