summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-04-29 23:37:09 -0300
committerGravatar ReinUsesLisp2019-05-02 21:46:25 -0300
commit06b363c9b5ccb64cfe7ac4d001ae35bff30828de (patch)
tree313a8c5330426e050cb0a6577420e3e40f58ce0b /src
parentshader_ir/memory: Emit AL2P IR (diff)
downloadyuzu-06b363c9b5ccb64cfe7ac4d001ae35bff30828de.tar.gz
yuzu-06b363c9b5ccb64cfe7ac4d001ae35bff30828de.tar.xz
yuzu-06b363c9b5ccb64cfe7ac4d001ae35bff30828de.zip
shader: Remove unused AbufNode Ipa mode
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp7
-rw-r--r--src/video_core/shader/decode/memory.cpp7
-rw-r--r--src/video_core/shader/decode/other.cpp2
-rw-r--r--src/video_core/shader/shader_ir.cpp10
-rw-r--r--src/video_core/shader/shader_ir.h20
6 files changed, 14 insertions, 35 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index ef1a1995f..33c0edca9 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -317,8 +317,7 @@ private:
317 317
318 void DeclareInputAttributes() { 318 void DeclareInputAttributes() {
319 const auto& attributes = ir.GetInputAttributes(); 319 const auto& attributes = ir.GetInputAttributes();
320 for (const auto element : attributes) { 320 for (const auto index : attributes) {
321 const Attribute::Index index = element.first;
322 if (index < Attribute::Index::Attribute_0 || index > Attribute::Index::Attribute_31) { 321 if (index < Attribute::Index::Attribute_0 || index > Attribute::Index::Attribute_31) {
323 // Skip when it's not a generic attribute 322 // Skip when it's not a generic attribute
324 continue; 323 continue;
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 23d9b10db..850085f35 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -194,8 +194,8 @@ public:
194 for (const auto& sampler : ir.GetSamplers()) { 194 for (const auto& sampler : ir.GetSamplers()) {
195 entries.samplers.emplace_back(sampler); 195 entries.samplers.emplace_back(sampler);
196 } 196 }
197 for (const auto& attr : ir.GetInputAttributes()) { 197 for (const auto& attribute : ir.GetInputAttributes()) {
198 entries.attributes.insert(GetGenericAttributeLocation(attr.first)); 198 entries.attributes.insert(GetGenericAttributeLocation(attribute));
199 } 199 }
200 entries.clip_distances = ir.GetClipDistances(); 200 entries.clip_distances = ir.GetClipDistances();
201 entries.shader_length = ir.GetLength(); 201 entries.shader_length = ir.GetLength();
@@ -322,8 +322,7 @@ private:
322 } 322 }
323 323
324 void DeclareInputAttributes() { 324 void DeclareInputAttributes() {
325 for (const auto element : ir.GetInputAttributes()) { 325 for (const auto index : ir.GetInputAttributes()) {
326 const Attribute::Index index = element.first;
327 if (!IsGenericAttribute(index)) { 326 if (!IsGenericAttribute(index)) {
328 continue; 327 continue;
329 } 328 }
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp
index 4aa74965f..84db4d4dc 100644
--- a/src/video_core/shader/decode/memory.cpp
+++ b/src/video_core/shader/decode/memory.cpp
@@ -50,16 +50,13 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
50 UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0, 50 UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0,
51 "Unaligned attribute loads are not supported"); 51 "Unaligned attribute loads are not supported");
52 52
53 Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Pass,
54 Tegra::Shader::IpaSampleMode::Default};
55
56 u64 next_element = instr.attribute.fmt20.element; 53 u64 next_element = instr.attribute.fmt20.element;
57 auto next_index = static_cast<u64>(instr.attribute.fmt20.index.Value()); 54 auto next_index = static_cast<u64>(instr.attribute.fmt20.index.Value());
58 55
59 const auto LoadNextElement = [&](u32 reg_offset) { 56 const auto LoadNextElement = [&](u32 reg_offset) {
60 const Node buffer = GetRegister(instr.gpr39); 57 const Node buffer = GetRegister(instr.gpr39);
61 const Node attribute = GetInputAttribute(static_cast<Attribute::Index>(next_index), 58 const Node attribute =
62 next_element, input_mode, buffer); 59 GetInputAttribute(static_cast<Attribute::Index>(next_index), next_element, buffer);
63 60
64 SetRegister(bb, instr.gpr0.Value() + reg_offset, attribute); 61 SetRegister(bb, instr.gpr0.Value() + reg_offset, attribute);
65 62
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp
index d750a2936..776bdb931 100644
--- a/src/video_core/shader/decode/other.cpp
+++ b/src/video_core/shader/decode/other.cpp
@@ -134,7 +134,7 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
134 const Tegra::Shader::IpaMode input_mode{instr.ipa.interp_mode.Value(), 134 const Tegra::Shader::IpaMode input_mode{instr.ipa.interp_mode.Value(),
135 instr.ipa.sample_mode.Value()}; 135 instr.ipa.sample_mode.Value()};
136 136
137 const Node attr = GetInputAttribute(attribute.index, attribute.element, input_mode); 137 const Node attr = GetInputAttribute(attribute.index, attribute.element);
138 Node value = attr; 138 Node value = attr;
139 const Tegra::Shader::Attribute::Index index = attribute.index.Value(); 139 const Tegra::Shader::Attribute::Index index = attribute.index.Value();
140 if (index >= Tegra::Shader::Attribute::Index::Attribute_0 && 140 if (index >= Tegra::Shader::Attribute::Index::Attribute_0 &&
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp
index e4eb0dfd9..0307ae5b0 100644
--- a/src/video_core/shader/shader_ir.cpp
+++ b/src/video_core/shader/shader_ir.cpp
@@ -89,13 +89,9 @@ Node ShaderIR::GetPredicate(bool immediate) {
89 return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute)); 89 return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute));
90} 90}
91 91
92Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element, 92Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element, Node buffer) {
93 const Tegra::Shader::IpaMode& input_mode, Node buffer) { 93 used_input_attributes.emplace(index);
94 const auto [entry, is_new] = 94 return StoreNode(AbufNode(index, static_cast<u32>(element), buffer));
95 used_input_attributes.emplace(std::make_pair(index, std::set<Tegra::Shader::IpaMode>{}));
96 entry->second.insert(input_mode);
97
98 return StoreNode(AbufNode(index, static_cast<u32>(element), input_mode, buffer));
99} 95}
100 96
101Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) { 97Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index b157608b7..6aff64394 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -466,16 +466,8 @@ private:
466class AbufNode final { 466class AbufNode final {
467public: 467public:
468 explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element, 468 explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
469 const Tegra::Shader::IpaMode& input_mode, Node buffer = {})
470 : input_mode{input_mode}, buffer{buffer}, index{index}, element{element} {}
471
472 explicit constexpr AbufNode(Tegra::Shader::Attribute::Index index, u32 element,
473 Node buffer = {}) 469 Node buffer = {})
474 : input_mode{}, buffer{buffer}, index{index}, element{element} {} 470 : buffer{buffer}, index{index}, element{element} {}
475
476 Tegra::Shader::IpaMode GetInputMode() const {
477 return input_mode;
478 }
479 471
480 Tegra::Shader::Attribute::Index GetIndex() const { 472 Tegra::Shader::Attribute::Index GetIndex() const {
481 return index; 473 return index;
@@ -490,7 +482,6 @@ public:
490 } 482 }
491 483
492private: 484private:
493 const Tegra::Shader::IpaMode input_mode;
494 const Node buffer; 485 const Node buffer;
495 const Tegra::Shader::Attribute::Index index; 486 const Tegra::Shader::Attribute::Index index;
496 const u32 element; 487 const u32 element;
@@ -585,8 +576,7 @@ public:
585 return used_predicates; 576 return used_predicates;
586 } 577 }
587 578
588 const std::map<Tegra::Shader::Attribute::Index, std::set<Tegra::Shader::IpaMode>>& 579 const std::set<Tegra::Shader::Attribute::Index>& GetInputAttributes() const {
589 GetInputAttributes() const {
590 return used_input_attributes; 580 return used_input_attributes;
591 } 581 }
592 582
@@ -700,8 +690,7 @@ private:
700 /// Generates a predicate node for an immediate true or false value 690 /// Generates a predicate node for an immediate true or false value
701 Node GetPredicate(bool immediate); 691 Node GetPredicate(bool immediate);
702 /// Generates a node representing an input attribute. Keeps track of used attributes. 692 /// Generates a node representing an input attribute. Keeps track of used attributes.
703 Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element, 693 Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer = {});
704 const Tegra::Shader::IpaMode& input_mode, Node buffer = {});
705 /// Generates a node representing an output attribute. Keeps track of used attributes. 694 /// Generates a node representing an output attribute. Keeps track of used attributes.
706 Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer); 695 Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer);
707 /// Generates a node representing an internal flag 696 /// Generates a node representing an internal flag
@@ -876,8 +865,7 @@ private:
876 865
877 std::set<u32> used_registers; 866 std::set<u32> used_registers;
878 std::set<Tegra::Shader::Pred> used_predicates; 867 std::set<Tegra::Shader::Pred> used_predicates;
879 std::map<Tegra::Shader::Attribute::Index, std::set<Tegra::Shader::IpaMode>> 868 std::set<Tegra::Shader::Attribute::Index> used_input_attributes;
880 used_input_attributes;
881 std::set<Tegra::Shader::Attribute::Index> used_output_attributes; 869 std::set<Tegra::Shader::Attribute::Index> used_output_attributes;
882 std::map<u32, ConstBuffer> used_cbufs; 870 std::map<u32, ConstBuffer> used_cbufs;
883 std::set<Sampler> used_samplers; 871 std::set<Sampler> used_samplers;