aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-08-13 22:26:42 -0300
committerGitHub <noreply@github.com>2023-08-13 22:26:42 -0300
commitb423197619dd8d9dda1c255a76105bf30e255dae (patch)
treee3898b3b1672f022b5de4522b51bd21583043996 /src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
parent8edfb2bc7b8507d0ef51f0544eb32a65f0bf54a1 (diff)
Delete ShaderConfig and organize shader resources/definitions better (#5509)1.1.985
* Move some properties out of ShaderConfig * Stop using ShaderConfig on backends * Replace ShaderConfig usages on Translator and passes * Move remaining properties out of ShaderConfig and delete ShaderConfig * Remove ResourceManager property from TranslatorContext * Move Rewriter passes to separate transform pass files * Fix TransformPasses.RunPass on cases where a node is removed * Move remaining ClipDistancePrimitivesWritten and UsedFeatures updates to decode stage * Reduce excessive parameter passing a bit by using structs more * Remove binding parameter from ShaderProperties methods since it is redundant * Replace decoder instruction checks with switch statement * Put GLSL on the same plan as SPIR-V for input/output declaration * Stop mutating TranslatorContext state when Translate is called * Pass most of the graphics state using a struct instead of individual query methods * Auto-format * Auto-format * Add backend logging interface * Auto-format * Remove unnecessary use of interpolated strings * Remove more modifications of AttributeUsage after decode * PR feedback * gl_Layer is not supported on compute
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
index 006c14b5..40129252 100644
--- a/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
+++ b/src/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
@@ -26,9 +26,9 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Atoms(EmitterContext context)
{
- if (context.Config.Stage != ShaderStage.Compute)
+ if (context.TranslatorContext.Definitions.Stage != ShaderStage.Compute)
{
- context.Config.GpuAccessor.Log($"Atoms instruction is not valid on \"{context.Config.Stage}\" stage.");
+ context.TranslatorContext.GpuAccessor.Log($"Atoms instruction is not valid on \"{context.TranslatorContext.Definitions.Stage}\" stage.");
return;
}
@@ -50,7 +50,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
_ => AtomSize.U32,
};
- Operand id = Const(context.Config.ResourceManager.SharedMemoryId);
+ Operand id = Const(context.ResourceManager.SharedMemoryId);
Operand res = EmitAtomicOp(context, StorageKind.SharedMemory, op.AtomOp, size, id, offset, value);
context.Copy(GetDest(op.Dest), res);
@@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (op.LsSize > LsSize2.B64)
{
- context.Config.GpuAccessor.Log($"Invalid LDC size: {op.LsSize}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid LDC size: {op.LsSize}.");
return;
}
@@ -119,9 +119,9 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Lds(EmitterContext context)
{
- if (context.Config.Stage != ShaderStage.Compute)
+ if (context.TranslatorContext.Definitions.Stage != ShaderStage.Compute)
{
- context.Config.GpuAccessor.Log($"Lds instruction is not valid on \"{context.Config.Stage}\" stage.");
+ context.TranslatorContext.GpuAccessor.Log($"Lds instruction is not valid on \"{context.TranslatorContext.Definitions.Stage}\" stage.");
return;
}
@@ -155,9 +155,9 @@ namespace Ryujinx.Graphics.Shader.Instructions
public static void Sts(EmitterContext context)
{
- if (context.Config.Stage != ShaderStage.Compute)
+ if (context.TranslatorContext.Definitions.Stage != ShaderStage.Compute)
{
- context.Config.GpuAccessor.Log($"Sts instruction is not valid on \"{context.Config.Stage}\" stage.");
+ context.TranslatorContext.GpuAccessor.Log($"Sts instruction is not valid on \"{context.TranslatorContext.Definitions.Stage}\" stage.");
return;
}
@@ -173,19 +173,19 @@ namespace Ryujinx.Graphics.Shader.Instructions
if (slot.Type == OperandType.Constant)
{
- int binding = context.Config.ResourceManager.GetConstantBufferBinding(slot.Value);
+ int binding = context.ResourceManager.GetConstantBufferBinding(slot.Value);
return context.Load(StorageKind.ConstantBuffer, binding, Const(0), vecIndex, elemIndex);
}
else
{
Operand value = Const(0);
- uint cbUseMask = context.Config.GpuAccessor.QueryConstantBufferUse();
+ uint cbUseMask = context.TranslatorContext.GpuAccessor.QueryConstantBufferUse();
while (cbUseMask != 0)
{
int cbIndex = BitOperations.TrailingZeroCount(cbUseMask);
- int binding = context.Config.ResourceManager.GetConstantBufferBinding(cbIndex);
+ int binding = context.ResourceManager.GetConstantBufferBinding(cbIndex);
Operand isCurrent = context.ICompareEqual(slot, Const(cbIndex));
Operand currentValue = context.Load(StorageKind.ConstantBuffer, binding, Const(0), vecIndex, elemIndex);
@@ -219,7 +219,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomOp.And:
@@ -229,7 +229,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomOp.Xor:
@@ -239,7 +239,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomOp.Or:
@@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomOp.Max:
@@ -263,7 +263,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
case AtomOp.Min:
@@ -277,7 +277,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
else
{
- context.Config.GpuAccessor.Log($"Invalid reduction type: {type}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid reduction type: {type}.");
}
break;
}
@@ -295,13 +295,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
if (size > LsSize2.B128)
{
- context.Config.GpuAccessor.Log($"Invalid load size: {size}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid load size: {size}.");
return;
}
int id = storageKind == StorageKind.LocalMemory
- ? context.Config.ResourceManager.LocalMemoryId
- : context.Config.ResourceManager.SharedMemoryId;
+ ? context.ResourceManager.LocalMemoryId
+ : context.ResourceManager.SharedMemoryId;
bool isSmallInt = size < LsSize2.B32;
int count = size switch
@@ -376,13 +376,13 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
if (size > LsSize2.B128)
{
- context.Config.GpuAccessor.Log($"Invalid store size: {size}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid store size: {size}.");
return;
}
int id = storageKind == StorageKind.LocalMemory
- ? context.Config.ResourceManager.LocalMemoryId
- : context.Config.ResourceManager.SharedMemoryId;
+ ? context.ResourceManager.LocalMemoryId
+ : context.ResourceManager.SharedMemoryId;
bool isSmallInt = size < LsSize2.B32;
int count = size switch
@@ -444,7 +444,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
{
if (size > LsSize2.B128)
{
- context.Config.GpuAccessor.Log($"Invalid store size: {size}.");
+ context.TranslatorContext.GpuAccessor.Log($"Invalid store size: {size}.");
return;
}