radeonsi: avoid crash when a sampler state is bound for a buffer texture
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 11 Mar 2016 16:07:38 +0000 (11:07 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 13 Mar 2016 14:37:23 +0000 (09:37 -0500)
Sampler states don't really make sense with buffer textures, but they
can be set anyway, so we need to be defensive here. This bug was lurking
for a while and was finally noticed due to PBO uploads setting sampler
states.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94284
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Tested-by: Shawn Starr <shawn.starr@rogers.com>
src/gallium/drivers/radeonsi/si_descriptors.c

index 11b902516e0eb883a12e6828406d422c7852376a..d12b3e6b28a6ee895ad0872ea41997b03840e2aa 100644 (file)
@@ -329,6 +329,7 @@ static void si_bind_sampler_states(struct pipe_context *ctx, unsigned shader,
                 */
                if (samplers->views.views[i] &&
                    samplers->views.views[i]->texture &&
+                   samplers->views.views[i]->texture->target != PIPE_BUFFER &&
                    ((struct r600_texture*)samplers->views.views[i]->texture)->fmask.size)
                        continue;