summaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-04-27 20:50:35 -0300
committerGravatar ReinUsesLisp2019-06-20 21:36:12 -0300
commit4e81fc8296c6204645151bbaa23a7d80827a4293 (patch)
treee826cbe2f9fd118a82d251854872eb7d300a6078 /src/video_core/shader/decode
parenttexture_cache: loose TryReconstructSurface when accurate GPU is not on. (diff)
downloadyuzu-4e81fc8296c6204645151bbaa23a7d80827a4293.tar.gz
yuzu-4e81fc8296c6204645151bbaa23a7d80827a4293.tar.xz
yuzu-4e81fc8296c6204645151bbaa23a7d80827a4293.zip
shader: Implement texture buffers
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/texture.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp
index 4a356dbd4..b22831c64 100644
--- a/src/video_core/shader/decode/texture.cpp
+++ b/src/video_core/shader/decode/texture.cpp
@@ -245,6 +245,18 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
245 } 245 }
246 break; 246 break;
247 } 247 }
248 case OpCode::Id::TLD: {
249 UNIMPLEMENTED_IF_MSG(instr.tld.aoffi, "AOFFI is not implemented");
250 UNIMPLEMENTED_IF_MSG(instr.tld.ms, "MS is not implemented");
251 UNIMPLEMENTED_IF_MSG(instr.tld.cl, "CL is not implemented");
252
253 if (instr.tld.nodep_flag) {
254 LOG_WARNING(HW_GPU, "TLD.NODEP implementation is incomplete");
255 }
256
257 WriteTexInstructionFloat(bb, instr, GetTldCode(instr));
258 break;
259 }
248 case OpCode::Id::TLDS: { 260 case OpCode::Id::TLDS: {
249 const Tegra::Shader::TextureType texture_type{instr.tlds.GetTextureType()}; 261 const Tegra::Shader::TextureType texture_type{instr.tlds.GetTextureType()};
250 const bool is_array{instr.tlds.IsArrayTexture()}; 262 const bool is_array{instr.tlds.IsArrayTexture()};
@@ -575,6 +587,38 @@ Node4 ShaderIR::GetTld4Code(Instruction instr, TextureType texture_type, bool de
575 return values; 587 return values;
576} 588}
577 589
590Node4 ShaderIR::GetTldCode(Tegra::Shader::Instruction instr) {
591 const auto texture_type{instr.tld.texture_type};
592 const bool is_array{instr.tld.is_array};
593 const bool lod_enabled{instr.tld.GetTextureProcessMode() == TextureProcessMode::LL};
594 const std::size_t coord_count{GetCoordCount(texture_type)};
595
596 u64 gpr8_cursor{instr.gpr8.Value()};
597 const Node array_register{is_array ? GetRegister(gpr8_cursor++) : nullptr};
598
599 std::vector<Node> coords;
600 for (std::size_t i = 0; i < coord_count; ++i) {
601 coords.push_back(GetRegister(gpr8_cursor++));
602 }
603
604 u64 gpr20_cursor{instr.gpr20.Value()};
605 // const Node bindless_register{is_bindless ? GetRegister(gpr20_cursor++) : nullptr};
606 const Node lod{lod_enabled ? GetRegister(gpr20_cursor++) : Immediate(0u)};
607 // const Node aoffi_register{is_aoffi ? GetRegister(gpr20_cursor++) : nullptr};
608 // const Node multisample{is_multisample ? GetRegister(gpr20_cursor++) : nullptr};
609
610 const auto& sampler = GetSampler(instr.sampler, texture_type, is_array, false);
611
612 Node4 values;
613 for (u32 element = 0; element < values.size(); ++element) {
614 auto coords_copy = coords;
615 MetaTexture meta{sampler, array_register, {}, {}, {}, lod, {}, element};
616 values[element] = Operation(OperationCode::TexelFetch, meta, std::move(coords_copy));
617 }
618
619 return values;
620}
621
578Node4 ShaderIR::GetTldsCode(Instruction instr, TextureType texture_type, bool is_array) { 622Node4 ShaderIR::GetTldsCode(Instruction instr, TextureType texture_type, bool is_array) {
579 const std::size_t type_coord_count = GetCoordCount(texture_type); 623 const std::size_t type_coord_count = GetCoordCount(texture_type);
580 const bool lod_enabled = instr.tlds.GetTextureProcessMode() == TextureProcessMode::LL; 624 const bool lod_enabled = instr.tlds.GetTextureProcessMode() == TextureProcessMode::LL;