Make sure attributes used on subsequent shader stages are initialized (#2538)

This commit is contained in:
gdkchan 2021-08-11 17:27:00 -03:00 committed by GitHub
parent 10d649e6d3
commit ed754af8d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 347 additions and 262 deletions

View file

@ -41,6 +41,10 @@ namespace Ryujinx.Graphics.Shader.Translation
private readonly TranslationCounts _counts;
public int UsedInputAttributes { get; private set; }
public int UsedOutputAttributes { get; private set; }
public int PassthroughAttributes { get; private set; }
private int _usedConstantBuffers;
private int _usedStorageBuffers;
private int _usedStorageBuffersWrite;
@ -170,6 +174,8 @@ namespace Ryujinx.Graphics.Shader.Translation
TextureHandlesForCache.UnionWith(other.TextureHandlesForCache);
UsedInputAttributes |= other.UsedInputAttributes;
UsedOutputAttributes |= other.UsedOutputAttributes;
_usedConstantBuffers |= other._usedConstantBuffers;
_usedStorageBuffers |= other._usedStorageBuffers;
_usedStorageBuffersWrite |= other._usedStorageBuffersWrite;
@ -191,6 +197,28 @@ namespace Ryujinx.Graphics.Shader.Translation
}
}
public void SetInputUserAttribute(int index)
{
UsedInputAttributes |= 1 << index;
}
public void SetOutputUserAttribute(int index)
{
UsedOutputAttributes |= 1 << index;
}
public void MergeOutputUserAttributes(int mask)
{
if (GpPassthrough)
{
PassthroughAttributes = mask & ~UsedOutputAttributes;
}
else
{
UsedOutputAttributes |= mask;
}
}
public void SetClipDistanceWritten(int index)
{
ClipDistancesWritten |= (byte)(1 << index);