[Mesa-dev] [PATCH] mesa/st/nir: fix driver_location for arrays of image/sampler
Rob Clark
robdclark at gmail.com
Mon Jun 11 22:20:41 UTC 2018
fwiw, I didn't notice yet any case where this matters for textures,
but for images, you could try (from deqp gles31 module)
dEQP-GLES31.functional.layout_binding.image.image2d.fragment_binding_array
as an example
(perhaps I should have mentioned that in the commit msg)
I'm not 100% sure if we just avoid this issue with textures (at least
when indirect deref not involves) simply by virtue of a lowering
pass..
BR,
-R
On Mon, Jun 11, 2018 at 6:15 PM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> Looks right to me. I guess we have no piglit tests for it, I ran the CTS a
> few times on radeonsi but I was more focused on getting piglit working.
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
>
> On 12/06/18 04:56, Rob Clark wrote:
>>
>> We can have arrays of images or samplers. But I forgot to handle that
>> case long ago. Suprised no one complained yet.
>>
>> Signed-off-by: Rob Clark <robdclark at gmail.com>
>> ---
>> src/mesa/state_tracker/st_glsl_to_nir.cpp | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp
>> b/src/mesa/state_tracker/st_glsl_to_nir.cpp
>> index c8c2ef6cffd..3fc04c7b8b7 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
>> @@ -272,12 +272,15 @@ st_nir_assign_uniform_locations(struct gl_context
>> *ctx,
>> uniform->interface_type != NULL)
>> continue;
>> - if (!uniform->data.bindless &&
>> - (uniform->type->is_sampler() || uniform->type->is_image())) {
>> - if (uniform->type->is_sampler())
>> - loc = shaderidx++;
>> - else
>> - loc = imageidx++;
>> + const struct glsl_type *type = glsl_without_array(uniform->type);
>> + if (!uniform->data.bindless && (type->is_sampler() ||
>> type->is_image())) {
>> + if (type->is_sampler()) {
>> + loc = shaderidx;
>> + shaderidx += type_size(uniform->type);
>> + } else {
>> + loc = imageidx;
>> + imageidx += type_size(uniform->type);
>> + }
>> } else if (strncmp(uniform->name, "gl_", 3) == 0) {
>> const gl_state_index16 *const stateTokens =
>> uniform->state_slots[0].tokens;
>> /* This state reference has already been setup by ir_to_mesa,
>> but we'll
>> @@ -285,7 +288,6 @@ st_nir_assign_uniform_locations(struct gl_context
>> *ctx,
>> */
>> unsigned comps;
>> - const struct glsl_type *type =
>> glsl_without_array(uniform->type);
>> if (glsl_type_is_struct(type)) {
>> comps = 4;
>> } else {
>>
>
More information about the mesa-dev
mailing list