From 37681eef8a3dd836451cd10f25362ba537761a95 Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Tue, 19 Aug 2025 16:41:35 -0300 Subject: [PATCH] panfrost: add some sanity checks for nr_samples Make sure that depth and color buffers have the same number of samples. This *should* be guaranteed by the higher levels, but in the case of a bug we want to notice quickly (and in fact such a bug has bitten us, see panfrost/mesa/issue#200). Reviewed-by: Christoph Pillmayer Reviewed-by: Erik Faye-Lund Part-of: --- src/panfrost/lib/pan_desc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 8bc94a3f118..f1ec3e76de3 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -1020,13 +1020,16 @@ check_fb_attachments(const struct pan_fb_info *fb) { #ifndef NDEBUG for (unsigned i = 0; i < fb->rt_count; i++) { - if (fb->rts[i].view) + if (fb->rts[i].view) { pan_image_view_check(fb->rts[i].view); + assert(fb->rts[i].view->nr_samples == fb->nr_samples); + } } - if (fb->zs.view.zs) + if (fb->zs.view.zs) { pan_image_view_check(fb->zs.view.zs); - + assert(fb->zs.view.zs->nr_samples == fb->nr_samples); + } if (fb->zs.view.s) pan_image_view_check(fb->zs.view.s); #endif