From b91f7d5d67a67115926ad03526f71a7cc3dfb326 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 16 Sep 2018 15:19:08 +0800 Subject: [PATCH 1/2] Add 1D sampler for TLDS - TexelFetch (Mario Rabbids) --- .../renderer_opengl/gl_shader_decompiler.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 81c0662d0..7a5321b9c 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1987,13 +1987,18 @@ private: break; } case OpCode::Id::TLDS: { - ASSERT(instr.tlds.GetTextureType() == Tegra::Shader::TextureType::Texture2D); - ASSERT(instr.tlds.IsArrayTexture() == false); std::string coord; + const Tegra::Shader::TextureType texture_type{instr.tlds.GetTextureType()}; + const bool is_array{instr.tlds.IsArrayTexture()}; - switch (instr.tlds.GetTextureType()) { + switch (texture_type) { + case Tegra::Shader::TextureType::Texture1D: { + const std::string x = regs.GetRegisterAsInteger(instr.gpr8); + coord = "int coords = " + x + ';'; + break; + } case Tegra::Shader::TextureType::Texture2D: { - if (instr.tlds.IsArrayTexture()) { + if (is_array) { LOG_CRITICAL(HW_GPU, "Unhandled 2d array texture"); UNREACHABLE(); } else { @@ -2005,11 +2010,11 @@ private: } default: LOG_CRITICAL(HW_GPU, "Unhandled texture type {}", - static_cast(instr.tlds.GetTextureType())); + static_cast(texture_type)); UNREACHABLE(); } - const std::string sampler = GetSampler(instr.sampler, instr.tlds.GetTextureType(), - instr.tlds.IsArrayTexture()); + + const std::string sampler = GetSampler(instr.sampler, texture_type, is_array); const std::string texture = "texelFetch(" + sampler + ", coords, 0)"; WriteTexsInstruction(instr, coord, texture); break; From b92b4bbeaf4de0200044c7fb24875b2b91d508c9 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 30 Sep 2018 10:35:48 +0800 Subject: [PATCH 2/2] Fix trailing whitespace --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 00cd05e62..702ffbe9c 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -2021,7 +2021,10 @@ private: std::string coord; const Tegra::Shader::TextureType texture_type{instr.tlds.GetTextureType()}; const bool is_array{instr.tlds.IsArrayTexture()}; - + + ASSERT(texture_type == Tegra::Shader::TextureType::Texture2D); + ASSERT(is_array == false); + ASSERT_MSG(!instr.tlds.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP), "NODEP is not implemented"); ASSERT_MSG(!instr.tlds.UsesMiscMode(Tegra::Shader::TextureMiscMode::AOFFI),