diff options
| author | 2018-09-19 00:16:00 -0400 | |
|---|---|---|
| committer | 2018-10-03 08:41:12 -0400 | |
| commit | f664437ae876bb47978e3fabeaa96d627658bbfd (patch) | |
| tree | 1099eb7898055f045a75db7d68c2b0e2043f4c4e | |
| parent | Merge pull request #1407 from DarkLordZach/dlc (diff) | |
| download | yuzu-f664437ae876bb47978e3fabeaa96d627658bbfd.tar.gz yuzu-f664437ae876bb47978e3fabeaa96d627658bbfd.tar.xz yuzu-f664437ae876bb47978e3fabeaa96d627658bbfd.zip | |
Implemented Texture Processing Modes in TEXS and TLDS
| -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: | |||
| 1935 | shader.AddLine(coord); | 1935 | shader.AddLine(coord); |
| 1936 | std::string texture; | 1936 | std::string texture; |
| 1937 | 1937 | ||
| 1938 | switch (instr.tex.process_mode) { | 1938 | switch (instr.tex.GetTextureProcessMode()) { |
| 1939 | case Tegra::Shader::TextureProcessMode::None: { | 1939 | case Tegra::Shader::TextureProcessMode::None: { |
| 1940 | texture = "texture(" + sampler + ", coords)"; | 1940 | texture = "texture(" + sampler + ", coords)"; |
| 1941 | break; | 1941 | break; |
| @@ -1959,7 +1959,7 @@ private: | |||
| 1959 | default: { | 1959 | default: { |
| 1960 | texture = "texture(" + sampler + ", coords)"; | 1960 | texture = "texture(" + sampler + ", coords)"; |
| 1961 | LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", | 1961 | LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", |
| 1962 | static_cast<u32>(instr.tex.process_mode.Value())); | 1962 | static_cast<u32>(instr.tex.GetTextureProcessMode())); |
| 1963 | UNREACHABLE(); | 1963 | UNREACHABLE(); |
| 1964 | } | 1964 | } |
| 1965 | } | 1965 | } |
| @@ -2021,7 +2021,28 @@ private: | |||
| 2021 | is_array = false; | 2021 | is_array = false; |
| 2022 | } | 2022 | } |
| 2023 | const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); | 2023 | const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); |
| 2024 | const std::string texture = "texture(" + sampler + ", coords)"; | 2024 | std::string texture; |
| 2025 | const std::string op_c = regs.GetRegisterAsFloat(instr.gpr20.Value() + 1); | ||
| 2026 | switch (instr.texs.GetTextureProcessMode()) { | ||
| 2027 | case Tegra::Shader::TextureProcessMode::None: { | ||
| 2028 | texture = "texture(" + sampler + ", coords)"; | ||
| 2029 | break; | ||
| 2030 | } | ||
| 2031 | case Tegra::Shader::TextureProcessMode::LZ: { | ||
| 2032 | texture = "textureLod(" + sampler + ", coords, 0.0)"; | ||
| 2033 | break; | ||
| 2034 | } | ||
| 2035 | case Tegra::Shader::TextureProcessMode::LL: { | ||
| 2036 | texture = "textureLod(" + sampler + ", coords, " + op_c + ')'; | ||
| 2037 | break; | ||
| 2038 | } | ||
| 2039 | default: { | ||
| 2040 | texture = "texture(" + sampler + ", coords)"; | ||
| 2041 | LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", | ||
| 2042 | static_cast<u32>(instr.texs.GetTextureProcessMode())); | ||
| 2043 | UNREACHABLE(); | ||
| 2044 | } | ||
| 2045 | } | ||
| 2025 | WriteTexsInstruction(instr, coord, texture); | 2046 | WriteTexsInstruction(instr, coord, texture); |
| 2026 | break; | 2047 | break; |
| 2027 | } | 2048 | } |
| @@ -2062,9 +2083,25 @@ private: | |||
| 2062 | static_cast<u32>(texture_type)); | 2083 | static_cast<u32>(texture_type)); |
| 2063 | UNREACHABLE(); | 2084 | UNREACHABLE(); |
| 2064 | } | 2085 | } |
| 2065 | |||
| 2066 | const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); | 2086 | const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); |
| 2067 | const std::string texture = "texelFetch(" + sampler + ", coords, 0)"; | 2087 | std::string texture = "texelFetch(" + sampler + ", coords, 0)"; |
| 2088 | const std::string op_c = regs.GetRegisterAsInteger(instr.gpr20.Value() + 1); | ||
| 2089 | switch (instr.tlds.GetTextureProcessMode()) { | ||
| 2090 | case Tegra::Shader::TextureProcessMode::LZ: { | ||
| 2091 | texture = "texelFetch(" + sampler + ", coords, 0)"; | ||
| 2092 | break; | ||
| 2093 | } | ||
| 2094 | case Tegra::Shader::TextureProcessMode::LL: { | ||
| 2095 | texture = "texelFetch(" + sampler + ", coords, " + op_c + ')'; | ||
| 2096 | break; | ||
| 2097 | } | ||
| 2098 | default: { | ||
| 2099 | texture = "texelFetch(" + sampler + ", coords, 0)"; | ||
| 2100 | LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}", | ||
| 2101 | static_cast<u32>(instr.tlds.GetTextureProcessMode())); | ||
| 2102 | UNREACHABLE(); | ||
| 2103 | } | ||
| 2104 | } | ||
| 2068 | WriteTexsInstruction(instr, coord, texture); | 2105 | WriteTexsInstruction(instr, coord, texture); |
| 2069 | break; | 2106 | break; |
| 2070 | } | 2107 | } |