public bool Equals(FunctionInvocation x, FunctionInvocation y) { if (x.functionName != y.functionName) { return(false); } if (x.returnType != y.returnType) { return(false); } if (x.operands.Count != y.operands.Count) { return(false); } for (int i = 0; i < x.operands.Count; i++) { if (x.operands[i].Semantic != y.operands[i].Semantic) { return(false); } var leftType = x.operands[i].Parameter.Type; var rightType = y.operands[i].Parameter.Type; if (Axiom.Core.Root.Instance.RenderSystem.Name.Contains("OpenGL ES 2")) { if (leftType == Graphics.GpuProgramParameters.GpuConstantType.Sampler1D) { leftType = Graphics.GpuProgramParameters.GpuConstantType.Sampler2D; } if (rightType == Graphics.GpuProgramParameters.GpuConstantType.Sampler1D) { rightType = Graphics.GpuProgramParameters.GpuConstantType.Sampler2D; } } if (Operand.GetFloatCount(x.operands[i].Mask) > 0 || Operand.GetFloatCount(y.operands[i].Mask) > 0) { if (Operand.GetFloatCount(x.operands[i].Mask) > 0) { leftType = (Graphics.GpuProgramParameters.GpuConstantType)(int) x.operands[i].Parameter.Type - (int)x.operands[i].Parameter.Type + Operand.GetFloatCount(x.operands[i].Mask); } if (Operand.GetFloatCount(y.operands[i].Mask) > 0) { rightType = (Graphics.GpuProgramParameters.GpuConstantType)(int) y.operands[i].Parameter.Type - (int)y.operands[i].Parameter.Type + Operand.GetFloatCount(y.operands[i].Mask); } } if (leftType != rightType) { return(false); } } return(true); }
private static bool FunctionInvocationLessThan(FunctionInvocation lhs, FunctionInvocation rhs) { if (lhs.operands.Count < rhs.operands.Count) { return(true); } if (lhs.operands.Count > rhs.operands.Count) { return(false); } for (int i = 0; i < lhs.operands.Count; i++) { var itLHSOps = lhs.operands[i]; var itRHSOps = rhs.operands[i]; if (itLHSOps.Semantic < itRHSOps.Semantic) { return(true); } if (itLHSOps.Semantic > itRHSOps.Semantic) { return(false); } var leftType = itLHSOps.Parameter.Type; var rightType = itRHSOps.Parameter.Type; if (Axiom.Core.Root.Instance.RenderSystems.ContainsKey("OpenGL ES 2") && Axiom.Core.Root.Instance.RenderSystem == Axiom.Core.Root.Instance.RenderSystems["OpenGL ES 2"]) { if (leftType == Graphics.GpuProgramParameters.GpuConstantType.Sampler1D) { leftType = Graphics.GpuProgramParameters.GpuConstantType.Sampler2D; } if (rightType == Graphics.GpuProgramParameters.GpuConstantType.Sampler1D) { rightType = Graphics.GpuProgramParameters.GpuConstantType.Sampler2D; } } //If a swizzle mask is being applied to the parameter, generate the GpuConstantType to //perform the parameter type comparison the way that the compiler will see it if ((Operand.GetFloatCount(itLHSOps.Mask) > 0 || (Operand.GetFloatCount(itRHSOps.Mask) > 0))) { if (Operand.GetFloatCount(itLHSOps.Mask) > 0) { leftType = (Graphics.GpuProgramParameters.GpuConstantType) (((int)itLHSOps.Parameter.Type - (int)itLHSOps.Parameter.Type) + Operand.GetFloatCount(itLHSOps.Mask)); } if (Operand.GetFloatCount(itRHSOps.Mask) > 0) { rightType = (Graphics.GpuProgramParameters.GpuConstantType) (((int)itRHSOps.Parameter.Type - (int)itRHSOps.Parameter.Type) + Operand.GetFloatCount(itRHSOps.Mask)); } } if (leftType < rightType) { return(true); } if (leftType > rightType) { return(false); } } return(false); }