summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar FernandoS272018-11-21 17:27:17 -0400
committerGravatar FernandoS272018-11-21 18:12:36 -0400
commit4a6a9b662244486f91ef99833796ab655621b626 (patch)
tree810feca513672aa6505d8c57dbdea1148aa905ea /src
parentMerge pull request #1667 from DarkLordZach/swkbd (diff)
downloadyuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.gz
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.xz
yuzu-4a6a9b662244486f91ef99833796ab655621b626.zip
Properly Implemented TXQ Instruction
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 5fde22ad4..9dbea9f3d 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -2976,6 +2976,8 @@ private:
2976 ASSERT_MSG(!instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP), 2976 ASSERT_MSG(!instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP),
2977 "NODEP is not implemented"); 2977 "NODEP is not implemented");
2978 2978
2979 ++shader.scope;
2980 shader.AddLine('{');
2979 // TODO: the new commits on the texture refactor, change the way samplers work. 2981 // TODO: the new commits on the texture refactor, change the way samplers work.
2980 // Sadly, not all texture instructions specify the type of texture their sampler 2982 // Sadly, not all texture instructions specify the type of texture their sampler
2981 // uses. This must be fixed at a later instance. 2983 // uses. This must be fixed at a later instance.
@@ -2983,8 +2985,14 @@ private:
2983 GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false); 2985 GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false);
2984 switch (instr.txq.query_type) { 2986 switch (instr.txq.query_type) {
2985 case Tegra::Shader::TextureQueryType::Dimension: { 2987 case Tegra::Shader::TextureQueryType::Dimension: {
2986 const std::string texture = "textureQueryLevels(" + sampler + ')'; 2988 const std::string texture = "textureSize(" + sampler + ", " +
2987 regs.SetRegisterToInteger(instr.gpr0, true, 0, texture, 1, 1); 2989 regs.GetRegisterAsInteger(instr.gpr8) + ')';
2990 const std::string mip_level = "textureQueryLevels(" + sampler + ')';
2991 shader.AddLine("ivec2 sizes = " + texture + ';');
2992 regs.SetRegisterToInteger(instr.gpr0, true, 0, "sizes.x", 1, 1);
2993 regs.SetRegisterToInteger(instr.gpr0.Value() + 1, true, 0, "sizes.y", 1, 1);
2994 regs.SetRegisterToInteger(instr.gpr0.Value() + 2, true, 0, "0", 1, 1);
2995 regs.SetRegisterToInteger(instr.gpr0.Value() + 3, true, 0, mip_level, 1, 1);
2988 break; 2996 break;
2989 } 2997 }
2990 default: { 2998 default: {
@@ -2993,6 +3001,8 @@ private:
2993 UNREACHABLE(); 3001 UNREACHABLE();
2994 } 3002 }
2995 } 3003 }
3004 --shader.scope;
3005 shader.AddLine('}');
2996 break; 3006 break;
2997 } 3007 }
2998 case OpCode::Id::TMML: { 3008 case OpCode::Id::TMML: {