mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Change non-uniform shader extension to be more conservative
The previous fix for Tomodachi Life (#91) included the extension to all shaders, independently on if it was needed or not. This PR fixes that by lazily adding the extension only when it is actually needed. This change should not be noticed by anyone, but it avoids having to modify shaders that do not perform any type of dynamic indexing, which apparently is something some modders care about. Co-authored-by: AsperTheDog <guillerman0000@gmail.com>
This commit is contained in:
committed by
KeatonTheBot
co-authored by
AsperTheDog
parent
0bc515e4ff
commit
79f55b12bf
@@ -82,6 +82,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||||||
|
|
||||||
public bool IsMainFunction { get; private set; }
|
public bool IsMainFunction { get; private set; }
|
||||||
public bool MayHaveReturned { get; set; }
|
public bool MayHaveReturned { get; set; }
|
||||||
|
public bool WasNonUniformAccessDeclared { get; set; }
|
||||||
|
|
||||||
public CodeGenContext(
|
public CodeGenContext(
|
||||||
StructuredProgramInfo info,
|
StructuredProgramInfo info,
|
||||||
@@ -89,6 +90,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||||||
GeneratorPool<Instruction> instPool,
|
GeneratorPool<Instruction> instPool,
|
||||||
GeneratorPool<LiteralInteger> integerPool) : base(SpirvVersionPacked, instPool, integerPool)
|
GeneratorPool<LiteralInteger> integerPool) : base(SpirvVersionPacked, instPool, integerPool)
|
||||||
{
|
{
|
||||||
|
WasNonUniformAccessDeclared = false;
|
||||||
|
|
||||||
Info = info;
|
Info = info;
|
||||||
AttributeUsage = parameters.AttributeUsage;
|
AttributeUsage = parameters.AttributeUsage;
|
||||||
Definitions = parameters.Definitions;
|
Definitions = parameters.Definitions;
|
||||||
|
|||||||
@@ -591,7 +591,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||||||
{
|
{
|
||||||
if (context.HostCapabilities.SupportsShaderNonUniformIndexing)
|
if (context.HostCapabilities.SupportsShaderNonUniformIndexing)
|
||||||
{
|
{
|
||||||
|
if (!context.WasNonUniformAccessDeclared)
|
||||||
|
{
|
||||||
|
context.AddExtension("SPV_EXT_descriptor_indexing");
|
||||||
|
context.AddCapability(Capability.ShaderNonUniform);
|
||||||
|
context.AddCapability(Capability.SampledImageArrayNonUniformIndexing);
|
||||||
|
context.AddCapability(Capability.StorageImageArrayNonUniformIndexing);
|
||||||
|
}
|
||||||
|
|
||||||
context.Decorate(inst, Decoration.NonUniform);
|
context.Decorate(inst, Decoration.NonUniform);
|
||||||
|
context.WasNonUniformAccessDeclared = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,14 +65,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
|||||||
context.AddCapability(Capability.Float64);
|
context.AddCapability(Capability.Float64);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.HostCapabilities.SupportsShaderNonUniformIndexing)
|
|
||||||
{
|
|
||||||
context.AddExtension("SPV_EXT_descriptor_indexing");
|
|
||||||
context.AddCapability(Capability.ShaderNonUniform);
|
|
||||||
context.AddCapability(Capability.SampledImageArrayNonUniformIndexing);
|
|
||||||
context.AddCapability(Capability.StorageImageArrayNonUniformIndexing);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parameters.Definitions.TransformFeedbackEnabled && parameters.Definitions.LastInVertexPipeline)
|
if (parameters.Definitions.TransformFeedbackEnabled && parameters.Definitions.LastInVertexPipeline)
|
||||||
{
|
{
|
||||||
context.AddCapability(Capability.TransformFeedback);
|
context.AddCapability(Capability.TransformFeedback);
|
||||||
|
|||||||
Reference in New Issue
Block a user