Mesa (master): vc4: Avoid a null-deref if a sampler index isn't used.
Eric Anholt
anholt at kemper.freedesktop.org
Tue Aug 19 15:47:35 UTC 2014
Module: Mesa
Branch: master
Commit: c8097afe2902c89d6d8a90c1948051680eaca9ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8097afe2902c89d6d8a90c1948051680eaca9ae
Author: Eric Anholt <eric at anholt.net>
Date: Mon Aug 18 15:50:48 2014 -0700
vc4: Avoid a null-deref if a sampler index isn't used.
Part of fixing ARB_fragment_program/sparse-samplers
---
src/gallium/drivers/vc4/vc4_program.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 20f7a44..fa59847 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1270,8 +1270,11 @@ static void
vc4_setup_shared_key(struct vc4_key *key, struct vc4_texture_stateobj *texstate)
{
for (int i = 0; i < texstate->num_textures; i++) {
- struct pipe_resource *prsc = texstate->textures[i]->texture;
- key->tex_format[i] = prsc->format;
+ struct pipe_sampler_view *sampler = texstate->textures[i];
+ if (sampler) {
+ struct pipe_resource *prsc = sampler->texture;
+ key->tex_format[i] = prsc->format;
+ }
}
}
More information about the mesa-commit
mailing list