summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 90a88b91a..7d7df0712 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -2885,6 +2885,8 @@ private:
2885 UNIMPLEMENTED_IF_MSG(instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP), 2885 UNIMPLEMENTED_IF_MSG(instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP),
2886 "NODEP is not implemented"); 2886 "NODEP is not implemented");
2887 2887
2888 ++shader.scope;
2889 shader.AddLine('{');
2888 // TODO: the new commits on the texture refactor, change the way samplers work. 2890 // TODO: the new commits on the texture refactor, change the way samplers work.
2889 // Sadly, not all texture instructions specify the type of texture their sampler 2891 // Sadly, not all texture instructions specify the type of texture their sampler
2890 // uses. This must be fixed at a later instance. 2892 // uses. This must be fixed at a later instance.
@@ -2892,8 +2894,14 @@ private:
2892 GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false); 2894 GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false);
2893 switch (instr.txq.query_type) { 2895 switch (instr.txq.query_type) {
2894 case Tegra::Shader::TextureQueryType::Dimension: { 2896 case Tegra::Shader::TextureQueryType::Dimension: {
2895 const std::string texture = "textureQueryLevels(" + sampler + ')'; 2897 const std::string texture = "textureSize(" + sampler + ", " +
2896 regs.SetRegisterToInteger(instr.gpr0, true, 0, texture, 1, 1); 2898 regs.GetRegisterAsInteger(instr.gpr8) + ')';
2899 const std::string mip_level = "textureQueryLevels(" + sampler + ')';
2900 shader.AddLine("ivec2 sizes = " + texture + ';');
2901 regs.SetRegisterToInteger(instr.gpr0, true, 0, "sizes.x", 1, 1);
2902 regs.SetRegisterToInteger(instr.gpr0.Value() + 1, true, 0, "sizes.y", 1, 1);
2903 regs.SetRegisterToInteger(instr.gpr0.Value() + 2, true, 0, "0", 1, 1);
2904 regs.SetRegisterToInteger(instr.gpr0.Value() + 3, true, 0, mip_level, 1, 1);
2897 break; 2905 break;
2898 } 2906 }
2899 default: { 2907 default: {
@@ -2901,6 +2909,8 @@ private:
2901 static_cast<u32>(instr.txq.query_type.Value())); 2909 static_cast<u32>(instr.txq.query_type.Value()));
2902 } 2910 }
2903 } 2911 }
2912 --shader.scope;
2913 shader.AddLine('}');
2904 break; 2914 break;
2905 } 2915 }
2906 case OpCode::Id::TMML: { 2916 case OpCode::Id::TMML: {