diff options
author | Timur Kristóf <[email protected]> | 2019-02-19 14:19:59 +0100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-02-20 10:37:47 +1100 |
commit | 9429bcc4b03c551be61e28f06f9a407a0bc1139c (patch) | |
tree | 55418429dd62885fb19c004a58b3c0dc197ef5e6 /src/gallium/drivers | |
parent | afb15d14ca19ea321280bb83215af4c55b9ce881 (diff) |
radeonsi/nir: Use uniform location when calculating const_file_max.
The nine state tracker can produce NIR uniform variables
whose location is explicitly set. radeonsi did not take that
into account when calculating const_file_max, resulting in
rendering glitches. This patch fixes that.
Signed-Off-By: Timur Kristóf <[email protected]>
Tested-by: Andre Heider <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 7554f5b9f8b..4c5e1241af1 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -669,6 +669,9 @@ void si_nir_scan_shader(const struct nir_shader *nir, enum glsl_base_type base_type = glsl_get_base_type(glsl_without_array(type)); unsigned aoa_size = MAX2(1, glsl_get_aoa_size(type)); + unsigned loc = variable->data.location; + int slot_count = glsl_count_attribute_slots(type, false); + int max_slot = MAX2(info->const_file_max[0], (int) loc) + slot_count; /* Gather buffers declared bitmasks. Note: radeonsi doesn't * really use the mask (other than ubo_idx == 1 for regular @@ -716,8 +719,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, if (base_type == GLSL_TYPE_SAMPLER) { if (variable->data.bindless) { info->const_buffers_declared |= 1; - info->const_file_max[0] += - glsl_count_attribute_slots(type, false); + info->const_file_max[0] = max_slot; } else { info->samplers_declared |= u_bit_consecutive(variable->data.binding, aoa_size); @@ -725,8 +727,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, } else if (base_type == GLSL_TYPE_IMAGE) { if (variable->data.bindless) { info->const_buffers_declared |= 1; - info->const_file_max[0] += - glsl_count_attribute_slots(type, false); + info->const_file_max[0] = max_slot; } else { info->images_declared |= u_bit_consecutive(variable->data.binding, aoa_size); @@ -741,8 +742,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, u_bit_consecutive(0, SI_NUM_CONST_BUFFERS); } else { info->const_buffers_declared |= 1; - info->const_file_max[0] += - glsl_count_attribute_slots(type, false); + info->const_file_max[0] = max_slot; } } } |