From a1d8306bfdd24edd5c61761b79e72be32c5aaff4 Mon Sep 17 00:00:00 2001
From: ameerj <52414509+ameerj@users.noreply.github.com>
Date: Sun, 29 Jan 2023 13:42:34 -0500
Subject: emit_glasm_image: Fix TXQ with MSAA textures

---
 src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/shader_recompiler/backend/glasm/emit_glasm_image.cpp')

diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
index b7bc114168..85ee273339 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
@@ -59,6 +59,13 @@ std::string Image(EmitContext& ctx, IR::TextureInstInfo info,
     }
 }
 
+bool IsTextureMsaa(EmitContext& ctx, const IR::TextureInstInfo& info) {
+    if (info.type == TextureType::Buffer) {
+        return false;
+    }
+    return ctx.info.texture_descriptors.at(info.descriptor_index).is_multisample;
+}
+
 std::string_view TextureType(IR::TextureInstInfo info, bool is_ms = false) {
     if (info.is_depth) {
         switch (info.type) {
@@ -535,7 +542,8 @@ void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value&
                               ScalarS32 lod, [[maybe_unused]] const IR::Value& skip_mips) {
     const auto info{inst.Flags<IR::TextureInstInfo>()};
     const std::string texture{Texture(ctx, info, index)};
-    const std::string_view type{TextureType(info)};
+    const bool is_msaa{IsTextureMsaa(ctx, info)};
+    const std::string_view type{TextureType(info, is_msaa)};
     ctx.Add("TXQ {},{},{},{};", inst, lod, texture, type);
 }
 
-- 
cgit v1.2.3-70-g09d2