Closed empyreanx closed 1 year ago
The optional reflection functions will basically be the only reliable way to lookup 'shader desc slots' by name, while any 'human readable' reflection information in the shader-desc struct might change as needed by the sokol-gfx backends.
Strings are only embedded in the shader desc structs when required by a sokol-gfx backend to setup the backend-specific shader objects (that's mostly the case for the GL backend, but also for D3D11 vertex attribute semantic names), but these details may change, since more modern 3D APIs moved from 'lookup by string' to implicit slot indices.
For instance now that the GLES2 backend has been dropped, sg_shader_attr_desc.name
will most likely be removed too at one point.
That's also why uniform block names are not included in the shader desc. D3D11 and Metal don't identify uniform blocks by name, but by slot indices, and in the GL backend, there is no concept of 'uniform blocks' at all, because they are disolved into direct uniforms.
Thank you for the explanation. Caching the slots seems to eliminate the downsides of using the reflection functions in my case.
I'm a bit frustrated that sokol_gfx doesn't have uniform block names listed in the struct
sg_shader_uniform_block_desc.
This means the only way to get a uniform block's slot is by using the reflection functions, which I had hoped I could avoid.