diff options
author | FernandoS27 <fsahmkow27@gmail.com> | 2018-09-19 00:16:00 -0400 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2018-10-03 08:41:12 -0400 |
commit | f664437ae876bb47978e3fabeaa96d627658bbfd (patch) | |
tree | 1099eb7898055f045a75db7d68c2b0e2043f4c4e /src | |
parent | bd14f397ce142f4552018554532ceb230e12bde5 (diff) |
Implemented Texture Processing Modes in TEXS and TLDS
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 579a78702..d73234ec3 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1935,7 +1935,7 @@ private: shader.AddLine(coord); std::string texture; - switch (instr.tex.process_mode) { + switch (instr.tex.GetTextureProcessMode()) { case Tegra::Shader::TextureProcessMode::None: { texture = "texture(" + sampler + ", coords)"; break; @@ -1959,7 +1959,7 @@ private: default: { texture = "texture(" + sampler + ", coords)"; LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", - static_cast<u32>(instr.tex.process_mode.Value())); + static_cast<u32>(instr.tex.GetTextureProcessMode())); UNREACHABLE(); } } @@ -2021,7 +2021,28 @@ private: is_array = false; } const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); - const std::string texture = "texture(" + sampler + ", coords)"; + std::string texture; + const std::string op_c = regs.GetRegisterAsFloat(instr.gpr20.Value() + 1); + switch (instr.texs.GetTextureProcessMode()) { + case Tegra::Shader::TextureProcessMode::None: { + texture = "texture(" + sampler + ", coords)"; + break; + } + case Tegra::Shader::TextureProcessMode::LZ: { + texture = "textureLod(" + sampler + ", coords, 0.0)"; + break; + } + case Tegra::Shader::TextureProcessMode::LL: { + texture = "textureLod(" + sampler + ", coords, " + op_c + ')'; + break; + } + default: { + texture = "texture(" + sampler + ", coords)"; + LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", + static_cast<u32>(instr.texs.GetTextureProcessMode())); + UNREACHABLE(); + } + } WriteTexsInstruction(instr, coord, texture); break; } @@ -2062,9 +2083,25 @@ private: static_cast<u32>(texture_type)); UNREACHABLE(); } - const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); - const std::string texture = "texelFetch(" + sampler + ", coords, 0)"; + std::string texture = "texelFetch(" + sampler + ", coords, 0)"; + const std::string op_c = regs.GetRegisterAsInteger(instr.gpr20.Value() + 1); + switch (instr.tlds.GetTextureProcessMode()) { + case Tegra::Shader::TextureProcessMode::LZ: { + texture = "texelFetch(" + sampler + ", coords, 0)"; + break; + } + case Tegra::Shader::TextureProcessMode::LL: { + texture = "texelFetch(" + sampler + ", coords, " + op_c + ')'; + break; + } + default: { + texture = "texelFetch(" + sampler + ", coords, 0)"; + LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", + static_cast<u32>(instr.tlds.GetTextureProcessMode())); + UNREACHABLE(); + } + } WriteTexsInstruction(instr, coord, texture); break; } |