diff options
| author | 2019-02-24 23:04:22 -0500 | |
|---|---|---|
| committer | 2019-02-24 23:04:22 -0500 | |
| 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.gz yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.tar.xz yuzu-c07987dfab78e32a14ea3cb883f71323c99ad034.zip | |
Merge pull request #2118 from FernandoS27/ipa-improve
shader_decompiler: Improve Accuracy of Attribute Interpolation.
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) { | |||
| 48 | UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0, | 48 | UNIMPLEMENTED_IF_MSG((instr.attribute.fmt20.immediate.Value() % sizeof(u32)) != 0, |
| 49 | "Unaligned attribute loads are not supported"); | 49 | "Unaligned attribute loads are not supported"); |
| 50 | 50 | ||
| 51 | Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Perspective, | 51 | Tegra::Shader::IpaMode input_mode{Tegra::Shader::IpaInterpMode::Pass, |
| 52 | Tegra::Shader::IpaSampleMode::Default}; | 52 | Tegra::Shader::IpaSampleMode::Default}; |
| 53 | 53 | ||
| 54 | u64 next_element = instr.attribute.fmt20.element; | 54 | 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) { | |||
| 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, input_mode); |
| 138 | const Node value = GetSaturatedFloat(attr, instr.ipa.saturate); | 138 | Node value = attr; |
| 139 | const Tegra::Shader::Attribute::Index index = attribute.index.Value(); | ||
| 140 | if (index >= Tegra::Shader::Attribute::Index::Attribute_0 && | ||
| 141 | index <= Tegra::Shader::Attribute::Index::Attribute_31) { | ||
| 142 | // TODO(Blinkhawk): There are cases where a perspective attribute use PASS. | ||
| 143 | // In theory by setting them as perspective, OpenGL does the perspective correction. | ||
| 144 | // A way must figured to reverse the last step of it. | ||
| 145 | if (input_mode.interpolation_mode == Tegra::Shader::IpaInterpMode::Multiply) { | ||
| 146 | value = Operation(OperationCode::FMul, PRECISE, value, GetRegister(instr.gpr20)); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | value = GetSaturatedFloat(value, instr.ipa.saturate); | ||
| 139 | 150 | ||
| 140 | SetRegister(bb, instr.gpr0, value); | 151 | SetRegister(bb, instr.gpr0, value); |
| 141 | break; | 152 | break; |
| @@ -175,4 +186,4 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 175 | return pc; | 186 | return pc; |
| 176 | } | 187 | } |
| 177 | 188 | ||
| 178 | } // namespace VideoCommon::Shader \ No newline at end of file | 189 | } // namespace VideoCommon::Shader |