aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs29
1 files changed, 28 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
index d05c77df..b951798d 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
@@ -390,7 +390,34 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
}
}
- Append(AssemblePVector(pCount));
+ string ApplyScaling(string vector)
+ {
+ if (intCoords)
+ {
+ int index = context.FindTextureDescriptorIndex(texOp);
+
+ if ((context.Config.Stage == ShaderStage.Fragment || context.Config.Stage == ShaderStage.Compute) &&
+ (texOp.Flags & TextureFlags.Bindless) == 0 &&
+ texOp.Type != SamplerType.Indexed &&
+ pCount == 2)
+ {
+ return "Helper_TexelFetchScale(" + vector + ", " + index + ")";
+ }
+ else
+ {
+ // Resolution scaling cannot be applied to this texture right now.
+ // Flag so that we know to blacklist scaling on related textures when binding them.
+
+ TextureDescriptor descriptor = context.TextureDescriptors[index];
+ descriptor.Flags |= TextureUsageFlags.ResScaleUnsupported;
+ context.TextureDescriptors[index] = descriptor;
+ }
+ }
+
+ return vector;
+ }
+
+ Append(ApplyScaling(AssemblePVector(pCount)));
string AssembleDerivativesVector(int count)
{