From a8bbb7bbf960fca8b79b941851208b340822d89b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 26 Aug 2019 00:40:50 +0200 Subject: [PATCH] Added known method mapping for new vector types --- .../Mappings/HlslKnownMethods.cs | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Shaders/Mappings/HlslKnownMethods.cs b/src/ComputeSharp.Shaders/Mappings/HlslKnownMethods.cs index 2d4a98a6..ffbb9cd0 100644 --- a/src/ComputeSharp.Shaders/Mappings/HlslKnownMethods.cs +++ b/src/ComputeSharp.Shaders/Mappings/HlslKnownMethods.cs @@ -108,7 +108,91 @@ namespace ComputeSharp.Shaders.Mappings ["System.Numerics.Vector4.Transform"] = "mul", ["System.Numerics.Vector4.Normalize"] = "normalize", ["System.Numerics.Vector4.Zero"] = "(float4)0", - ["System.Numerics.Vector4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)" + ["System.Numerics.Vector4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)", + + // Int2 + ["ComputeSharp.Int2.Zero"] = "(int2)0", + ["ComputeSharp.Int2.One"] = "int2(1, 1)", + ["ComputeSharp.Int2.UnitX"] = "int2(1, 0)", + ["ComputeSharp.Int2.UnitY"] = "int2(0, 1)", + + // Int3 + ["ComputeSharp.Int3.Zero"] = "(int3)0", + ["ComputeSharp.Int3.One"] = "int3(1, 1, 1)", + ["ComputeSharp.Int3.UnitX"] = "int3(1, 0, 0)", + ["ComputeSharp.Int3.UnitY"] = "int3(0, 1, 0)", + ["ComputeSharp.Int3.UnitZ"] = "int3(0, 0, 1)", + + // Int4 + ["ComputeSharp.Int4.Zero"] = "(int4)0", + ["ComputeSharp.Int4.One"] = "int4(1, 1, 1, 1)", + ["ComputeSharp.Int4.UnitX"] = "int4(1, 0, 0, 0)", + ["ComputeSharp.Int4.UnitY"] = "int4(0, 1, 0, 0)", + ["ComputeSharp.Int4.UnitZ"] = "int4(0, 0, 1, 0)", + ["ComputeSharp.Int4.UnitW"] = "int4(0, 0, 0, 1)", + + // UInt2 + ["ComputeSharp.UInt2.Zero"] = "(uint2)0", + ["ComputeSharp.UInt2.One"] = "uint2(1u, 1u)", + ["ComputeSharp.UInt2.UnitX"] = "uint2(1u, 0u)", + ["ComputeSharp.UInt2.UnitY"] = "uint2(0u, 1u)", + + // UInt3 + ["ComputeSharp.UInt3.Zero"] = "(uint3)0", + ["ComputeSharp.UInt3.One"] = "uint3(1u, 1u, 1u)", + ["ComputeSharp.UInt3.UnitX"] = "uint3(1u, 0u, 0u)", + ["ComputeSharp.UInt3.UnitY"] = "uint3(0u, 1u, 0u)", + ["ComputeSharp.UInt3.UnitZ"] = "uint3(0u, 0u, 1u)", + + // UInt4 + ["ComputeSharp.UInt4.Zero"] = "(uint4)0", + ["ComputeSharp.UInt4.One"] = "uint4(1u, 1u, 1u, 1u)", + ["ComputeSharp.UInt4.UnitX"] = "uint4(1u, 0u, 0u, 0u)", + ["ComputeSharp.UInt4.UnitY"] = "uint4(0u, 1u, 0u, 0u)", + ["ComputeSharp.UInt4.UnitZ"] = "uint4(0u, 0u, 1u, 0u)", + ["ComputeSharp.UInt4.UnitW"] = "uint4(0u, 0u, 0u, 1u)", + + // Float2 + ["ComputeSharp.Float2.Zero"] = "(float2)0", + ["ComputeSharp.Float2.One"] = "float2(1.0f, 1.0f)", + ["ComputeSharp.Float2.UnitX"] = "float2(1.0f, 0.0f)", + ["ComputeSharp.Float2.UnitY"] = "float2(0.0f, 1.0f)", + + // Float3 + ["ComputeSharp.Float3.Zero"] = "(float3)0", + ["ComputeSharp.Float3.One"] = "float3(1.0f, 1.0f, 1.0f)", + ["ComputeSharp.Float3.UnitX"] = "float3(1.0f, 0.0f, 0.0f)", + ["ComputeSharp.Float3.UnitY"] = "float3(0.0f, 1.0f, 0.0f)", + ["ComputeSharp.Float3.UnitZ"] = "float3(0.0f, 0.0f, 1.0f)", + + // Float4 + ["ComputeSharp.Float4.Zero"] = "(float4)0", + ["ComputeSharp.Float4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)", + ["ComputeSharp.Float4.UnitX"] = "float4(1.0f, 0.0f, 0.0f, 0.0f)", + ["ComputeSharp.Float4.UnitY"] = "float4(0.0f, 1.0f, 0.0f, 0.0f)", + ["ComputeSharp.Float4.UnitZ"] = "float4(0.0f, 0.0f, 1.0f, 0.0f)", + ["ComputeSharp.Float4.UnitW"] = "float4(0.0f, 0.0f, 0.0f, 1.0f)", + + // Double2 + ["ComputeSharp.Double2.Zero"] = "(double2)0", + ["ComputeSharp.Double2.One"] = "double2(1.0, 1.0)", + ["ComputeSharp.Double2.UnitX"] = "double2(1.0, 0.0)", + ["ComputeSharp.Double2.UnitY"] = "double2(0.0, 1.0)", + + // Double3 + ["ComputeSharp.Double3.Zero"] = "(double3)0", + ["ComputeSharp.Double3.One"] = "double3(1.0, 1.0, 1.0)", + ["ComputeSharp.Double3.UnitX"] = "double3(1.0, 0.0, 0.0)", + ["ComputeSharp.Double3.UnitY"] = "double3(0.0, 1.0, 0.0)", + ["ComputeSharp.Double3.UnitZ"] = "double3(0.0, 0.0, 1.0)", + + // Double4 + ["ComputeSharp.Double4.Zero"] = "(double4)0", + ["ComputeSharp.Double4.One"] = "double4(1.0, 1.0, 1.0, 1.0)", + ["ComputeSharp.Double4.UnitX"] = "double4(1.0, 0.0, 0.0, 0.0)", + ["ComputeSharp.Double4.UnitY"] = "double4(0.0, 1.0, 0.0, 0.0)", + ["ComputeSharp.Double4.UnitZ"] = "double4(0.0, 0.0, 1.0, 0.0)", + ["ComputeSharp.Double4.UnitW"] = "double4(0.0, 0.0, 0.0, 1.0)" }; // Programmatically load mappings from the Hlsl class as well