diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs
index 17002c2b..26191a04 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs
@@ -18210,6 +18210,253 @@ partial class Hlsl
[HlslIntrinsicName("normalize")]
public static Float4 Normalize(Float4 x) => default;
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool2 Or(Bool2 left, Bool2 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool3 Or(Bool3 left, Bool3 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool4 Or(Bool4 left, Bool4 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool1x1 Or(Bool1x1 left, Bool1x1 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool1x2 Or(Bool1x2 left, Bool1x2 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool1x3 Or(Bool1x3 left, Bool1x3 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool1x4 Or(Bool1x4 left, Bool1x4 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool2x1 Or(Bool2x1 left, Bool2x1 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool2x2 Or(Bool2x2 left, Bool2x2 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool2x3 Or(Bool2x3 left, Bool2x3 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool2x4 Or(Bool2x4 left, Bool2x4 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool3x1 Or(Bool3x1 left, Bool3x1 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool3x2 Or(Bool3x2 left, Bool3x2 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool3x3 Or(Bool3x3 left, Bool3x3 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool3x4 Or(Bool3x4 left, Bool3x4 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool4x1 Or(Bool4x1 left, Bool4x1 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool4x2 Or(Bool4x2 left, Bool4x2 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool4x3 Or(Bool4x3 left, Bool4x3 right) => default;
+
+ ///
+ /// Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.
+ ///
+ /// The first input vector or matrix value.
+ /// The second input vector or matrix value.
+ /// The new vector or matrix value with elements resulting from the boolean operation.
+ ///
+ /// For more info, see .
+ /// 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("__Or")]
+ public static Bool4x4 Or(Bool4x4 left, Bool4x4 right) => default;
+
///
/// Returns the specified value raised to the specified power.
///
diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude b/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude
index 0f405bcc..96f1588d 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude
@@ -2317,6 +2317,41 @@ var Intrinsics = new[]
}
},
new
+ {
+ Name = "Or",
+ HlslName = "__Or",
+ Summary = "Performs a vectorized, non short-circuiting boolean 'OR' operation between two operands.",
+ Url = "https://learn.microsoft.com/windows/win32/direct3dhlsl/dx-graphics-hlsl-operators#boolean-math-operators",
+ Parameters = new[]
+ {
+ new { IsOut = false, Name = "left", Info = "The first input vector or matrix value." },
+ new { IsOut = false, Name = "right", Info = "The second input vector or matrix value." }
+ },
+ Returns = "The new vector or matrix value with elements resulting from the boolean operation.",
+ Overloads = new[]
+ {
+ new { Return = "Bool2", Params = new[] { "Bool2", "Bool2" } },
+ new { Return = "Bool3", Params = new[] { "Bool3", "Bool3" } },
+ new { Return = "Bool4", Params = new[] { "Bool4", "Bool4" } },
+ new { Return = "Bool1x1", Params = new[] { "Bool1x1", "Bool1x1" } },
+ new { Return = "Bool1x2", Params = new[] { "Bool1x2", "Bool1x2" } },
+ new { Return = "Bool1x3", Params = new[] { "Bool1x3", "Bool1x3" } },
+ new { Return = "Bool1x4", Params = new[] { "Bool1x4", "Bool1x4" } },
+ new { Return = "Bool2x1", Params = new[] { "Bool2x1", "Bool2x1" } },
+ new { Return = "Bool2x2", Params = new[] { "Bool2x2", "Bool2x2" } },
+ new { Return = "Bool2x3", Params = new[] { "Bool2x3", "Bool2x3" } },
+ new { Return = "Bool2x4", Params = new[] { "Bool2x4", "Bool2x4" } },
+ new { Return = "Bool3x1", Params = new[] { "Bool3x1", "Bool3x1" } },
+ new { Return = "Bool3x2", Params = new[] { "Bool3x2", "Bool3x2" } },
+ new { Return = "Bool3x3", Params = new[] { "Bool3x3", "Bool3x3" } },
+ new { Return = "Bool3x4", Params = new[] { "Bool3x4", "Bool3x4" } },
+ new { Return = "Bool4x1", Params = new[] { "Bool4x1", "Bool4x1" } },
+ new { Return = "Bool4x2", Params = new[] { "Bool4x2", "Bool4x2" } },
+ new { Return = "Bool4x3", Params = new[] { "Bool4x3", "Bool4x3" } },
+ new { Return = "Bool4x4", Params = new[] { "Bool4x4", "Bool4x4" } }
+ }
+ },
+ new
{
Name = "Pow",
HlslName = "pow",
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs
index a19e9f79..66655aa9 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs
@@ -480,6 +480,22 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
SyntaxKind.LogicalAndExpression,
updatedNode.ArgumentList.Arguments[0].Expression,
updatedNode.ArgumentList.Arguments[1].Expression));
+#endif
+ // 'Or' invocations are rewritten as follows:
+ //
+ // C#: Hlsl.Or(left, right)
+ // HLSL (DX12): or(left, right)
+ // HLSL (D2D1): (left || right)
+ case "Or":
+#if D3D12_SOURCE_GENERATOR
+ return updatedNode.WithExpression(IdentifierName("or"));
+#else
+ return
+ ParenthesizedExpression(
+ BinaryExpression(
+ SyntaxKind.LogicalOrExpression,
+ updatedNode.ArgumentList.Arguments[0].Expression,
+ updatedNode.ArgumentList.Arguments[1].Expression));
#endif
// 'Select' invocations are rewritten as follows:
//