Currently the SPRIV reflect API for graphics/compute shaders return counts.
typedef struct SDL_ShaderCross_GraphicsShaderResourceInfo
{
Uint32 num_samplers; /**< The number of samplers defined in the shader. */
Uint32 num_storage_textures; /**< The number of storage textures defined in the shader. */
Uint32 num_storage_buffers; /**< The number of storage buffers defined in the shader. */
Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
} SDL_ShaderCross_GraphicsShaderResourceInfo;
typedef struct SDL_ShaderCross_ComputePipelineMetadata
{
Uint32 num_samplers; /**< The number of samplers defined in the shader. */
Uint32 num_readonly_storage_textures; /**< The number of readonly storage textures defined in the shader. */
Uint32 num_readonly_storage_buffers; /**< The number of readonly storage buffers defined in the shader. */
Uint32 num_readwrite_storage_textures; /**< The number of read-write storage textures defined in the shader. */
Uint32 num_readwrite_storage_buffers; /**< The number of read-write storage buffers defined in the shader. */
Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
Uint32 threadcount_x; /**< The number of threads in the X dimension. */
Uint32 threadcount_y; /**< The number of threads in the Y dimension. */
Uint32 threadcount_z; /**< The number of threads in the Z dimension. */
} SDL_ShaderCross_ComputePipelineMetadata;
It would be very useful if the API would contain more details like:
- name (if exists in SPRIV)
- binding indices (eg. set, binding / register, space)
- anything else that could be useful
eg.
typedef struct SDL_ShaderCross_ReflectResourceInfo
{
char *name;
Uint32 set;
Uint32 binding;
} SDL_ShaderCross_ReflectResourceInfo;
typedef struct SDL_ShaderCross_GraphicsShaderResourceInfo
{
Uint32 num_samplers; /**< The number of samplers defined in the shader. */
Uint32 num_storage_textures; /**< The number of storage textures defined in the shader. */
Uint32 num_storage_buffers; /**< The number of storage buffers defined in the shader. */
Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
/** new fields */
SDL_ShaderCross_ReflectResourceInfo samplers;
SDL_ShaderCross_ReflectResourceInfo storage_textures;
SDL_ShaderCross_ReflectResourceInfo storage_buffers;
SDL_ShaderCross_ReflectResourceInfo uniform_buffers;
} SDL_ShaderCross_GraphicsShaderResourceInfo;
Benefits:
- Ability to validate resource locations / bindings
- Automatic resource binding (especially important during development/experimentation for faster iteration time)
Currently the SPRIV reflect API for graphics/compute shaders return counts.
It would be very useful if the API would contain more details like:
eg.
Benefits: