diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-05-20 16:19:26 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-20 16:19:26 -0300 |
commit | 402f05b8ef013807997589ecc0a8ff50267dcd23 (patch) | |
tree | 8e3b06c2ce3e3ccd4b443a4c68365251acc668fa /src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs | |
parent | fb27042e01b0fa110184673d436ec96ec8cf20c7 (diff) |
Replace constant buffer access on shader with new Load instruction (#4646)1.1.811
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs b/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs index b4ca8ee5..939a52f3 100644 --- a/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs +++ b/src/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs @@ -73,27 +73,34 @@ namespace Ryujinx.Graphics.Shader.StructuredIr Instruction inst = operation.Inst; StorageKind storageKind = operation.StorageKind; - if ((inst == Instruction.Load || inst == Instruction.Store) && storageKind.IsInputOrOutput()) + if (inst == Instruction.Load || inst == Instruction.Store) { - IoVariable ioVariable = (IoVariable)operation.GetSource(0).Value; - bool isOutput = storageKind.IsOutput(); - bool perPatch = storageKind.IsPerPatch(); - int location = 0; - int component = 0; - - if (context.Config.HasPerLocationInputOrOutput(ioVariable, isOutput)) + if (storageKind.IsInputOrOutput()) { - location = operation.GetSource(1).Value; + IoVariable ioVariable = (IoVariable)operation.GetSource(0).Value; + bool isOutput = storageKind.IsOutput(); + bool perPatch = storageKind.IsPerPatch(); + int location = 0; + int component = 0; - if (operation.SourcesCount > 2 && - operation.GetSource(2).Type == OperandType.Constant && - context.Config.HasPerLocationInputOrOutputComponent(ioVariable, location, operation.GetSource(2).Value, isOutput)) + if (context.Config.HasPerLocationInputOrOutput(ioVariable, isOutput)) { - component = operation.GetSource(2).Value; + location = operation.GetSource(1).Value; + + if (operation.SourcesCount > 2 && + operation.GetSource(2).Type == OperandType.Constant && + context.Config.HasPerLocationInputOrOutputComponent(ioVariable, location, operation.GetSource(2).Value, isOutput)) + { + component = operation.GetSource(2).Value; + } } - } - context.Info.IoDefinitions.Add(new IoDefinition(storageKind, ioVariable, location, component)); + context.Info.IoDefinitions.Add(new IoDefinition(storageKind, ioVariable, location, component)); + } + else if (storageKind == StorageKind.ConstantBuffer && operation.GetSource(0).Type == OperandType.Constant) + { + context.Config.ResourceManager.SetUsedConstantBufferBinding(operation.GetSource(0).Value); + } } bool vectorDest = IsVectorDestInst(inst); @@ -105,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr for (int index = 0; index < operation.SourcesCount; index++) { - sources[index] = context.GetOperand(operation.GetSource(index)); + sources[index] = context.GetOperandOrCbLoad(operation.GetSource(index)); } for (int index = 0; index < outDestsCount; index++) |