private static void ApplyScalingInterpolated(CodeGenContext context, SpvInstruction output, SpvInstruction vector, SpvInstruction scale) { var vector2Type = context.TypeVector(context.TypeFP32(), 2); var scaleNegated = context.FNegate(context.TypeFP32(), scale); var scaleVector = context.CompositeConstruct(vector2Type, scaleNegated, scaleNegated); var vectorFloat = context.ConvertSToF(vector2Type, vector); var vectorScaled = context.VectorTimesScalar(vector2Type, vectorFloat, scaleNegated); var fragCoordPointer = context.Inputs[AttributeConsts.PositionX]; var fragCoord = context.Load(context.TypeVector(context.TypeFP32(), 4), fragCoordPointer); var fragCoordXY = context.VectorShuffle(vector2Type, fragCoord, fragCoord, 0, 1); var scaleMod = context.FMod(vector2Type, fragCoordXY, scaleVector); var vectorInterpolated = context.FAdd(vector2Type, vectorScaled, scaleMod); context.Store(output, context.ConvertFToS(context.TypeVector(context.TypeS32(), 2), vectorInterpolated)); }