3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
5 using SharpDX.Direct3D11;
7 namespace SiliconStudio.
Paradox.Graphics
9 class EffectSignatureLayout
11 public InputElement[] InputElements {
get;
private set; }
13 public byte[] ShaderSignature {
get;
private set; }
15 private readonly
int inputElementsHashCode = 0;
17 public EffectSignatureLayout(InputElement[] inputElements, byte[] signature)
19 InputElements = inputElements;
20 ShaderSignature = signature;
21 inputElementsHashCode = InputElements.Aggregate(InputElements.Length, (current, inputElement) => (current * 397) ^ inputElement.GetHashCode());
22 inputElementsHashCode = (inputElementsHashCode * 397) ^ ShaderSignature.GetHashCode();
25 public bool Equals(EffectSignatureLayout other)
27 if (ReferenceEquals(null, other))
return false;
28 if (ReferenceEquals(
this, other))
return true;
31 if (InputElements.Length != other.InputElements.Length)
35 if (ShaderSignature != other.ShaderSignature)
38 return !InputElements.Where((t, i) => t != other.InputElements[i]).Any();
41 public override bool Equals(
object obj)
43 if (ReferenceEquals(null, obj))
return false;
44 if (ReferenceEquals(
this, obj))
return true;
45 if (obj.GetType() != typeof(EffectSignatureLayout))
return false;
46 return Equals((EffectSignatureLayout)obj);
49 public override int GetHashCode()
51 return inputElementsHashCode;
54 public static bool operator ==(EffectSignatureLayout left, EffectSignatureLayout right)
56 return Equals(left, right);
59 public static bool operator !=(EffectSignatureLayout left, EffectSignatureLayout right)
61 return !Equals(left, right);