Revert "misc: chore: Remove redundant code"

This reverts commit 05a88ccc94.
This commit is contained in:
KeatonTheBot
2025-03-15 20:00:22 -05:00
parent 7960ea643f
commit efd5a104b6
109 changed files with 412 additions and 271 deletions
@@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
{
using IrOperandType = IntermediateRepresentation.OperandType;
class CodeGenContext : Module
partial class CodeGenContext : Module
{
private const uint SpirvVersionMajor = 1;
private const uint SpirvVersionMinor = 3;
@@ -4,10 +4,17 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
class StructuredProgramInfo
{
public List<StructuredFunction> Functions { get; } = [];
public List<StructuredFunction> Functions { get; }
public HashSet<IoDefinition> IoDefinitions { get; } = [];
public HashSet<IoDefinition> IoDefinitions { get; }
public HelperFunctionsMask HelperFunctionsMask { get; set; }
public StructuredProgramInfo()
{
Functions = [];
IoDefinitions = [];
}
}
}
@@ -4,22 +4,31 @@ using System.Numerics;
namespace Ryujinx.Graphics.Shader.Translation
{
class AttributeUsage(IGpuAccessor gpuAccessor)
class AttributeUsage
{
public bool NextUsesFixedFuncAttributes { get; private set; }
public int UsedInputAttributes { get; private set; }
public int UsedOutputAttributes { get; private set; }
public HashSet<int> UsedInputAttributesPerPatch { get; } = [];
public HashSet<int> UsedOutputAttributesPerPatch { get; } = [];
public HashSet<int> UsedInputAttributesPerPatch { get; }
public HashSet<int> UsedOutputAttributesPerPatch { get; }
public HashSet<int> NextUsedInputAttributesPerPatch { get; private set; }
public int PassthroughAttributes { get; private set; }
private int _nextUsedInputAttributes;
private int _thisUsedInputAttributes;
private Dictionary<int, int> _perPatchAttributeLocations;
private readonly IGpuAccessor _gpuAccessor;
public UInt128 NextInputAttributesComponents { get; private set; }
public UInt128 ThisInputAttributesComponents { get; private set; }
public AttributeUsage(IGpuAccessor gpuAccessor)
{
_gpuAccessor = gpuAccessor;
UsedInputAttributesPerPatch = [];
UsedOutputAttributesPerPatch = [];
}
public void SetInputUserAttribute(int index, int component)
{
int mask = 1 << index;
@@ -65,7 +74,7 @@ namespace Ryujinx.Graphics.Shader.Translation
int location = BitOperations.TrailingZeroCount(freeMask);
if (location == 32)
{
gpuAccessor.Log($"No enough free locations for patch input/output 0x{attr:X}.");
_gpuAccessor.Log($"No enough free locations for patch input/output 0x{attr:X}.");
break;
}
@@ -61,12 +61,18 @@ namespace Ryujinx.Graphics.Shader.Translation
private readonly TransformFeedbackOutput[] _transformFeedbackOutputs;
readonly struct TransformFeedbackVariable(IoVariable ioVariable, int location = 0, int component = 0)
: IEquatable<TransformFeedbackVariable>
readonly struct TransformFeedbackVariable : IEquatable<TransformFeedbackVariable>
{
public IoVariable IoVariable { get; } = ioVariable;
public int Location { get; } = location;
public int Component { get; } = component;
public IoVariable IoVariable { get; }
public int Location { get; }
public int Component { get; }
public TransformFeedbackVariable(IoVariable ioVariable, int location = 0, int component = 0)
{
IoVariable = ioVariable;
Location = location;
Component = component;
}
public override bool Equals(object other)
{