aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-07-03 14:29:27 -0300
committerGitHub <noreply@github.com>2023-07-03 14:29:27 -0300
commit1c7a90ef359d9974e5bd257c4d8e9bf526a6966c (patch)
tree3ab1644927819b90b0aef78ed6749c6434150490 /src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs
parent3b46bb73f781a011705ecbc8a1d3207dfb145829 (diff)
Stop identifying shader textures with handle and cbuf, use binding instead (#5266)
* Stop identifying shader textures with handle and cbuf, use binding instead * Remove now unused code * Consider image operations as having accurate type information too I don't know why that was not the case before * Fix missing unscale on InsertCoordNormalization, stop calling SetUsageFlagsForTextureQuery when not needed * Shader cache version bump * Change get texture methods to return descriptors created from ResourceManager state This is required to ensure that reserved textures and images will not be bound as a guest texture/image * Fix BindlessElimination.SetHandle inserting coords at the wrong place
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs b/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs
index c2f1b790..c92d0583 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs
@@ -604,6 +604,45 @@ namespace Ryujinx.Graphics.Shader.Translation
return context.Add(Instruction.Subtract, Local(), a, b);
}
+ public static Operand ImageAtomic(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFormat format,
+ TextureFlags flags,
+ int binding,
+ Operand[] sources)
+ {
+ Operand dest = Local();
+
+ context.Add(new TextureOperation(Instruction.ImageAtomic, type, format, flags, binding, 0, new[] { dest }, sources));
+
+ return dest;
+ }
+
+ public static void ImageLoad(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFormat format,
+ TextureFlags flags,
+ int binding,
+ int compMask,
+ Operand[] dests,
+ Operand[] sources)
+ {
+ context.Add(new TextureOperation(Instruction.ImageLoad, type, format, flags, binding, compMask, dests, sources));
+ }
+
+ public static void ImageStore(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFormat format,
+ TextureFlags flags,
+ int binding,
+ Operand[] sources)
+ {
+ context.Add(new TextureOperation(Instruction.ImageStore, type, format, flags, binding, 0, null, sources));
+ }
+
public static Operand IsNan(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32)
{
return context.Add(fpType | Instruction.IsNan, Local(), a);
@@ -666,6 +705,21 @@ namespace Ryujinx.Graphics.Shader.Translation
: context.Load(storageKind, (int)ioVariable, arrayIndex, elemIndex);
}
+ public static Operand Lod(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFlags flags,
+ int binding,
+ int compIndex,
+ Operand[] sources)
+ {
+ Operand dest = Local();
+
+ context.Add(new TextureOperation(Instruction.Lod, type, TextureFormat.Unknown, flags, binding, compIndex, new[] { dest }, sources));
+
+ return dest;
+ }
+
public static Operand MemoryBarrier(this EmitterContext context)
{
return context.Add(Instruction.MemoryBarrier);
@@ -797,6 +851,33 @@ namespace Ryujinx.Graphics.Shader.Translation
: context.Add(Instruction.Store, storageKind, null, Const((int)ioVariable), arrayIndex, elemIndex, value);
}
+ public static void TextureSample(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFlags flags,
+ int binding,
+ int compMask,
+ Operand[] dests,
+ Operand[] sources)
+ {
+ context.Add(new TextureOperation(Instruction.TextureSample, type, TextureFormat.Unknown, flags, binding, compMask, dests, sources));
+ }
+
+ public static Operand TextureSize(
+ this EmitterContext context,
+ SamplerType type,
+ TextureFlags flags,
+ int binding,
+ int compIndex,
+ Operand[] sources)
+ {
+ Operand dest = Local();
+
+ context.Add(new TextureOperation(Instruction.TextureSize, type, TextureFormat.Unknown, flags, binding, compIndex, new[] { dest }, sources));
+
+ return dest;
+ }
+
public static Operand UnpackDouble2x32High(this EmitterContext context, Operand a)
{
return UnpackDouble2x32(context, a, 1);