Remove some dead/redundant code

This commit is contained in:
Gabriel A 2023-10-27 21:47:50 -03:00
parent 17daa0b68d
commit 7ec367c448
2 changed files with 2 additions and 47 deletions

View file

@ -53,13 +53,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
AggregateType type = texOp.Format.GetComponentType();
string bindlessHandle = null;
string imageName;
if (isBindless)
{
bindlessHandle = Src(AggregateType.S32);
imageName = GetBindlessImage(context, texOp.Type, type, bindlessHandle);
imageName = GetBindlessImage(context, texOp.Type, type, Src(AggregateType.S32));
}
else
{
@ -283,12 +281,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
return GetSoureExpr(context, texOp.GetSource(srcIndex++), type);
}
string bindlessHandle = null;
if (isBindless)
{
bindlessHandle = Src(AggregateType.S32);
texCall += "(" + GetBindlessSampler(context, texOp.Type, bindlessHandle);
texCall += "(" + GetBindlessSampler(context, texOp.Type, Src(AggregateType.S32));
}
else
{

View file

@ -716,7 +716,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
pCoords = Src(AggregateType.S32);
}
SpvInstruction bindlessIndex;
SpvInstruction image;
if (isBindless)
@ -726,14 +725,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
var imageIndex = GenerateBindlessTextureHandleToIndex(context, bindlessHandle);
var imagePointer = context.AccessChain(imagePointerType, imageVariable, imageIndex);
bindlessIndex = imageIndex;
image = context.Load(imageType, imagePointer);
}
else
{
(var imageType, var imageVariable) = context.Images[texOp.Binding];
bindlessIndex = null;
image = context.Load(imageType, imageVariable);
}
@ -1263,8 +1260,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
SpvInstruction pCoords = AssemblePVector(pCount);
_ = isBindless ? GenerateBindlessTextureHandleToIndex(context, bindlessHandle) : null;
SpvInstruction AssembleDerivativesVector(int count)
{
if (count > 1)
@ -1535,7 +1530,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
bool isBindless = (texOp.Flags & TextureFlags.Bindless) != 0;
SpvInstruction bindlessIndex;
SpvInstruction imageType;
SpvInstruction image;
@ -1548,14 +1542,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
var imageIndex = GenerateBindlessTextureHandleToIndex(context, bindlessHandle);
var imagePointer = context.AccessChain(imagePointerType, imageVariable, imageIndex);
bindlessIndex = imageIndex;
image = context.Load(imageType, imagePointer);
}
else
{
(imageType, var sampledImageType, var sampledImageVariable) = context.Samplers[texOp.Binding];
bindlessIndex = null;
image = context.Load(sampledImageType, sampledImageVariable);
}
@ -2001,38 +1993,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
return context.Load(context.GetType(varType), context.Inputs[ioDefinition]);
}
private static OperationResult GetZeroOperationResult(
CodeGenContext context,
AstTextureOperation texOp,
AggregateType scalarType,
bool isVector)
{
var zero = scalarType switch
{
AggregateType.S32 => context.Constant(context.TypeS32(), 0),
AggregateType.U32 => context.Constant(context.TypeU32(), 0u),
_ => context.Constant(context.TypeFP32(), 0f),
};
if (isVector)
{
AggregateType outputType = texOp.GetVectorType(scalarType);
if ((outputType & AggregateType.ElementCountMask) != 0)
{
int componentsCount = BitOperations.PopCount((uint)texOp.Index);
SpvInstruction[] values = new SpvInstruction[componentsCount];
values.AsSpan().Fill(zero);
return new OperationResult(outputType, context.ConstantComposite(context.GetType(outputType), values));
}
}
return new OperationResult(scalarType, zero);
}
private static SpvInstruction GetSwizzledResult(CodeGenContext context, SpvInstruction vector, AggregateType swizzledResultType, int mask)
{
if ((swizzledResultType & AggregateType.ElementCountMask) != 0)