Move True/False and One/Zero properties to T4 templates

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-24 23:40:15 +02:00
1 親 2de22e1cb3
コミット f5c4e6aacd
31ファイル変更
+181 -152

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

-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -32,6 +32,16 @@ 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 reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -35,6 +35,16 @@ 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 reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -38,6 +38,16 @@ 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 reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -37,6 +37,16 @@ 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 reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -40,6 +40,16 @@ 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 reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -43,6 +43,16 @@ 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 reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -9,16 +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>
+10
ファイルの表示
@@ -37,6 +37,16 @@ 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 reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -9,16 +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>
+10
ファイルの表示
@@ -40,6 +40,16 @@ 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 reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -9,16 +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>
+10
ファイルの表示
@@ -43,6 +43,16 @@ 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 reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -37,6 +37,16 @@ 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 reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -40,6 +40,16 @@ 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 reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -43,6 +43,16 @@ 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 reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -37,6 +37,16 @@ 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 reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -40,6 +40,16 @@ 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 reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
-10
ファイルの表示
@@ -7,16 +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>
+10
ファイルの表示
@@ -43,6 +43,16 @@ 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 reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
+31 -2
ファイルの表示
@@ -108,7 +108,38 @@ 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;
<#
}
PushIndent(" ");
// Generate the combinatorial swizzling properties
@@ -161,7 +192,6 @@ public unsafe partial struct <#=typeName#>
#if !SOURCE_GENERATOR
<#
if (elementTypeName == "Bool")
{
#>
@@ -222,7 +252,6 @@ public unsafe partial struct <#=typeName#>
#endif
<#
// Generate the negation operator
if (elementTypeName != "UInt")
{