From: "Conor McCarthy" Subject: Re: [PATCH vkd3d v2 3/3] vkd3d-shader: Emit SPIR-V for descriptor arrays and arrayed bindings. Message-Id: <3cd7a066edd9c35a38b50e60da6f03cf@codeweavers.com> Date: Tue, 15 Jun 2021 12:55:29 +0000 In-Reply-To: References: <20210603050124.45254-1-cmccarthy@codeweavers.com> <20210603050124.45254-3-cmccarthy@codeweavers.com> <91ad271c716d35e3632754a66772fc73@codeweavers.com> June 15, 2021 8:36 PM, "Henri Verbeet" 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.