diff options
author | bunnei <bunneidev@gmail.com> | 2018-11-23 17:48:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 17:48:57 +0100 |
commit | d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c (patch) | |
tree | c5b030e1ff9d5de3576228dd181037866141b999 /src/video_core/renderer_opengl | |
parent | Merge pull request #1762 from bunnei/getgputime (diff) | |
parent | Properly Implemented TXQ Instruction (diff) | |
download | yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar.gz yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar.bz2 yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar.lz yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar.xz yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.tar.zst yuzu-d77af9f8fd04a3b1635ecc5f2a4dd76c319e137c.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 14 |
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: UNIMPLEMENTED_IF_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. @@ -2892,8 +2894,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: { @@ -2901,6 +2909,8 @@ private: static_cast<u32>(instr.txq.query_type.Value())); } } + --shader.scope; + shader.AddLine('}'); break; } case OpCode::Id::TMML: { |