Mesa (master): radeonsi/nir: fix number of used samplers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 16 10:44:25 UTC 2019


Module: Mesa
Branch: master
Commit: 741cff91d3fbf920cc196d2607090d1350cb1ab6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=741cff91d3fbf920cc196d2607090d1350cb1ab6

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Mon Sep 16 19:39:40 2019 +1000

radeonsi/nir: fix number of used samplers

Commit f3e978db incorrectly assumed the maximum number of
samplers was equal to the max number of defined samplers
e.g. where bindings skip slots.

This fixes an assert in si_nir_load_sampler_desc() for an
enemy territory quake wars shader. And fixes potential bugs with
incorrect bounds limiting in the same code for production builds
of mesa.

Fixes: f3e978db ("radeonsi/nir: Remove uniform variable scanning")

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

 src/gallium/drivers/radeonsi/si_shader_nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 4970b01fd73..85cf53848e6 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -783,7 +783,7 @@ void si_nir_scan_shader(const struct nir_shader *nir,
 	if (nir->num_uniforms > 0)
 		info->const_buffers_declared |= 1;
 	info->images_declared = u_bit_consecutive(0, nir->info.num_images);
-	info->samplers_declared = u_bit_consecutive(0, nir->info.num_textures);
+	info->samplers_declared = nir->info.textures_used;
 
 	info->num_written_clipdistance = nir->info.clip_distance_array_size;
 	info->num_written_culldistance = nir->info.cull_distance_array_size;




More information about the mesa-commit mailing list