From 31b8c7bc481725414bd0e29e0c2b785de05a26db Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 27 Aug 2022 01:03:29 +0200 Subject: [PATCH] Add HLSL intrinsics to convert from bool --- .../Intrinsics/Hlsl.Casts.g.cs | 720 ++++++++++++++++++ .../Intrinsics/Hlsl.Casts.tt | 41 +- 2 files changed, 760 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs index ce787c2b..102c7d17 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.g.cs @@ -721,4 +721,724 @@ partial class Hlsl /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. [HlslIntrinsicName("bool4x4")] public static Bool4x4 UIntToBool(UInt4x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float")] + public static float BoolToFloat(bool x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float2")] + public static Float2 BoolToFloat(Bool2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float3")] + public static Float3 BoolToFloat(Bool3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float4")] + public static Float4 BoolToFloat(Bool4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float1x1")] + public static Float1x1 BoolToFloat(Bool1x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float1x2")] + public static Float1x2 BoolToFloat(Bool1x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float1x3")] + public static Float1x3 BoolToFloat(Bool1x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float1x4")] + public static Float1x4 BoolToFloat(Bool1x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float2x1")] + public static Float2x1 BoolToFloat(Bool2x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float2x2")] + public static Float2x2 BoolToFloat(Bool2x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float2x3")] + public static Float2x3 BoolToFloat(Bool2x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float2x4")] + public static Float2x4 BoolToFloat(Bool2x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float3x1")] + public static Float3x1 BoolToFloat(Bool3x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float3x2")] + public static Float3x2 BoolToFloat(Bool3x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float3x3")] + public static Float3x3 BoolToFloat(Bool3x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float3x4")] + public static Float3x4 BoolToFloat(Bool3x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float4x1")] + public static Float4x1 BoolToFloat(Bool4x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float4x2")] + public static Float4x2 BoolToFloat(Bool4x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float4x3")] + public static Float4x3 BoolToFloat(Bool4x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("float4x4")] + public static Float4x4 BoolToFloat(Bool4x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double")] + public static double BoolToDouble(bool x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double2")] + public static Double2 BoolToDouble(Bool2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double3")] + public static Double3 BoolToDouble(Bool3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double4")] + public static Double4 BoolToDouble(Bool4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double1x1")] + public static Double1x1 BoolToDouble(Bool1x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double1x2")] + public static Double1x2 BoolToDouble(Bool1x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double1x3")] + public static Double1x3 BoolToDouble(Bool1x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double1x4")] + public static Double1x4 BoolToDouble(Bool1x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double2x1")] + public static Double2x1 BoolToDouble(Bool2x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double2x2")] + public static Double2x2 BoolToDouble(Bool2x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double2x3")] + public static Double2x3 BoolToDouble(Bool2x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double2x4")] + public static Double2x4 BoolToDouble(Bool2x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double3x1")] + public static Double3x1 BoolToDouble(Bool3x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double3x2")] + public static Double3x2 BoolToDouble(Bool3x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double3x3")] + public static Double3x3 BoolToDouble(Bool3x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double3x4")] + public static Double3x4 BoolToDouble(Bool3x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double4x1")] + public static Double4x1 BoolToDouble(Bool4x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double4x2")] + public static Double4x2 BoolToDouble(Bool4x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double4x3")] + public static Double4x3 BoolToDouble(Bool4x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("double4x4")] + public static Double4x4 BoolToDouble(Bool4x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int")] + public static int BoolToInt(bool x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int2")] + public static Int2 BoolToInt(Bool2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int3")] + public static Int3 BoolToInt(Bool3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int4")] + public static Int4 BoolToInt(Bool4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int1x1")] + public static Int1x1 BoolToInt(Bool1x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int1x2")] + public static Int1x2 BoolToInt(Bool1x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int1x3")] + public static Int1x3 BoolToInt(Bool1x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int1x4")] + public static Int1x4 BoolToInt(Bool1x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int2x1")] + public static Int2x1 BoolToInt(Bool2x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int2x2")] + public static Int2x2 BoolToInt(Bool2x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int2x3")] + public static Int2x3 BoolToInt(Bool2x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int2x4")] + public static Int2x4 BoolToInt(Bool2x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int3x1")] + public static Int3x1 BoolToInt(Bool3x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int3x2")] + public static Int3x2 BoolToInt(Bool3x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int3x3")] + public static Int3x3 BoolToInt(Bool3x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int3x4")] + public static Int3x4 BoolToInt(Bool3x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int4x1")] + public static Int4x1 BoolToInt(Bool4x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int4x2")] + public static Int4x2 BoolToInt(Bool4x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int4x3")] + public static Int4x3 BoolToInt(Bool4x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("int4x4")] + public static Int4x4 BoolToInt(Bool4x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint")] + public static uint BoolToUInt(bool x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint2")] + public static UInt2 BoolToUInt(Bool2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint3")] + public static UInt3 BoolToUInt(Bool3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint4")] + public static UInt4 BoolToUInt(Bool4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint1x1")] + public static UInt1x1 BoolToUInt(Bool1x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint1x2")] + public static UInt1x2 BoolToUInt(Bool1x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint1x3")] + public static UInt1x3 BoolToUInt(Bool1x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint1x4")] + public static UInt1x4 BoolToUInt(Bool1x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint2x1")] + public static UInt2x1 BoolToUInt(Bool2x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint2x2")] + public static UInt2x2 BoolToUInt(Bool2x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint2x3")] + public static UInt2x3 BoolToUInt(Bool2x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint2x4")] + public static UInt2x4 BoolToUInt(Bool2x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint3x1")] + public static UInt3x1 BoolToUInt(Bool3x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint3x2")] + public static UInt3x2 BoolToUInt(Bool3x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint3x3")] + public static UInt3x3 BoolToUInt(Bool3x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint3x4")] + public static UInt3x4 BoolToUInt(Bool3x4 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint4x1")] + public static UInt4x1 BoolToUInt(Bool4x1 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint4x2")] + public static UInt4x2 BoolToUInt(Bool4x2 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint4x3")] + public static UInt4x3 BoolToUInt(Bool4x3 x) => default; + + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("uint4x4")] + public static UInt4x4 BoolToUInt(Bool4x4 x) => default; } diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt index 0d96cfda..9d329bec 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Casts.tt @@ -10,6 +10,7 @@ namespace ComputeSharp; partial class Hlsl { <# +// Numeric to bool foreach (var type in new[] { "Float", "Double", "Int", "UInt" }) { int index = 0; @@ -37,7 +38,6 @@ foreach (var type in new[] { "Float", "Double", "Int", "UInt" }) foreach (var pair in typeNames) { if (index++ != 0) WriteLine(""); - #> /// /// Converts the input value into a value (non-zero elements map to , zero elements map to ). @@ -50,5 +50,44 @@ foreach (var type in new[] { "Float", "Double", "Int", "UInt" }) <# } } + +// Bool to numeric +foreach (var type in new[] { "Float", "Double", "Int", "UInt" }) +{ + List<(string Source, string Target)> typeNames = new List<(string, string)>(); + + typeNames.Add((type.ToLower(), "bool")); + + // Vector types + for (int i = 2; i <= 4; i++) + { + typeNames.Add(($"{type}{i}", $"Bool{i}")); + } + + // Matrix types + for (int i = 1; i <= 4; i++) + { + for (int j = 1; j <= 4; j++) + { + typeNames.Add(($"{type}{i}x{j}", $"Bool{i}x{j}")); + } + } + + // Produce the intrinsics + foreach (var pair in typeNames) + { + WriteLine(""); +#> + /// + /// Converts the input value into a value ( elements map to 1, map to 0). + /// + /// The input value. + /// The converted value. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("<#=pair.Source.ToLower()#>")] + public static <#=pair.Source#> BoolTo<#=type#>(<#=pair.Target#> x) => default; +<# + } +} #> }