Move primitives to ComputeSharp.Core
このコミットが含まれているのは:
1 親
cc298770ca
コミット
e48949cd48
78ファイル変更
+369
-245
検索条件に一致するファイルはありません
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
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>
|
||||
[StructLayout(LayoutKind.Explicit, Size = sizeof(int), Pack = 4)]
|
||||
public readonly struct Bool
|
||||
{
|
||||
/// <summary>
|
||||
/// The wrapped <see cref="bool"/> value for the current instance.
|
||||
/// </summary>
|
||||
[FieldOffset(0)]
|
||||
private readonly bool Value;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool"/> instance for a given <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="value">.</param>
|
||||
private Bool(bool value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Bool x && Value == x.Value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Value.GetHashCode();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return Value.ToString();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="bool.ToString(IFormatProvider?)"/>
|
||||
public string ToString(IFormatProvider? formatProvider)
|
||||
{
|
||||
return Value.ToString();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc cref="bool.TryFormat(Span{char}, out int)"/>
|
||||
public bool TryFormat(Span<char> destination, out int charsWritten)
|
||||
{
|
||||
return Value.TryFormat(destination, out charsWritten);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not two <see cref="Bool"/> instances represent the same <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="left">The left <see cref="Bool"/> instance.</param>
|
||||
/// <param name="right">The right <see cref="Bool"/> instance.</param>
|
||||
public static bool operator ==(Bool left, Bool right) => left.Value == right.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not two <see cref="Bool"/> instances represent a different <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="left">The left <see cref="Bool"/> instance.</param>
|
||||
/// <param name="right">The right <see cref="Bool"/> instance.</param>
|
||||
public static bool operator !=(Bool left, Bool right) => left.Value != right.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Inverts the <see cref="bool"/> value represented by a given <see cref="Bool"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="x">The input <see cref="Bool"/> instance.</param>
|
||||
public static Bool operator !(Bool x) => new(!x.Value);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a given <see cref="Bool"/> instance to its corresponding <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The input <see cref="Bool"/> instance.</param>
|
||||
public static implicit operator bool(Bool x) => x.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="bool"/> value to a corresponding <see cref="Bool"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="x">The input <see cref="bool"/> value.</param>
|
||||
public static implicit operator Bool(bool x) => new(x);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool2"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
public Bool2(bool x, bool y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool2"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Bool2"/> instance.</param>
|
||||
public static implicit operator Bool2(bool x) => new(x, x);
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="Bool2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct Bool2
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(Bool2), sizeof(Bool4));
|
||||
|
||||
[FieldOffset(0)]
|
||||
private bool x;
|
||||
|
||||
[FieldOffset(4)]
|
||||
private bool y;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="Bool2"/> instance.
|
||||
/// </summary>
|
||||
/// <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 bool this[int i] => ref *(bool*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="bool"/> value representing the <c>X</c> component.
|
||||
/// </summary>
|
||||
public readonly ref bool X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="bool"/> value representing the <c>Y</c> component.
|
||||
/// </summary>
|
||||
public readonly ref bool Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 XX => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Bool2 XY => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Bool2 YX => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 YY => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 XXX => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 XXY => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 XYX => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 XYY => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 YXX => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 YXY => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 YYX => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 YYY => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 XXXX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 XXXY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 XXYX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 XXYY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 XYXX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 XYXY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 XYYX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 XYYY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 YXXX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 YXXY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 YXYX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 YXYY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 YYXX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 YYXY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 YYYX => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 YYYY => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="bool"/> value representing the <c>R</c> component.
|
||||
/// </summary>
|
||||
public readonly ref bool R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="bool"/> value representing the <c>G</c> component.
|
||||
/// </summary>
|
||||
public readonly ref bool G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 RR => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Bool2 RG => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Bool2 GR => ref *(Bool2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 RRR => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 RRG => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 RGR => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 RGG => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 GRR => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 GRG => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 GGR => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 GGG => ref *(Bool3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 RRRR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 RRRG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 RRGR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 RRGG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 RGRR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 RGRG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 RGGR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 RGGG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 GRRR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 GRRG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 GRGR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 GRGG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 GGRR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 GGRG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 GGGR => ref *(Bool4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 GGGG => ref *(Bool4*)UndefinedData;
|
||||
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[32], $"<{this.x}, {this.y}>");
|
||||
#else
|
||||
return $"<{this.x}, {this.y}>";
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Bool2"/> value.
|
||||
/// </summary>
|
||||
/// <param name="xy">The <see cref="Bool2"/> value to negate.</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 static Bool2 operator !(Bool2 xy) => default;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Bool2", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,75 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool3"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Bool3(bool x, bool y, bool z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Bool3(Bool2 xy, bool z)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yz">The value to assign to the second and thirt vector components.</param>
|
||||
public Bool3(bool x, Bool2 yz)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yz.X;
|
||||
this.z = yz.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool3"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Bool3"/> instance.</param>
|
||||
public static implicit operator Bool3(bool x) => new(x, x, x);
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Bool3", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,125 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="bool4"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Bool4(bool x, bool y, bool z, bool w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Bool4(Bool2 xy, bool z, bool w)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Bool4(bool x, bool y, Bool2 zw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Bool4(Bool2 xy, Bool2 zw)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The value to assign to the first, second and third vector components.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Bool4(Bool3 xyz, bool w)
|
||||
{
|
||||
this.x = xyz.X;
|
||||
this.y = xyz.Y;
|
||||
this.z = xyz.Z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yzw">The value to assign to the second, third and fourth vector components.</param>
|
||||
public Bool4(bool x, Bool3 yzw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yzw.X;
|
||||
this.z = yzw.Y;
|
||||
this.w = yzw.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Bool4"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Bool4"/> instance.</param>
|
||||
public static implicit operator Bool4(bool x) => new(x, x, x, x);
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Bool4", sizeof(int));
|
||||
#>
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\MatrixType.ttinclude" #>
|
||||
<#
|
||||
GenerateAllMatrixProperties("Bool", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,65 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double2"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
public Double2(double x, double y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double2"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Double2"/> instance.</param>
|
||||
public static implicit operator Double2(double x) => new(x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double2"/> value to a <see cref="Int2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Double2"/> value to cast.</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 static explicit operator Int2(Double2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double2"/> value to a <see cref="UInt2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Double2"/> value to cast.</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 static explicit operator UInt2(Double2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double2"/> value to a <see cref="Float2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Double2"/> value to cast.</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 static explicit operator Float2(Double2 xy) => default;
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="Double2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
|
||||
public unsafe partial struct Double2
|
||||
#if NET6_0_OR_GREATER
|
||||
: ISpanFormattable
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(Double2), sizeof(Double4));
|
||||
|
||||
[FieldOffset(0)]
|
||||
private double x;
|
||||
|
||||
[FieldOffset(8)]
|
||||
private double y;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="Double2"/> instance.
|
||||
/// </summary>
|
||||
/// <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 double this[int i] => ref *(double*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="double"/> value representing the <c>X</c> component.
|
||||
/// </summary>
|
||||
public readonly ref double X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="double"/> value representing the <c>Y</c> component.
|
||||
/// </summary>
|
||||
public readonly ref double Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double2 XX => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double2 XY => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double2 YX => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double2 YY => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double3 XXX => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double3 XXY => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double3 XYX => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double3 XYY => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double3 YXX => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double3 YXY => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double3 YYX => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double3 YYY => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double4 XXXX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 XXXY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double4 XXYX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 XXYY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double4 XYXX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 XYXY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double4 XYYX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 XYYY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double4 YXXX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 YXXY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double4 YXYX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 YXYY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Double4 YYXX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 YYXY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Double4 YYYX => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Double4 YYYY => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="double"/> value representing the <c>R</c> component.
|
||||
/// </summary>
|
||||
public readonly ref double R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="double"/> value representing the <c>G</c> component.
|
||||
/// </summary>
|
||||
public readonly ref double G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double2 RR => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double2 RG => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double2 GR => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double2 GG => ref *(Double2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double3 RRR => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double3 RRG => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double3 RGR => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double3 RGG => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double3 GRR => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double3 GRG => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double3 GGR => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double3 GGG => ref *(Double3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double4 RRRR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double4 RRRG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double4 RRGR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double4 RRGG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double4 RGRR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double4 RGRG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double4 RGGR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double4 RGGG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double4 GRRR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double4 GRRG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double4 GRGR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double4 GRGG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Double4 GGRR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Double4 GGRG => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Double4 GGGR => ref *(Double4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Double4 GGGG => ref *(Double4*)UndefinedData;
|
||||
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
string separator = NumberFormatInfo.CurrentInfo.NumberGroupSeparator;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[64], $"<{this.x}{separator} {this.y}>");
|
||||
#else
|
||||
return $"<{this.x}{separator} {this.y}>";
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
return FormatInterpolatedStringHandler.Create(
|
||||
format,
|
||||
formatProvider,
|
||||
stackalloc char[64],
|
||||
$"<{this.x}{separator} {this.y}>");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(provider).NumberGroupSeparator;
|
||||
|
||||
return TryWriteFormatInterpolatedStringHandler.TryWrite(
|
||||
destination,
|
||||
format,
|
||||
provider,
|
||||
$"<{this.x}{separator} {this.y}>",
|
||||
out charsWritten);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Double2"/> value.
|
||||
/// </summary>
|
||||
/// <param name="xy">The <see cref="Double2"/> value to negate.</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 static Double2 operator -(Double2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="Double2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Double2"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="Double2"/> value to sum.</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 static Double2 operator +(Double2 left, Double2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="Double2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Double2"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="Double2"/> value to divide.</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 static Double2 operator /(Double2 left, Double2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="Double2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Double2"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="Double2"/> value to multiply.</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 static Double2 operator *(Double2 left, Double2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="Double2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Double2"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="Double2"/> value to subtract.</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 static Double2 operator -(Double2 left, Double2 right) => default;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Double2", sizeof(double));
|
||||
#>
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double3"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Double3(double x, double y, double z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Double3(Double2 xy, double z)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yz">The value to assign to the second and thirt vector components.</param>
|
||||
public Double3(double x, Double2 yz)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yz.X;
|
||||
this.z = yz.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double3"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Double3"/> instance.</param>
|
||||
public static implicit operator Double3(double x) => new(x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double3"/> value to a <see cref="Int3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Double3"/> value to cast.</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 static explicit operator Int3(Double3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double3"/> value to a <see cref="UInt3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Double3"/> value to cast.</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 static explicit operator UInt3(Double3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double3"/> value to a <see cref="Float3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Double3"/> value to cast.</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 static explicit operator Float3(Double3 xyz) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Double3", sizeof(double));
|
||||
#>
|
||||
@@ -0,0 +1,146 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="double4"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Double4(double x, double y, double z, double w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Double4(Double2 xy, double z, double w)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Double4(double x, double y, Double2 zw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Double4(Double2 xy, Double2 zw)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The value to assign to the first, second and third vector components.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Double4(Double3 xyz, double w)
|
||||
{
|
||||
this.x = xyz.X;
|
||||
this.y = xyz.Y;
|
||||
this.z = xyz.Z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yzw">The value to assign to the second, third and fourth vector components.</param>
|
||||
public Double4(double x, Double3 yzw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yzw.X;
|
||||
this.z = yzw.Y;
|
||||
this.w = yzw.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Double4"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Double4"/> instance.</param>
|
||||
public static implicit operator Double4(double x) => new(x, x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double4"/> value to a <see cref="Int4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Double4"/> value to cast.</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 static explicit operator Int4(Double4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double4"/> value to a <see cref="UInt4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Double4"/> value to cast.</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 static explicit operator UInt4(Double4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Double4"/> value to a <see cref="Float4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Double4"/> value to cast.</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 static explicit operator Float4(Double4 xyzw) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Double4", sizeof(double));
|
||||
#>
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\MatrixType.ttinclude" #>
|
||||
<#
|
||||
GenerateAllMatrixProperties("Double", sizeof(double));
|
||||
#>
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float2"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
public Float2(float x, float y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float2"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float2"/> instance.</param>
|
||||
public static implicit operator Float2(float x) => new(x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="Vector2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float2"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector2(Float2 xy) => *(Vector2*)&xy;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector2"/> value to a <see cref="Float2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Vector2"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float2(Vector2 xy) => *(Float2*)&xy;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="Double2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float2"/> value to cast.</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 static implicit operator Double2(Float2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="Int2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float2"/> value to cast.</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 static explicit operator Int2(Float2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float2"/> value to a <see cref="UInt2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Float2"/> value to cast.</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 static explicit operator UInt2(Float2 xy) => default;
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="Float2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct Float2
|
||||
#if NET6_0_OR_GREATER
|
||||
: ISpanFormattable
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(Float2), sizeof(Float4));
|
||||
|
||||
[FieldOffset(0)]
|
||||
private float x;
|
||||
|
||||
[FieldOffset(4)]
|
||||
private float y;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="Float2"/> instance.
|
||||
/// </summary>
|
||||
/// <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 float this[int i] => ref *(float*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="float"/> value representing the <c>X</c> component.
|
||||
/// </summary>
|
||||
public readonly ref float X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="float"/> value representing the <c>Y</c> component.
|
||||
/// </summary>
|
||||
public readonly ref float Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float2 XX => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float2 XY => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float2 YX => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float2 YY => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float3 XXX => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float3 XXY => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float3 XYX => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float3 XYY => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float3 YXX => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float3 YXY => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float3 YYX => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float3 YYY => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float4 XXXX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 XXXY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float4 XXYX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 XXYY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float4 XYXX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 XYXY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float4 XYYX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 XYYY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float4 YXXX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 YXXY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float4 YXYX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 YXYY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Float4 YYXX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 YYXY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Float4 YYYX => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Float4 YYYY => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="float"/> value representing the <c>R</c> component.
|
||||
/// </summary>
|
||||
public readonly ref float R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="float"/> value representing the <c>G</c> component.
|
||||
/// </summary>
|
||||
public readonly ref float G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float2 RR => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float2 RG => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float2 GR => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float2 GG => ref *(Float2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float3 RRR => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float3 RRG => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float3 RGR => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float3 RGG => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float3 GRR => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float3 GRG => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float3 GGR => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float3 GGG => ref *(Float3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float4 RRRR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float4 RRRG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float4 RRGR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float4 RRGG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float4 RGRR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float4 RGRG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float4 RGGR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float4 RGGG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float4 GRRR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float4 GRRG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float4 GRGR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float4 GRGG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Float4 GGRR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Float4 GGRG => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Float4 GGGR => ref *(Float4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Float4 GGGG => ref *(Float4*)UndefinedData;
|
||||
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
string separator = NumberFormatInfo.CurrentInfo.NumberGroupSeparator;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[64], $"<{this.x}{separator} {this.y}>");
|
||||
#else
|
||||
return $"<{this.x}{separator} {this.y}>";
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
return FormatInterpolatedStringHandler.Create(
|
||||
format,
|
||||
formatProvider,
|
||||
stackalloc char[64],
|
||||
$"<{this.x}{separator} {this.y}>");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(provider).NumberGroupSeparator;
|
||||
|
||||
return TryWriteFormatInterpolatedStringHandler.TryWrite(
|
||||
destination,
|
||||
format,
|
||||
provider,
|
||||
$"<{this.x}{separator} {this.y}>",
|
||||
out charsWritten);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Float2"/> value.
|
||||
/// </summary>
|
||||
/// <param name="xy">The <see cref="Float2"/> value to negate.</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 static Float2 operator -(Float2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="Float2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Float2"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="Float2"/> value to sum.</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 static Float2 operator +(Float2 left, Float2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="Float2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Float2"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="Float2"/> value to divide.</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 static Float2 operator /(Float2 left, Float2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="Float2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Float2"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="Float2"/> value to multiply.</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 static Float2 operator *(Float2 left, Float2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="Float2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Float2"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="Float2"/> value to subtract.</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 static Float2 operator -(Float2 left, Float2 right) => default;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Float2", sizeof(float));
|
||||
#>
|
||||
@@ -0,0 +1,110 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float3"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Float3(float x, float y, float z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Float3(Float2 xy, float z)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yz">The value to assign to the second and thirt vector components.</param>
|
||||
public Float3(float x, Float2 yz)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yz.X;
|
||||
this.z = yz.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float3"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float3"/> instance.</param>
|
||||
public static implicit operator Float3(float x) => new(x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="Vector3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Float3"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector3(Float3 xyz) => *(Vector3*)&xyz;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector3"/> value to a <see cref="Float3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Vector3"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float3(Vector3 xyz) => *(Float3*)&xyz;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="Double3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Float3"/> value to cast.</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 static implicit operator Double3(Float3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="Int3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Float3"/> value to cast.</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 static explicit operator Int3(Float3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float3"/> value to a <see cref="UInt3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Float3"/> value to cast.</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 static explicit operator UInt3(Float3 xyz) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Float3", sizeof(float));
|
||||
#>
|
||||
@@ -0,0 +1,160 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="float4"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Float4(float x, float y, float z, float w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Float4(Float2 xy, float z, float w)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Float4(float x, float y, Float2 zw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Float4(Float2 xy, Float2 zw)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The value to assign to the first, second and third vector components.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Float4(Float3 xyz, float w)
|
||||
{
|
||||
this.x = xyz.X;
|
||||
this.y = xyz.Y;
|
||||
this.z = xyz.Z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yzw">The value to assign to the second, third and fourth vector components.</param>
|
||||
public Float4(float x, Float3 yzw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yzw.X;
|
||||
this.z = yzw.Y;
|
||||
this.w = yzw.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Float4"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Float4"/> instance.</param>
|
||||
public static implicit operator Float4(float x) => new(x, x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="Vector4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Float4"/> value to cast.</param>
|
||||
public static unsafe implicit operator Vector4(Float4 xyzw) => *(Vector4*)&xyzw;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Vector4"/> value to a <see cref="Float4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Vector4"/> value to cast.</param>
|
||||
public static unsafe implicit operator Float4(Vector4 xyzw) => *(Float4*)&xyzw;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="Double4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Float4"/> value to cast.</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 static implicit operator Double4(Float4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="Int4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Float4"/> value to cast.</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 static explicit operator Int4(Float4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Float4"/> value to a <see cref="UInt4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Float4"/> value to cast.</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 static explicit operator UInt4(Float4 xyzw) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Float4", sizeof(float));
|
||||
#>
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\MatrixType.ttinclude" #>
|
||||
<#
|
||||
GenerateAllMatrixProperties("Float", sizeof(float));
|
||||
#>
|
||||
@@ -0,0 +1,65 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int2"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
public Int2(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int2"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Int2"/> instance.</param>
|
||||
public static implicit operator Int2(int x) => new(x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int2"/> value to a <see cref="UInt2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Int2"/> value to cast.</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 static explicit operator UInt2(Int2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int2"/> value to a <see cref="Float2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Int2"/> value to cast.</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 static implicit operator Float2(Int2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int2"/> value to a <see cref="Double2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="Int2"/> value to cast.</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 static implicit operator Double2(Int2 xy) => default;
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="Int2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct Int2
|
||||
#if NET6_0_OR_GREATER
|
||||
: ISpanFormattable
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(Int2), sizeof(Int4));
|
||||
|
||||
[FieldOffset(0)]
|
||||
private int x;
|
||||
|
||||
[FieldOffset(4)]
|
||||
private int y;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="Int2"/> instance.
|
||||
/// </summary>
|
||||
/// <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 int this[int i] => ref *(int*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="int"/> value representing the <c>X</c> component.
|
||||
/// </summary>
|
||||
public readonly ref int X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="int"/> value representing the <c>Y</c> component.
|
||||
/// </summary>
|
||||
public readonly ref int Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int2 XX => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int2 XY => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int2 YX => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int2 YY => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int3 XXX => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int3 XXY => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int3 XYX => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int3 XYY => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int3 YXX => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int3 YXY => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int3 YYX => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int3 YYY => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int4 XXXX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 XXXY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int4 XXYX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 XXYY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int4 XYXX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 XYXY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int4 XYYX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 XYYY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int4 YXXX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 YXXY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int4 YXYX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 YXYY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 Int4 YYXX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 YYXY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 Int4 YYYX => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 Int4 YYYY => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="int"/> value representing the <c>R</c> component.
|
||||
/// </summary>
|
||||
public readonly ref int R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="int"/> value representing the <c>G</c> component.
|
||||
/// </summary>
|
||||
public readonly ref int G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int2 RR => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int2 RG => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int2 GR => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int2 GG => ref *(Int2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int3 RRR => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int3 RRG => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int3 RGR => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int3 RGG => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int3 GRR => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int3 GRG => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int3 GGR => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int3 GGG => ref *(Int3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int4 RRRR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int4 RRRG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int4 RRGR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int4 RRGG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int4 RGRR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int4 RGRG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int4 RGGR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int4 RGGG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int4 GRRR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int4 GRRG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int4 GRGR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int4 GRGG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 Int4 GGRR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 Int4 GGRG => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 Int4 GGGR => ref *(Int4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 Int4 GGGG => ref *(Int4*)UndefinedData;
|
||||
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
string separator = NumberFormatInfo.CurrentInfo.NumberGroupSeparator;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[64], $"<{this.x}{separator} {this.y}>");
|
||||
#else
|
||||
return $"<{this.x}{separator} {this.y}>";
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
return FormatInterpolatedStringHandler.Create(
|
||||
format,
|
||||
formatProvider,
|
||||
stackalloc char[64],
|
||||
$"<{this.x}{separator} {this.y}>");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(provider).NumberGroupSeparator;
|
||||
|
||||
return TryWriteFormatInterpolatedStringHandler.TryWrite(
|
||||
destination,
|
||||
format,
|
||||
provider,
|
||||
$"<{this.x}{separator} {this.y}>",
|
||||
out charsWritten);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Negates a <see cref="Int2"/> value.
|
||||
/// </summary>
|
||||
/// <param name="xy">The <see cref="Int2"/> value to negate.</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 static Int2 operator -(Int2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="Int2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Int2"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="Int2"/> value to sum.</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 static Int2 operator +(Int2 left, Int2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="Int2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Int2"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="Int2"/> value to divide.</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 static Int2 operator /(Int2 left, Int2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="Int2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Int2"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="Int2"/> value to multiply.</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 static Int2 operator *(Int2 left, Int2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="Int2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Int2"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="Int2"/> value to subtract.</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 static Int2 operator -(Int2 left, Int2 right) => default;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Int2", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int3"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Int3(int x, int y, int z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public Int3(Int2 xy, int z)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yz">The value to assign to the second and thirt vector components.</param>
|
||||
public Int3(int x, Int2 yz)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yz.X;
|
||||
this.z = yz.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int3"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Int3"/> instance.</param>
|
||||
public static implicit operator Int3(int x) => new(x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int3"/> value to a <see cref="UInt3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Int3"/> value to cast.</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 static explicit operator UInt3(Int3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int3"/> value to a <see cref="Float3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Int3"/> value to cast.</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 static implicit operator Float3(Int3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int3"/> value to a <see cref="Double3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="Int3"/> value to cast.</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 static implicit operator Double3(Int3 xyz) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Int3", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,146 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="int4"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Int4(int x, int y, int z, int w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Int4(Int2 xy, int z, int w)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Int4(int x, int y, Int2 zw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public Int4(Int2 xy, Int2 zw)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The value to assign to the first, second and third vector components.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public Int4(Int3 xyz, int w)
|
||||
{
|
||||
this.x = xyz.X;
|
||||
this.y = xyz.Y;
|
||||
this.z = xyz.Z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yzw">The value to assign to the second, third and fourth vector components.</param>
|
||||
public Int4(int x, Int3 yzw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yzw.X;
|
||||
this.z = yzw.Y;
|
||||
this.w = yzw.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Int4"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="Int4"/> instance.</param>
|
||||
public static implicit operator Int4(int x) => new(x, x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int4"/> value to a <see cref="UInt4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Int4"/> value to cast.</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 static explicit operator UInt4(Int4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int4"/> value to a <see cref="Float4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Int4"/> value to cast.</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 static implicit operator Float4(Int4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="Int4"/> value to a <see cref="Double4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="Int4"/> value to cast.</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 static implicit operator Double4(Int4 xyzw) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("Int4", sizeof(int));
|
||||
#>
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\MatrixType.ttinclude" #>
|
||||
<#
|
||||
GenerateAllMatrixProperties("Int", sizeof(int));
|
||||
#>
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A type indicating a base-1 index into a matrix type. This can be used to extract references to swizzled vectors within a given matrix value.
|
||||
/// For more info, see <see href="https://docs.microsoft.com/windows/win32/direct3dhlsl/dx-graphics-hlsl-per-component-math"/>.
|
||||
/// <para>This type is meant to be used within a <see langword="using static"/> directive to simplify the code:</para>
|
||||
/// <para>
|
||||
/// <c>
|
||||
/// using static ComputeSharp.MatrixIndex;
|
||||
/// Float2x2 matrix = 0;
|
||||
/// Float2 row = matrix[M11, M12];
|
||||
/// </c>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public enum MatrixIndex
|
||||
{
|
||||
/// <summary>
|
||||
/// The first item in the first row.
|
||||
/// </summary>
|
||||
M11,
|
||||
|
||||
/// <summary>
|
||||
/// The second item in the first row.
|
||||
/// </summary>
|
||||
M12,
|
||||
|
||||
/// <summary>
|
||||
/// The third item in the first row.
|
||||
/// </summary>
|
||||
M13,
|
||||
|
||||
/// <summary>
|
||||
/// The fourth item in the first row.
|
||||
/// </summary>
|
||||
M14,
|
||||
|
||||
/// <summary>
|
||||
/// The first item in the second row.
|
||||
/// </summary>
|
||||
M21,
|
||||
|
||||
/// <summary>
|
||||
/// The second item in the second row.
|
||||
/// </summary>
|
||||
M22,
|
||||
|
||||
/// <summary>
|
||||
/// The third item in the second row.
|
||||
/// </summary>
|
||||
M23,
|
||||
|
||||
/// <summary>
|
||||
/// The fourth item in the second row.
|
||||
/// </summary>
|
||||
M24,
|
||||
|
||||
/// <summary>
|
||||
/// The first item in the third row.
|
||||
/// </summary>
|
||||
M31,
|
||||
|
||||
/// <summary>
|
||||
/// The second item in the third row.
|
||||
/// </summary>
|
||||
M32,
|
||||
|
||||
/// <summary>
|
||||
/// The third item in the third row.
|
||||
/// </summary>
|
||||
M33,
|
||||
|
||||
/// <summary>
|
||||
/// The fourth item in the third row.
|
||||
/// </summary>
|
||||
M34,
|
||||
|
||||
/// <summary>
|
||||
/// The first item in the fourth row.
|
||||
/// </summary>
|
||||
M41,
|
||||
|
||||
/// <summary>
|
||||
/// The second item in the fourth row.
|
||||
/// </summary>
|
||||
M42,
|
||||
|
||||
/// <summary>
|
||||
/// The third item in the fourth row.
|
||||
/// </summary>
|
||||
M43,
|
||||
|
||||
/// <summary>
|
||||
/// The fourth item in the fourth row.
|
||||
/// </summary>
|
||||
M44
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Text.RegularExpressions" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension=".g.cs"#>
|
||||
<#
|
||||
// Generates all matrix members and types for a given HLSL type
|
||||
void GenerateAllMatrixProperties(string typeName, int elementSize)
|
||||
{
|
||||
#>
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
<#
|
||||
for (int rows = 1; rows <= 4; rows++)
|
||||
for (int columns = 1; columns <= 4; columns++)
|
||||
{
|
||||
if (rows > 1 || columns > 1) WriteLine("");
|
||||
|
||||
GenerateMatrixProperties(typeName, rows, columns, elementSize);
|
||||
}
|
||||
}
|
||||
|
||||
// Generates all vector access properties for a specified type
|
||||
void GenerateMatrixProperties(string typeName, int rows, int columns, int elementSize)
|
||||
{
|
||||
string elementTypeName = typeName.ToLower();
|
||||
string fullTypeName = $"{typeName}{rows}x{columns}";
|
||||
string rowTypeName = columns > 1 ? $"{typeName}{columns}" : elementTypeName;
|
||||
List<string> fieldNames = new List<string>();
|
||||
#>
|
||||
/// <inheritdoc cref="<#=fullTypeName#>"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = <#=(elementSize * rows * columns)#>, Pack = <#=elementSize#>)]
|
||||
public unsafe partial struct <#=fullTypeName#>
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(<#=fullTypeName#>), sizeof(<#=typeName#>4));
|
||||
<#
|
||||
WriteLine("");
|
||||
PushIndent(" ");
|
||||
|
||||
// Generate the private fields
|
||||
for (int i = 1; i <= rows; i++)
|
||||
for (int j = 1; j <= columns; j++)
|
||||
{
|
||||
WriteLine($"[FieldOffset({((i - 1) * columns + j - 1) * elementSize})]");
|
||||
WriteLine($"private {elementTypeName} m{i}{j};");
|
||||
WriteLine("");
|
||||
|
||||
fieldNames.Add($"m{i}{j}");
|
||||
}
|
||||
|
||||
// Generate the elementwise constructor
|
||||
WriteLine("/// <summary>");
|
||||
WriteLine($"/// Creates a new <see cref=\"{fullTypeName}\"/> instance with the specified parameters.");
|
||||
WriteLine("/// </summary>");
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
for (int j = 1; j <= columns; j++)
|
||||
{
|
||||
WriteLine($"/// <param name=\"m{i}{j}\">The value to assign to the component at position [{i}, {j}].</param>");
|
||||
}
|
||||
|
||||
WriteLine($"public {fullTypeName}({string.Join(", ", fieldNames.Select(n => $"{elementTypeName} {n}"))})");
|
||||
WriteLine("{");
|
||||
PushIndent(" ");
|
||||
|
||||
foreach (string fieldName in fieldNames)
|
||||
{
|
||||
WriteLine($"this.{fieldName} = {fieldName};");
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
WriteLine("}");
|
||||
WriteLine("");
|
||||
|
||||
// Generate the row-wise constructor, if needed
|
||||
if (rows > 1 && columns > 1)
|
||||
{
|
||||
WriteLine("/// <summary>");
|
||||
WriteLine($"/// Creates a new <see cref=\"{fullTypeName}\"/> instance with the specified parameters.");
|
||||
WriteLine("/// </summary>");
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
{
|
||||
WriteLine($"/// <param name=\"row{i}\">The value to assign to the row at position [{i}].</param>");
|
||||
}
|
||||
|
||||
Write($"public {fullTypeName}(");
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
{
|
||||
if (i > 1) Write(", ");
|
||||
Write($"{rowTypeName} row{i}");
|
||||
}
|
||||
|
||||
WriteLine(")");
|
||||
WriteLine("{");
|
||||
PushIndent(" ");
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
for (int j = 1; j <= columns; j++)
|
||||
{
|
||||
WriteLine($"this.m{i}{j} = row{i}.{"XYZW"[j - 1]};");
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
WriteLine("}");
|
||||
WriteLine("");
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
#>
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific row in the current <see cref="<#=fullTypeName#>"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="row">The row 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 <#=rowTypeName#> this[int row] => ref *(<#=rowTypeName#>*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="xy0">The identifier of the first item to index.</param>
|
||||
/// <param name="xy1">The identifier of the second item to index.</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 <#=typeName#>2 this[MatrixIndex xy0, MatrixIndex xy1] => ref *(<#=typeName#>2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="xy0">The identifier of the first item to index.</param>
|
||||
/// <param name="xy1">The identifier of the second item to index.</param>
|
||||
/// <param name="xy2">The identifier of the third item to index.</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 <#=typeName#>3 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2] => ref *(<#=typeName#>3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="xy0">The identifier of the first item to index.</param>
|
||||
/// <param name="xy1">The identifier of the second item to index.</param>
|
||||
/// <param name="xy2">The identifier of the third item to index.</param>
|
||||
/// <param name="xy3">The identifier of the fourth item to index.</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 <#=typeName#>4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => ref *(<#=typeName#>4*)UndefinedData;
|
||||
<#
|
||||
for (int i = 1; i <= rows; i++)
|
||||
for (int j = 1; j <= columns; j++)
|
||||
{
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="<#=elementTypeName#>"/> value representing the component at position [<#=i#>, <#=j#>].
|
||||
/// </summary>
|
||||
public readonly ref <#=elementTypeName#> M<#=i#><#=j#> => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.m<#=i#><#=j#>), 1));
|
||||
<#
|
||||
}
|
||||
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="<#=fullTypeName#>"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="<#=fullTypeName#>"/> instance.</param>
|
||||
public static implicit operator <#=fullTypeName#>(<#=elementTypeName#> x)
|
||||
<#
|
||||
// Complete the conversion operator above
|
||||
PushIndent(" ");
|
||||
WriteLine("{");
|
||||
PushIndent(" ");
|
||||
WriteLine($"{fullTypeName} matrix;");
|
||||
WriteLine("");
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
for (int j = 1; j <= columns; j++)
|
||||
{
|
||||
WriteLine($"matrix.m{i}{j} = x;");
|
||||
}
|
||||
|
||||
WriteLine("");
|
||||
WriteLine("return matrix;");
|
||||
|
||||
PopIndent();
|
||||
WriteLine("}");
|
||||
PopIndent();
|
||||
|
||||
// Generate the negation operator
|
||||
if (typeName != "UInt")
|
||||
{
|
||||
WriteLine("");
|
||||
|
||||
string operatorName = typeName == "Bool" ? "!" : "-";
|
||||
#>
|
||||
/// <summary>
|
||||
/// Negates a <see cref="<#=fullTypeName#>"/> value.
|
||||
/// </summary>
|
||||
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to negate.</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 static <#=fullTypeName#> operator <#=operatorName#>(<#=fullTypeName#> matrix) => default;
|
||||
<#
|
||||
}
|
||||
|
||||
// Generate the numerical operators
|
||||
if (typeName != "Bool")
|
||||
{
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Sums two <see cref="<#=fullTypeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=fullTypeName#>"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="<#=fullTypeName#>"/> value to sum.</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 static <#=fullTypeName#> operator +(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="<#=fullTypeName#>"/> values (elementwise division).
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=fullTypeName#>"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="<#=fullTypeName#>"/> value to divide.</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 static <#=fullTypeName#> operator /(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="<#=fullTypeName#>"/> values (elementwise product).
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=fullTypeName#>"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="<#=fullTypeName#>"/> value to multiply.</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 static <#=fullTypeName#> operator *(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="<#=fullTypeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=fullTypeName#>"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="<#=fullTypeName#>"/> value to subtract.</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 static <#=fullTypeName#> operator -(<#=fullTypeName#> left, <#=fullTypeName#> right) => default;
|
||||
<#
|
||||
}
|
||||
|
||||
// Generate the casting operators for row/column vectors
|
||||
if (rows == 1 && columns > 1)
|
||||
{
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Casts a <see cref="<#=typeName#><#=columns#>"/> value to a <see cref="<#=fullTypeName#>"/> one.
|
||||
/// </summary>
|
||||
/// <param name="vector">The input <see cref="<#=typeName#><#=columns#>"/> value to cast.</param>
|
||||
public static implicit operator <#=fullTypeName#>(<#=typeName#><#=columns#> vector) => *(<#=fullTypeName#>*)&vector;
|
||||
<#
|
||||
}
|
||||
|
||||
if (columns == 1 && rows > 1)
|
||||
{
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Casts a <see cref="<#=fullTypeName#>"/> value to a <see cref="<#=typeName#><#=rows#>"/> one.
|
||||
/// </summary>
|
||||
/// <param name="matrix">The input <see cref="<#=fullTypeName#>"/> value to cast.</param>
|
||||
public static implicit operator <#=typeName#><#=rows#>(<#=fullTypeName#> matrix) => *(<#=typeName#><#=rows#>*)&matrix;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
}
|
||||
#>
|
||||
@@ -0,0 +1,65 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint2"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
public UInt2(uint x, uint y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt2"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="UInt2"/> instance.</param>
|
||||
public static implicit operator UInt2(uint x) => new(x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt2"/> value to a <see cref="Int2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="UInt2"/> value to cast.</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 static explicit operator Int2(UInt2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt2"/> value to a <see cref="Float2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="UInt2"/> value to cast.</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 static implicit operator Float2(UInt2 xy) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt2"/> value to a <see cref="Double2"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xy">The input <see cref="UInt2"/> value to cast.</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 static implicit operator Double2(UInt2 xy) => default;
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="UInt2"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)]
|
||||
public unsafe partial struct UInt2
|
||||
#if NET6_0_OR_GREATER
|
||||
: ISpanFormattable
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(UInt2), sizeof(UInt4));
|
||||
|
||||
[FieldOffset(0)]
|
||||
private uint x;
|
||||
|
||||
[FieldOffset(4)]
|
||||
private uint y;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="UInt2"/> instance.
|
||||
/// </summary>
|
||||
/// <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 uint this[int i] => ref *(uint*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="uint"/> value representing the <c>X</c> component.
|
||||
/// </summary>
|
||||
public readonly ref uint X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="uint"/> value representing the <c>Y</c> component.
|
||||
/// </summary>
|
||||
public readonly ref uint Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt2 XX => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt2 XY => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt2 YX => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt2 YY => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt3 XXX => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt3 XXY => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt3 XYX => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt3 XYY => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt3 YXX => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt3 YXY => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt3 YYX => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt3 YYY => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 XXXX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 XXXY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 XXYX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 XXYY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 XYXX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 XYXY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 XYYX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 XYYY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 YXXX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 YXXY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 YXYX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 YXYY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 YYXX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 YYXY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </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 UInt4 YYYX => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </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 UInt4 YYYY => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="uint"/> value representing the <c>R</c> component.
|
||||
/// </summary>
|
||||
public readonly ref uint R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="uint"/> value representing the <c>G</c> component.
|
||||
/// </summary>
|
||||
public readonly ref uint G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt2 RR => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt2 RG => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt2 GR => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt2 GG => ref *(UInt2*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt3 RRR => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt3 RRG => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt3 RGR => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt3 RGG => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt3 GRR => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt3 GRG => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt3 GGR => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt3 GGG => ref *(UInt3*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 RRRR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 RRRG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 RRGR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 RRGG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 RGRR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 RGRG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 RGGR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 RGGG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 GRRR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 GRRG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 GRGR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 GRGG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 GGRR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 GGRG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
|
||||
/// </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 UInt4 GGGR => ref *(UInt4*)UndefinedData;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
|
||||
/// </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 UInt4 GGGG => ref *(UInt4*)UndefinedData;
|
||||
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
string separator = NumberFormatInfo.CurrentInfo.NumberGroupSeparator;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[64], $"<{this.x}{separator} {this.y}>");
|
||||
#else
|
||||
return $"<{this.x}{separator} {this.y}>";
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
return FormatInterpolatedStringHandler.Create(
|
||||
format,
|
||||
formatProvider,
|
||||
stackalloc char[64],
|
||||
$"<{this.x}{separator} {this.y}>");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(provider).NumberGroupSeparator;
|
||||
|
||||
return TryWriteFormatInterpolatedStringHandler.TryWrite(
|
||||
destination,
|
||||
format,
|
||||
provider,
|
||||
$"<{this.x}{separator} {this.y}>",
|
||||
out charsWritten);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Sums two <see cref="UInt2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="UInt2"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="UInt2"/> value to sum.</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 static UInt2 operator +(UInt2 left, UInt2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="UInt2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="UInt2"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="UInt2"/> value to divide.</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 static UInt2 operator /(UInt2 left, UInt2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="UInt2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="UInt2"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="UInt2"/> value to multiply.</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 static UInt2 operator *(UInt2 left, UInt2 right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="UInt2"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="UInt2"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="UInt2"/> value to subtract.</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 static UInt2 operator -(UInt2 left, UInt2 right) => default;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("UInt2", sizeof(uint));
|
||||
#>
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint3"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public UInt3(uint x, uint y, uint z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
public UInt3(UInt2 xy, uint z)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt3"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yz">The value to assign to the second and thirt vector components.</param>
|
||||
public UInt3(uint x, UInt2 yz)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yz.X;
|
||||
this.z = yz.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt3"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="UInt3"/> instance.</param>
|
||||
public static implicit operator UInt3(uint x) => new(x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt3"/> value to a <see cref="Int3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="UInt3"/> value to cast.</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 static explicit operator Int3(UInt3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt3"/> value to a <see cref="Float3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="UInt3"/> value to cast.</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 static implicit operator Float3(UInt3 xyz) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt3"/> value to a <see cref="Double3"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The input <see cref="UInt3"/> value to cast.</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 static implicit operator Double3(UInt3 xyz) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("UInt3", sizeof(uint));
|
||||
#>
|
||||
@@ -0,0 +1,146 @@
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> that maps the <see langword="uint4"/> HLSL type.
|
||||
/// </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>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public UInt4(uint x, uint y, uint z, uint w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="z">The value to assign to the third vector component.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public UInt4(UInt2 xy, uint z, uint w)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="y">The value to assign to the second vector component.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public UInt4(uint x, uint y, UInt2 zw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xy">The value to assign to the first and second vector components.</param>
|
||||
/// <param name="zw">The value to assign to the third and fourth vector components.</param>
|
||||
public UInt4(UInt2 xy, UInt2 zw)
|
||||
{
|
||||
this.x = xy.X;
|
||||
this.y = xy.Y;
|
||||
this.z = zw.X;
|
||||
this.w = zw.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The value to assign to the first, second and third vector components.</param>
|
||||
/// <param name="w">The value to assign to the fourth vector component.</param>
|
||||
public UInt4(UInt3 xyz, uint w)
|
||||
{
|
||||
this.x = xyz.X;
|
||||
this.y = xyz.Y;
|
||||
this.z = xyz.Z;
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to assign to the first vector component.</param>
|
||||
/// <param name="yzw">The value to assign to the second, third and fourth vector components.</param>
|
||||
public UInt4(uint x, UInt3 yzw)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = yzw.X;
|
||||
this.z = yzw.Y;
|
||||
this.w = yzw.Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UInt4"/> value with the same value for all its components.
|
||||
/// </summary>
|
||||
/// <param name="x">The value to use for the components of the new <see cref="UInt4"/> instance.</param>
|
||||
public static implicit operator UInt4(uint x) => new(x, x, x, x);
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt4"/> value to a <see cref="Int4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="UInt4"/> value to cast.</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 static explicit operator Int4(UInt4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt4"/> value to a <see cref="Float4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="UInt4"/> value to cast.</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 static implicit operator Float4(UInt4 xyzw) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Casts a <see cref="UInt4"/> value to a <see cref="Double4"/> one.
|
||||
/// </summary>
|
||||
/// <param name="xyzw">The input <see cref="UInt4"/> value to cast.</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 static implicit operator Double4(UInt4 xyzw) => default;
|
||||
}
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\VectorType.ttinclude" #>
|
||||
<#
|
||||
GenerateVectorProperties("UInt4", sizeof(uint));
|
||||
#>
|
||||
ファイル差分が大きすぎるため表示されません。
差分を読み込み
@@ -0,0 +1,4 @@
|
||||
<#@include file="..\MatrixType.ttinclude" #>
|
||||
<#
|
||||
GenerateAllMatrixProperties("UInt", sizeof(uint));
|
||||
#>
|
||||
@@ -0,0 +1,284 @@
|
||||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Text.RegularExpressions" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ output extension=".g.cs"#>
|
||||
<#
|
||||
IEnumerable<string> EnumeratePropertyNames(string characters)
|
||||
{
|
||||
static IEnumerable<string> EnumeratePropertyNames(
|
||||
string characters,
|
||||
StringBuilder builder,
|
||||
int remainingCount)
|
||||
{
|
||||
foreach (char c in characters)
|
||||
{
|
||||
builder.Append(c);
|
||||
|
||||
if (remainingCount == 1)
|
||||
{
|
||||
yield return builder.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string name in EnumeratePropertyNames(characters, builder, remainingCount - 1))
|
||||
{
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
|
||||
builder.Remove(builder.Length - 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(4);
|
||||
|
||||
for (int length = 1; length <= 4; length++)
|
||||
{
|
||||
foreach (string name in EnumeratePropertyNames(characters, builder, length))
|
||||
{
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generates all vector access properties for a specified type
|
||||
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" ? "" : "ISpanFormattable";
|
||||
|
||||
if (elementTypeName != "Bool")
|
||||
{
|
||||
WriteLine("using System;");
|
||||
WriteLine("using System.Globalization;");
|
||||
}
|
||||
#>
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <inheritdoc cref="<#=typeName#>"/>
|
||||
[StructLayout(LayoutKind.Explicit, Size = <#=(elementSize * i)#>, Pack = <#=elementSize#>)]
|
||||
public unsafe partial struct <#=typeName#>
|
||||
<#
|
||||
if (formattable != "")
|
||||
{
|
||||
#>
|
||||
#if NET6_0_OR_GREATER
|
||||
: <#=formattable#>
|
||||
#endif
|
||||
<#
|
||||
}
|
||||
#>
|
||||
{
|
||||
/// <summary>
|
||||
/// A private buffer to which the undefined properties will point to.
|
||||
/// </summary>
|
||||
private static readonly void* UndefinedData = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(<#=typeName#>), sizeof(<#=elementTypeName#>4));
|
||||
<#
|
||||
WriteLine("");
|
||||
PushIndent(" ");
|
||||
|
||||
// Generate the private fields
|
||||
foreach (char name in "xyzw".Substring(0, i))
|
||||
{
|
||||
WriteLine($"[FieldOffset({"xyzw".IndexOf(name) * elementSize})]");
|
||||
WriteLine($"private {hlslElementTypeName} {name};");
|
||||
WriteLine("");
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
#>
|
||||
/// <summary>
|
||||
/// Gets a reference to a specific component in the current <see cref="<#=typeName#>"/> instance.
|
||||
/// </summary>
|
||||
/// <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;
|
||||
<#
|
||||
PushIndent(" ");
|
||||
|
||||
// Generate the combinatorial swizzling properties
|
||||
foreach (
|
||||
var propertyName in
|
||||
from source in new[] { "XYZW", "RGBA" }
|
||||
let range = source.Substring(0, i)
|
||||
from name in EnumeratePropertyNames(range)
|
||||
select name)
|
||||
{
|
||||
WriteLine("");
|
||||
|
||||
string propertyType = propertyName.Length == 1 ? hlslElementTypeName : $"{elementTypeName}{propertyName.Length}";
|
||||
bool isReadonly = propertyName.Distinct().Count() < propertyName.Length;
|
||||
string refType = isReadonly ? "ref readonly" : "ref";
|
||||
|
||||
// XML docs
|
||||
WriteLine("/// <summary>");
|
||||
if (propertyName.Length == 1)
|
||||
{
|
||||
WriteLine($"/// Gets a reference to the <see cref=\"{propertyType}\"/> value representing the <c>{propertyName}</c> component.");
|
||||
WriteLine("/// </summary>");
|
||||
|
||||
char fieldName = "xyzw"["xyzwrgba".IndexOf(propertyName.ToLower()) % 4];
|
||||
|
||||
// Property
|
||||
Write($"public readonly {refType} {propertyType} {propertyName} ");
|
||||
WriteLine($"=> ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.{fieldName}), 1));");
|
||||
}
|
||||
else
|
||||
{
|
||||
Write("/// Gets a ");
|
||||
if (isReadonly) Write("readonly ");
|
||||
Write($"reference to the <see cref=\"{propertyType}\"/> value with the components ");
|
||||
Write(string.Join(", ", propertyName.Select(c => $"<see cref=\"{c}\"/>")));
|
||||
WriteLine(".");
|
||||
WriteLine("/// </summary>");
|
||||
WriteLine("/// <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>");
|
||||
|
||||
// Property
|
||||
Write($"public readonly {refType} {propertyType} {propertyName} ");
|
||||
WriteLine($"=> ref *({propertyType}*)UndefinedData;");
|
||||
}
|
||||
}
|
||||
|
||||
PopIndent();
|
||||
WriteLine("");
|
||||
|
||||
#>
|
||||
#if !SOURCE_GENERATOR
|
||||
|
||||
<#
|
||||
|
||||
if (elementTypeName == "Bool")
|
||||
{
|
||||
#>
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[32], $"<<#=string.Join(", ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>");
|
||||
#else
|
||||
return $"<<#=string.Join(", ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>";
|
||||
#endif
|
||||
}
|
||||
<#
|
||||
}
|
||||
else
|
||||
{
|
||||
#>
|
||||
/// <inheritdoc/>
|
||||
public override readonly string ToString()
|
||||
{
|
||||
string separator = NumberFormatInfo.CurrentInfo.NumberGroupSeparator;
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
return string.Create(null, stackalloc char[64], $"<<#=string.Join("{separator} ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>");
|
||||
#else
|
||||
return $"<<#=string.Join("{separator} ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>";
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
|
||||
return FormatInterpolatedStringHandler.Create(
|
||||
format,
|
||||
formatProvider,
|
||||
stackalloc char[64],
|
||||
$"<<#=string.Join("{separator} ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
string separator = NumberFormatInfo.GetInstance(provider).NumberGroupSeparator;
|
||||
|
||||
return TryWriteFormatInterpolatedStringHandler.TryWrite(
|
||||
destination,
|
||||
format,
|
||||
provider,
|
||||
$"<<#=string.Join("{separator} ", "xyzw".Take(i).Select(c => $"{{this.{c}}}"))#>>",
|
||||
out charsWritten);
|
||||
}
|
||||
<#
|
||||
}
|
||||
|
||||
#>
|
||||
|
||||
#endif
|
||||
<#
|
||||
|
||||
// Generate the negation operator
|
||||
if (elementTypeName != "UInt")
|
||||
{
|
||||
WriteLine("");
|
||||
|
||||
string argumentName = "xyzw".Substring(0, i);
|
||||
string operatorName = elementTypeName == "Bool" ? "!" : "-";
|
||||
#>
|
||||
/// <summary>
|
||||
/// Negates a <see cref="<#=typeName#>"/> value.
|
||||
/// </summary>
|
||||
/// <param name="<#=argumentName#>">The <see cref="<#=typeName#>"/> value to negate.</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 static <#=typeName#> operator <#=operatorName#>(<#=typeName#> <#=argumentName#>) => default;
|
||||
<#
|
||||
}
|
||||
|
||||
// Generate the numerical operators
|
||||
if (elementTypeName != "Bool")
|
||||
{
|
||||
WriteLine("");
|
||||
#>
|
||||
/// <summary>
|
||||
/// Sums two <see cref="<#=typeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=typeName#>"/> value to sum.</param>
|
||||
/// <param name="right">The second <see cref="<#=typeName#>"/> value to sum.</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 static <#=typeName#> operator +(<#=typeName#> left, <#=typeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Divides two <see cref="<#=typeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=typeName#>"/> value to divide.</param>
|
||||
/// <param name="right">The second <see cref="<#=typeName#>"/> value to divide.</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 static <#=typeName#> operator /(<#=typeName#> left, <#=typeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two <see cref="<#=typeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=typeName#>"/> value to multiply.</param>
|
||||
/// <param name="right">The second <see cref="<#=typeName#>"/> value to multiply.</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 static <#=typeName#> operator *(<#=typeName#> left, <#=typeName#> right) => default;
|
||||
|
||||
/// <summary>
|
||||
/// Subtracts two <see cref="<#=typeName#>"/> values.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="<#=typeName#>"/> value to subtract.</param>
|
||||
/// <param name="right">The second <see cref="<#=typeName#>"/> value to subtract.</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 static <#=typeName#> operator -(<#=typeName#> left, <#=typeName#> right) => default;
|
||||
<#
|
||||
}
|
||||
#>
|
||||
}
|
||||
<#
|
||||
}
|
||||
#>
|
||||
新しいイシューから参照
ユーザーをブロックする