aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-05-20 16:19:26 -0300
committerGitHub <noreply@github.com>2023-05-20 16:19:26 -0300
commit402f05b8ef013807997589ecc0a8ff50267dcd23 (patch)
tree8e3b06c2ce3e3ccd4b443a4c68365251acc668fa /src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
parentfb27042e01b0fa110184673d436ec96ec8cf20c7 (diff)
Replace constant buffer access on shader with new Load instruction (#4646)1.1.811
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
index ed292ef1..0ef89b39 100644
--- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs
@@ -23,9 +23,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
public int InputVertices { get; }
- public Dictionary<int, Instruction> UniformBuffers { get; } = new Dictionary<int, Instruction>();
- public Instruction SupportBuffer { get; set; }
- public Instruction UniformBuffersArray { get; set; }
+ public Dictionary<int, Instruction> ConstantBuffers { get; } = new Dictionary<int, Instruction>();
public Instruction StorageBuffersArray { get; set; }
public Instruction LocalMemory { get; set; }
public Instruction SharedMemory { get; set; }
@@ -217,7 +215,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
{
IrOperandType.Argument => GetArgument(type, operand),
IrOperandType.Constant => GetConstant(type, operand),
- IrOperandType.ConstantBuffer => GetConstantBuffer(type, operand),
IrOperandType.LocalVariable => GetLocal(type, operand),
IrOperandType.Undefined => GetUndefined(type),
_ => throw new ArgumentException($"Invalid operand type \"{operand.Type}\".")
@@ -274,31 +271,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
};
}
- public Instruction GetConstantBuffer(AggregateType type, AstOperand operand)
- {
- var i1 = Constant(TypeS32(), 0);
- var i2 = Constant(TypeS32(), operand.CbufOffset >> 2);
- var i3 = Constant(TypeU32(), operand.CbufOffset & 3);
-
- Instruction elemPointer;
-
- if (UniformBuffersArray != null)
- {
- var ubVariable = UniformBuffersArray;
- var i0 = Constant(TypeS32(), operand.CbufSlot);
-
- elemPointer = AccessChain(TypePointer(StorageClass.Uniform, TypeFP32()), ubVariable, i0, i1, i2, i3);
- }
- else
- {
- var ubVariable = UniformBuffers[operand.CbufSlot];
-
- elemPointer = AccessChain(TypePointer(StorageClass.Uniform, TypeFP32()), ubVariable, i1, i2, i3);
- }
-
- return BitcastIfNeeded(type, AggregateType.FP32, Load(TypeFP32(), elemPointer));
- }
-
public Instruction GetLocalPointer(AstOperand local)
{
return _locals[local];