Add HLSL intrinsics to convert from bool

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-27 01:03:29 +02:00
1 親 7f99e59b12
コミット 31b8c7bc48
2ファイル変更
+760 -1

検索条件に一致するファイルはありません

+720
ファイルの表示
@@ -721,4 +721,724 @@ partial class Hlsl
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("bool4x4")]
public static Bool4x4 UIntToBool(UInt4x4 x) => default;
/// <summary>
/// Converts the input <see cref="bool"/> value into a <see cref="float"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="bool"/> value.</param>
/// <returns>The converted <see cref="float"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float")]
public static float BoolToFloat(bool x) => default;
/// <summary>
/// Converts the input <see cref="Bool2"/> value into a <see cref="Float2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2"/> value.</param>
/// <returns>The converted <see cref="Float2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float2")]
public static Float2 BoolToFloat(Bool2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3"/> value into a <see cref="Float3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3"/> value.</param>
/// <returns>The converted <see cref="Float3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float3")]
public static Float3 BoolToFloat(Bool3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4"/> value into a <see cref="Float4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4"/> value.</param>
/// <returns>The converted <see cref="Float4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float4")]
public static Float4 BoolToFloat(Bool4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x1"/> value into a <see cref="Float1x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x1"/> value.</param>
/// <returns>The converted <see cref="Float1x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float1x1")]
public static Float1x1 BoolToFloat(Bool1x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x2"/> value into a <see cref="Float1x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x2"/> value.</param>
/// <returns>The converted <see cref="Float1x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float1x2")]
public static Float1x2 BoolToFloat(Bool1x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x3"/> value into a <see cref="Float1x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x3"/> value.</param>
/// <returns>The converted <see cref="Float1x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float1x3")]
public static Float1x3 BoolToFloat(Bool1x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x4"/> value into a <see cref="Float1x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x4"/> value.</param>
/// <returns>The converted <see cref="Float1x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float1x4")]
public static Float1x4 BoolToFloat(Bool1x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x1"/> value into a <see cref="Float2x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x1"/> value.</param>
/// <returns>The converted <see cref="Float2x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float2x1")]
public static Float2x1 BoolToFloat(Bool2x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x2"/> value into a <see cref="Float2x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x2"/> value.</param>
/// <returns>The converted <see cref="Float2x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float2x2")]
public static Float2x2 BoolToFloat(Bool2x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x3"/> value into a <see cref="Float2x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x3"/> value.</param>
/// <returns>The converted <see cref="Float2x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float2x3")]
public static Float2x3 BoolToFloat(Bool2x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x4"/> value into a <see cref="Float2x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x4"/> value.</param>
/// <returns>The converted <see cref="Float2x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float2x4")]
public static Float2x4 BoolToFloat(Bool2x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x1"/> value into a <see cref="Float3x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x1"/> value.</param>
/// <returns>The converted <see cref="Float3x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float3x1")]
public static Float3x1 BoolToFloat(Bool3x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x2"/> value into a <see cref="Float3x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x2"/> value.</param>
/// <returns>The converted <see cref="Float3x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float3x2")]
public static Float3x2 BoolToFloat(Bool3x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x3"/> value into a <see cref="Float3x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x3"/> value.</param>
/// <returns>The converted <see cref="Float3x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float3x3")]
public static Float3x3 BoolToFloat(Bool3x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x4"/> value into a <see cref="Float3x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x4"/> value.</param>
/// <returns>The converted <see cref="Float3x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float3x4")]
public static Float3x4 BoolToFloat(Bool3x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x1"/> value into a <see cref="Float4x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x1"/> value.</param>
/// <returns>The converted <see cref="Float4x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float4x1")]
public static Float4x1 BoolToFloat(Bool4x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x2"/> value into a <see cref="Float4x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x2"/> value.</param>
/// <returns>The converted <see cref="Float4x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float4x2")]
public static Float4x2 BoolToFloat(Bool4x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x3"/> value into a <see cref="Float4x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x3"/> value.</param>
/// <returns>The converted <see cref="Float4x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float4x3")]
public static Float4x3 BoolToFloat(Bool4x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x4"/> value into a <see cref="Float4x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x4"/> value.</param>
/// <returns>The converted <see cref="Float4x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("float4x4")]
public static Float4x4 BoolToFloat(Bool4x4 x) => default;
/// <summary>
/// Converts the input <see cref="bool"/> value into a <see cref="double"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="bool"/> value.</param>
/// <returns>The converted <see cref="double"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double")]
public static double BoolToDouble(bool x) => default;
/// <summary>
/// Converts the input <see cref="Bool2"/> value into a <see cref="Double2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2"/> value.</param>
/// <returns>The converted <see cref="Double2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double2")]
public static Double2 BoolToDouble(Bool2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3"/> value into a <see cref="Double3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3"/> value.</param>
/// <returns>The converted <see cref="Double3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double3")]
public static Double3 BoolToDouble(Bool3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4"/> value into a <see cref="Double4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4"/> value.</param>
/// <returns>The converted <see cref="Double4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double4")]
public static Double4 BoolToDouble(Bool4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x1"/> value into a <see cref="Double1x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x1"/> value.</param>
/// <returns>The converted <see cref="Double1x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double1x1")]
public static Double1x1 BoolToDouble(Bool1x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x2"/> value into a <see cref="Double1x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x2"/> value.</param>
/// <returns>The converted <see cref="Double1x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double1x2")]
public static Double1x2 BoolToDouble(Bool1x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x3"/> value into a <see cref="Double1x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x3"/> value.</param>
/// <returns>The converted <see cref="Double1x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double1x3")]
public static Double1x3 BoolToDouble(Bool1x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x4"/> value into a <see cref="Double1x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x4"/> value.</param>
/// <returns>The converted <see cref="Double1x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double1x4")]
public static Double1x4 BoolToDouble(Bool1x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x1"/> value into a <see cref="Double2x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x1"/> value.</param>
/// <returns>The converted <see cref="Double2x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double2x1")]
public static Double2x1 BoolToDouble(Bool2x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x2"/> value into a <see cref="Double2x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x2"/> value.</param>
/// <returns>The converted <see cref="Double2x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double2x2")]
public static Double2x2 BoolToDouble(Bool2x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x3"/> value into a <see cref="Double2x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x3"/> value.</param>
/// <returns>The converted <see cref="Double2x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double2x3")]
public static Double2x3 BoolToDouble(Bool2x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x4"/> value into a <see cref="Double2x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x4"/> value.</param>
/// <returns>The converted <see cref="Double2x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double2x4")]
public static Double2x4 BoolToDouble(Bool2x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x1"/> value into a <see cref="Double3x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x1"/> value.</param>
/// <returns>The converted <see cref="Double3x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double3x1")]
public static Double3x1 BoolToDouble(Bool3x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x2"/> value into a <see cref="Double3x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x2"/> value.</param>
/// <returns>The converted <see cref="Double3x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double3x2")]
public static Double3x2 BoolToDouble(Bool3x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x3"/> value into a <see cref="Double3x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x3"/> value.</param>
/// <returns>The converted <see cref="Double3x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double3x3")]
public static Double3x3 BoolToDouble(Bool3x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x4"/> value into a <see cref="Double3x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x4"/> value.</param>
/// <returns>The converted <see cref="Double3x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double3x4")]
public static Double3x4 BoolToDouble(Bool3x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x1"/> value into a <see cref="Double4x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x1"/> value.</param>
/// <returns>The converted <see cref="Double4x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double4x1")]
public static Double4x1 BoolToDouble(Bool4x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x2"/> value into a <see cref="Double4x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x2"/> value.</param>
/// <returns>The converted <see cref="Double4x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double4x2")]
public static Double4x2 BoolToDouble(Bool4x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x3"/> value into a <see cref="Double4x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x3"/> value.</param>
/// <returns>The converted <see cref="Double4x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double4x3")]
public static Double4x3 BoolToDouble(Bool4x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x4"/> value into a <see cref="Double4x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x4"/> value.</param>
/// <returns>The converted <see cref="Double4x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("double4x4")]
public static Double4x4 BoolToDouble(Bool4x4 x) => default;
/// <summary>
/// Converts the input <see cref="bool"/> value into a <see cref="int"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="bool"/> value.</param>
/// <returns>The converted <see cref="int"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int")]
public static int BoolToInt(bool x) => default;
/// <summary>
/// Converts the input <see cref="Bool2"/> value into a <see cref="Int2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2"/> value.</param>
/// <returns>The converted <see cref="Int2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int2")]
public static Int2 BoolToInt(Bool2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3"/> value into a <see cref="Int3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3"/> value.</param>
/// <returns>The converted <see cref="Int3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int3")]
public static Int3 BoolToInt(Bool3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4"/> value into a <see cref="Int4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4"/> value.</param>
/// <returns>The converted <see cref="Int4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int4")]
public static Int4 BoolToInt(Bool4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x1"/> value into a <see cref="Int1x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x1"/> value.</param>
/// <returns>The converted <see cref="Int1x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int1x1")]
public static Int1x1 BoolToInt(Bool1x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x2"/> value into a <see cref="Int1x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x2"/> value.</param>
/// <returns>The converted <see cref="Int1x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int1x2")]
public static Int1x2 BoolToInt(Bool1x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x3"/> value into a <see cref="Int1x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x3"/> value.</param>
/// <returns>The converted <see cref="Int1x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int1x3")]
public static Int1x3 BoolToInt(Bool1x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x4"/> value into a <see cref="Int1x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x4"/> value.</param>
/// <returns>The converted <see cref="Int1x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int1x4")]
public static Int1x4 BoolToInt(Bool1x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x1"/> value into a <see cref="Int2x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x1"/> value.</param>
/// <returns>The converted <see cref="Int2x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int2x1")]
public static Int2x1 BoolToInt(Bool2x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x2"/> value into a <see cref="Int2x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x2"/> value.</param>
/// <returns>The converted <see cref="Int2x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int2x2")]
public static Int2x2 BoolToInt(Bool2x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x3"/> value into a <see cref="Int2x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x3"/> value.</param>
/// <returns>The converted <see cref="Int2x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int2x3")]
public static Int2x3 BoolToInt(Bool2x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x4"/> value into a <see cref="Int2x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x4"/> value.</param>
/// <returns>The converted <see cref="Int2x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int2x4")]
public static Int2x4 BoolToInt(Bool2x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x1"/> value into a <see cref="Int3x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x1"/> value.</param>
/// <returns>The converted <see cref="Int3x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int3x1")]
public static Int3x1 BoolToInt(Bool3x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x2"/> value into a <see cref="Int3x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x2"/> value.</param>
/// <returns>The converted <see cref="Int3x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int3x2")]
public static Int3x2 BoolToInt(Bool3x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x3"/> value into a <see cref="Int3x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x3"/> value.</param>
/// <returns>The converted <see cref="Int3x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int3x3")]
public static Int3x3 BoolToInt(Bool3x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x4"/> value into a <see cref="Int3x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x4"/> value.</param>
/// <returns>The converted <see cref="Int3x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int3x4")]
public static Int3x4 BoolToInt(Bool3x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x1"/> value into a <see cref="Int4x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x1"/> value.</param>
/// <returns>The converted <see cref="Int4x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int4x1")]
public static Int4x1 BoolToInt(Bool4x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x2"/> value into a <see cref="Int4x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x2"/> value.</param>
/// <returns>The converted <see cref="Int4x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int4x2")]
public static Int4x2 BoolToInt(Bool4x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x3"/> value into a <see cref="Int4x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x3"/> value.</param>
/// <returns>The converted <see cref="Int4x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int4x3")]
public static Int4x3 BoolToInt(Bool4x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x4"/> value into a <see cref="Int4x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x4"/> value.</param>
/// <returns>The converted <see cref="Int4x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("int4x4")]
public static Int4x4 BoolToInt(Bool4x4 x) => default;
/// <summary>
/// Converts the input <see cref="bool"/> value into a <see cref="uint"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="bool"/> value.</param>
/// <returns>The converted <see cref="uint"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint")]
public static uint BoolToUInt(bool x) => default;
/// <summary>
/// Converts the input <see cref="Bool2"/> value into a <see cref="UInt2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2"/> value.</param>
/// <returns>The converted <see cref="UInt2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint2")]
public static UInt2 BoolToUInt(Bool2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3"/> value into a <see cref="UInt3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3"/> value.</param>
/// <returns>The converted <see cref="UInt3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint3")]
public static UInt3 BoolToUInt(Bool3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4"/> value into a <see cref="UInt4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4"/> value.</param>
/// <returns>The converted <see cref="UInt4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint4")]
public static UInt4 BoolToUInt(Bool4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x1"/> value into a <see cref="UInt1x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x1"/> value.</param>
/// <returns>The converted <see cref="UInt1x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint1x1")]
public static UInt1x1 BoolToUInt(Bool1x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x2"/> value into a <see cref="UInt1x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x2"/> value.</param>
/// <returns>The converted <see cref="UInt1x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint1x2")]
public static UInt1x2 BoolToUInt(Bool1x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x3"/> value into a <see cref="UInt1x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x3"/> value.</param>
/// <returns>The converted <see cref="UInt1x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint1x3")]
public static UInt1x3 BoolToUInt(Bool1x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool1x4"/> value into a <see cref="UInt1x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool1x4"/> value.</param>
/// <returns>The converted <see cref="UInt1x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint1x4")]
public static UInt1x4 BoolToUInt(Bool1x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x1"/> value into a <see cref="UInt2x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x1"/> value.</param>
/// <returns>The converted <see cref="UInt2x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint2x1")]
public static UInt2x1 BoolToUInt(Bool2x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x2"/> value into a <see cref="UInt2x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x2"/> value.</param>
/// <returns>The converted <see cref="UInt2x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint2x2")]
public static UInt2x2 BoolToUInt(Bool2x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x3"/> value into a <see cref="UInt2x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x3"/> value.</param>
/// <returns>The converted <see cref="UInt2x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint2x3")]
public static UInt2x3 BoolToUInt(Bool2x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool2x4"/> value into a <see cref="UInt2x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool2x4"/> value.</param>
/// <returns>The converted <see cref="UInt2x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint2x4")]
public static UInt2x4 BoolToUInt(Bool2x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x1"/> value into a <see cref="UInt3x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x1"/> value.</param>
/// <returns>The converted <see cref="UInt3x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint3x1")]
public static UInt3x1 BoolToUInt(Bool3x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x2"/> value into a <see cref="UInt3x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x2"/> value.</param>
/// <returns>The converted <see cref="UInt3x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint3x2")]
public static UInt3x2 BoolToUInt(Bool3x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x3"/> value into a <see cref="UInt3x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x3"/> value.</param>
/// <returns>The converted <see cref="UInt3x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint3x3")]
public static UInt3x3 BoolToUInt(Bool3x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool3x4"/> value into a <see cref="UInt3x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool3x4"/> value.</param>
/// <returns>The converted <see cref="UInt3x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint3x4")]
public static UInt3x4 BoolToUInt(Bool3x4 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x1"/> value into a <see cref="UInt4x1"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x1"/> value.</param>
/// <returns>The converted <see cref="UInt4x1"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint4x1")]
public static UInt4x1 BoolToUInt(Bool4x1 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x2"/> value into a <see cref="UInt4x2"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x2"/> value.</param>
/// <returns>The converted <see cref="UInt4x2"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint4x2")]
public static UInt4x2 BoolToUInt(Bool4x2 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x3"/> value into a <see cref="UInt4x3"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x3"/> value.</param>
/// <returns>The converted <see cref="UInt4x3"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint4x3")]
public static UInt4x3 BoolToUInt(Bool4x3 x) => default;
/// <summary>
/// Converts the input <see cref="Bool4x4"/> value into a <see cref="UInt4x4"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="Bool4x4"/> value.</param>
/// <returns>The converted <see cref="UInt4x4"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("uint4x4")]
public static UInt4x4 BoolToUInt(Bool4x4 x) => default;
}
+40 -1
ファイルの表示
@@ -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("");
#>
/// <summary>
/// Converts the input <see cref="<#=pair.Source#>"/> value into a <see cref="<#=pair.Target#>"/> value (non-zero elements map to <see langword="true"/>, zero elements map to <see langword="false"/>).
@@ -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("");
#>
/// <summary>
/// Converts the input <see cref="<#=pair.Target#>"/> value into a <see cref="<#=pair.Source#>"/> value (<see langword="true"/> elements map to 1, <see langword="false"/> map to 0).
/// </summary>
/// <param name="x">The input <see cref="<#=pair.Target#>"/> value.</param>
/// <returns>The converted <see cref="<#=pair.Source#>"/> value.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[HlslIntrinsicName("<#=pair.Source.ToLower()#>")]
public static <#=pair.Source#> BoolTo<#=type#>(<#=pair.Target#> x) => default;
<#
}
}
#>
}