summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-11-09 08:56:01 -0800
committerEmil Velikov <[email protected]>2015-11-18 18:49:41 +0000
commit9bbdd99d8ceb9c1064bacff7071590f6bbe2a8ed (patch)
treeed84f73d156f8c485a55b099de02e73e7f46deac
parente54ac25120dbcfaf8cedef62c74bde97d32f2046 (diff)
vc4: Return NULL when we can't make our shadow for a sampler view.
I'm not sure what the caller does is appropriate (just have a NULL sampler at this slot), but it fixes the immediate crash. Cc: "11.0" <[email protected]> (cherry picked from commit 5980389bbf98b8186ba6a06392d92b82fa9efad3)
-rw-r--r--src/gallium/drivers/vc4/vc4_state.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c
index 8a759c2ca4c..996b158adde 100644
--- a/src/gallium/drivers/vc4/vc4_state.c
+++ b/src/gallium/drivers/vc4/vc4_state.c
@@ -581,6 +581,10 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
tmpl.last_level = cso->u.tex.last_level - cso->u.tex.first_level;
prsc = vc4_resource_create(pctx->screen, &tmpl);
+ if (!prsc) {
+ free(so);
+ return NULL;
+ }
rsc = vc4_resource(prsc);
clone = vc4_resource(prsc);
clone->shadow_parent = &shadow_parent->base.b;