Replies: 1 comment
-
Hi, Reflection isn't necessary for general WebGPU programming. Reflection is telling you information about a shader, but if you are writing an app where you are in control of the shader and it's rendering, then you don't really need reflection. Reflection is useful for when you're writing something like an engine, where shaders are provided by the user of the engine. Then it's useful for the engine to know information about the shader. For example, with WebGPU, a RenderPipeline object needs BindGroups. A BindGroup is the binding of buffers and textures to a shader. To create a BindGroup, you need to know what buffers and textures the shader uses. So if the engine doesn't know anything about the shader, then it can use reflection to find that information. It can also determine the members of a uniform buffer. Again, mostly only useful when the engine takes external shaders. |
Beta Was this translation helpful? Give feedback.
-
I'm totally new to WebGPU community, only have experiences with old WebGL engines, like three.js.
I was told that shader reflection is important, but I have no idea why and how to use it to optimize a WebGPU renderer.
Hope you could do a simple tutorial or demo of how to use reflection in a webgpu renderer and why it is important
Thanks
Beta Was this translation helpful? Give feedback.
All reactions