diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index 9e59adb20..e240d6495 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -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 { diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs index 1cf9df4a5..e06a6ebad 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs @@ -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)