Move primitives to ComputeSharp.Core

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:03:14 +02:00
1 親 cc298770ca
コミット e48949cd48
78ファイル変更
+369 -245

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

+90
ファイルの表示
@@ -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);
}
+44
ファイルの表示
@@ -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);
}
+410
ファイルの表示
@@ -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;
}
+4
ファイルの表示
@@ -0,0 +1,4 @@
<#@include file="..\VectorType.ttinclude" #>
<#
GenerateVectorProperties("Bool2", sizeof(int));
#>
+75
ファイルの表示
@@ -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);
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+4
ファイルの表示
@@ -0,0 +1,4 @@
<#@include file="..\VectorType.ttinclude" #>
<#
GenerateVectorProperties("Bool3", sizeof(int));
#>
+125
ファイルの表示
@@ -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);
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+4
ファイルの表示
@@ -0,0 +1,4 @@
<#@include file="..\VectorType.ttinclude" #>
<#
GenerateVectorProperties("Bool4", sizeof(int));
#>
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+4
ファイルの表示
@@ -0,0 +1,4 @@
<#@include file="..\MatrixType.ttinclude" #>
<#
GenerateAllMatrixProperties("Bool", sizeof(int));
#>