June 15, 2021 8:36 PM, "Henri Verbeet" hverbeet@gmail.com wrote:
Multiple symbols can map to one array variable, and each can have a different base index.
Is that really true? E.g., suppose you have a vkd3d_shader_descriptor_binding like this:
You're right, I had it the wrong way around. The base index of the binding can be stored along with the other data in the symbol table.
That's one possibility, but it would also be possible to just compare the "count" field from the vkd3d_shader_descriptor_binding structure against 1, instead of comparing "binding_base_idx" against ~0u. (I.e., when storing a vkd3d_shader_descriptor_binding structure in the vkd3d_array_variable/vkd3d_symbol_descriptor_binding structure.)
The one potential problem I see is it's possible to declare in a shader an unbounded resource array which maps to a range containing only one descriptor, and then dynamically index it with a variable that's always zero. Unlikely to occur, but the dynamic indexing would fail because with binding.count == 1, a scalar variable is declared.