diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/StructuredIr')
| -rw-r--r-- | Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs | 19 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs | 1 |
2 files changed, 17 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs index f1dd08f2..65de5218 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs @@ -2,6 +2,7 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation; using Ryujinx.Graphics.Shader.Translation; using System; using System.Collections.Generic; +using System.Numerics; namespace Ryujinx.Graphics.Shader.StructuredIr { @@ -73,12 +74,24 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { Operand slot = operation.GetSource(0); - if (slot.Type != OperandType.Constant) + if (slot.Type == OperandType.Constant) { - throw new InvalidOperationException("Found load with non-constant constant buffer slot."); + context.Info.CBuffers.Add(slot.Value); } + else + { + // If the value is not constant, then we don't know + // how many constant buffers are used, so we assume + // all of them are used. + int cbCount = 32 - BitOperations.LeadingZeroCount(context.Config.GpuAccessor.QueryConstantBufferUse()); + + for (int index = 0; index < cbCount; index++) + { + context.Info.CBuffers.Add(index); + } - context.Info.CBuffers.Add(slot.Value); + context.Info.UsesCbIndexing = true; + } } else if (UsesStorage(inst)) { diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs index be79f00e..ef3b3eca 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs @@ -15,6 +15,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr public HashSet<int> OAttributes { get; } public bool UsesInstanceId { get; set; } + public bool UsesCbIndexing { get; set; } public HelperFunctionsMask HelperFunctionsMask { get; set; } |
