Mesa (master): v3d: Add safety checks for resource_create().
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Dec 15 03:29:15 UTC 2018
Module: Mesa
Branch: master
Commit: 332a5cf6a57dc838e7010e2f7c42eceb8209f6c6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=332a5cf6a57dc838e7010e2f7c42eceb8209f6c6
Author: Eric Anholt <eric at anholt.net>
Date: Thu Nov 29 17:06:25 2018 -0800
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 33b44868bb..e7e149abd7 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];
More information about the mesa-commit
mailing list