KhronosGroup / KhronosGroup/SPIRV-Cross
spirv-cross --reflect resource group namings are confusing and imprecise
- Dominant language
- GLSL
- Stars
- 2.5k
- Forks
- 713
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 16
Description
The way `spirv-cross --reflect` exposes type information about bound resources is currently very confusing. In the JSON output we get a list of arrays whose names are the only way to get which type of descriptor is bound, but the names are only somewhat related to the descriptor types. For instance:
{
"textures" : [ ... ],
"separate_images" : [ ... ],
"images" : [ ... ]
}
The only way I can be sure that images refers to `VK_DESCRIPTOR_TYPE_STORAGE_IMAGE` descriptors rather than `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE` is to view the source of SPIRV-cross:
void CompilerReflection::emit_resources()
{
auto res = get_shader_resources();
emit_resources("subpass_inputs", res.subpass_inputs);
emit_resources("inputs", res.stage_inputs);
emit_resources("outputs", res.stage_outputs);
emit_resources("textures", res.sampled_images);
emit_resources("separate_images", res.separate_images);
emit_resources("separate_samplers", res.separate_samplers);
emit_resources("images", res.storage_images);
emit_resources("ssbos", res.storage_buffers);
emit_resources("ubos", res.uniform_buffers);
emit_resources("push_constants", res.push_constant_buffers);
emit_resources("counters", res.atomic_counters);
}
There is a well-defined and finite set of descriptor types, why not name the arrays explicitly after those types? Or better yet have a single array of `bound_resources` each with a `descriptor_type` field which contains the Vulkan descriptor type constant?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at CompilerReflection::emit_resources(), which assembles the resource groups exposed by spirv-cross --reflect. Review the current JSON output against the descriptor-type naming problem described here, then establish whether the accepted design uses explicit descriptor-type arrays or bound_resources entries with descriptor_type; done means the reflection output unambiguously identifies each resource type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100