aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-10-28 20:27:46 +0000
committerGitHub <noreply@github.com>2020-10-28 21:27:46 +0100
commit780c7530d69068dd651c33e18828e23dc6977d90 (patch)
treef33c5c8cc16f5e850b723f7b1fdd0fe26a7f4dbc
parent0031edae27ba6a7bdb08db51efd84c887a6bdabd (diff)
Add scaling for Texture2DArray when using TexelFetch. (#1645)
* Add scaling for Texture2DArray when using TexelFetch. * Should only really trigger for Texture2D. (do not emit texelfetch for TextureBufferArray(?) and Texture1DArray) * Address nit.
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs27
1 files changed, 16 insertions, 11 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
index 7fdca138..456bfc4e 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
@@ -407,20 +407,25 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
if ((context.Config.Stage == ShaderStage.Fragment || context.Config.Stage == ShaderStage.Compute) &&
(texOp.Flags & TextureFlags.Bindless) == 0 &&
- texOp.Type != SamplerType.Indexed &&
- pCount == 2)
+ texOp.Type != SamplerType.Indexed)
{
- return "Helper_TexelFetchScale(" + vector + ", " + index + ")";
+ if (pCount == 3 && isArray)
+ {
+ // The array index is not scaled, just x and y.
+ return "ivec3(Helper_TexelFetchScale((" + vector + ").xy, " + index + "), (" + vector + ").z)";
+ }
+ else if (pCount == 2 && !isArray)
+ {
+ 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;
- }
+ // 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;