Merge pull request #362 from Sergio0694/dev/hlsl-intrinsic-improvements

Add HLSL bitwise operators
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-08-25 02:12:37 +02:00
コミット b954632bf2
35ファイル変更
+4517 -377

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

-20
ファイルの表示
@@ -7,26 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Bool2
{
/// <summary>
/// Gets an <see cref="Bool2"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool2 False => false;
/// <summary>
/// Gets an <see cref="Bool2"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool2 True => true;
/// <summary>
/// Gets an <see cref="Bool2"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool2 TrueX => new(true, false);
/// <summary>
/// Gets an <see cref="Bool2"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool2 TrueY => new(false, true);
/// <summary>
/// Creates a new <see cref="Bool2"/> instance with the specified parameters.
/// </summary>
+20
ファイルの表示
@@ -32,6 +32,26 @@ 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData;
/// <summary>
/// Gets a <see cref="Bool2"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool2 False => false;
/// <summary>
/// Gets a <see cref="Bool2"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool2 True => true;
/// <summary>
/// Gets a <see cref="Bool2"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool2 TrueX => new(true, false);
/// <summary>
/// Gets a <see cref="Bool2"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool2 TrueY => new(false, true);
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-25
ファイルの表示
@@ -7,31 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Bool3
{
/// <summary>
/// Gets an <see cref="Bool3"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool3 False => false;
/// <summary>
/// Gets an <see cref="Bool3"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool3 True => true;
/// <summary>
/// Gets an <see cref="Bool3"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueX => new(true, false, false);
/// <summary>
/// Gets an <see cref="Bool3"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueY => new(false, true, false);
/// <summary>
/// Gets an <see cref="Bool3"/> value with the <see cref="Z"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueZ => new(false, false, true);
/// <summary>
/// Creates a new <see cref="Bool3"/> instance with the specified parameters.
/// </summary>
+25
ファイルの表示
@@ -35,6 +35,31 @@ 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData;
/// <summary>
/// Gets a <see cref="Bool3"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool3 False => false;
/// <summary>
/// Gets a <see cref="Bool3"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool3 True => true;
/// <summary>
/// Gets a <see cref="Bool3"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueX => new(true, false, false);
/// <summary>
/// Gets a <see cref="Bool3"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueY => new(false, true, false);
/// <summary>
/// Gets a <see cref="Bool3"/> value with the <see cref="Z"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool3 TrueZ => new(false, false, true);
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-30
ファイルの表示
@@ -7,36 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Bool4
{
/// <summary>
/// Gets an <see cref="Bool4"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool4 False => false;
/// <summary>
/// Gets an <see cref="Bool4"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool4 True => true;
/// <summary>
/// Gets an <see cref="Bool4"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueX => new(true, false, false, false);
/// <summary>
/// Gets an <see cref="Bool4"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueY => new(false, true, false, false);
/// <summary>
/// Gets an <see cref="Bool4"/> value with the <see cref="Z"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueZ => new(false, false, true, false);
/// <summary>
/// Gets an <see cref="Bool4"/> value with the <see cref="W"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueW => new(false, false, false, true);
/// <summary>
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
/// </summary>
+30
ファイルの表示
@@ -38,6 +38,36 @@ 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData;
/// <summary>
/// Gets a <see cref="Bool4"/> value with all components set to <see langword="false"/>.
/// </summary>
public static Bool4 False => false;
/// <summary>
/// Gets a <see cref="Bool4"/> value with all components set to <see langword="true"/>.
/// </summary>
public static Bool4 True => true;
/// <summary>
/// Gets a <see cref="Bool4"/> value with the <see cref="X"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueX => new(true, false, false, false);
/// <summary>
/// Gets a <see cref="Bool4"/> value with the <see cref="Y"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueY => new(false, true, false, false);
/// <summary>
/// Gets a <see cref="Bool4"/> value with the <see cref="Z"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueZ => new(false, false, true, false);
/// <summary>
/// Gets a <see cref="Bool4"/> value with the <see cref="W"/> component set to <see langword="true"/>, and the others to <see langword="false"/>.
/// </summary>
public static Bool4 TrueW => new(false, false, false, true);
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-20
ファイルの表示
@@ -7,26 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double2
{
/// <summary>
/// Gets an <see cref="Double2"/> value with all components set to 0.
/// </summary>
public static Double2 Zero => 0;
/// <summary>
/// Gets an <see cref="Double2"/> value with all components set to 1.
/// </summary>
public static Double2 One => 1;
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double2 UnitX => new(1, 0);
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double2 UnitY => new(0, 1);
/// <summary>
/// Creates a new <see cref="Double2"/> instance with the specified parameters.
/// </summary>
+20
ファイルの表示
@@ -37,6 +37,26 @@ public unsafe partial struct Double2
/// <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 readonly ref double this[int i] => ref *(double*)UndefinedData;
/// <summary>
/// Gets a <see cref="Double2"/> value with all components set to 0.
/// </summary>
public static Double2 Zero => 0;
/// <summary>
/// Gets a <see cref="Double2"/> value with all components set to 1.
/// </summary>
public static Double2 One => 1;
/// <summary>
/// Gets a <see cref="Double2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double2 UnitX => new(1, 0);
/// <summary>
/// Gets a <see cref="Double2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double2 UnitY => new(0, 1);
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-25
ファイルの表示
@@ -7,31 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double3
{
/// <summary>
/// Gets an <see cref="Double3"/> value with all components set to 0.
/// </summary>
public static Double3 Zero => 0;
/// <summary>
/// Gets an <see cref="Double3"/> value with all components set to 1.
/// </summary>
public static Double3 One => 1;
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitZ => new(0, 0, 1);
/// <summary>
/// Creates a new <see cref="Double3"/> instance with the specified parameters.
/// </summary>
+25
ファイルの表示
@@ -40,6 +40,31 @@ public unsafe partial struct Double3
/// <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 readonly ref double this[int i] => ref *(double*)UndefinedData;
/// <summary>
/// Gets a <see cref="Double3"/> value with all components set to 0.
/// </summary>
public static Double3 Zero => 0;
/// <summary>
/// Gets a <see cref="Double3"/> value with all components set to 1.
/// </summary>
public static Double3 One => 1;
/// <summary>
/// Gets a <see cref="Double3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets a <see cref="Double3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets a <see cref="Double3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Double3 UnitZ => new(0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-30
ファイルの表示
@@ -7,36 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double4
{
/// <summary>
/// Gets an <see cref="Double4"/> value with all components set to 0.
/// </summary>
public static Double4 Zero => 0;
/// <summary>
/// Gets an <see cref="Double4"/> value with all components set to 1.
/// </summary>
public static Double4 One => 1;
/// <summary>
/// Gets an <see cref="Double4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets an <see cref="Double4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets an <see cref="Double4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets an <see cref="Double4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
/// </summary>
+30
ファイルの表示
@@ -43,6 +43,36 @@ public unsafe partial struct Double4
/// <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 readonly ref double this[int i] => ref *(double*)UndefinedData;
/// <summary>
/// Gets a <see cref="Double4"/> value with all components set to 0.
/// </summary>
public static Double4 Zero => 0;
/// <summary>
/// Gets a <see cref="Double4"/> value with all components set to 1.
/// </summary>
public static Double4 One => 1;
/// <summary>
/// Gets a <see cref="Double4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets a <see cref="Double4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets a <see cref="Double4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets a <see cref="Double4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Double4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-20
ファイルの表示
@@ -9,26 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float2
{
/// <summary>
/// Gets an <see cref="Float2"/> value with all components set to 0.
/// </summary>
public static Float2 Zero => 0;
/// <summary>
/// Gets an <see cref="Float2"/> value with all components set to 1.
/// </summary>
public static Float2 One => 1;
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float2 UnitX => new(1, 0);
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float2 UnitY => new(0, 1);
/// <summary>
/// Creates a new <see cref="Float2"/> instance with the specified parameters.
/// </summary>
+20
ファイルの表示
@@ -37,6 +37,26 @@ public unsafe partial struct Float2
/// <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 readonly ref float this[int i] => ref *(float*)UndefinedData;
/// <summary>
/// Gets a <see cref="Float2"/> value with all components set to 0.
/// </summary>
public static Float2 Zero => 0;
/// <summary>
/// Gets a <see cref="Float2"/> value with all components set to 1.
/// </summary>
public static Float2 One => 1;
/// <summary>
/// Gets a <see cref="Float2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float2 UnitX => new(1, 0);
/// <summary>
/// Gets a <see cref="Float2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float2 UnitY => new(0, 1);
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-25
ファイルの表示
@@ -9,31 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float3
{
/// <summary>
/// Gets an <see cref="Float3"/> value with all components set to 0.
/// </summary>
public static Float3 Zero => 0;
/// <summary>
/// Gets an <see cref="Float3"/> value with all components set to 1.
/// </summary>
public static Float3 One => 1;
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitZ => new(0, 0, 1);
/// <summary>
/// Creates a new <see cref="Float3"/> instance with the specified parameters.
/// </summary>
+25
ファイルの表示
@@ -40,6 +40,31 @@ public unsafe partial struct Float3
/// <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 readonly ref float this[int i] => ref *(float*)UndefinedData;
/// <summary>
/// Gets a <see cref="Float3"/> value with all components set to 0.
/// </summary>
public static Float3 Zero => 0;
/// <summary>
/// Gets a <see cref="Float3"/> value with all components set to 1.
/// </summary>
public static Float3 One => 1;
/// <summary>
/// Gets a <see cref="Float3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets a <see cref="Float3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets a <see cref="Float3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Float3 UnitZ => new(0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-30
ファイルの表示
@@ -9,36 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float4
{
/// <summary>
/// Gets an <see cref="Float4"/> value with all components set to 0.
/// </summary>
public static Float4 Zero => 0;
/// <summary>
/// Gets an <see cref="Float4"/> value with all components set to 1.
/// </summary>
public static Float4 One => 1;
/// <summary>
/// Gets an <see cref="Float4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets an <see cref="Float4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets an <see cref="Float4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets an <see cref="Float4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
/// </summary>
+30
ファイルの表示
@@ -43,6 +43,36 @@ public unsafe partial struct Float4
/// <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 readonly ref float this[int i] => ref *(float*)UndefinedData;
/// <summary>
/// Gets a <see cref="Float4"/> value with all components set to 0.
/// </summary>
public static Float4 Zero => 0;
/// <summary>
/// Gets a <see cref="Float4"/> value with all components set to 1.
/// </summary>
public static Float4 One => 1;
/// <summary>
/// Gets a <see cref="Float4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets a <see cref="Float4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets a <see cref="Float4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets a <see cref="Float4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Float4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-20
ファイルの表示
@@ -7,26 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int2
{
/// <summary>
/// Gets an <see cref="Int2"/> value with all components set to 0.
/// </summary>
public static Int2 Zero => 0;
/// <summary>
/// Gets an <see cref="Int2"/> value with all components set to 1.
/// </summary>
public static Int2 One => 1;
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int2 UnitX => new(1, 0);
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int2 UnitY => new(0, 1);
/// <summary>
/// Creates a new <see cref="Int2"/> instance with the specified parameters.
/// </summary>
+120
ファイルの表示
@@ -37,6 +37,26 @@ public unsafe partial struct Int2
/// <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 readonly ref int this[int i] => ref *(int*)UndefinedData;
/// <summary>
/// Gets a <see cref="Int2"/> value with all components set to 0.
/// </summary>
public static Int2 Zero => 0;
/// <summary>
/// Gets a <see cref="Int2"/> value with all components set to 1.
/// </summary>
public static Int2 One => 1;
/// <summary>
/// Gets a <see cref="Int2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int2 UnitX => new(1, 0);
/// <summary>
/// Gets a <see cref="Int2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int2 UnitY => new(0, 1);
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
@@ -523,6 +543,106 @@ public unsafe partial struct Int2
/// <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 <=(Int2 left, Int2 right) => default;
/// <summary>
/// Bitwise negates a <see cref="Int2"/> value.
/// </summary>
/// <param name="xy">The <see cref="Int2"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xy"/>.</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 Int2 operator ~(Int2 xy) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="Int2"/> value.
/// </summary>
/// <param name="xy">The <see cref="Int2"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xy"/> right by <paramref name="amount"/>.</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 Int2 operator >>(Int2 xy, Int2 amount) => default;
/// <summary>
/// Shifts right a <see cref="Int2"/> value.
/// </summary>
/// <param name="xy">The <see cref="Int2"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xy"/> right by <paramref name="amount"/>.</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 Int2 operator >>(Int2 xy, UInt2 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int2"/> value.
/// </summary>
/// <param name="xy">The <see cref="Int2"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</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 Int2 operator <<(Int2 xy, Int2 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int2"/> value.
/// </summary>
/// <param name="xy">The <see cref="Int2"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</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 Int2 operator <<(Int2 xy, UInt2 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int2"/> 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 Int2 operator &(Int2 left, Int2 right) => default;
/// <summary>
/// Bitwise ands a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt2"/> 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 Int2 operator &(Int2 left, UInt2 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int2 operator |(Int2 left, Int2 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int2 operator |(Int2 left, UInt2 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int2 operator ^(Int2 left, Int2 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int2"/> value.
/// </summary>
/// <param name="left">The <see cref="Int2"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int2 operator ^(Int2 left, UInt2 right) => default;
/// <summary>
/// Compares two <see cref="Int2"/> values to see if they are equal.
/// </summary>
-25
ファイルの表示
@@ -7,31 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int3
{
/// <summary>
/// Gets an <see cref="Int3"/> value with all components set to 0.
/// </summary>
public static Int3 Zero => 0;
/// <summary>
/// Gets an <see cref="Int3"/> value with all components set to 1.
/// </summary>
public static Int3 One => 1;
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitZ => new(0, 0, 1);
/// <summary>
/// Creates a new <see cref="Int3"/> instance with the specified parameters.
/// </summary>
+125
ファイルの表示
@@ -40,6 +40,31 @@ public unsafe partial struct Int3
/// <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 readonly ref int this[int i] => ref *(int*)UndefinedData;
/// <summary>
/// Gets a <see cref="Int3"/> value with all components set to 0.
/// </summary>
public static Int3 Zero => 0;
/// <summary>
/// Gets a <see cref="Int3"/> value with all components set to 1.
/// </summary>
public static Int3 One => 1;
/// <summary>
/// Gets a <see cref="Int3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets a <see cref="Int3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets a <see cref="Int3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Int3 UnitZ => new(0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
@@ -1604,6 +1629,106 @@ public unsafe partial struct Int3
/// <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 <=(Int3 left, Int3 right) => default;
/// <summary>
/// Bitwise negates a <see cref="Int3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="Int3"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xyz"/>.</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 Int3 operator ~(Int3 xyz) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="Int3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="Int3"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> right by <paramref name="amount"/>.</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 Int3 operator >>(Int3 xyz, Int3 amount) => default;
/// <summary>
/// Shifts right a <see cref="Int3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="Int3"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> right by <paramref name="amount"/>.</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 Int3 operator >>(Int3 xyz, UInt3 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="Int3"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> left by <paramref name="amount"/>.</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 Int3 operator <<(Int3 xyz, Int3 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="Int3"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> left by <paramref name="amount"/>.</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 Int3 operator <<(Int3 xyz, UInt3 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int3"/> 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 Int3 operator &(Int3 left, Int3 right) => default;
/// <summary>
/// Bitwise ands a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt3"/> 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 Int3 operator &(Int3 left, UInt3 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int3 operator |(Int3 left, Int3 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int3 operator |(Int3 left, UInt3 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int3 operator ^(Int3 left, Int3 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int3"/> value.
/// </summary>
/// <param name="left">The <see cref="Int3"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int3 operator ^(Int3 left, UInt3 right) => default;
/// <summary>
/// Compares two <see cref="Int3"/> values to see if they are equal.
/// </summary>
-30
ファイルの表示
@@ -7,36 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int4
{
/// <summary>
/// Gets an <see cref="Int4"/> value with all components set to 0.
/// </summary>
public static Int4 Zero => 0;
/// <summary>
/// Gets an <see cref="Int4"/> value with all components set to 1.
/// </summary>
public static Int4 One => 1;
/// <summary>
/// Gets an <see cref="Int4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets an <see cref="Int4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets an <see cref="Int4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets an <see cref="Int4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
/// </summary>
+130
ファイルの表示
@@ -43,6 +43,36 @@ public unsafe partial struct Int4
/// <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 readonly ref int this[int i] => ref *(int*)UndefinedData;
/// <summary>
/// Gets a <see cref="Int4"/> value with all components set to 0.
/// </summary>
public static Int4 Zero => 0;
/// <summary>
/// Gets a <see cref="Int4"/> value with all components set to 1.
/// </summary>
public static Int4 One => 1;
/// <summary>
/// Gets a <see cref="Int4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets a <see cref="Int4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets a <see cref="Int4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets a <see cref="Int4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static Int4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
@@ -4245,6 +4275,106 @@ public unsafe partial struct Int4
/// <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 <=(Int4 left, Int4 right) => default;
/// <summary>
/// Bitwise negates a <see cref="Int4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="Int4"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xyzw"/>.</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 Int4 operator ~(Int4 xyzw) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="Int4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="Int4"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> right by <paramref name="amount"/>.</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 Int4 operator >>(Int4 xyzw, Int4 amount) => default;
/// <summary>
/// Shifts right a <see cref="Int4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="Int4"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> right by <paramref name="amount"/>.</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 Int4 operator >>(Int4 xyzw, UInt4 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="Int4"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> left by <paramref name="amount"/>.</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 Int4 operator <<(Int4 xyzw, Int4 amount) => default;
/// <summary>
/// Shifts left a <see cref="Int4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="Int4"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> left by <paramref name="amount"/>.</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 Int4 operator <<(Int4 xyzw, UInt4 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int4"/> 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 Int4 operator &(Int4 left, Int4 right) => default;
/// <summary>
/// Bitwise ands a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt4"/> 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 Int4 operator &(Int4 left, UInt4 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int4 operator |(Int4 left, Int4 right) => default;
/// <summary>
/// Bitwise ors a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int4 operator |(Int4 left, UInt4 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int4 operator ^(Int4 left, Int4 right) => default;
/// <summary>
/// Bitwise xors a <see cref="Int4"/> value.
/// </summary>
/// <param name="left">The <see cref="Int4"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 Int4 operator ^(Int4 left, UInt4 right) => default;
/// <summary>
/// Compares two <see cref="Int4"/> values to see if they are equal.
/// </summary>
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+107
ファイルの表示
@@ -301,6 +301,113 @@ public unsafe partial struct <#=fullTypeName#>
<#
}
// Generate the bitwise operators
if (typeName == "Int" || typeName == "UInt")
{
WriteLine("");
#>
/// <summary>
/// Bitwise negates a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="matrix"/>.</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#> matrix) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> right by <paramref name="amount"/>.</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#> matrix, Int<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts right a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> right by <paramref name="amount"/>.</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#> matrix, UInt<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> left by <paramref name="amount"/>.</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#> matrix, Int<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> left by <paramref name="amount"/>.</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#> matrix, UInt<#=rows#>x<#=columns#> amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> 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 <#=fullTypeName#> operator &(<#=fullTypeName#> left, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ands a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> 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 <#=fullTypeName#> operator &(<#=fullTypeName#> left, UInt<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, UInt<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, UInt<#=rows#>x<#=columns#> right) => default;
<#
}
WriteLine("");
#>
/// <summary>
-20
ファイルの表示
@@ -7,26 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt2
{
/// <summary>
/// Gets an <see cref="UInt2"/> value with all components set to 0.
/// </summary>
public static UInt2 Zero => 0;
/// <summary>
/// Gets an <see cref="UInt2"/> value with all components set to 1.
/// </summary>
public static UInt2 One => 1;
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt2 UnitX => new(1, 0);
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt2 UnitY => new(0, 1);
/// <summary>
/// Creates a new <see cref="UInt2"/> instance with the specified parameters.
/// </summary>
+120
ファイルの表示
@@ -37,6 +37,26 @@ public unsafe partial struct UInt2
/// <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 readonly ref uint this[int i] => ref *(uint*)UndefinedData;
/// <summary>
/// Gets a <see cref="UInt2"/> value with all components set to 0.
/// </summary>
public static UInt2 Zero => 0;
/// <summary>
/// Gets a <see cref="UInt2"/> value with all components set to 1.
/// </summary>
public static UInt2 One => 1;
/// <summary>
/// Gets a <see cref="UInt2"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt2 UnitX => new(1, 0);
/// <summary>
/// Gets a <see cref="UInt2"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt2 UnitY => new(0, 1);
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
@@ -515,6 +535,106 @@ public unsafe partial struct UInt2
/// <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 <=(UInt2 left, UInt2 right) => default;
/// <summary>
/// Bitwise negates a <see cref="UInt2"/> value.
/// </summary>
/// <param name="xy">The <see cref="UInt2"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xy"/>.</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 UInt2 operator ~(UInt2 xy) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="UInt2"/> value.
/// </summary>
/// <param name="xy">The <see cref="UInt2"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xy"/> right by <paramref name="amount"/>.</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 UInt2 operator >>(UInt2 xy, Int2 amount) => default;
/// <summary>
/// Shifts right a <see cref="UInt2"/> value.
/// </summary>
/// <param name="xy">The <see cref="UInt2"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xy"/> right by <paramref name="amount"/>.</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 UInt2 operator >>(UInt2 xy, UInt2 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt2"/> value.
/// </summary>
/// <param name="xy">The <see cref="UInt2"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</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 UInt2 operator <<(UInt2 xy, Int2 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt2"/> value.
/// </summary>
/// <param name="xy">The <see cref="UInt2"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</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 UInt2 operator <<(UInt2 xy, UInt2 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int2"/> 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 UInt2 operator &(UInt2 left, Int2 right) => default;
/// <summary>
/// Bitwise ands a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt2"/> 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 UInt2 operator &(UInt2 left, UInt2 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt2 operator |(UInt2 left, Int2 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt2 operator |(UInt2 left, UInt2 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt2 operator ^(UInt2 left, Int2 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt2"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt2"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt2"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt2 operator ^(UInt2 left, UInt2 right) => default;
/// <summary>
/// Compares two <see cref="UInt2"/> values to see if they are equal.
/// </summary>
-25
ファイルの表示
@@ -7,31 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt3
{
/// <summary>
/// Gets an <see cref="UInt3"/> value with all components set to 0.
/// </summary>
public static UInt3 Zero => 0;
/// <summary>
/// Gets an <see cref="UInt3"/> value with all components set to 1.
/// </summary>
public static UInt3 One => 1;
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitZ => new(0, 0, 1);
/// <summary>
/// Creates a new <see cref="UInt3"/> instance with the specified parameters.
/// </summary>
+125
ファイルの表示
@@ -40,6 +40,31 @@ public unsafe partial struct UInt3
/// <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 readonly ref uint this[int i] => ref *(uint*)UndefinedData;
/// <summary>
/// Gets a <see cref="UInt3"/> value with all components set to 0.
/// </summary>
public static UInt3 Zero => 0;
/// <summary>
/// Gets a <see cref="UInt3"/> value with all components set to 1.
/// </summary>
public static UInt3 One => 1;
/// <summary>
/// Gets a <see cref="UInt3"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitX => new(1, 0, 0);
/// <summary>
/// Gets a <see cref="UInt3"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitY => new(0, 1, 0);
/// <summary>
/// Gets a <see cref="UInt3"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static UInt3 UnitZ => new(0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
@@ -1596,6 +1621,106 @@ public unsafe partial struct UInt3
/// <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 <=(UInt3 left, UInt3 right) => default;
/// <summary>
/// Bitwise negates a <see cref="UInt3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="UInt3"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xyz"/>.</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 UInt3 operator ~(UInt3 xyz) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="UInt3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="UInt3"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> right by <paramref name="amount"/>.</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 UInt3 operator >>(UInt3 xyz, Int3 amount) => default;
/// <summary>
/// Shifts right a <see cref="UInt3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="UInt3"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> right by <paramref name="amount"/>.</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 UInt3 operator >>(UInt3 xyz, UInt3 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="UInt3"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> left by <paramref name="amount"/>.</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 UInt3 operator <<(UInt3 xyz, Int3 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt3"/> value.
/// </summary>
/// <param name="xyz">The <see cref="UInt3"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyz"/> left by <paramref name="amount"/>.</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 UInt3 operator <<(UInt3 xyz, UInt3 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int3"/> 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 UInt3 operator &(UInt3 left, Int3 right) => default;
/// <summary>
/// Bitwise ands a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt3"/> 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 UInt3 operator &(UInt3 left, UInt3 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt3 operator |(UInt3 left, Int3 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt3 operator |(UInt3 left, UInt3 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt3 operator ^(UInt3 left, Int3 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt3"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt3"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt3"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt3 operator ^(UInt3 left, UInt3 right) => default;
/// <summary>
/// Compares two <see cref="UInt3"/> values to see if they are equal.
/// </summary>
-30
ファイルの表示
@@ -7,36 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt4
{
/// <summary>
/// Gets an <see cref="UInt4"/> value with all components set to 0.
/// </summary>
public static UInt4 Zero => 0;
/// <summary>
/// Gets an <see cref="UInt4"/> value with all components set to 1.
/// </summary>
public static UInt4 One => 1;
/// <summary>
/// Gets an <see cref="UInt4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets an <see cref="UInt4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets an <see cref="UInt4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets an <see cref="UInt4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
/// </summary>
+130
ファイルの表示
@@ -43,6 +43,36 @@ public unsafe partial struct UInt4
/// <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 readonly ref uint this[int i] => ref *(uint*)UndefinedData;
/// <summary>
/// Gets a <see cref="UInt4"/> value with all components set to 0.
/// </summary>
public static UInt4 Zero => 0;
/// <summary>
/// Gets a <see cref="UInt4"/> value with all components set to 1.
/// </summary>
public static UInt4 One => 1;
/// <summary>
/// Gets a <see cref="UInt4"/> value with the <see cref="X"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitX => new(1, 0, 0, 0);
/// <summary>
/// Gets a <see cref="UInt4"/> value with the <see cref="Y"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitY => new(0, 1, 0, 0);
/// <summary>
/// Gets a <see cref="UInt4"/> value with the <see cref="Z"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitZ => new(0, 0, 1, 0);
/// <summary>
/// Gets a <see cref="UInt4"/> value with the <see cref="W"/> component set to 1, and the others to 0.
/// </summary>
public static UInt4 UnitW => new(0, 0, 0, 1);
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
@@ -4237,6 +4267,106 @@ public unsafe partial struct UInt4
/// <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 <=(UInt4 left, UInt4 right) => default;
/// <summary>
/// Bitwise negates a <see cref="UInt4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="UInt4"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="xyzw"/>.</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 UInt4 operator ~(UInt4 xyzw) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="UInt4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="UInt4"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> right by <paramref name="amount"/>.</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 UInt4 operator >>(UInt4 xyzw, Int4 amount) => default;
/// <summary>
/// Shifts right a <see cref="UInt4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="UInt4"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> right by <paramref name="amount"/>.</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 UInt4 operator >>(UInt4 xyzw, UInt4 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="UInt4"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> left by <paramref name="amount"/>.</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 UInt4 operator <<(UInt4 xyzw, Int4 amount) => default;
/// <summary>
/// Shifts left a <see cref="UInt4"/> value.
/// </summary>
/// <param name="xyzw">The <see cref="UInt4"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="xyzw"/> left by <paramref name="amount"/>.</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 UInt4 operator <<(UInt4 xyzw, UInt4 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int4"/> 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 UInt4 operator &(UInt4 left, Int4 right) => default;
/// <summary>
/// Bitwise ands a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt4"/> 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 UInt4 operator &(UInt4 left, UInt4 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt4 operator |(UInt4 left, Int4 right) => default;
/// <summary>
/// Bitwise ors a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt4 operator |(UInt4 left, UInt4 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt4 operator ^(UInt4 left, Int4 right) => default;
/// <summary>
/// Bitwise xors a <see cref="UInt4"/> value.
/// </summary>
/// <param name="left">The <see cref="UInt4"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt4"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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 UInt4 operator ^(UInt4 left, UInt4 right) => default;
/// <summary>
/// Compares two <see cref="UInt4"/> values to see if they are equal.
/// </summary>
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+174 -2
ファイルの表示
@@ -108,7 +108,72 @@ public unsafe partial struct <#=typeName#>
/// <param name="i">The index of the component to access.</param>
/// <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 readonly ref <#=hlslElementTypeName#> this[int i] => ref *(<#=hlslElementTypeName#>*)UndefinedData;
<#
// Generate the true/false and zero/one properties
if (elementTypeName == "Bool")
{
#>
/// <summary>
/// Gets a <see cref="<#=typeName#>"/> value with all components set to <see langword="false"/>.
/// </summary>
public static <#=typeName#> False => false;
/// <summary>
/// Gets a <see cref="<#=typeName#>"/> value with all components set to <see langword="true"/>.
/// </summary>
public static <#=typeName#> True => true;
<#
}
else
{
#>
/// <summary>
/// Gets a <see cref="<#=typeName#>"/> value with all components set to 0.
/// </summary>
public static <#=typeName#> Zero => 0;
/// <summary>
/// Gets a <see cref="<#=typeName#>"/> value with all components set to 1.
/// </summary>
public static <#=typeName#> One => 1;
<#
}
string unitName, unitOne, unitZero, unitOneXmlName, unitZeroXmlName;
if (elementTypeName == "Bool")
{
unitName = "True";
unitOne = "true";
unitZero = "false";
unitOneXmlName = "<see langword=\"true\"/>";
unitZeroXmlName = "<see langword=\"false\"/>";
}
else
{
unitName = "Unit";
unitOne = "1";
unitZero = "0";
unitOneXmlName = "1";
unitZeroXmlName = "0";
}
// Generate the True<N> and Unit<N> properties
for (int j = 0; j < i; j++)
{
string unitComponentName = ("XYZW"[j]).ToString();
string[] unitArguments = Enumerable.Range(0, i).Select(x => x == j ? unitOne : unitZero).ToArray();
string unitArgumentExpression = string.Join(", ", unitArguments);
#>
/// <summary>
/// Gets a <see cref="<#=typeName#>"/> value with the <see cref="<#=unitComponentName#>"/> component set to <#=unitOneXmlName#>, and the others to <#=unitZeroXmlName#>.
/// </summary>
public static <#=typeName#> <#=unitName#><#=unitComponentName#> => new(<#=unitArgumentExpression#>);
<#
}
PushIndent(" ");
// Generate the combinatorial swizzling properties
@@ -161,7 +226,6 @@ public unsafe partial struct <#=typeName#>
#if !SOURCE_GENERATOR
<#
if (elementTypeName == "Bool")
{
#>
@@ -222,7 +286,6 @@ public unsafe partial struct <#=typeName#>
#endif
<#
// Generate the negation operator
if (elementTypeName != "UInt")
{
@@ -329,6 +392,115 @@ public unsafe partial struct <#=typeName#>
<#
}
// Generate the bitwise operators
if (elementTypeName == "Int" || elementTypeName == "UInt")
{
string argumentName = "xyzw".Substring(0, i);
WriteLine("");
#>
/// <summary>
/// Bitwise negates a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="<#=argumentName#>"/>.</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#> <#=argumentName#>) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="<#=argumentName#>"/> right by <paramref name="amount"/>.</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#> <#=argumentName#>, Int<#=i#> amount) => default;
/// <summary>
/// Shifts right a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="<#=argumentName#>"/> right by <paramref name="amount"/>.</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#> <#=argumentName#>, UInt<#=i#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="<#=argumentName#>"/> left by <paramref name="amount"/>.</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#> <#=argumentName#>, Int<#=i#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="<#=argumentName#>"/> left by <paramref name="amount"/>.</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#> <#=argumentName#>, UInt<#=i#> amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int<#=i#>"/> 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, Int<#=i#> right) => default;
/// <summary>
/// Bitwise ands a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt<#=i#>"/> 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, UInt<#=i#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int<#=i#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, Int<#=i#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt<#=i#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, UInt<#=i#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int<#=i#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, Int<#=i#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=typeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=typeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt<#=i#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise 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, UInt<#=i#> right) => default;
<#
}
WriteLine("");
#>
/// <summary>
+61
ファイルの表示
@@ -130,6 +130,67 @@ public partial class ShaderRewriterTests
}
}
// See: https://github.com/Sergio0694/ComputeSharp/issues/361
[CombinatorialTestMethod]
[AllDevices]
public void BitwiseHlslOperators(Device device)
{
int[] data = { 186456131, 215486738, unchecked((int)416439712738), unchecked((int)1437124371243), 0, 0, 0, 0 };
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);
device.Get().For(1, new BitwiseOperatorsShader(buffer));
int[] results = buffer.ToArray();
int2 a = new(data[0], data[1]);
uint2 b = new((uint)data[2], (uint)data[3]);
int2 c = new(~a.X, ~a.Y);
int2 d = new(a.X & (int)b.X, a.Y & (int)b.Y);
int2 e = new(a.X | (int)b.X, a.Y | (int)b.Y);
int2 f = new(a.X ^ (int)b.X, a.Y ^ (int)b.Y);
Assert.AreEqual(results[0], c.X);
Assert.AreEqual(results[1], c.Y);
Assert.AreEqual(results[2], d.X);
Assert.AreEqual(results[3], d.Y);
Assert.AreEqual(results[4], e.X);
Assert.AreEqual(results[5], e.Y);
Assert.AreEqual(results[6], f.X);
Assert.AreEqual(results[7], f.Y);
}
[AutoConstructor]
internal readonly partial struct BitwiseOperatorsShader : IComputeShader
{
public readonly ReadWriteBuffer<int> buffer;
public void Execute()
{
int2 a = new(buffer[0], buffer[1]);
uint2 b = new((uint)buffer[2], (uint)buffer[3]);
int2 c = ~a;
int2 d = a & b;
int2 e = a | b;
int2 f = a ^ b;
#if NEEDS_CSHARP_11
// TODO: add bit shifting tests
#endif
buffer[0] = c.X;
buffer[1] = c.Y;
buffer[2] = d.X;
buffer[3] = d.Y;
buffer[4] = e.X;
buffer[5] = e.Y;
buffer[6] = f.X;
buffer[7] = f.Y;
}
}
// See: https://github.com/Sergio0694/ComputeSharp/issues/259
[CombinatorialTestMethod]
[AllDevices]