vc4: Return NULL when we can't make our shadow for a sampler view.
authorEric Anholt <eric@anholt.net>
Mon, 9 Nov 2015 16:56:01 +0000 (08:56 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 10 Nov 2015 03:17:36 +0000 (19:17 -0800)
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" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/vc4/vc4_state.c

index 78aa344ab1d4dbcbf08309f837a3963cbf5cb6a3..7317695b6521816a16f46c7595e74be833ce0a5b 100644 (file)
@@ -583,6 +583,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;