[Mesa-dev] [PATCH] radeonsi: fix a crash when unbinding sampler states

Marek Olšák maraeo at gmail.com
Mon Apr 8 18:25:04 UTC 2019


From: Marek Olšák <marek.olsak at amd.com>

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

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 244ba5a7bec..ac40ed27f91 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -942,21 +942,21 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
 static void si_bind_sampler_states(struct pipe_context *ctx,
                                    enum pipe_shader_type shader,
                                    unsigned start, unsigned count, void **states)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_samplers *samplers = &sctx->samplers[shader];
 	struct si_descriptors *desc = si_sampler_and_image_descriptors(sctx, shader);
 	struct si_sampler_state **sstates = (struct si_sampler_state**)states;
 	int i;
 
-	if (!count || shader >= SI_NUM_SHADERS)
+	if (!count || shader >= SI_NUM_SHADERS || !sstates)
 		return;
 
 	for (i = 0; i < count; i++) {
 		unsigned slot = start + i;
 		unsigned desc_slot = si_get_sampler_slot(slot);
 
 		if (!sstates[i] ||
 		    sstates[i] == samplers->sampler_states[slot])
 			continue;
 
-- 
2.17.1



More information about the mesa-dev mailing list