Module: Mesa
Branch: main
Commit: cfa23e66901300a2572dfef54c9bf2a1e2233740
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cfa23e66901300a2572dfef54c9bf2a1e2233740

Author: Daniel Stone <[email protected]>
Date:   Fri Aug  4 12:39:40 2023 +0100

panfrost/vk: Use correct sampler dimensions for MSAA

2D-MS samplers are SAMPLER_DIM_MS, not SAMPLER_DIM_2D. There is no MSAA
for non-2D textures.

Signed-off-by: Daniel Stone <[email protected]>
Closes: mesa/mesa#9474
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24494>

---

 src/panfrost/vulkan/panvk_vX_meta_copy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/panfrost/vulkan/panvk_vX_meta_copy.c 
b/src/panfrost/vulkan/panvk_vX_meta_copy.c
index befcc2cbbab..7256231af56 100644
--- a/src/panfrost/vulkan/panvk_vX_meta_copy.c
+++ b/src/panfrost/vulkan/panvk_vX_meta_copy.c
@@ -314,12 +314,14 @@ panvk_meta_copy_img2img_shader(struct panfrost_device 
*pdev,
 
    switch (texdim) {
    case 1:
+      assert(!is_ms);
       tex->sampler_dim = GLSL_SAMPLER_DIM_1D;
       break;
    case 2:
-      tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
+      tex->sampler_dim = is_ms ? GLSL_SAMPLER_DIM_MS : GLSL_SAMPLER_DIM_2D;
       break;
    case 3:
+      assert(!is_ms);
       tex->sampler_dim = GLSL_SAMPLER_DIM_3D;
       break;
    default:
@@ -702,8 +704,8 @@ panvk_meta_copy_img2img_init(struct panvk_physical_device 
*dev, bool is_ms)
          unsigned texdimidx = panvk_meta_copy_tex_type(texdim, false);
          assert(texdimidx < ARRAY_SIZE(dev->meta.copy.img2img[0]));
 
-         /* No MSAA on 3D textures */
-         if (texdim == 3 && is_ms)
+         /* No MSAA on 1D/3D textures */
+         if (texdim != 2 && is_ms)
             continue;
 
          struct pan_shader_info shader_info;

Reply via email to