Move gl_Layer to vertex shader if geometry is not supported (#4368)

* Set gl_Layer on vertex shader if it's set on the geometry shader and it does nothing else

* Shader cache version bump

* PR feedback

* Fix typo
This commit is contained in:
gdkchan 2023-02-25 07:39:51 -03:00 committed by GitHub
parent 58207685c0
commit cedd200745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 262 additions and 3 deletions

View file

@ -20,6 +20,8 @@ namespace Ryujinx.Graphics.Shader.Translation
public bool LastInPipeline { get; private set; }
public bool LastInVertexPipeline { get; private set; }
public bool HasLayerInputAttribute { get; private set; }
public int GpLayerInputAttribute { get; private set; }
public int ThreadsPerInputPrimitive { get; }
public OutputTopology OutputTopology { get; }
@ -245,6 +247,22 @@ namespace Ryujinx.Graphics.Shader.Translation
LayerOutputAttribute = attr;
}
public void SetGeometryShaderLayerInputAttribute(int attr)
{
HasLayerInputAttribute = true;
GpLayerInputAttribute = attr;
}
public void SetLastInVertexPipeline(bool hasFragment)
{
if (!hasFragment)
{
LastInPipeline = true;
}
LastInVertexPipeline = true;
}
public void SetInputUserAttributeFixedFunc(int index)
{
UsedInputAttributes |= 1 << index;
@ -706,13 +724,15 @@ namespace Ryujinx.Graphics.Shader.Translation
return FindDescriptorIndex(GetImageDescriptors(), texOp);
}
public ShaderProgramInfo CreateProgramInfo()
public ShaderProgramInfo CreateProgramInfo(ShaderIdentification identification = ShaderIdentification.None)
{
return new ShaderProgramInfo(
GetConstantBufferDescriptors(),
GetStorageBufferDescriptors(),
GetTextureDescriptors(),
GetImageDescriptors(),
identification,
GpLayerInputAttribute,
Stage,
UsedFeatures.HasFlag(FeatureFlags.InstanceId),
UsedFeatures.HasFlag(FeatureFlags.DrawParameters),