mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-12 13:15:24 +02:00
misc: chore: Use explicit types in Shader project
This commit is contained in:
@@ -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",
|
||||
|
@@ -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")})";
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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),
|
||||
|
Reference in New Issue
Block a user