aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-05-25 17:46:58 -0300
committerGitHub <noreply@github.com>2023-05-25 17:46:58 -0300
commit8f0c89ffd65eb2b979b24d457708218050fec6ae (patch)
tree5657b8a7f6246659d97f0f574f3f1829d65a235e /src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs
parent2c9715acf6cb9ae8bceabec5e81602c7d64c7192 (diff)
Generate scaling helper functions on IR (#4714)
* Generate scaling helper functions on IR * Delete unused code * Split RewriteTextureSample and move gather bias add to an earlier pass * Remove using * Shader cache version bump
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs b/src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs
index 77560797..73525cb2 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs
@@ -860,7 +860,7 @@ namespace Ryujinx.Graphics.Shader.Translation
return descriptors;
}
- public (TextureDescriptor, int) FindTextureDescriptor(AstTextureOperation texOp)
+ public TextureDescriptor FindTextureDescriptor(AstTextureOperation texOp)
{
TextureDescriptor[] descriptors = GetTextureDescriptors();
@@ -872,11 +872,11 @@ namespace Ryujinx.Graphics.Shader.Translation
descriptor.HandleIndex == texOp.Handle &&
descriptor.Format == texOp.Format)
{
- return (descriptor, i);
+ return descriptor;
}
}
- return (default, -1);
+ return default;
}
private static int FindDescriptorIndex(TextureDescriptor[] array, AstTextureOperation texOp)
@@ -897,12 +897,30 @@ namespace Ryujinx.Graphics.Shader.Translation
return -1;
}
- public int FindTextureDescriptorIndex(AstTextureOperation texOp)
+ private static int FindDescriptorIndex(TextureDescriptor[] array, TextureOperation texOp, bool ignoreType = false)
{
- return FindDescriptorIndex(GetTextureDescriptors(), texOp);
+ for (int i = 0; i < array.Length; i++)
+ {
+ var descriptor = array[i];
+
+ if ((descriptor.Type == texOp.Type || ignoreType) &&
+ descriptor.CbufSlot == texOp.CbufSlot &&
+ descriptor.HandleIndex == texOp.Handle &&
+ descriptor.Format == texOp.Format)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ public int FindTextureDescriptorIndex(TextureOperation texOp, bool ignoreType = false)
+ {
+ return FindDescriptorIndex(GetTextureDescriptors(), texOp, ignoreType);
}
- public int FindImageDescriptorIndex(AstTextureOperation texOp)
+ public int FindImageDescriptorIndex(TextureOperation texOp)
{
return FindDescriptorIndex(GetImageDescriptors(), texOp);
}