Implemented ToString() formatting to HLSL vector types
このコミットが含まれているのは:
1 親
65e15edcd0
コミット
f636eb590e
32ファイル変更
+564
-88
検索条件に一致するファイルはありません
@@ -1,12 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that can be used in place of the <see cref="bool"/> type in HLSL shaders.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Value}")]
|
||||
[StructLayout(LayoutKind.Explicit, Size = sizeof(int), Pack = 4)]
|
||||
public readonly struct Bool
|
||||
{
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool2"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y})")]
|
||||
public partial struct Bool2
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Bool2"/>
|
||||
@@ -96,5 +101,19 @@ namespace ComputeSharp
|
||||
/// </summary>
|
||||
/// <remarks>This 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 readonly Bool2 GG => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.y);
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool3"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z})")]
|
||||
public partial struct Bool3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Bool3"/>
|
||||
@@ -493,5 +498,21 @@ namespace ComputeSharp
|
||||
/// </summary>
|
||||
/// <remarks>This 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 readonly Bool3 BBB => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.y);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.z);
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool4"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
|
||||
public partial struct Bool4
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Bool4"/>
|
||||
@@ -4106,5 +4111,23 @@ namespace ComputeSharp
|
||||
/// </summary>
|
||||
/// <remarks>This 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 readonly Bool4 AAAA => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.y);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.z);
|
||||
sb.Append(", ");
|
||||
sb.Append(this.w);
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double2"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y})")]
|
||||
public partial struct Double2
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Double2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
|
||||
public unsafe partial struct Double2
|
||||
public unsafe partial struct Double2 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -97,6 +102,29 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Double2 GG => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Double2"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double3"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z})")]
|
||||
public partial struct Double3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Double3"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)]
|
||||
public unsafe partial struct Double3
|
||||
public unsafe partial struct Double3 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -494,6 +499,32 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Double3 BBB => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Double3"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double4"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
|
||||
public partial struct Double4
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Double4"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)]
|
||||
public unsafe partial struct Double4
|
||||
public unsafe partial struct Double4 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -4107,6 +4112,35 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Double4 AAAA => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.w.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Double4"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float2"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y})")]
|
||||
public partial struct Float2
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Float2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct Float2
|
||||
public unsafe partial struct Float2 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -97,6 +102,29 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Float2 GG => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Float2"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float3"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z})")]
|
||||
public partial struct Float3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Float3"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)]
|
||||
public unsafe partial struct Float3
|
||||
public unsafe partial struct Float3 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -494,6 +499,32 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Float3 BBB => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Float3"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float4"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
|
||||
public partial struct Float4
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Float4"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)]
|
||||
public unsafe partial struct Float4
|
||||
public unsafe partial struct Float4 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -4107,6 +4112,35 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Float4 AAAA => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.w.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Float4"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int2"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y})")]
|
||||
public partial struct Int2
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Int2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct Int2
|
||||
public unsafe partial struct Int2 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -97,6 +102,29 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Int2 GG => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Int2"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int3"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z})")]
|
||||
public partial struct Int3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Int3"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)]
|
||||
public unsafe partial struct Int3
|
||||
public unsafe partial struct Int3 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -494,6 +499,32 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Int3 BBB => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Int3"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int4"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
|
||||
public partial struct Int4
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="Int4"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)]
|
||||
public unsafe partial struct Int4
|
||||
public unsafe partial struct Int4 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -4107,6 +4112,35 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly Int4 AAAA => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.w.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Int4"/> value.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint2"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y})")]
|
||||
public partial struct UInt2
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="UInt2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct UInt2
|
||||
public unsafe partial struct UInt2 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -97,6 +102,29 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly UInt2 GG => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="UInt2"/> values.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint3"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z})")]
|
||||
public partial struct UInt3
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="UInt3"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)]
|
||||
public unsafe partial struct UInt3
|
||||
public unsafe partial struct UInt3 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -494,6 +499,32 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly UInt3 BBB => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="UInt3"/> values.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint4"/> HLSL type.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("({X}, {Y}, {Z}, {W})")]
|
||||
public partial struct UInt4
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="UInt4"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)]
|
||||
public unsafe partial struct UInt4
|
||||
public unsafe partial struct UInt4 : IFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -4107,6 +4112,35 @@ namespace ComputeSharp
|
||||
/// <remarks>This 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 readonly UInt4 AAAA => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
sb.Append(this.x.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.y.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.z.ToString(format, formatProvider));
|
||||
sb.Append(separator);
|
||||
sb.Append(' ');
|
||||
sb.Append(this.w.ToString(format, formatProvider));
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="UInt4"/> values.
|
||||
/// </summary>
|
||||
|
||||
@@ -65,19 +65,25 @@ void GenerateVectorProperties(string typeName, int elementSize)
|
||||
string elementTypeName = Regex.Match(typeName, @"^[A-Za-z]+").Value;
|
||||
string hlslElementTypeName = elementTypeName.ToLower();
|
||||
int i = int.Parse(Regex.Match(typeName, @"\d+$").Value);
|
||||
string formattable = elementTypeName == "Bool" ? "" : " : IFormattable";
|
||||
#>
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
#if !NET5_0
|
||||
using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="<#=typeName#>"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = <#=(elementSize * i)#>, Pack = <#=elementSize#>)]
|
||||
public unsafe partial struct <#=typeName#>
|
||||
public unsafe partial struct <#=typeName#><#=formattable#>
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
@@ -155,6 +161,85 @@ namespace ComputeSharp
|
||||
|
||||
PopIndent();
|
||||
PopIndent();
|
||||
WriteLine("");
|
||||
|
||||
if (elementTypeName == "Bool")
|
||||
{
|
||||
#>
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.Append('<');
|
||||
<#
|
||||
PushIndent(" ");
|
||||
PushIndent(" ");
|
||||
PushIndent(" ");
|
||||
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
WriteLine($"sb.Append(this.{"xyzw"[j]});");
|
||||
|
||||
if (j < i - 1)
|
||||
{
|
||||
WriteLine("sb.Append(\", \");");
|
||||
}
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
PopIndent();
|
||||
PopIndent();
|
||||
#>
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
<#
|
||||
}
|
||||
else
|
||||
{
|
||||
#>
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
sb.Append('<');
|
||||
<#
|
||||
PushIndent(" ");
|
||||
PushIndent(" ");
|
||||
PushIndent(" ");
|
||||
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
WriteLine($"sb.Append(this.{"xyzw"[j]}.ToString(format, formatProvider));");
|
||||
|
||||
if (j < i - 1)
|
||||
{
|
||||
WriteLine("sb.Append(separator);");
|
||||
WriteLine("sb.Append(' ');");
|
||||
}
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
PopIndent();
|
||||
PopIndent();
|
||||
#>
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
<#
|
||||
}
|
||||
|
||||
// Generate the negation operator
|
||||
if (elementTypeName != "Bool" && elementTypeName != "UInt")
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする