summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/shader/decode/memory.cpp2
-rw-r--r--src/video_core/shader/decode/texture.cpp23
2 files changed, 13 insertions, 12 deletions
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp
index 8112ead3e..9392f065b 100644
--- a/src/video_core/shader/decode/memory.cpp
+++ b/src/video_core/shader/decode/memory.cpp
@@ -479,7 +479,7 @@ std::tuple<Node, Node, GlobalMemoryBase> ShaderIR::TrackGlobalMemory(NodeBlock&
479 bb.push_back(Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", index, offset))); 479 bb.push_back(Comment(fmt::format("Base address is c[0x{:x}][0x{:x}]", index, offset)));
480 480
481 const GlobalMemoryBase descriptor{index, offset}; 481 const GlobalMemoryBase descriptor{index, offset};
482 const auto& [entry, is_new] = used_global_memory.try_emplace(descriptor); 482 const auto& entry = used_global_memory.try_emplace(descriptor).first;
483 auto& usage = entry->second; 483 auto& usage = entry->second;
484 usage.is_written |= is_write; 484 usage.is_written |= is_write;
485 usage.is_read |= is_read; 485 usage.is_read |= is_read;
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp
index 6c4a1358b..e68f1d305 100644
--- a/src/video_core/shader/decode/texture.cpp
+++ b/src/video_core/shader/decode/texture.cpp
@@ -139,7 +139,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
139 } 139 }
140 const Node component = Immediate(static_cast<u32>(instr.tld4s.component)); 140 const Node component = Immediate(static_cast<u32>(instr.tld4s.component));
141 141
142 const SamplerInfo info{TextureType::Texture2D, false, is_depth_compare}; 142 const SamplerInfo info{TextureType::Texture2D, false, is_depth_compare, false};
143 const Sampler& sampler = *GetSampler(instr.sampler, info); 143 const Sampler& sampler = *GetSampler(instr.sampler, info);
144 144
145 Node4 values; 145 Node4 values;
@@ -171,13 +171,12 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
171 const auto coord_count = GetCoordCount(texture_type); 171 const auto coord_count = GetCoordCount(texture_type);
172 Node index_var{}; 172 Node index_var{};
173 const Sampler* sampler = 173 const Sampler* sampler =
174 is_bindless ? GetBindlessSampler(base_reg, index_var, {{texture_type, is_array, false}}) 174 is_bindless
175 : GetSampler(instr.sampler, {{texture_type, is_array, false}}); 175 ? GetBindlessSampler(base_reg, index_var, {{texture_type, is_array, false, false}})
176 : GetSampler(instr.sampler, {{texture_type, is_array, false, false}});
176 Node4 values; 177 Node4 values;
177 if (sampler == nullptr) { 178 if (sampler == nullptr) {
178 for (u32 element = 0; element < values.size(); ++element) { 179 std::generate(values.begin(), values.end(), [] { return Immediate(0); });
179 values[element] = Immediate(0);
180 }
181 WriteTexInstructionFloat(bb, instr, values); 180 WriteTexInstructionFloat(bb, instr, values);
182 break; 181 break;
183 } 182 }
@@ -269,7 +268,6 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
269 "NDV is not implemented"); 268 "NDV is not implemented");
270 269
271 auto texture_type = instr.tmml.texture_type.Value(); 270 auto texture_type = instr.tmml.texture_type.Value();
272 const bool is_array = instr.tmml.array != 0;
273 Node index_var{}; 271 Node index_var{};
274 const Sampler* sampler = 272 const Sampler* sampler =
275 is_bindless ? GetBindlessSampler(instr.gpr20, index_var) : GetSampler(instr.sampler); 273 is_bindless ? GetBindlessSampler(instr.gpr20, index_var) : GetSampler(instr.sampler);
@@ -593,8 +591,9 @@ Node4 ShaderIR::GetTexCode(Instruction instr, TextureType texture_type,
593 ++parameter_register; 591 ++parameter_register;
594 } 592 }
595 593
596 const auto [coord_count, total_coord_count] = ValidateAndGetCoordinateElement( 594 const auto coord_counts = ValidateAndGetCoordinateElement(texture_type, depth_compare, is_array,
597 texture_type, depth_compare, is_array, lod_bias_enabled, 4, 5); 595 lod_bias_enabled, 4, 5);
596 const auto coord_count = std::get<0>(coord_counts);
598 // If enabled arrays index is always stored in the gpr8 field 597 // If enabled arrays index is always stored in the gpr8 field
599 const u64 array_register = instr.gpr8.Value(); 598 const u64 array_register = instr.gpr8.Value();
600 // First coordinate index is the gpr8 or gpr8 + 1 when arrays are used 599 // First coordinate index is the gpr8 or gpr8 + 1 when arrays are used
@@ -632,8 +631,10 @@ Node4 ShaderIR::GetTexsCode(Instruction instr, TextureType texture_type,
632 const bool lod_bias_enabled = 631 const bool lod_bias_enabled =
633 (process_mode != TextureProcessMode::None && process_mode != TextureProcessMode::LZ); 632 (process_mode != TextureProcessMode::None && process_mode != TextureProcessMode::LZ);
634 633
635 const auto [coord_count, total_coord_count] = ValidateAndGetCoordinateElement( 634 const auto coord_counts = ValidateAndGetCoordinateElement(texture_type, depth_compare, is_array,
636 texture_type, depth_compare, is_array, lod_bias_enabled, 4, 4); 635 lod_bias_enabled, 4, 4);
636 const auto coord_count = std::get<0>(coord_counts);
637
637 // If enabled arrays index is always stored in the gpr8 field 638 // If enabled arrays index is always stored in the gpr8 field
638 const u64 array_register = instr.gpr8.Value(); 639 const u64 array_register = instr.gpr8.Value();
639 // First coordinate index is stored in gpr8 field or (gpr8 + 1) when arrays are used 640 // First coordinate index is stored in gpr8 field or (gpr8 + 1) when arrays are used