misc: chore: Use explicit types in Shader project

This commit is contained in:
Evan Husted
2025-01-25 14:07:59 -06:00
parent 68bbb29be6
commit f2aa6b3a5b
39 changed files with 726 additions and 725 deletions

View File

@@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
? AggregateType.S32
: AggregateType.U32;
var shared = operation.StorageKind == StorageKind.SharedMemory;
bool shared = operation.StorageKind == StorageKind.SharedMemory;
builder.Append($"({(shared ? "threadgroup" : "device")} {Declarations.GetVarTypeName(dstType, true)}*)&{GenerateLoadOrStore(context, operation, isStore: false)}");
@@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
case 2:
if (operation.ForcePrecise)
{
var func = (inst & Instruction.Mask) switch
string func = (inst & Instruction.Mask) switch
{
Instruction.Add => "PreciseFAdd",
Instruction.Subtract => "PreciseFSub",

View File

@@ -7,7 +7,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
{
public static string Barrier(CodeGenContext context, AstOperation operation)
{
var device = (operation.Inst & Instruction.Mask) == Instruction.MemoryBarrier;
bool device = (operation.Inst & Instruction.Mask) == Instruction.MemoryBarrier;
return $"threadgroup_barrier(mem_flags::mem_{(device ? "device" : "threadgroup")})";
}

View File

@@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
{
AstOperand funcId = (AstOperand)operation.GetSource(0);
var function = context.GetFunction(funcId.Value);
StructuredFunction function = context.GetFunction(funcId.Value);
int argCount = operation.SourcesCount - 1;
int additionalArgCount = CodeGenContext.AdditionalArgCount + (context.Definitions.Stage != ShaderStage.Compute ? 1 : 0);

View File

@@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
bool isArray = (texOp.Type & SamplerType.Array) != 0;
var texCallBuilder = new StringBuilder();
StringBuilder texCallBuilder = new StringBuilder();
int srcIndex = 0;
@@ -194,7 +194,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
texCallBuilder.Append('(');
var coordsBuilder = new StringBuilder();
StringBuilder coordsBuilder = new StringBuilder();
int coordsCount = texOp.Type.GetDimensions();
@@ -326,8 +326,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
coordsExpr = GetSourceExpr(context, texOp.GetSource(coordsIndex), AggregateType.FP32);
}
var clamped = $"{textureName}.calculate_clamped_lod({samplerName}, {coordsExpr})";
var unclamped = $"{textureName}.calculate_unclamped_lod({samplerName}, {coordsExpr})";
string clamped = $"{textureName}.calculate_clamped_lod({samplerName}, {coordsExpr})";
string unclamped = $"{textureName}.calculate_unclamped_lod({samplerName}, {coordsExpr})";
return $"float2({clamped}, {unclamped}){GetMask(texOp.Index)}";
}
@@ -352,7 +352,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
bool isArray = (texOp.Type & SamplerType.Array) != 0;
bool isShadow = (texOp.Type & SamplerType.Shadow) != 0;
var texCallBuilder = new StringBuilder();
StringBuilder texCallBuilder = new StringBuilder();
bool colorIsVector = isGather || !isShadow;
@@ -525,8 +525,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
private static string GetSamplerName(CodeGenContext context, AstTextureOperation texOp, ref int srcIndex)
{
var index = texOp.IsSeparate ? texOp.GetSamplerSetAndBinding() : texOp.GetTextureSetAndBinding();
var sourceIndex = texOp.IsSeparate ? srcIndex++ : srcIndex + 1;
SetBindingPair index = texOp.IsSeparate ? texOp.GetSamplerSetAndBinding() : texOp.GetTextureSetAndBinding();
int sourceIndex = texOp.IsSeparate ? srcIndex++ : srcIndex + 1;
TextureDefinition samplerDefinition = context.Properties.Textures[index];
string name = samplerDefinition.Name;
@@ -589,7 +589,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
{
AstTextureOperation texOp = (AstTextureOperation)operation;
var texCallBuilder = new StringBuilder();
StringBuilder texCallBuilder = new StringBuilder();
int srcIndex = 0;

View File

@@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
bool isOutput,
bool isPerPatch)
{
var returnValue = ioVariable switch
(string, AggregateType) returnValue = ioVariable switch
{
IoVariable.BaseInstance => ("base_instance", AggregateType.U32),
IoVariable.BaseVertex => ("base_vertex", AggregateType.U32),