diff options
author | bunnei <bunneidev@gmail.com> | 2019-02-25 05:04:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 05:04:22 +0100 |
commit | c07987dfab78e32a14ea3cb883f71323c99ad034 (patch) | |
tree | 1da5948cc12c8261b5e740ce14d3cccee78e0536 /src/video_core/shader | |
parent | Merge pull request #2119 from FernandoS27/fix-copy (diff) | |
parent | shader_decompiler: Improve Accuracy of Attribute Interpolation. (diff) | |
download | yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.gz yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.bz2 yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.lz yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.xz yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.zst yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.zip |
Diffstat (limited to 'src/video_core/shader')
-rw-r--r-- | src/video_core/shader/decode/memory.cpp | 2 | ||||
-rw-r--r-- | src/video_core/shader/decode/other.cpp | 15 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp index 55ec601ff..38f01ca50 100644 --- a/src/video_core/shader/decode/memory.cpp +++ b/src/video_core/shader/decode/memory.cpp @@ -48,7 +48,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0, "Unaligned attribute loads are not supported"); - Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Perspective, + Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Pass, Tegra::Shader::IpaSampleMode::Default}; u64 next_element = instr.attribute.fmt20.element; diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp index f9502e3d0..d750a2936 100644 --- a/src/video_core/shader/decode/other.cpp +++ b/src/video_core/shader/decode/other.cpp @@ -135,7 +135,18 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { instr.ipa.sample_mode.Value()}; const Node attr = GetInputAttribute(attribute.index, attribute.element, input_mode); - const Node value = GetSaturatedFloat(attr, instr.ipa.saturate); + Node value = attr; + const Tegra::Shader::Attribute::Index index = attribute.index.Value(); + if (index >= Tegra::Shader::Attribute::Index::Attribute_0 && + index <= Tegra::Shader::Attribute::Index::Attribute_31) { + // TODO(Blinkhawk): There are cases where a perspective attribute use PASS. + // In theory by setting them as perspective, OpenGL does the perspective correction. + // A way must figured to reverse the last step of it. + if (input_mode.interpolation_mode == Tegra::Shader::IpaInterpMode::Multiply) { + value = Operation(OperationCode::FMul, PRECISE, value, GetRegister(instr.gpr20)); + } + } + value = GetSaturatedFloat(value, instr.ipa.saturate); SetRegister(bb, instr.gpr0, value); break; @@ -175,4 +186,4 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { return pc; } -} // namespace VideoCommon::Shader
\ No newline at end of file +} // namespace VideoCommon::Shader |