From 0b5bc6ed674020f26b695eed0004b74e89c2789c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 30 Jun 2020 15:41:24 -0400 Subject: [PATCH] panfrost: Set depth to sample_count for MSAA 2D Treated like a 3D texture. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 69f05e5beab..98e67adf4f7 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -932,6 +932,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, * whereas in Gallium, it also covers cubemaps */ unsigned array_size = texture->array_size; + unsigned depth = texture->depth0; if (so->base.target == PIPE_TEXTURE_CUBE) { /* TODO: Cubemap arrays */ @@ -939,6 +940,17 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, array_size /= 6; } + /* MSAA only supported for 2D textures (and 2D texture arrays via an + * extension currently unimplemented */ + + if (so->base.target == PIPE_TEXTURE_2D) { + assert(depth == 1); + depth = texture->nr_samples; + } else { + /* MSAA only supported for 2D textures */ + assert(texture->nr_samples <= 1); + } + enum mali_texture_type type = panfrost_translate_texture_type(so->base.target); @@ -961,7 +973,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, panfrost_new_texture_bifrost( so->bifrost_descriptor, texture->width0, texture->height0, - texture->depth0, array_size, + depth, array_size, so->base.format, type, prsrc->layout, so->base.u.tex.first_level, @@ -987,7 +999,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, panfrost_new_texture( so->bo->cpu, texture->width0, texture->height0, - texture->depth0, array_size, + depth, array_size, so->base.format, type, prsrc->layout, so->base.u.tex.first_level, -- 2.30.2