summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorGravatar FernandoS272018-09-07 21:09:39 -0400
committerGravatar FernandoS272018-09-12 12:28:22 -0400
commita99d9db32faef06c74a1e2fd5fc8715a8f3016e1 (patch)
tree9fb83a733934972e9d2ec30117c89ca73b529679 /src/video_core/renderer_opengl
parentMerge pull request #1291 from lioncash/default (diff)
downloadyuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.gz
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.xz
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.zip
Implemented Texture Processing Modes
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index e350113f1..64f3f341a 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1786,15 +1786,47 @@ private:
1786 coord = "vec2 coords = vec2(" + x + ", " + y + ");"; 1786 coord = "vec2 coords = vec2(" + x + ", " + y + ");";
1787 texture_type = Tegra::Shader::TextureType::Texture2D; 1787 texture_type = Tegra::Shader::TextureType::Texture2D;
1788 } 1788 }
1789 // TODO: make sure coordinates are always indexed to gpr8 and gpr20 is always bias
1790 // or lod.
1791 const std::string op_c = regs.GetRegisterAsFloat(instr.gpr20);
1789 1792
1790 const std::string sampler = GetSampler(instr.sampler, texture_type, false); 1793 const std::string sampler = GetSampler(instr.sampler, texture_type, false);
1791 // Add an extra scope and declare the texture coords inside to prevent 1794 // Add an extra scope and declare the texture coords inside to prevent
1792 // overwriting them in case they are used as outputs of the texs instruction. 1795 // overwriting them in case they are used as outputs of the texs instruction.
1796
1793 shader.AddLine("{"); 1797 shader.AddLine("{");
1794 ++shader.scope; 1798 ++shader.scope;
1795 shader.AddLine(coord); 1799 shader.AddLine(coord);
1796 const std::string texture = "texture(" + sampler + ", coords)"; 1800 std::string texture;
1797 1801
1802 switch (instr.tex.process_mode) {
1803 case Tegra::Shader::TextureProcessMode::None: {
1804 texture = "texture(" + sampler + ", coords)";
1805 break;
1806 }
1807 case Tegra::Shader::TextureProcessMode::LZ: {
1808 texture = "textureLod(" + sampler + ", coords, 0.0)";
1809 break;
1810 }
1811 case Tegra::Shader::TextureProcessMode::LB:
1812 case Tegra::Shader::TextureProcessMode::LBA: {
1813 // TODO: Figure if A suffix changes the equation at all.
1814 texture = "texture(" + sampler + ", coords, " + op_c + ')';
1815 break;
1816 }
1817 case Tegra::Shader::TextureProcessMode::LL:
1818 case Tegra::Shader::TextureProcessMode::LLA: {
1819 // TODO: Figure if A suffix changes the equation at all.
1820 texture = "textureLod(" + sampler + ", coords, " + op_c + ')';
1821 break;
1822 }
1823 default: {
1824 texture = "texture(" + sampler + ", coords)";
1825 LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}",
1826 static_cast<u32>(instr.tex.process_mode.Value()));
1827 UNREACHABLE();
1828 }
1829 }
1798 size_t dest_elem{}; 1830 size_t dest_elem{};
1799 for (size_t elem = 0; elem < 4; ++elem) { 1831 for (size_t elem = 0; elem < 4; ++elem) {
1800 if (!instr.tex.IsComponentEnabled(elem)) { 1832 if (!instr.tex.IsComponentEnabled(elem)) {