summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-18 15:50:48 -0700
committerEric Anholt <[email protected]>2014-08-19 08:47:13 -0700
commitc8097afe2902c89d6d8a90c1948051680eaca9ae (patch)
tree1ddff19e0ed8c40291a5d7a56009c368dafa9226 /src
parent31ce84a81f7166ded07e9cb41e5dfe212dd8fed1 (diff)
vc4: Avoid a null-deref if a sampler index isn't used.
Part of fixing ARB_fragment_program/sparse-samplers
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 20f7a4489dc..fa598473aab 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;
+ }
}
}