Merge pull request #363 from Sergio0694/dev/bool-bitwise-operators

Add HLSL bool operators
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-08-26 02:17:44 +02:00
コミット faef95d5f4
8ファイル変更
+658 -6

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

+33 -6
ファイルの表示
@@ -56,6 +56,39 @@ public readonly struct Bool
}
#endif
/// <summary>
/// Inverts the <see cref="bool"/> value represented by a given <see cref="Bool"/> instance.
/// </summary>
/// <param name="x">The input <see cref="Bool"/> instance.</param>
public static Bool operator !(Bool x) => new(!x.Value);
/// <summary>
/// Ands two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to and.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool operator &(Bool left, Bool right) => default;
/// <summary>
/// Ors two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to or.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool operator |(Bool left, Bool right) => default;
/// <summary>
/// Xors two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to xor.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool operator ^(Bool left, Bool right) => default;
/// <summary>
/// Checks whether or not two <see cref="Bool"/> instances represent the same <see cref="bool"/> value.
/// </summary>
@@ -70,12 +103,6 @@ public readonly struct Bool
/// <param name="right">The right <see cref="Bool"/> instance.</param>
public static bool operator !=(Bool left, Bool right) => left.Value != right.Value;
/// <summary>
/// Inverts the <see cref="bool"/> value represented by a given <see cref="Bool"/> instance.
/// </summary>
/// <param name="x">The input <see cref="Bool"/> instance.</param>
public static Bool operator !(Bool x) => new(!x.Value);
/// <summary>
/// Converts a given <see cref="Bool"/> instance to its corresponding <see cref="bool"/> value.
/// </summary>
+27
ファイルの表示
@@ -430,6 +430,33 @@ public unsafe partial struct Bool2
/// <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>
public static Bool2 operator !(Bool2 xy) => default;
/// <summary>
/// Ands two <see cref="Bool2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2"/> value to and.</param>
/// <param name="right">The <see cref="Bool2"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2 operator &(Bool2 left, Bool2 right) => default;
/// <summary>
/// Ors two <see cref="Bool2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2"/> value to or.</param>
/// <param name="right">The <see cref="Bool2"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2 operator |(Bool2 left, Bool2 right) => default;
/// <summary>
/// Xors two <see cref="Bool2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2"/> value to xor.</param>
/// <param name="right">The <see cref="Bool2"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2 operator ^(Bool2 left, Bool2 right) => default;
/// <summary>
/// Compares two <see cref="Bool2"/> values to see if they are equal.
/// </summary>
+27
ファイルの表示
@@ -1516,6 +1516,33 @@ public unsafe partial struct Bool3
/// <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>
public static Bool3 operator !(Bool3 xyz) => default;
/// <summary>
/// Ands two <see cref="Bool3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3"/> value to and.</param>
/// <param name="right">The <see cref="Bool3"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3 operator &(Bool3 left, Bool3 right) => default;
/// <summary>
/// Ors two <see cref="Bool3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3"/> value to or.</param>
/// <param name="right">The <see cref="Bool3"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3 operator |(Bool3 left, Bool3 right) => default;
/// <summary>
/// Xors two <see cref="Bool3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3"/> value to xor.</param>
/// <param name="right">The <see cref="Bool3"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3 operator ^(Bool3 left, Bool3 right) => default;
/// <summary>
/// Compares two <see cref="Bool3"/> values to see if they are equal.
/// </summary>
+27
ファイルの表示
@@ -4162,6 +4162,33 @@ public unsafe partial struct Bool4
/// <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>
public static Bool4 operator !(Bool4 xyzw) => default;
/// <summary>
/// Ands two <see cref="Bool4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4"/> value to and.</param>
/// <param name="right">The <see cref="Bool4"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4 operator &(Bool4 left, Bool4 right) => default;
/// <summary>
/// Ors two <see cref="Bool4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4"/> value to or.</param>
/// <param name="right">The <see cref="Bool4"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4 operator |(Bool4 left, Bool4 right) => default;
/// <summary>
/// Xors two <see cref="Bool4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4"/> value to xor.</param>
/// <param name="right">The <see cref="Bool4"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4 operator ^(Bool4 left, Bool4 right) => default;
/// <summary>
/// Compares two <see cref="Bool4"/> values to see if they are equal.
/// </summary>
+432
ファイルの表示
@@ -89,6 +89,33 @@ public unsafe partial struct Bool1x1
/// <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>
public static Bool1x1 operator !(Bool1x1 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool1x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x1"/> value to and.</param>
/// <param name="right">The <see cref="Bool1x1"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x1 operator &(Bool1x1 left, Bool1x1 right) => default;
/// <summary>
/// Ors two <see cref="Bool1x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x1"/> value to or.</param>
/// <param name="right">The <see cref="Bool1x1"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x1 operator |(Bool1x1 left, Bool1x1 right) => default;
/// <summary>
/// Xors two <see cref="Bool1x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x1"/> value to xor.</param>
/// <param name="right">The <see cref="Bool1x1"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x1 operator ^(Bool1x1 left, Bool1x1 right) => default;
/// <summary>
/// Compares two <see cref="Bool1x1"/> values to see if they are equal.
/// </summary>
@@ -199,6 +226,33 @@ public unsafe partial struct Bool1x2
/// <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>
public static Bool1x2 operator !(Bool1x2 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool1x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x2"/> value to and.</param>
/// <param name="right">The <see cref="Bool1x2"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x2 operator &(Bool1x2 left, Bool1x2 right) => default;
/// <summary>
/// Ors two <see cref="Bool1x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x2"/> value to or.</param>
/// <param name="right">The <see cref="Bool1x2"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x2 operator |(Bool1x2 left, Bool1x2 right) => default;
/// <summary>
/// Xors two <see cref="Bool1x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x2"/> value to xor.</param>
/// <param name="right">The <see cref="Bool1x2"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x2 operator ^(Bool1x2 left, Bool1x2 right) => default;
/// <summary>
/// Compares two <see cref="Bool1x2"/> values to see if they are equal.
/// </summary>
@@ -326,6 +380,33 @@ public unsafe partial struct Bool1x3
/// <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>
public static Bool1x3 operator !(Bool1x3 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool1x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x3"/> value to and.</param>
/// <param name="right">The <see cref="Bool1x3"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x3 operator &(Bool1x3 left, Bool1x3 right) => default;
/// <summary>
/// Ors two <see cref="Bool1x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x3"/> value to or.</param>
/// <param name="right">The <see cref="Bool1x3"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x3 operator |(Bool1x3 left, Bool1x3 right) => default;
/// <summary>
/// Xors two <see cref="Bool1x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x3"/> value to xor.</param>
/// <param name="right">The <see cref="Bool1x3"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x3 operator ^(Bool1x3 left, Bool1x3 right) => default;
/// <summary>
/// Compares two <see cref="Bool1x3"/> values to see if they are equal.
/// </summary>
@@ -464,6 +545,33 @@ public unsafe partial struct Bool1x4
/// <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>
public static Bool1x4 operator !(Bool1x4 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool1x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x4"/> value to and.</param>
/// <param name="right">The <see cref="Bool1x4"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x4 operator &(Bool1x4 left, Bool1x4 right) => default;
/// <summary>
/// Ors two <see cref="Bool1x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x4"/> value to or.</param>
/// <param name="right">The <see cref="Bool1x4"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x4 operator |(Bool1x4 left, Bool1x4 right) => default;
/// <summary>
/// Xors two <see cref="Bool1x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool1x4"/> value to xor.</param>
/// <param name="right">The <see cref="Bool1x4"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool1x4 operator ^(Bool1x4 left, Bool1x4 right) => default;
/// <summary>
/// Compares two <see cref="Bool1x4"/> values to see if they are equal.
/// </summary>
@@ -580,6 +688,33 @@ public unsafe partial struct Bool2x1
/// <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>
public static Bool2x1 operator !(Bool2x1 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool2x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x1"/> value to and.</param>
/// <param name="right">The <see cref="Bool2x1"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x1 operator &(Bool2x1 left, Bool2x1 right) => default;
/// <summary>
/// Ors two <see cref="Bool2x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x1"/> value to or.</param>
/// <param name="right">The <see cref="Bool2x1"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x1 operator |(Bool2x1 left, Bool2x1 right) => default;
/// <summary>
/// Xors two <see cref="Bool2x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x1"/> value to xor.</param>
/// <param name="right">The <see cref="Bool2x1"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x1 operator ^(Bool2x1 left, Bool2x1 right) => default;
/// <summary>
/// Compares two <see cref="Bool2x1"/> values to see if they are equal.
/// </summary>
@@ -731,6 +866,33 @@ public unsafe partial struct Bool2x2
/// <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>
public static Bool2x2 operator !(Bool2x2 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool2x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x2"/> value to and.</param>
/// <param name="right">The <see cref="Bool2x2"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x2 operator &(Bool2x2 left, Bool2x2 right) => default;
/// <summary>
/// Ors two <see cref="Bool2x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x2"/> value to or.</param>
/// <param name="right">The <see cref="Bool2x2"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x2 operator |(Bool2x2 left, Bool2x2 right) => default;
/// <summary>
/// Xors two <see cref="Bool2x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x2"/> value to xor.</param>
/// <param name="right">The <see cref="Bool2x2"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x2 operator ^(Bool2x2 left, Bool2x2 right) => default;
/// <summary>
/// Compares two <see cref="Bool2x2"/> values to see if they are equal.
/// </summary>
@@ -900,6 +1062,33 @@ public unsafe partial struct Bool2x3
/// <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>
public static Bool2x3 operator !(Bool2x3 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool2x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x3"/> value to and.</param>
/// <param name="right">The <see cref="Bool2x3"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x3 operator &(Bool2x3 left, Bool2x3 right) => default;
/// <summary>
/// Ors two <see cref="Bool2x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x3"/> value to or.</param>
/// <param name="right">The <see cref="Bool2x3"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x3 operator |(Bool2x3 left, Bool2x3 right) => default;
/// <summary>
/// Xors two <see cref="Bool2x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x3"/> value to xor.</param>
/// <param name="right">The <see cref="Bool2x3"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x3 operator ^(Bool2x3 left, Bool2x3 right) => default;
/// <summary>
/// Compares two <see cref="Bool2x3"/> values to see if they are equal.
/// </summary>
@@ -1093,6 +1282,33 @@ public unsafe partial struct Bool2x4
/// <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>
public static Bool2x4 operator !(Bool2x4 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool2x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x4"/> value to and.</param>
/// <param name="right">The <see cref="Bool2x4"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x4 operator &(Bool2x4 left, Bool2x4 right) => default;
/// <summary>
/// Ors two <see cref="Bool2x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x4"/> value to or.</param>
/// <param name="right">The <see cref="Bool2x4"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x4 operator |(Bool2x4 left, Bool2x4 right) => default;
/// <summary>
/// Xors two <see cref="Bool2x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool2x4"/> value to xor.</param>
/// <param name="right">The <see cref="Bool2x4"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool2x4 operator ^(Bool2x4 left, Bool2x4 right) => default;
/// <summary>
/// Compares two <see cref="Bool2x4"/> values to see if they are equal.
/// </summary>
@@ -1214,6 +1430,33 @@ public unsafe partial struct Bool3x1
/// <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>
public static Bool3x1 operator !(Bool3x1 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool3x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x1"/> value to and.</param>
/// <param name="right">The <see cref="Bool3x1"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x1 operator &(Bool3x1 left, Bool3x1 right) => default;
/// <summary>
/// Ors two <see cref="Bool3x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x1"/> value to or.</param>
/// <param name="right">The <see cref="Bool3x1"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x1 operator |(Bool3x1 left, Bool3x1 right) => default;
/// <summary>
/// Xors two <see cref="Bool3x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x1"/> value to xor.</param>
/// <param name="right">The <see cref="Bool3x1"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x1 operator ^(Bool3x1 left, Bool3x1 right) => default;
/// <summary>
/// Compares two <see cref="Bool3x1"/> values to see if they are equal.
/// </summary>
@@ -1390,6 +1633,33 @@ public unsafe partial struct Bool3x2
/// <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>
public static Bool3x2 operator !(Bool3x2 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool3x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x2"/> value to and.</param>
/// <param name="right">The <see cref="Bool3x2"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x2 operator &(Bool3x2 left, Bool3x2 right) => default;
/// <summary>
/// Ors two <see cref="Bool3x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x2"/> value to or.</param>
/// <param name="right">The <see cref="Bool3x2"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x2 operator |(Bool3x2 left, Bool3x2 right) => default;
/// <summary>
/// Xors two <see cref="Bool3x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x2"/> value to xor.</param>
/// <param name="right">The <see cref="Bool3x2"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x2 operator ^(Bool3x2 left, Bool3x2 right) => default;
/// <summary>
/// Compares two <see cref="Bool3x2"/> values to see if they are equal.
/// </summary>
@@ -1596,6 +1866,33 @@ public unsafe partial struct Bool3x3
/// <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>
public static Bool3x3 operator !(Bool3x3 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool3x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x3"/> value to and.</param>
/// <param name="right">The <see cref="Bool3x3"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x3 operator &(Bool3x3 left, Bool3x3 right) => default;
/// <summary>
/// Ors two <see cref="Bool3x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x3"/> value to or.</param>
/// <param name="right">The <see cref="Bool3x3"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x3 operator |(Bool3x3 left, Bool3x3 right) => default;
/// <summary>
/// Xors two <see cref="Bool3x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x3"/> value to xor.</param>
/// <param name="right">The <see cref="Bool3x3"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x3 operator ^(Bool3x3 left, Bool3x3 right) => default;
/// <summary>
/// Compares two <see cref="Bool3x3"/> values to see if they are equal.
/// </summary>
@@ -1838,6 +2135,33 @@ public unsafe partial struct Bool3x4
/// <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>
public static Bool3x4 operator !(Bool3x4 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool3x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x4"/> value to and.</param>
/// <param name="right">The <see cref="Bool3x4"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x4 operator &(Bool3x4 left, Bool3x4 right) => default;
/// <summary>
/// Ors two <see cref="Bool3x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x4"/> value to or.</param>
/// <param name="right">The <see cref="Bool3x4"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x4 operator |(Bool3x4 left, Bool3x4 right) => default;
/// <summary>
/// Xors two <see cref="Bool3x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool3x4"/> value to xor.</param>
/// <param name="right">The <see cref="Bool3x4"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool3x4 operator ^(Bool3x4 left, Bool3x4 right) => default;
/// <summary>
/// Compares two <see cref="Bool3x4"/> values to see if they are equal.
/// </summary>
@@ -1970,6 +2294,33 @@ public unsafe partial struct Bool4x1
/// <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>
public static Bool4x1 operator !(Bool4x1 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool4x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x1"/> value to and.</param>
/// <param name="right">The <see cref="Bool4x1"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x1 operator &(Bool4x1 left, Bool4x1 right) => default;
/// <summary>
/// Ors two <see cref="Bool4x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x1"/> value to or.</param>
/// <param name="right">The <see cref="Bool4x1"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x1 operator |(Bool4x1 left, Bool4x1 right) => default;
/// <summary>
/// Xors two <see cref="Bool4x1"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x1"/> value to xor.</param>
/// <param name="right">The <see cref="Bool4x1"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x1 operator ^(Bool4x1 left, Bool4x1 right) => default;
/// <summary>
/// Compares two <see cref="Bool4x1"/> values to see if they are equal.
/// </summary>
@@ -2171,6 +2522,33 @@ public unsafe partial struct Bool4x2
/// <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>
public static Bool4x2 operator !(Bool4x2 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool4x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x2"/> value to and.</param>
/// <param name="right">The <see cref="Bool4x2"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x2 operator &(Bool4x2 left, Bool4x2 right) => default;
/// <summary>
/// Ors two <see cref="Bool4x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x2"/> value to or.</param>
/// <param name="right">The <see cref="Bool4x2"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x2 operator |(Bool4x2 left, Bool4x2 right) => default;
/// <summary>
/// Xors two <see cref="Bool4x2"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x2"/> value to xor.</param>
/// <param name="right">The <see cref="Bool4x2"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x2 operator ^(Bool4x2 left, Bool4x2 right) => default;
/// <summary>
/// Compares two <see cref="Bool4x2"/> values to see if they are equal.
/// </summary>
@@ -2414,6 +2792,33 @@ public unsafe partial struct Bool4x3
/// <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>
public static Bool4x3 operator !(Bool4x3 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool4x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x3"/> value to and.</param>
/// <param name="right">The <see cref="Bool4x3"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x3 operator &(Bool4x3 left, Bool4x3 right) => default;
/// <summary>
/// Ors two <see cref="Bool4x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x3"/> value to or.</param>
/// <param name="right">The <see cref="Bool4x3"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x3 operator |(Bool4x3 left, Bool4x3 right) => default;
/// <summary>
/// Xors two <see cref="Bool4x3"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x3"/> value to xor.</param>
/// <param name="right">The <see cref="Bool4x3"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x3 operator ^(Bool4x3 left, Bool4x3 right) => default;
/// <summary>
/// Compares two <see cref="Bool4x3"/> values to see if they are equal.
/// </summary>
@@ -2705,6 +3110,33 @@ public unsafe partial struct Bool4x4
/// <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>
public static Bool4x4 operator !(Bool4x4 matrix) => default;
/// <summary>
/// Ands two <see cref="Bool4x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x4"/> value to and.</param>
/// <param name="right">The <see cref="Bool4x4"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x4 operator &(Bool4x4 left, Bool4x4 right) => default;
/// <summary>
/// Ors two <see cref="Bool4x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x4"/> value to or.</param>
/// <param name="right">The <see cref="Bool4x4"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x4 operator |(Bool4x4 left, Bool4x4 right) => default;
/// <summary>
/// Xors two <see cref="Bool4x4"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool4x4"/> value to xor.</param>
/// <param name="right">The <see cref="Bool4x4"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static Bool4x4 operator ^(Bool4x4 left, Bool4x4 right) => default;
/// <summary>
/// Compares two <see cref="Bool4x4"/> values to see if they are equal.
/// </summary>
+32
ファイルの表示
@@ -407,6 +407,38 @@ public unsafe partial struct <#=fullTypeName#>
public static <#=fullTypeName#> operator ^(<#=fullTypeName#> left, UInt<#=rows#>x<#=columns#> right) => default;
<#
}
else if (typeName == "Bool")
{
WriteLine("");
#>
/// <summary>
/// Ands two <see cref="<#=fullTypeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to and.</param>
/// <param name="right">The <see cref="<#=fullTypeName#>"/> value to combine.</param>
/// <returns>The result of performing the and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=fullTypeName#> operator &(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
/// <summary>
/// Ors two <see cref="<#=fullTypeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to or.</param>
/// <param name="right">The <see cref="<#=fullTypeName#>"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=fullTypeName#> operator |(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
/// <summary>
/// Xors two <see cref="<#=fullTypeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to xor.</param>
/// <param name="right">The <see cref="<#=fullTypeName#>"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=fullTypeName#> operator ^(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
<#
}
WriteLine("");
#>
+34
ファイルの表示
@@ -500,6 +500,40 @@ public unsafe partial struct <#=typeName#>
public static <#=typeName#> operator ^(<#=typeName#> left, UInt<#=i#> right) => default;
<#
}
else if (elementTypeName == "Bool")
{
string argumentName = "xyzw".Substring(0, i);
WriteLine("");
#>
/// <summary>
/// Ands two <see cref="<#=typeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to and.</param>
/// <param name="right">The <see cref="<#=typeName#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=typeName#> operator &(<#=typeName#> left, <#=typeName#> right) => default;
/// <summary>
/// Ors two <see cref="<#=typeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to or.</param>
/// <param name="right">The <see cref="<#=typeName#>"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=typeName#> operator |(<#=typeName#> left, <#=typeName#> right) => default;
/// <summary>
/// Xors two <see cref="<#=typeName#>"/> values.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to xor.</param>
/// <param name="right">The <see cref="<#=typeName#>"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</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>
public static <#=typeName#> operator ^(<#=typeName#> left, <#=typeName#> right) => default;
<#
}
WriteLine("");
#>
+46
ファイルの表示
@@ -191,6 +191,52 @@ public partial class ShaderRewriterTests
}
}
[CombinatorialTestMethod]
[AllDevices]
public void BooleanHlslOperators(Device device)
{
int[] data = { 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);
device.Get().For(1, new BooleanOperatorsShader(buffer));
int[] results = buffer.ToArray();
CollectionAssert.AreEqual(
expected: new[] { 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1 },
actual: results);
}
[AutoConstructor]
internal readonly partial struct BooleanOperatorsShader : IComputeShader
{
public readonly ReadWriteBuffer<int> buffer;
public void Execute()
{
bool4 a = new int4(buffer[0], buffer[1], buffer[2], buffer[3]) == 1;
bool4 b = new int4(buffer[4], buffer[5], buffer[6], buffer[7]) == 1;
bool4 c = a & b;
bool4 d = a | b;
bool4 e = a ^ b;
buffer[8] = c.X ? 1 : 0;
buffer[9] = c.Y ? 1 : 0;
buffer[10] = c.Z ? 1 : 0;
buffer[11] = c.W ? 1 : 0;
buffer[12] = d.X ? 1 : 0;
buffer[13] = d.Y ? 1 : 0;
buffer[14] = d.Z ? 1 : 0;
buffer[15] = d.W ? 1 : 0;
buffer[16] = e.X ? 1 : 0;
buffer[17] = e.Y ? 1 : 0;
buffer[18] = e.Z ? 1 : 0;
buffer[19] = e.W ? 1 : 0;
}
}
// See: https://github.com/Sergio0694/ComputeSharp/issues/259
[CombinatorialTestMethod]
[AllDevices]