summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-11-21 22:27:17 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2018-11-21 23:12:36 +0100
commit4a6a9b662244486f91ef99833796ab655621b626 (patch)
tree810feca513672aa6505d8c57dbdea1148aa905ea /src/video_core/renderer_opengl
parentMerge pull request #1667 from DarkLordZach/swkbd (diff)
downloadyuzu-4a6a9b662244486f91ef99833796ab655621b626.tar
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.gz
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.bz2
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.lz
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.xz
yuzu-4a6a9b662244486f91ef99833796ab655621b626.tar.zst
yuzu-4a6a9b662244486f91ef99833796ab655621b626.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-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:
ASSERT_MSG(!instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP),
"NODEP is not implemented");
+ ++shader.scope;
+ shader.AddLine('{');
// TODO: the new commits on the texture refactor, change the way samplers work.
// Sadly, not all texture instructions specify the type of texture their sampler
// uses. This must be fixed at a later instance.
@@ -2983,8 +2985,14 @@ private:
GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false);
switch (instr.txq.query_type) {
case Tegra::Shader::TextureQueryType::Dimension: {
- const std::string texture = "textureQueryLevels(" + sampler + ')';
- regs.SetRegisterToInteger(instr.gpr0, true, 0, texture, 1, 1);
+ const std::string texture = "textureSize(" + sampler + ", " +
+ regs.GetRegisterAsInteger(instr.gpr8) + ')';
+ const std::string mip_level = "textureQueryLevels(" + sampler + ')';
+ shader.AddLine("ivec2 sizes = " + texture + ';');
+ regs.SetRegisterToInteger(instr.gpr0, true, 0, "sizes.x", 1, 1);
+ regs.SetRegisterToInteger(instr.gpr0.Value() + 1, true, 0, "sizes.y", 1, 1);
+ regs.SetRegisterToInteger(instr.gpr0.Value() + 2, true, 0, "0", 1, 1);
+ regs.SetRegisterToInteger(instr.gpr0.Value() + 3, true, 0, mip_level, 1, 1);
break;
}
default: {
@@ -2993,6 +3001,8 @@ private:
UNREACHABLE();
}
}
+ --shader.scope;
+ shader.AddLine('}');
break;
}
case OpCode::Id::TMML: {