From 332a5cf6a57dc838e7010e2f7c42eceb8209f6c6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Nov 2018 17:06:25 -0800 Subject: [PATCH] v3d: Add safety checks for resource_create(). This should ease my debugging next time I screw it up. --- src/gallium/drivers/v3d/v3d_resource.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c index 33b44868bbd..e7e149abd74 100644 --- a/src/gallium/drivers/v3d/v3d_resource.c +++ b/src/gallium/drivers/v3d/v3d_resource.c @@ -432,6 +432,12 @@ v3d_setup_slices(struct v3d_resource *rsc, uint32_t winsys_stride) */ bool uif_top = msaa; + /* Check some easy mistakes to make in a resource_create() call that + * will break our setup. + */ + assert(prsc->array_size != 0); + assert(prsc->depth0 != 0); + for (int i = prsc->last_level; i >= 0; i--) { struct v3d_resource_slice *slice = &rsc->slices[i]; -- 2.30.2