diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2023-08-13 22:26:42 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-13 22:26:42 -0300 |
| commit | b423197619dd8d9dda1c255a76105bf30e255dae (patch) | |
| tree | e3898b3b1672f022b5de4522b51bd21583043996 /src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | |
| parent | 8edfb2bc7b8507d0ef51f0544eb32a65f0bf54a1 (diff) | |
Delete ShaderConfig and organize shader resources/definitions better (#5509)
* 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/CodeGen/Spirv/Instructions.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 9489397b..30ce7f8b 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -240,10 +240,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { // Barrier on divergent control flow paths may cause the GPU to hang, // so skip emitting the barrier for those cases. - if (!context.Config.GpuAccessor.QueryHostSupportsShaderBarrierDivergence() && + if (!context.HostCapabilities.SupportsShaderBarrierDivergence && (context.CurrentBlock.Type != AstBlockType.Main || context.MayHaveReturned || !context.IsMainFunction)) { - context.Config.GpuAccessor.Log($"Shader has barrier on potentially divergent block, the barrier will be removed."); + context.Logger.Log("Shader has barrier on potentially divergent block, the barrier will be removed."); return OperationResult.Invalid; } @@ -546,7 +546,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv private static OperationResult GenerateFSIBegin(CodeGenContext context, AstOperation operation) { - if (context.Config.GpuAccessor.QueryHostSupportsFragmentShaderInterlock()) + if (context.HostCapabilities.SupportsFragmentShaderInterlock) { context.BeginInvocationInterlockEXT(); } @@ -556,7 +556,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv private static OperationResult GenerateFSIEnd(CodeGenContext context, AstOperation operation) { - if (context.Config.GpuAccessor.QueryHostSupportsFragmentShaderInterlock()) + if (context.HostCapabilities.SupportsFragmentShaderInterlock) { context.EndInvocationInterlockEXT(); } @@ -1446,7 +1446,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv lodBias = Src(AggregateType.FP32); } - if (!isGather && !intCoords && !isMultisample && !hasLodLevel && !hasDerivatives && context.Config.Stage != ShaderStage.Fragment) + if (!isGather && !intCoords && !isMultisample && !hasLodLevel && !hasDerivatives && context.Definitions.Stage != ShaderStage.Fragment) { // Implicit LOD is only valid on fragment. // Use the LOD bias as explicit LOD if available. @@ -1804,8 +1804,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv } BufferDefinition buffer = storageKind == StorageKind.ConstantBuffer - ? context.Config.Properties.ConstantBuffers[bindingIndex.Value] - : context.Config.Properties.StorageBuffers[bindingIndex.Value]; + ? context.Properties.ConstantBuffers[bindingIndex.Value] + : context.Properties.StorageBuffers[bindingIndex.Value]; StructureField field = buffer.Type.Fields[fieldIndex.Value]; storageClass = StorageClass.Uniform; @@ -1825,13 +1825,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv if (storageKind == StorageKind.LocalMemory) { storageClass = StorageClass.Private; - varType = context.Config.Properties.LocalMemories[bindingId.Value].Type & AggregateType.ElementTypeMask; + varType = context.Properties.LocalMemories[bindingId.Value].Type & AggregateType.ElementTypeMask; baseObj = context.LocalMemories[bindingId.Value]; } else { storageClass = StorageClass.Workgroup; - varType = context.Config.Properties.SharedMemories[bindingId.Value].Type & AggregateType.ElementTypeMask; + varType = context.Properties.SharedMemories[bindingId.Value].Type & AggregateType.ElementTypeMask; baseObj = context.SharedMemories[bindingId.Value]; } break; @@ -1851,7 +1851,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv int location = 0; int component = 0; - if (context.Config.HasPerLocationInputOrOutput(ioVariable, isOutput)) + if (context.Definitions.HasPerLocationInputOrOutput(ioVariable, isOutput)) { if (operation.GetSource(srcIndex++) is not AstOperand vecIndex || vecIndex.Type != OperandType.Constant) { @@ -1863,7 +1863,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv if (operation.SourcesCount > srcIndex && operation.GetSource(srcIndex) is AstOperand elemIndex && elemIndex.Type == OperandType.Constant && - context.Config.HasPerLocationInputOrOutputComponent(ioVariable, location, elemIndex.Value, isOutput)) + context.Definitions.HasPerLocationInputOrOutputComponent(ioVariable, location, elemIndex.Value, isOutput)) { component = elemIndex.Value; srcIndex++; @@ -1872,11 +1872,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv if (ioVariable == IoVariable.UserDefined) { - varType = context.Config.GetUserDefinedType(location, isOutput); + varType = context.Definitions.GetUserDefinedType(location, isOutput); } else if (ioVariable == IoVariable.FragmentOutputColor) { - varType = context.Config.GetFragmentOutputColorType(location); + varType = context.Definitions.GetFragmentOutputColorType(location); } else { @@ -2076,7 +2076,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { var result = emitF(context.TypeFP64(), context.GetFP64(src1), context.GetFP64(src2)); - if (!context.Config.GpuAccessor.QueryHostReducedPrecision() || operation.ForcePrecise) + if (!context.HostCapabilities.ReducedPrecision || operation.ForcePrecise) { context.Decorate(result, Decoration.NoContraction); } @@ -2087,7 +2087,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { var result = emitF(context.TypeFP32(), context.GetFP32(src1), context.GetFP32(src2)); - if (!context.Config.GpuAccessor.QueryHostReducedPrecision() || operation.ForcePrecise) + if (!context.HostCapabilities.ReducedPrecision || operation.ForcePrecise) { context.Decorate(result, Decoration.NoContraction); } @@ -2147,7 +2147,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { var result = emitF(context.TypeFP64(), context.GetFP64(src1), context.GetFP64(src2), context.GetFP64(src3)); - if (!context.Config.GpuAccessor.QueryHostReducedPrecision() || operation.ForcePrecise) + if (!context.HostCapabilities.ReducedPrecision || operation.ForcePrecise) { context.Decorate(result, Decoration.NoContraction); } @@ -2158,7 +2158,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv { var result = emitF(context.TypeFP32(), context.GetFP32(src1), context.GetFP32(src2), context.GetFP32(src3)); - if (!context.Config.GpuAccessor.QueryHostReducedPrecision() || operation.ForcePrecise) + if (!context.HostCapabilities.ReducedPrecision || operation.ForcePrecise) { context.Decorate(result, Decoration.NoContraction); } |
