summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-09-08 03:09:39 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2018-09-12 18:28:22 +0200
commita99d9db32faef06c74a1e2fd5fc8715a8f3016e1 (patch)
tree9fb83a733934972e9d2ec30117c89ca73b529679 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp
parentMerge pull request #1291 from lioncash/default (diff)
downloadyuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.gz
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.bz2
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.lz
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.xz
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.tar.zst
yuzu-a99d9db32faef06c74a1e2fd5fc8715a8f3016e1.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index e350113f1..64f3f341a 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1786,15 +1786,47 @@ private:
coord = "vec2 coords = vec2(" + x + ", " + y + ");";
texture_type = Tegra::Shader::TextureType::Texture2D;
}
+ // TODO: make sure coordinates are always indexed to gpr8 and gpr20 is always bias
+ // or lod.
+ const std::string op_c = regs.GetRegisterAsFloat(instr.gpr20);
const std::string sampler = GetSampler(instr.sampler, texture_type, false);
// Add an extra scope and declare the texture coords inside to prevent
// overwriting them in case they are used as outputs of the texs instruction.
+
shader.AddLine("{");
++shader.scope;
shader.AddLine(coord);
- const std::string texture = "texture(" + sampler + ", coords)";
+ std::string texture;
+ switch (instr.tex.process_mode) {
+ case Tegra::Shader::TextureProcessMode::None: {
+ texture = "texture(" + sampler + ", coords)";
+ break;
+ }
+ case Tegra::Shader::TextureProcessMode::LZ: {
+ texture = "textureLod(" + sampler + ", coords, 0.0)";
+ break;
+ }
+ case Tegra::Shader::TextureProcessMode::LB:
+ case Tegra::Shader::TextureProcessMode::LBA: {
+ // TODO: Figure if A suffix changes the equation at all.
+ texture = "texture(" + sampler + ", coords, " + op_c + ')';
+ break;
+ }
+ case Tegra::Shader::TextureProcessMode::LL:
+ case Tegra::Shader::TextureProcessMode::LLA: {
+ // TODO: Figure if A suffix changes the equation at all.
+ texture = "textureLod(" + sampler + ", coords, " + op_c + ')';
+ break;
+ }
+ default: {
+ texture = "texture(" + sampler + ", coords)";
+ LOG_CRITICAL(HW_GPU, "Unhandled texture process mode {}",
+ static_cast<u32>(instr.tex.process_mode.Value()));
+ UNREACHABLE();
+ }
+ }
size_t dest_elem{};
for (size_t elem = 0; elem < 4; ++elem) {
if (!instr.tex.IsComponentEnabled(elem)) {