diff options
author | bunnei <bunneidev@gmail.com> | 2020-01-24 20:02:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-24 20:02:40 +0100 |
commit | a104b985a850f272831397c656e2fb01e5c1e52b (patch) | |
tree | 8a0885e79a438a1fd539ec0c0649895292286165 /src/video_core/shader/decode | |
parent | Merge pull request #3340 from SciresM/pmdx (diff) | |
parent | Shader_IR: Implement TXD Array. (diff) | |
download | yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar.gz yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar.bz2 yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar.lz yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar.xz yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.tar.zst yuzu-a104b985a850f272831397c656e2fb01e5c1e52b.zip |
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r-- | src/video_core/shader/decode/texture.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index cd984f763..0b567e39d 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp @@ -161,16 +161,16 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { case OpCode::Id::TXD: { UNIMPLEMENTED_IF_MSG(instr.txd.UsesMiscMode(TextureMiscMode::AOFFI), "AOFFI is not implemented"); - UNIMPLEMENTED_IF_MSG(instr.txd.is_array != 0, "TXD Array is not implemented"); + const bool is_array = instr.txd.is_array != 0; u64 base_reg = instr.gpr8.Value(); const auto derivate_reg = instr.gpr20.Value(); const auto texture_type = instr.txd.texture_type.Value(); const auto coord_count = GetCoordCount(texture_type); - const Sampler* sampler = is_bindless - ? GetBindlessSampler(base_reg, {{texture_type, false, false}}) - : GetSampler(instr.sampler, {{texture_type, false, false}}); + const Sampler* sampler = + is_bindless ? GetBindlessSampler(base_reg, {{texture_type, is_array, false}}) + : GetSampler(instr.sampler, {{texture_type, is_array, false}}); Node4 values; if (sampler == nullptr) { for (u32 element = 0; element < values.size(); ++element) { @@ -179,6 +179,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { WriteTexInstructionFloat(bb, instr, values); break; } + if (is_bindless) { base_reg++; } @@ -192,8 +193,14 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { derivates.push_back(GetRegister(derivate_reg + derivate + 1)); } + Node array_node = {}; + if (is_array) { + const Node info_reg = GetRegister(base_reg + coord_count); + array_node = BitfieldExtract(info_reg, 0, 16); + } + for (u32 element = 0; element < values.size(); ++element) { - MetaTexture meta{*sampler, {}, {}, {}, {}, derivates, {}, {}, {}, element}; + MetaTexture meta{*sampler, array_node, {}, {}, {}, derivates, {}, {}, {}, element}; values[element] = Operation(OperationCode::TextureGradient, std::move(meta), coords); } |