Jelajahi Sumber

shader: Remove unused AbufNode Ipa mode

ReinUsesLisp 7 tahun lalu
induk
melakukan
06b363c9b5

+ 1 - 2
src/video_core/renderer_opengl/gl_shader_decompiler.cpp

@@ -317,8 +317,7 @@ private:
 
 
     void DeclareInputAttributes() {
     void DeclareInputAttributes() {
         const auto& attributes = ir.GetInputAttributes();
         const auto& attributes = ir.GetInputAttributes();
-        for (const auto element : attributes) {
-            const Attribute::Index index = element.first;
+        for (const auto index : attributes) {
             if (index < Attribute::Index::Attribute_0 || index > Attribute::Index::Attribute_31) {
             if (index < Attribute::Index::Attribute_0 || index > Attribute::Index::Attribute_31) {
                 // Skip when it's not a generic attribute
                 // Skip when it's not a generic attribute
                 continue;
                 continue;

+ 3 - 4
src/video_core/renderer_vulkan/vk_shader_decompiler.cpp

@@ -194,8 +194,8 @@ public:
         for (const auto& sampler : ir.GetSamplers()) {
         for (const auto& sampler : ir.GetSamplers()) {
             entries.samplers.emplace_back(sampler);
             entries.samplers.emplace_back(sampler);
         }
         }
-        for (const auto& attr : ir.GetInputAttributes()) {
-            entries.attributes.insert(GetGenericAttributeLocation(attr.first));
+        for (const auto& attribute : ir.GetInputAttributes()) {
+            entries.attributes.insert(GetGenericAttributeLocation(attribute));
         }
         }
         entries.clip_distances = ir.GetClipDistances();
         entries.clip_distances = ir.GetClipDistances();
         entries.shader_length = ir.GetLength();
         entries.shader_length = ir.GetLength();
@@ -322,8 +322,7 @@ private:
     }
     }
 
 
     void DeclareInputAttributes() {
     void DeclareInputAttributes() {
-        for (const auto element : ir.GetInputAttributes()) {
-            const Attribute::Index index = element.first;
+        for (const auto index : ir.GetInputAttributes()) {
             if (!IsGenericAttribute(index)) {
             if (!IsGenericAttribute(index)) {
                 continue;
                 continue;
             }
             }

+ 2 - 5
src/video_core/shader/decode/memory.cpp

@@ -50,16 +50,13 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
         UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0,
         UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0,
                              "Unaligned attribute loads are not supported");
                              "Unaligned attribute loads are not supported");
 
 
-        Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Pass,
-                                          Tegra::Shader::IpaSampleMode::Default};
-
         u64 next_element = instr.attribute.fmt20.element;
         u64 next_element = instr.attribute.fmt20.element;
         auto next_index = static_cast<u64>(instr.attribute.fmt20.index.Value());
         auto next_index = static_cast<u64>(instr.attribute.fmt20.index.Value());
 
 
         const auto LoadNextElement = [&](u32 reg_offset) {
         const auto LoadNextElement = [&](u32 reg_offset) {
             const Node buffer = GetRegister(instr.gpr39);
             const Node buffer = GetRegister(instr.gpr39);
-            const Node attribute = GetInputAttribute(static_cast<Attribute::Index>(next_index),
-                                                     next_element, input_mode, buffer);
+            const Node attribute =
+                GetInputAttribute(static_cast<Attribute::Index>(next_index), next_element, buffer);
 
 
             SetRegister(bb, instr.gpr0.Value() + reg_offset, attribute);
             SetRegister(bb, instr.gpr0.Value() + reg_offset, attribute);
 
 

+ 1 - 1
src/video_core/shader/decode/other.cpp

@@ -134,7 +134,7 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
         const Tegra::Shader::IpaMode input_mode{instr.ipa.interp_mode.Value(),
         const Tegra::Shader::IpaMode input_mode{instr.ipa.interp_mode.Value(),
                                                 instr.ipa.sample_mode.Value()};
                                                 instr.ipa.sample_mode.Value()};
 
 
-        const Node attr = GetInputAttribute(attribute.index, attribute.element, input_mode);
+        const Node attr = GetInputAttribute(attribute.index, attribute.element);
         Node value = attr;
         Node value = attr;
         const Tegra::Shader::Attribute::Index index = attribute.index.Value();
         const Tegra::Shader::Attribute::Index index = attribute.index.Value();
         if (index >= Tegra::Shader::Attribute::Index::Attribute_0 &&
         if (index >= Tegra::Shader::Attribute::Index::Attribute_0 &&

+ 3 - 7
src/video_core/shader/shader_ir.cpp

@@ -89,13 +89,9 @@ Node ShaderIR::GetPredicate(bool immediate) {
     return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute));
     return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute));
 }
 }
 
 
-Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element,
-                                 const Tegra::Shader::IpaMode& input_mode, Node buffer) {
-    const auto [entry, is_new] =
-        used_input_attributes.emplace(std::make_pair(index, std::set<Tegra::Shader::IpaMode>{}));
-    entry->second.insert(input_mode);
-
-    return StoreNode(AbufNode(index, static_cast<u32>(element), input_mode, buffer));
+Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element, Node buffer) {
+    used_input_attributes.emplace(index);
+    return StoreNode(AbufNode(index, static_cast<u32>(element), buffer));
 }
 }
 
 
 Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {
 Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {

+ 4 - 16
src/video_core/shader/shader_ir.h

@@ -465,17 +465,9 @@ private:
 /// Attribute buffer memory (known as attributes or varyings in GLSL terms)
 /// Attribute buffer memory (known as attributes or varyings in GLSL terms)
 class AbufNode final {
 class AbufNode final {
 public:
 public:
-    explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
-                                const Tegra::Shader::IpaMode& input_mode, Node buffer = {})
-        : input_mode{input_mode}, buffer{buffer}, index{index}, element{element} {}
-
     explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
     explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
                                 Node buffer = {})
                                 Node buffer = {})
-        : input_mode{}, buffer{buffer}, index{index}, element{element} {}
-
-    Tegra::Shader::IpaMode GetInputMode() const {
-        return input_mode;
-    }
+        : buffer{buffer}, index{index}, element{element} {}
 
 
     Tegra::Shader::Attribute::Index GetIndex() const {
     Tegra::Shader::Attribute::Index GetIndex() const {
         return index;
         return index;
@@ -490,7 +482,6 @@ public:
     }
     }
 
 
 private:
 private:
-    const Tegra::Shader::IpaMode input_mode;
     const Node buffer;
     const Node buffer;
     const Tegra::Shader::Attribute::Index index;
     const Tegra::Shader::Attribute::Index index;
     const u32 element;
     const u32 element;
@@ -585,8 +576,7 @@ public:
         return used_predicates;
         return used_predicates;
     }
     }
 
 
-    const std::map<Tegra::Shader::Attribute::Index, std::set<Tegra::Shader::IpaMode>>&
-    GetInputAttributes() const {
+    const std::set<Tegra::Shader::Attribute::Index>& GetInputAttributes() const {
         return used_input_attributes;
         return used_input_attributes;
     }
     }
 
 
@@ -700,8 +690,7 @@ private:
     /// Generates a predicate node for an immediate true or false value
     /// Generates a predicate node for an immediate true or false value
     Node GetPredicate(bool immediate);
     Node GetPredicate(bool immediate);
     /// Generates a node representing an input attribute. Keeps track of used attributes.
     /// Generates a node representing an input attribute. Keeps track of used attributes.
-    Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element,
-                           const Tegra::Shader::IpaMode& input_mode, Node buffer = {});
+    Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer = {});
     /// Generates a node representing an output attribute. Keeps track of used attributes.
     /// Generates a node representing an output attribute. Keeps track of used attributes.
     Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer);
     Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer);
     /// Generates a node representing an internal flag
     /// Generates a node representing an internal flag
@@ -876,8 +865,7 @@ private:
 
 
     std::set<u32> used_registers;
     std::set<u32> used_registers;
     std::set<Tegra::Shader::Pred> used_predicates;
     std::set<Tegra::Shader::Pred> used_predicates;
-    std::map<Tegra::Shader::Attribute::Index, std::set<Tegra::Shader::IpaMode>>
-        used_input_attributes;
+    std::set<Tegra::Shader::Attribute::Index> used_input_attributes;
     std::set<Tegra::Shader::Attribute::Index> used_output_attributes;
     std::set<Tegra::Shader::Attribute::Index> used_output_attributes;
     std::map<u32, ConstBuffer> used_cbufs;
     std::map<u32, ConstBuffer> used_cbufs;
     std::set<Sampler> used_samplers;
     std::set<Sampler> used_samplers;