Merge pull request #37 from Sergio0694/feature_vector-types

Added HLSL vector types
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2019-08-26 15:45:14 +02:00
コミット d0e03708e9
45ファイル変更
+20745 -98

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

+6 -5
ファイルの表示
@@ -2,7 +2,7 @@
# What is it?
**ComputeSharp** is a .NET Standard 2.0 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders. The available APIs let you allocate GPU buffers and write compute shaders as simple lambda expressions or local methods, with all the captured variables being handled automatically and passed to the running shader.
**ComputeSharp** is a .NET Standard 2.1 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders. The available APIs let you allocate GPU buffers and write compute shaders as simple lambda expressions or local methods, with all the captured variables being handled automatically and passed to the running shader.
# Table of Contents
@@ -48,6 +48,8 @@ If the shader in C# is capturing some local variable, those will be automaticall
✅ Local vector types: `System.Numerics.Vector2`, `Vector3`, `Vector4`
✅ HLSL vector types: `Float2`, `Float3`, `Float4`, `Int2`, `Int3`, `Int4`, `UInt2`, `Uint3`, `UInt4`, `Double2`, `Double3`, `Double4`
✅ `static` fields of both scalar, vector or buffer types
✅ `static` properties, same as with fields
@@ -80,10 +82,9 @@ yBuffer.GetData(y);
# Requirements
The **ComputeSharp** library requires .NET Standard 2.0 support, and it is available for applications targeting:
- .NET Framework >= 4.6.1
- .NET Core >= 2.0
- UWP (from SDK 10.0.16299, and only in `Debug` mode for now)
The **ComputeSharp** library requires .NET Standard 2.1 support, and it is available for applications targeting:
- .NET Core >= 3.0
- Windows (x86 or x64)
Additionally, you need an IDE with .NET Core 3.0 and C# 8.0 support to compile the library on your PC.
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using ComputeSharp.Graphics.Buffers;
namespace ComputeSharp.Benchmark
{
-1
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using ComputeSharp.Graphics.Buffers;
namespace ComputeSharp.Benchmark
{
-1
ファイルの表示
@@ -3,7 +3,6 @@ using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using ComputeSharp.Graphics.Buffers;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
-1
ファイルの表示
@@ -2,7 +2,6 @@
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using ComputeSharp.Graphics.Buffers;
namespace ComputeSharp.Sample
{
+7
ファイルの表示
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
</Project>
@@ -1,7 +1,6 @@
using System;
using System.Runtime.CompilerServices;
namespace ComputeSharp.Graphics.Exceptions
namespace ComputeSharp.Exceptions
{
/// <summary>
/// A custom <see cref="InvalidOperationException"/> that indicates when an HLSL-only API is called from C#
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+171
ファイルの表示
@@ -0,0 +1,171 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the double2 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(double) * 2)]
public struct Double2
{
/// <summary>
/// Gets an <see cref="Double2"/> value with all components set to 0
/// </summary>
public static Double2 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Double2"/> value with all components set to 1
/// </summary>
public static Double2 One { get; } = 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 { get; } = new Double2(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 { get; } = new Double2(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)
{
X = x;
Y = y;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public double X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public double Y { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public double R
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public double G
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Double2"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public double this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}[int]");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Double2 XX => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Double2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(XY)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Double2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Double2 YY => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(YY)}");
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Double2 RR => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Double2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(RG)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Double2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Double2 GG => throw new InvalidExecutionContextException($"{nameof(Double2)}.{nameof(GG)}");
/// <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 Double2(x, x);
/// <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>
public static Double2 operator +(Double2 left, Double2 right) => throw new InvalidExecutionContextException($"{nameof(Double2)}.+");
/// <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>
public static Double2 operator /(Double2 left, Double2 right) => throw new InvalidExecutionContextException($"{nameof(Double2)}./");
/// <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>
public static Double2 operator *(Double2 left, Double2 right) => throw new InvalidExecutionContextException($"{nameof(Double2)}.*");
/// <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>
public static Double2 operator -(Double2 left, Double2 right) => throw new InvalidExecutionContextException($"{nameof(Double2)}.-");
}
}
+592
ファイルの表示
@@ -0,0 +1,592 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the double3 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(double) * 3)]
public struct Double3
{
/// <summary>
/// Gets an <see cref="Double3"/> value with all components set to 0
/// </summary>
public static Double3 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Double3"/> value with all components set to 1
/// </summary>
public static Double3 One { get; } = 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 { get; } = new Double3(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 { get; } = new Double3(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 { get; } = new Double3(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)
{
X = x;
Y = y;
Z = z;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public double X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public double Y { get; set; }
/// <summary>
/// Gets or sets the value of the third vector component
/// </summary>
public double Z { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public double R
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public double G
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets the value of the third color component
/// </summary>
public double B
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(B)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Double3"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public double this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}[int]");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Double2 XX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Double2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XY)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Double2 XZ
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Double2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Double2 YY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YY)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Double2 YZ
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Double2 ZX
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZX)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Double2 ZY
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZY)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Double2 ZZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZZ)}");
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Double2 RR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Double2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RG)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Double2 RB
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RB)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RB)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Double2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Double2 GG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GG)}");
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Double2 GB
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GB)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GB)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Double2 BR
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BR)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BR)}");
}
/// <summary>
/// Gets or sets an <see cref="Double2"/> value with the <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Double2 BG
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BG)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BG)}");
}
/// <summary>
/// Gets an <see cref="Double2"/> value with the <see cref="B"/> value for all components
/// </summary>
public Double2 BB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BB)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/> value for all components
/// </summary>
public Double2 XXX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XXX)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Double2 XXY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XXY)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Double2 XXZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XXZ)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Double2 XYX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XYX)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Double2 XYY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XYY)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Double2 XYZ
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XYZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XYZ)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Double2 XZX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZX)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Double2 XZY
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZY)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Double2 XZZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(XZZ)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="X"/> values
/// </summary>
public Double2 YXX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YXX)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Double2 YXY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YXY)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Double2 YXZ
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YXZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YXZ)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Double2 YYX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YYX)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Double2 YYY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YYY)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Double2 YYZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YYZ)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Double2 YZX
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZX)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Double2 YZY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZY)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Double2 YZZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(YZZ)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Double2 ZXX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZXX)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Double2 ZXY
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZXY)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZXY)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Double2 ZXZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZXZ)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Double2 ZYX
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZYX)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZYX)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Double2 ZYY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZYY)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Double2 ZYZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZYZ)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Double2 ZZX => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZZX)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Double2 ZZY => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZZY)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Double2 ZZZ => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(ZZZ)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/> value for all components
/// </summary>
public Double2 RRR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RRR)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Double2 RRG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RRG)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Double2 RRB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RRB)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Double2 RGR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RGR)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Double2 RGG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RGG)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Double2 RGB
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RGB)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RGB)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Double2 RBR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RBR)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Double2 RBG
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RBG)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RBG)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Double2 RBB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(RBB)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="R"/> values
/// </summary>
public Double2 GRR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GRR)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Double2 GRG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GRG)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Double2 GRB
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GRB)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GRB)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Double2 GGR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GGR)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/> value for all components
/// </summary>
public Double2 GGG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GGG)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Double2 GGB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GGB)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Double2 GBR
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GBR)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GBR)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Double2 GBG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GBG)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Double2 GBB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(GBB)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Double2 BRR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BRR)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Double2 BRG
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BRG)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BRG)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Double2 BRB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BRB)}");
/// <summary>
/// Gets or sets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Double2 BGR
{
get => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BGR)}");
set => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BGR)}");
}
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Double2 BGG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BGG)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Double2 BGB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BGB)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Double2 BBR => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BBR)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Double2 BBG => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BBG)}");
/// <summary>
/// Gets an <see cref="Double3"/> value with the <see cref="B"/> value for all components
/// </summary>
public Double2 BBB => throw new InvalidExecutionContextException($"{nameof(Double3)}.{nameof(BBB)}");
/// <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 Double3(x, x, x);
/// <summary>
/// Sums two <see cref="Double3"/> values
/// </summary>
/// <param name="left">The first <see cref="Double3"/> value to sum</param>
/// <param name="right">The second <see cref="Double3"/> value to sum</param>
public static Double3 operator +(Double3 left, Double3 right) => throw new InvalidExecutionContextException($"{nameof(Double3)}.+");
/// <summary>
/// Divides two <see cref="Double3"/> values
/// </summary>
/// <param name="left">The first <see cref="Double3"/> value to divide</param>
/// <param name="right">The second <see cref="Double3"/> value to divide</param>
public static Double3 operator /(Double3 left, Double3 right) => throw new InvalidExecutionContextException($"{nameof(Double3)}./");
/// <summary>
/// Multiplies two <see cref="Double3"/> values
/// </summary>
/// <param name="left">The first <see cref="Double3"/> value to multiply</param>
/// <param name="right">The second <see cref="Double3"/> value to multiply</param>
public static Double3 operator *(Double3 left, Double3 right) => throw new InvalidExecutionContextException($"{nameof(Double3)}.*");
/// <summary>
/// Subtracts two <see cref="Double3"/> values
/// </summary>
/// <param name="left">The first <see cref="Double3"/> value to subtract</param>
/// <param name="right">The second <see cref="Double3"/> value to subtract</param>
public static Double3 operator -(Double3 left, Double3 right) => throw new InvalidExecutionContextException($"{nameof(Double3)}.-");
}
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+171
ファイルの表示
@@ -0,0 +1,171 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the float2 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * 2)]
public struct Float2
{
/// <summary>
/// Gets an <see cref="Float2"/> value with all components set to 0
/// </summary>
public static Float2 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Float2"/> value with all components set to 1
/// </summary>
public static Float2 One { get; } = 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 { get; } = new Float2(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 { get; } = new Float2(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)
{
X = x;
Y = y;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public float X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public float Y { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public float R
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public float G
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Float2"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public float this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}[int]");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Float2 XX => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Float2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(XY)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Float2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Float2 YY => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(YY)}");
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Float2 RR => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Float2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(RG)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Float2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Float2 GG => throw new InvalidExecutionContextException($"{nameof(Float2)}.{nameof(GG)}");
/// <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 Float2(x, x);
/// <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>
public static Float2 operator +(Float2 left, Float2 right) => throw new InvalidExecutionContextException($"{nameof(Float2)}.+");
/// <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>
public static Float2 operator /(Float2 left, Float2 right) => throw new InvalidExecutionContextException($"{nameof(Float2)}./");
/// <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>
public static Float2 operator *(Float2 left, Float2 right) => throw new InvalidExecutionContextException($"{nameof(Float2)}.*");
/// <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>
public static Float2 operator -(Float2 left, Float2 right) => throw new InvalidExecutionContextException($"{nameof(Float2)}.-");
}
}
+592
ファイルの表示
@@ -0,0 +1,592 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the float3 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * 3)]
public struct Float3
{
/// <summary>
/// Gets an <see cref="Float3"/> value with all components set to 0
/// </summary>
public static Float3 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Float3"/> value with all components set to 1
/// </summary>
public static Float3 One { get; } = 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 { get; } = new Float3(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 { get; } = new Float3(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 { get; } = new Float3(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)
{
X = x;
Y = y;
Z = z;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public float X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public float Y { get; set; }
/// <summary>
/// Gets or sets the value of the third vector component
/// </summary>
public float Z { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public float R
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public float G
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets the value of the third color component
/// </summary>
public float B
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(B)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Float3"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public float this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}[int]");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Float2 XX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Float2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XY)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Float2 XZ
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Float2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Float2 YY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YY)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Float2 YZ
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Float2 ZX
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZX)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Float2 ZY
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZY)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Float2 ZZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZZ)}");
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Float2 RR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Float2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RG)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Float2 RB
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RB)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RB)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Float2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Float2 GG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GG)}");
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Float2 GB
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GB)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GB)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Float2 BR
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BR)}");
}
/// <summary>
/// Gets or sets an <see cref="Float2"/> value with the <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Float2 BG
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BG)}");
}
/// <summary>
/// Gets an <see cref="Float2"/> value with the <see cref="B"/> value for all components
/// </summary>
public Float2 BB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BB)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/> value for all components
/// </summary>
public Float2 XXX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XXX)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Float2 XXY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XXY)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Float2 XXZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XXZ)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Float2 XYX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XYX)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Float2 XYY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XYY)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Float2 XYZ
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XYZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XYZ)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Float2 XZX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZX)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Float2 XZY
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZY)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Float2 XZZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(XZZ)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="X"/> values
/// </summary>
public Float2 YXX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YXX)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Float2 YXY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YXY)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Float2 YXZ
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YXZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YXZ)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Float2 YYX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YYX)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Float2 YYY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YYY)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Float2 YYZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YYZ)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Float2 YZX
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZX)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Float2 YZY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZY)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Float2 YZZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(YZZ)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Float2 ZXX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZXX)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Float2 ZXY
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZXY)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZXY)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Float2 ZXZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZXZ)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Float2 ZYX
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZYX)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZYX)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Float2 ZYY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZYY)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Float2 ZYZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZYZ)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Float2 ZZX => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZZX)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Float2 ZZY => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZZY)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Float2 ZZZ => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(ZZZ)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/> value for all components
/// </summary>
public Float2 RRR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RRR)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Float2 RRG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RRG)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Float2 RRB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RRB)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Float2 RGR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RGR)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Float2 RGG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RGG)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Float2 RGB
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RGB)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RGB)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Float2 RBR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RBR)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Float2 RBG
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RBG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RBG)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Float2 RBB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(RBB)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="R"/> values
/// </summary>
public Float2 GRR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GRR)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Float2 GRG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GRG)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Float2 GRB
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GRB)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GRB)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Float2 GGR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GGR)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/> value for all components
/// </summary>
public Float2 GGG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GGG)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Float2 GGB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GGB)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Float2 GBR
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GBR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GBR)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Float2 GBG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GBG)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Float2 GBB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(GBB)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Float2 BRR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BRR)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Float2 BRG
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BRG)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BRG)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Float2 BRB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BRB)}");
/// <summary>
/// Gets or sets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Float2 BGR
{
get => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BGR)}");
set => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BGR)}");
}
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Float2 BGG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BGG)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Float2 BGB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BGB)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Float2 BBR => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BBR)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Float2 BBG => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BBG)}");
/// <summary>
/// Gets an <see cref="Float3"/> value with the <see cref="B"/> value for all components
/// </summary>
public Float2 BBB => throw new InvalidExecutionContextException($"{nameof(Float3)}.{nameof(BBB)}");
/// <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 Float3(x, x, x);
/// <summary>
/// Sums two <see cref="Float3"/> values
/// </summary>
/// <param name="left">The first <see cref="Float3"/> value to sum</param>
/// <param name="right">The second <see cref="Float3"/> value to sum</param>
public static Float3 operator +(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.+");
/// <summary>
/// Divides two <see cref="Float3"/> values
/// </summary>
/// <param name="left">The first <see cref="Float3"/> value to divide</param>
/// <param name="right">The second <see cref="Float3"/> value to divide</param>
public static Float3 operator /(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}./");
/// <summary>
/// Multiplies two <see cref="Float3"/> values
/// </summary>
/// <param name="left">The first <see cref="Float3"/> value to multiply</param>
/// <param name="right">The second <see cref="Float3"/> value to multiply</param>
public static Float3 operator *(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.*");
/// <summary>
/// Subtracts two <see cref="Float3"/> values
/// </summary>
/// <param name="left">The first <see cref="Float3"/> value to subtract</param>
/// <param name="right">The second <see cref="Float3"/> value to subtract</param>
public static Float3 operator -(Float3 left, Float3 right) => throw new InvalidExecutionContextException($"{nameof(Float3)}.-");
}
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+171
ファイルの表示
@@ -0,0 +1,171 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the int2 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(int) * 2)]
public struct Int2
{
/// <summary>
/// Gets an <see cref="Int2"/> value with all components set to 0
/// </summary>
public static Int2 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Int2"/> value with all components set to 1
/// </summary>
public static Int2 One { get; } = 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 { get; } = new Int2(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 { get; } = new Int2(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)
{
X = x;
Y = y;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public int X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public int Y { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public int R
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public int G
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Int2"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public int this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}[int]");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Int2 XX => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Int2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(XY)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Int2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Int2 YY => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(YY)}");
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Int2 RR => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Int2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(RG)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Int2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Int2 GG => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(GG)}");
/// <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 Int2(x, x);
/// <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>
public static Int2 operator +(Int2 left, Int2 right) => throw new InvalidExecutionContextException($"{nameof(Int2)}.+");
/// <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>
public static Int2 operator /(Int2 left, Int2 right) => throw new InvalidExecutionContextException($"{nameof(Int2)}./");
/// <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>
public static Int2 operator *(Int2 left, Int2 right) => throw new InvalidExecutionContextException($"{nameof(Int2)}.*");
/// <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>
public static Int2 operator -(Int2 left, Int2 right) => throw new InvalidExecutionContextException($"{nameof(Int2)}.-");
}
}
+592
ファイルの表示
@@ -0,0 +1,592 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the int3 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(int) * 3)]
public struct Int3
{
/// <summary>
/// Gets an <see cref="Int3"/> value with all components set to 0
/// </summary>
public static Int3 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="Int3"/> value with all components set to 1
/// </summary>
public static Int3 One { get; } = 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 { get; } = new Int3(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 { get; } = new Int3(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 { get; } = new Int3(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)
{
X = x;
Y = y;
Z = z;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public int X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public int Y { get; set; }
/// <summary>
/// Gets or sets the value of the third vector component
/// </summary>
public int Z { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public int R
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public int G
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets the value of the third color component
/// </summary>
public int B
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(B)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="Int3"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public int this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}[int]");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="X"/> value for all components
/// </summary>
public Int2 XX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Int2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XY)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Int2 XZ
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Int2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Int2 YY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YY)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Int2 YZ
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZ)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Int2 ZX
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZX)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Int2 ZY
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZY)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Int2 ZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZ)}");
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="R"/> value for all components
/// </summary>
public Int2 RR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Int2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RG)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Int2 RB
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RB)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RB)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Int2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="G"/> value for all components
/// </summary>
public Int2 GG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GG)}");
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Int2 GB
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GB)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GB)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Int2 BR
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BR)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BR)}");
}
/// <summary>
/// Gets or sets an <see cref="Int2"/> value with the <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Int2 BG
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BG)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BG)}");
}
/// <summary>
/// Gets an <see cref="Int2"/> value with the <see cref="B"/> value for all components
/// </summary>
public Int2 BB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BB)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/> value for all components
/// </summary>
public Int2 XXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXX)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Int2 XXY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXY)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Int2 XXZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXZ)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Int2 XYX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYX)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Int2 XYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYY)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Int2 XYZ
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYZ)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Int2 XZX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZX)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Int2 XZY
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZY)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZY)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Int2 XZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZZ)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="X"/> values
/// </summary>
public Int2 YXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXX)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Int2 YXY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXY)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Int2 YXZ
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXZ)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXZ)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Int2 YYX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYX)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/> value for all components
/// </summary>
public Int2 YYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYY)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Int2 YYZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYZ)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Int2 YZX
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZX)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZX)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Int2 YZY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZY)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Int2 YZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZZ)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public Int2 ZXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXX)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public Int2 ZXY
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXY)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXY)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public Int2 ZXZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXZ)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public Int2 ZYX
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYX)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYX)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public Int2 ZYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYY)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public Int2 ZYZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYZ)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public Int2 ZZX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZX)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public Int2 ZZY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZY)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="Z"/> value for all components
/// </summary>
public Int2 ZZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZZ)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/> value for all components
/// </summary>
public Int2 RRR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RRR)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Int2 RRG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RRG)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Int2 RRB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RRB)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Int2 RGR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RGR)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Int2 RGG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RGG)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Int2 RGB
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RGB)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RGB)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Int2 RBR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RBR)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Int2 RBG
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RBG)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RBG)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Int2 RBB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(RBB)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="R"/> values
/// </summary>
public Int2 GRR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GRR)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Int2 GRG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GRG)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Int2 GRB
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GRB)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GRB)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Int2 GGR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GGR)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/> value for all components
/// </summary>
public Int2 GGG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GGG)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Int2 GGB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GGB)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Int2 GBR
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GBR)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GBR)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Int2 GBG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GBG)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Int2 GBB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(GBB)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public Int2 BRR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BRR)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public Int2 BRG
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BRG)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BRG)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public Int2 BRB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BRB)}");
/// <summary>
/// Gets or sets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public Int2 BGR
{
get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BGR)}");
set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BGR)}");
}
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public Int2 BGG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BGG)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public Int2 BGB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BGB)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public Int2 BBR => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BBR)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public Int2 BBG => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BBG)}");
/// <summary>
/// Gets an <see cref="Int3"/> value with the <see cref="B"/> value for all components
/// </summary>
public Int2 BBB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BBB)}");
/// <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 Int3(x, x, x);
/// <summary>
/// Sums two <see cref="Int3"/> values
/// </summary>
/// <param name="left">The first <see cref="Int3"/> value to sum</param>
/// <param name="right">The second <see cref="Int3"/> value to sum</param>
public static Int3 operator +(Int3 left, Int3 right) => throw new InvalidExecutionContextException($"{nameof(Int3)}.+");
/// <summary>
/// Divides two <see cref="Int3"/> values
/// </summary>
/// <param name="left">The first <see cref="Int3"/> value to divide</param>
/// <param name="right">The second <see cref="Int3"/> value to divide</param>
public static Int3 operator /(Int3 left, Int3 right) => throw new InvalidExecutionContextException($"{nameof(Int3)}./");
/// <summary>
/// Multiplies two <see cref="Int3"/> values
/// </summary>
/// <param name="left">The first <see cref="Int3"/> value to multiply</param>
/// <param name="right">The second <see cref="Int3"/> value to multiply</param>
public static Int3 operator *(Int3 left, Int3 right) => throw new InvalidExecutionContextException($"{nameof(Int3)}.*");
/// <summary>
/// Subtracts two <see cref="Int3"/> values
/// </summary>
/// <param name="left">The first <see cref="Int3"/> value to subtract</param>
/// <param name="right">The second <see cref="Int3"/> value to subtract</param>
public static Int3 operator -(Int3 left, Int3 right) => throw new InvalidExecutionContextException($"{nameof(Int3)}.-");
}
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
差分なしでファイル名を変更。
+171
ファイルの表示
@@ -0,0 +1,171 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the uint2 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(uint) * 2)]
public struct UInt2
{
/// <summary>
/// Gets an <see cref="UInt2"/> value with all components set to 0
/// </summary>
public static UInt2 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="UInt2"/> value with all components set to 1
/// </summary>
public static UInt2 One { get; } = 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 { get; } = new UInt2(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 { get; } = new UInt2(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)
{
X = x;
Y = y;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public uint X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public uint Y { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public uint R
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public uint G
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="UInt2"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public float this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}[int]");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="X"/> value for all components
/// </summary>
public UInt2 XX => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public UInt2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(XY)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public UInt2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public UInt2 YY => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(YY)}");
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="R"/> value for all components
/// </summary>
public UInt2 RR => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public UInt2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(RG)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public UInt2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="G"/> value for all components
/// </summary>
public UInt2 GG => throw new InvalidExecutionContextException($"{nameof(UInt2)}.{nameof(GG)}");
/// <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 UInt2(x, x);
/// <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>
public static UInt2 operator +(UInt2 left, UInt2 right) => throw new InvalidExecutionContextException($"{nameof(UInt2)}.+");
/// <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>
public static UInt2 operator /(UInt2 left, UInt2 right) => throw new InvalidExecutionContextException($"{nameof(UInt2)}./");
/// <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>
public static UInt2 operator *(UInt2 left, UInt2 right) => throw new InvalidExecutionContextException($"{nameof(UInt2)}.*");
/// <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>
public static UInt2 operator -(UInt2 left, UInt2 right) => throw new InvalidExecutionContextException($"{nameof(UInt2)}.-");
}
}
+592
ファイルの表示
@@ -0,0 +1,592 @@
using System.Runtime.InteropServices;
using ComputeSharp.Exceptions;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="struct"/> that maps the uint3 HLSL type
/// </summary>
[StructLayout(LayoutKind.Sequential, Size = sizeof(uint) * 3)]
public struct UInt3
{
/// <summary>
/// Gets an <see cref="UInt3"/> value with all components set to 0
/// </summary>
public static UInt3 Zero { get; } = 0;
/// <summary>
/// Gets an <see cref="UInt3"/> value with all components set to 1
/// </summary>
public static UInt3 One { get; } = 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 { get; } = new UInt3(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 { get; } = new UInt3(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 { get; } = new UInt3(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)
{
X = x;
Y = y;
Z = z;
}
/// <summary>
/// Gets or sets the value of the first vector component
/// </summary>
public uint X { get; set; }
/// <summary>
/// Gets or sets the value of the second vector component
/// </summary>
public uint Y { get; set; }
/// <summary>
/// Gets or sets the value of the third vector component
/// </summary>
public uint Z { get; set; }
/// <summary>
/// Gets or sets the value of the first color component
/// </summary>
public uint R
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(R)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(R)}");
}
/// <summary>
/// Gets or sets the value of the second color component
/// </summary>
public uint G
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(G)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(G)}");
}
/// <summary>
/// Gets or sets the value of the third color component
/// </summary>
public uint B
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(B)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(B)}");
}
/// <summary>
/// Gets or sets a specific component in the current <see cref="UInt3"/> instance
/// </summary>
/// <param name="i">The index of the component to access</param>
public uint this[int i]
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}[int]");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}[int]");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="X"/> value for all components
/// </summary>
public UInt2 XX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XX)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public UInt2 XY
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XY)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XY)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public UInt2 XZ
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZ)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZ)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public UInt2 YX
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YX)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YX)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="Y"/> value for all components
/// </summary>
public UInt2 YY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YY)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public UInt2 YZ
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZ)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZ)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public UInt2 ZX
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZX)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZX)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public UInt2 ZY
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZY)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZY)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="Z"/> value for all components
/// </summary>
public UInt2 ZZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZZ)}");
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="R"/> value for all components
/// </summary>
public UInt2 RR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RR)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="R"/> and <see cref="G"/> values
/// </summary>
public UInt2 RG
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RG)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RG)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="R"/> and <see cref="B"/> values
/// </summary>
public UInt2 RB
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RB)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RB)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="G"/> and <see cref="R"/> values
/// </summary>
public UInt2 GR
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GR)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GR)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="G"/> value for all components
/// </summary>
public UInt2 GG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GG)}");
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="G"/> and <see cref="B"/> values
/// </summary>
public UInt2 GB
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GB)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GB)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="B"/> and <see cref="R"/> values
/// </summary>
public UInt2 BR
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BR)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BR)}");
}
/// <summary>
/// Gets or sets an <see cref="UInt2"/> value with the <see cref="B"/> and <see cref="G"/> values
/// </summary>
public UInt2 BG
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BG)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BG)}");
}
/// <summary>
/// Gets an <see cref="UInt2"/> value with the <see cref="B"/> value for all components
/// </summary>
public UInt2 BB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BB)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/> value for all components
/// </summary>
public UInt2 XXX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XXX)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public UInt2 XXY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XXY)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public UInt2 XXZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XXZ)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public UInt2 XYX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XYX)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public UInt2 XYY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XYY)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public UInt2 XYZ
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XYZ)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XYZ)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public UInt2 XZX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZX)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public UInt2 XZY
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZY)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZY)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="X"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public UInt2 XZZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(XZZ)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="X"/> values
/// </summary>
public UInt2 YXX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YXX)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public UInt2 YXY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YXY)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public UInt2 YXZ
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YXZ)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YXZ)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public UInt2 YYX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YYX)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/> value for all components
/// </summary>
public UInt2 YYY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YYY)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public UInt2 YYZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YYZ)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public UInt2 YZX
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZX)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZX)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public UInt2 YZY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZY)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Y"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public UInt2 YZZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(YZZ)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Z"/> values
/// </summary>
public UInt2 ZXX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZXX)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Y"/> values
/// </summary>
public UInt2 ZXY
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZXY)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZXY)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="X"/> and <see cref="Z"/> values
/// </summary>
public UInt2 ZXZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZXZ)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="X"/> values
/// </summary>
public UInt2 ZYX
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZYX)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZYX)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Y"/> values
/// </summary>
public UInt2 ZYY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZYY)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Y"/> and <see cref="Z"/> values
/// </summary>
public UInt2 ZYZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZYZ)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="X"/> values
/// </summary>
public UInt2 ZZX => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZZX)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/>, <see cref="Z"/> and <see cref="Y"/> values
/// </summary>
public UInt2 ZZY => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZZY)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="Z"/> value for all components
/// </summary>
public UInt2 ZZZ => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(ZZZ)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/> value for all components
/// </summary>
public UInt2 RRR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RRR)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public UInt2 RRG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RRG)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public UInt2 RRB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RRB)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public UInt2 RGR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RGR)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public UInt2 RGG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RGG)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public UInt2 RGB
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RGB)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RGB)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public UInt2 RBR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RBR)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public UInt2 RBG
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RBG)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RBG)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="R"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public UInt2 RBB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(RBB)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="R"/> values
/// </summary>
public UInt2 GRR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GRR)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public UInt2 GRG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GRG)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public UInt2 GRB
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GRB)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GRB)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public UInt2 GGR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GGR)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/> value for all components
/// </summary>
public UInt2 GGG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GGG)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public UInt2 GGB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GGB)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public UInt2 GBR
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GBR)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GBR)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public UInt2 GBG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GBG)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="G"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public UInt2 GBB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(GBB)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="B"/> values
/// </summary>
public UInt2 BRR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BRR)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="G"/> values
/// </summary>
public UInt2 BRG
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BRG)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BRG)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="R"/> and <see cref="B"/> values
/// </summary>
public UInt2 BRB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BRB)}");
/// <summary>
/// Gets or sets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="R"/> values
/// </summary>
public UInt2 BGR
{
get => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BGR)}");
set => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BGR)}");
}
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="G"/> values
/// </summary>
public UInt2 BGG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BGG)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="G"/> and <see cref="B"/> values
/// </summary>
public UInt2 BGB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BGB)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="R"/> values
/// </summary>
public UInt2 BBR => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BBR)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/>, <see cref="B"/> and <see cref="G"/> values
/// </summary>
public UInt2 BBG => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BBG)}");
/// <summary>
/// Gets an <see cref="UInt3"/> value with the <see cref="B"/> value for all components
/// </summary>
public UInt2 BBB => throw new InvalidExecutionContextException($"{nameof(UInt3)}.{nameof(BBB)}");
/// <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 UInt3(x, x, x);
/// <summary>
/// Sums two <see cref="UInt3"/> values
/// </summary>
/// <param name="left">The first <see cref="UInt3"/> value to sum</param>
/// <param name="right">The second <see cref="UInt3"/> value to sum</param>
public static UInt3 operator +(UInt3 left, UInt3 right) => throw new InvalidExecutionContextException($"{nameof(UInt3)}.+");
/// <summary>
/// Divides two <see cref="UInt3"/> values
/// </summary>
/// <param name="left">The first <see cref="UInt3"/> value to divide</param>
/// <param name="right">The second <see cref="UInt3"/> value to divide</param>
public static UInt3 operator /(UInt3 left, UInt3 right) => throw new InvalidExecutionContextException($"{nameof(UInt3)}./");
/// <summary>
/// Multiplies two <see cref="UInt3"/> values
/// </summary>
/// <param name="left">The first <see cref="UInt3"/> value to multiply</param>
/// <param name="right">The second <see cref="UInt3"/> value to multiply</param>
public static UInt3 operator *(UInt3 left, UInt3 right) => throw new InvalidExecutionContextException($"{nameof(UInt3)}.*");
/// <summary>
/// Subtracts two <see cref="UInt3"/> values
/// </summary>
/// <param name="left">The first <see cref="UInt3"/> value to subtract</param>
/// <param name="right">The second <see cref="UInt3"/> value to subtract</param>
public static UInt3 operator -(UInt3 left, UInt3 right) => throw new InvalidExecutionContextException($"{nameof(UInt3)}.-");
}
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+3
ファイルの表示
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("ComputeSharp.Graphics")]
+4 -3
ファイルの表示
@@ -2,14 +2,15 @@
using System.Buffers;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Exceptions;
using ComputeSharp.Graphics.Helpers;
using SharpDX.Direct3D12;
using CommandList = ComputeSharp.Graphics.Commands.CommandList;
namespace ComputeSharp.Graphics.Buffers
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> representing a typed read write buffer stored on GPU memory
@@ -39,7 +40,7 @@ namespace ComputeSharp.Graphics.Buffers
/// </summary>
/// <param name="i">The index of the value to get</param>
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else</remarks>
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ConstantBuffer<T>)}<T>[int i]");
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ConstantBuffer<T>)}<T>[int]");
/// <inheritdoc/>
public override void GetData(Span<T> span, int offset, int count)
+10 -19
ファイルの表示
@@ -1,8 +1,8 @@
using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Graphics.Buffers.Abstract;
namespace ComputeSharp
@@ -35,13 +35,10 @@ namespace ComputeSharp
/// <returns>A constant <see cref="ConstantBuffer{T}"/> instance with the contents of the input 2D array</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
{
fixed (T* p = array)
{
Span<T> span = new Span<T>(p, array.Length);
return device.AllocateConstantBuffer(span);
}
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
return device.AllocateConstantBuffer(span);
}
/// <summary>
@@ -115,13 +112,10 @@ namespace ComputeSharp
/// <returns>A read write <see cref="ReadOnlyBuffer{T}"/> instance with the contents of the input 2D array</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
{
fixed (T* p = array)
{
Span<T> span = new Span<T>(p, array.Length);
return device.AllocateReadOnlyBuffer(span);
}
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
return device.AllocateReadOnlyBuffer(span);
}
/// <summary>
@@ -195,13 +189,10 @@ namespace ComputeSharp
/// <returns>A read write <see cref="ReadWriteBuffer{T}"/> instance with the contents of the input 2D array</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[,] array) where T : unmanaged
{
fixed (T* p = array)
{
Span<T> span = new Span<T>(p, array.Length);
return device.AllocateReadWriteBuffer(span);
}
Span<T> span = MemoryMarshal.CreateSpan(ref array[0, 0], array.Length);
return device.AllocateReadWriteBuffer(span);
}
/// <summary>
+13 -1
ファイルの表示
@@ -45,12 +45,24 @@ namespace ComputeSharp.Graphics.Buffers.Extensions
WriteValue(ub, ref r0);
break;
case int i: WriteValue(i, ref r0); break;
case Int2 i2: WriteValue(i2, ref r0); break;
case Int3 i3: WriteValue(i3, ref r0); break;
case Int4 i4: WriteValue(i4, ref r0); break;
case uint u: WriteValue(u, ref r0); break;
case UInt2 ui2: WriteValue(ui2, ref r0); break;
case UInt3 ui3: WriteValue(ui3, ref r0); break;
case UInt4 ui4: WriteValue(ui4, ref r0); break;
case float f: WriteValue(f, ref r0); break;
case double d: WriteValue(d, ref r0); break;
case Float2 f2: WriteValue(f2, ref r0); break;
case Float3 f3: WriteValue(f3, ref r0); break;
case Float4 f4: WriteValue(f4, ref r0); break;
case Vector2 v2: WriteValue(v2, ref r0); break;
case Vector3 v3: WriteValue(v3, ref r0); break;
case Vector4 v4: WriteValue(v4, ref r0); break;
case double d: WriteValue(d, ref r0); break;
case Double2 d2: WriteValue(d2, ref r0); break;
case Double3 d3: WriteValue(d3, ref r0); break;
case Double4 d4: WriteValue(d4, ref r0); break;
default: throw new InvalidOperationException($"Invalid item of type {data[j].GetType()}");
}
}
+5 -4
ファイルの表示
@@ -1,8 +1,9 @@
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Exceptions;
namespace ComputeSharp.Graphics.Buffers
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> representing a typed readonly buffer stored on GPU memory
@@ -22,6 +23,6 @@ namespace ComputeSharp.Graphics.Buffers
/// </summary>
/// <param name="i">The index of the value to get</param>
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else</remarks>
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadOnlyBuffer<T>)}<T>[int i]");
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadOnlyBuffer<T>)}<T>[int]");
}
}
+5 -4
ファイルの表示
@@ -1,8 +1,9 @@
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Exceptions;
namespace ComputeSharp.Graphics.Buffers
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> representing a typed read write buffer stored on GPU memory
@@ -22,6 +23,6 @@ namespace ComputeSharp.Graphics.Buffers
/// </summary>
/// <param name="i">The index of the value to get or set</param>
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else</remarks>
public ref T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadWriteBuffer<T>)}<T>[int i]");
public ref T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadWriteBuffer<T>)}<T>[int]");
}
}
+6 -5
ファイルの表示
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2002-preview" />
<PackageReference Include="SharpDX.Direct3D12" Version="4.2.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Numerics.Vectors" Version="4.6.0-preview5.19224.8" />
<PackageReference Include="System.Runtime.InteropServices.WindowsRuntime" Version="4.3.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0-preview8.19405.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputeSharp.Core\ComputeSharp.Core.csproj" />
</ItemGroup>
</Project>
+1 -1
ファイルの表示
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+107 -14
ファイルの表示
@@ -83,6 +83,19 @@ namespace ComputeSharp.Shaders.Mappings
["ComputeSharp.ThreadIds.Y"] = ".y",
["ComputeSharp.ThreadIds.Z"] = ".z",
// Vector2
["System.Numerics.Vector2.X"] = ".x",
["System.Numerics.Vector2.Y"] = ".y",
["System.Numerics.Vector2.Dot"] = "dot",
["System.Numerics.Vector2.Lerp"] = "lerp",
["System.Numerics.Vector2.Transform"] = "mul",
["System.Numerics.Vector2.TransformNormal"] = "mul",
["System.Numerics.Vector2.Normalize"] = "normalize",
["System.Numerics.Vector2.Zero"] = "(float2)0",
["System.Numerics.Vector2.One"] = "float2(1.0f, 1.0f)",
["System.Numerics.Vector2.UnitX"] = "float2(1.0f, 0.0f)",
["System.Numerics.Vector2.UnitY"] = "float2(0.0f, 1.0f)",
// Vector3
["System.Numerics.Vector3.X"] = ".x",
["System.Numerics.Vector3.Y"] = ".y",
@@ -108,7 +121,91 @@ namespace ComputeSharp.Shaders.Mappings
["System.Numerics.Vector4.Transform"] = "mul",
["System.Numerics.Vector4.Normalize"] = "normalize",
["System.Numerics.Vector4.Zero"] = "(float4)0",
["System.Numerics.Vector4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)"
["System.Numerics.Vector4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)",
// Int2
["ComputeSharp.Int2.Zero"] = "(int2)0",
["ComputeSharp.Int2.One"] = "int2(1, 1)",
["ComputeSharp.Int2.UnitX"] = "int2(1, 0)",
["ComputeSharp.Int2.UnitY"] = "int2(0, 1)",
// Int3
["ComputeSharp.Int3.Zero"] = "(int3)0",
["ComputeSharp.Int3.One"] = "int3(1, 1, 1)",
["ComputeSharp.Int3.UnitX"] = "int3(1, 0, 0)",
["ComputeSharp.Int3.UnitY"] = "int3(0, 1, 0)",
["ComputeSharp.Int3.UnitZ"] = "int3(0, 0, 1)",
// Int4
["ComputeSharp.Int4.Zero"] = "(int4)0",
["ComputeSharp.Int4.One"] = "int4(1, 1, 1, 1)",
["ComputeSharp.Int4.UnitX"] = "int4(1, 0, 0, 0)",
["ComputeSharp.Int4.UnitY"] = "int4(0, 1, 0, 0)",
["ComputeSharp.Int4.UnitZ"] = "int4(0, 0, 1, 0)",
["ComputeSharp.Int4.UnitW"] = "int4(0, 0, 0, 1)",
// UInt2
["ComputeSharp.UInt2.Zero"] = "(uint2)0",
["ComputeSharp.UInt2.One"] = "uint2(1u, 1u)",
["ComputeSharp.UInt2.UnitX"] = "uint2(1u, 0u)",
["ComputeSharp.UInt2.UnitY"] = "uint2(0u, 1u)",
// UInt3
["ComputeSharp.UInt3.Zero"] = "(uint3)0",
["ComputeSharp.UInt3.One"] = "uint3(1u, 1u, 1u)",
["ComputeSharp.UInt3.UnitX"] = "uint3(1u, 0u, 0u)",
["ComputeSharp.UInt3.UnitY"] = "uint3(0u, 1u, 0u)",
["ComputeSharp.UInt3.UnitZ"] = "uint3(0u, 0u, 1u)",
// UInt4
["ComputeSharp.UInt4.Zero"] = "(uint4)0",
["ComputeSharp.UInt4.One"] = "uint4(1u, 1u, 1u, 1u)",
["ComputeSharp.UInt4.UnitX"] = "uint4(1u, 0u, 0u, 0u)",
["ComputeSharp.UInt4.UnitY"] = "uint4(0u, 1u, 0u, 0u)",
["ComputeSharp.UInt4.UnitZ"] = "uint4(0u, 0u, 1u, 0u)",
["ComputeSharp.UInt4.UnitW"] = "uint4(0u, 0u, 0u, 1u)",
// Float2
["ComputeSharp.Float2.Zero"] = "(float2)0",
["ComputeSharp.Float2.One"] = "float2(1.0f, 1.0f)",
["ComputeSharp.Float2.UnitX"] = "float2(1.0f, 0.0f)",
["ComputeSharp.Float2.UnitY"] = "float2(0.0f, 1.0f)",
// Float3
["ComputeSharp.Float3.Zero"] = "(float3)0",
["ComputeSharp.Float3.One"] = "float3(1.0f, 1.0f, 1.0f)",
["ComputeSharp.Float3.UnitX"] = "float3(1.0f, 0.0f, 0.0f)",
["ComputeSharp.Float3.UnitY"] = "float3(0.0f, 1.0f, 0.0f)",
["ComputeSharp.Float3.UnitZ"] = "float3(0.0f, 0.0f, 1.0f)",
// Float4
["ComputeSharp.Float4.Zero"] = "(float4)0",
["ComputeSharp.Float4.One"] = "float4(1.0f, 1.0f, 1.0f, 1.0f)",
["ComputeSharp.Float4.UnitX"] = "float4(1.0f, 0.0f, 0.0f, 0.0f)",
["ComputeSharp.Float4.UnitY"] = "float4(0.0f, 1.0f, 0.0f, 0.0f)",
["ComputeSharp.Float4.UnitZ"] = "float4(0.0f, 0.0f, 1.0f, 0.0f)",
["ComputeSharp.Float4.UnitW"] = "float4(0.0f, 0.0f, 0.0f, 1.0f)",
// Double2
["ComputeSharp.Double2.Zero"] = "(double2)0",
["ComputeSharp.Double2.One"] = "double2(1.0, 1.0)",
["ComputeSharp.Double2.UnitX"] = "double2(1.0, 0.0)",
["ComputeSharp.Double2.UnitY"] = "double2(0.0, 1.0)",
// Double3
["ComputeSharp.Double3.Zero"] = "(double3)0",
["ComputeSharp.Double3.One"] = "double3(1.0, 1.0, 1.0)",
["ComputeSharp.Double3.UnitX"] = "double3(1.0, 0.0, 0.0)",
["ComputeSharp.Double3.UnitY"] = "double3(0.0, 1.0, 0.0)",
["ComputeSharp.Double3.UnitZ"] = "double3(0.0, 0.0, 1.0)",
// Double4
["ComputeSharp.Double4.Zero"] = "(double4)0",
["ComputeSharp.Double4.One"] = "double4(1.0, 1.0, 1.0, 1.0)",
["ComputeSharp.Double4.UnitX"] = "double4(1.0, 0.0, 0.0, 0.0)",
["ComputeSharp.Double4.UnitY"] = "double4(0.0, 1.0, 0.0, 0.0)",
["ComputeSharp.Double4.UnitZ"] = "double4(0.0, 0.0, 1.0, 0.0)",
["ComputeSharp.Double4.UnitW"] = "double4(0.0, 0.0, 0.0, 1.0)"
};
// Programmatically load mappings from the Hlsl class as well
@@ -121,23 +218,19 @@ namespace ComputeSharp.Shaders.Mappings
knownMethods.Add($"{typeof(Hlsl).FullName}{Type.Delimiter}{name}", name.ToLowerInvariant());
}
// Programmatically load mappings for the vector types
foreach (var item in
from type in HlslKnownTypes.KnownVectorTypes
from property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
select (Type: type, Property: property))
{
knownMethods.Add($"{item.Type.FullName}{Type.Delimiter}{item.Property.Name}", $".{item.Property.Name.ToLowerInvariant()}");
}
return _KnownMethods = knownMethods;
}
}
/// <summary>
/// Checks whether or not a specified method is a known HLSL method
/// </summary>
/// <param name="containingMemberSymbol">The containing member symbol for the method to check</param>
/// <param name="memberSymbol">The symbol for the method to check</param>
/// <returns>A <see langword="bool"/> indicating whether the input method is in fact an HLSL known method</returns>
[Pure]
public static bool IsKnownMethod(ISymbol containingMemberSymbol, ISymbol memberSymbol)
{
string fullTypeName = containingMemberSymbol.IsStatic ? containingMemberSymbol.ToString() : memberSymbol.ContainingType.ToString();
return KnownMethods.ContainsKey(fullTypeName + Type.Delimiter + memberSymbol.Name);
}
/// <summary>
/// Tries to get the mapped HLSL-compatible mthod name for the input symbols
/// </summary>
+36 -16
ファイルの表示
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Numerics;
using System.Text.RegularExpressions;
using ComputeSharp.Graphics.Buffers;
namespace ComputeSharp.Shaders.Mappings
{
@@ -26,10 +25,33 @@ namespace ComputeSharp.Shaders.Mappings
[typeof(Vector3).FullName] = "float3",
[typeof(Vector4).FullName] = "float4",
[typeof(ThreadIds).FullName] = "uint3",
[typeof(Int2).FullName] = "int2",
[typeof(Int3).FullName] = "int3",
[typeof(Int4).FullName] = "int4",
[typeof(UInt2).FullName] = "uint2",
[typeof(UInt3).FullName] = "uint3",
[typeof(UInt4).FullName] = "uint4",
[typeof(Float2).FullName] = "float2",
[typeof(Float3).FullName] = "float3",
[typeof(Float4).FullName] = "float4",
[typeof(Double2).FullName] = "double2",
[typeof(Double3).FullName] = "double3",
[typeof(Double4).FullName] = "double4",
[typeof(ReadOnlyBuffer<>).FullName] = "StructuredBuffer",
[typeof(ReadWriteBuffer<>).FullName] = "RWStructuredBuffer"
};
/// <summary>
/// Gets the known HLSL vector types available as mapped types
/// </summary>
public static IReadOnlyList<Type> KnownVectorTypes { get; } = new[]
{
typeof(Int2), typeof(Int3), typeof(Int4),
typeof(UInt2), typeof(UInt3), typeof(UInt4),
typeof(Float2), typeof(Float3), typeof(Float4),
typeof(Double2), typeof(Double3), typeof(Double4)
};
/// <summary>
/// Checks whether or not the input type is a known scalar type
/// </summary>
@@ -50,7 +72,19 @@ namespace ComputeSharp.Shaders.Mappings
[Pure]
public static bool IsKnownVectorType(Type type) => type == typeof(Vector2) ||
type == typeof(Vector3) ||
type == typeof(Vector4);
type == typeof(Vector4) ||
type == typeof(Int2) ||
type == typeof(Int3) ||
type == typeof(Int4) ||
type == typeof(UInt2) ||
type == typeof(UInt3) ||
type == typeof(UInt4) ||
type == typeof(Float2) ||
type == typeof(Float3) ||
type == typeof(Float4) ||
type == typeof(Double2) ||
type == typeof(Double3) ||
type == typeof(Double4);
/// <summary>
/// Checks whether or not the input type is a <see cref="ConstantBuffer{T}"/> value
@@ -79,20 +113,6 @@ namespace ComputeSharp.Shaders.Mappings
public static bool IsReadWriteBufferType(Type type) => type.IsGenericType &&
type.GetGenericTypeDefinition() == typeof(ReadWriteBuffer<>);
/// <summary>
/// Checks whether or not a given <see cref="Type"/> is an HLSL known type
/// </summary>
/// <param name="type">The input <see cref="Type"/> instance to check</param>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is in fact a known HLSL type</returns>
[Pure]
public static bool IsKnownType(Type type)
{
Type declaredType = type.IsArray ? type.GetElementType() : type;
string fullname = $"{declaredType.Namespace}{Type.Delimiter}{declaredType.Name}";
return KnownTypes.ContainsKey(fullname);
}
/// <summary>
/// Gets the mapped HLSL-compatible type name for the input <see cref="Type"/> instance
/// </summary>
+10
ファイルの表示
@@ -30,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Benchmark", ".
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.BokehBlur", "..\samples\ComputeSharp.BokehBlur\ComputeSharp.BokehBlur.csproj", "{524CC5DD-1DEE-4A30-9515-AB90965E5207}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.Core", "ComputeSharp.Core\ComputeSharp.Core.csproj", "{9F9581FB-6EF7-418E-BFA5-0EFED874E980}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -102,6 +104,14 @@ Global
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|Any CPU.Build.0 = Release|Any CPU
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|x64.ActiveCfg = Release|Any CPU
{524CC5DD-1DEE-4A30-9515-AB90965E5207}.Release|x64.Build.0 = Release|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Debug|x64.ActiveCfg = Debug|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Debug|x64.Build.0 = Debug|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Release|Any CPU.Build.0 = Release|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Release|x64.ActiveCfg = Release|Any CPU
{9F9581FB-6EF7-418E-BFA5-0EFED874E980}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+5 -1
ファイルの表示
@@ -1,11 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2002-preview" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputeSharp.Shaders\ComputeSharp.Shaders.csproj" />
</ItemGroup>
+2 -4
ファイルの表示
@@ -10,7 +10,7 @@
<projectUrl>https://github.com/Sergio0694/ComputeSharp</projectUrl>
<iconUrl>https://i.imgur.com/ntvmD6P.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>A .NET Standard 2.0 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders</description>
<description>A .NET Standard 2.1 library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders</description>
<releaseNotes>Initial alpha release</releaseNotes>
<copyright>Copyright (c) 2019 Sergio Pedri</copyright>
<tags>dotnet net netcore netstandard csharp library graphics shader hlsl compute gpu</tags>
@@ -18,9 +18,7 @@
<dependencies>
<dependency id="Microsoft.Windows.SDK.Contracts" version="10.0.18362.2002-preview" />
<dependency id="SharpDX.Direct3D12" version="4.2.0" />
<dependency id="System.Memory" version="4.5.3" />
<dependency id="System.Numerics.Vectors" version="4.6.0-preview5.19224.8" />
<dependency id="System.Runtime.InteropServices.WindowsRuntime" version="4.3.0" />
<dependency id="System.Runtime.CompilerServices.Unsafe" version="4.6.0-preview8.19405.3" />
<dependency id="DotNetDxc" version="1.2.0-alpha" />
<dependency id="ICSharpCode.Decompiler" version="5.0.0.5066-preview4" />
<dependency id="Microsoft.CodeAnalysis.CSharp" version="3.3.0-beta2-final" />
+81
ファイルの表示
@@ -0,0 +1,81 @@
using System;
using System.Diagnostics.Contracts;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> that contains extension methods for the <see cref="Vector2"/>, <see cref="Vector3"/> and <see cref="Vector4"/> types
/// </summary>
public static class VectorExtensions
{
/// <summary>
/// Converts a <see cref="Vector2"/> array into a <see cref="Span{T}"/> with items of type <see cref="Float2"/>
/// </summary>
/// <param name="array">The input <see cref="Vector2"/> array</param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float2"/>, mapping the original array</returns>
[Pure]
public static Span<Float2> AsFloat2Span(this Vector2[] array) => array.AsSpan().As<Vector2, Float2>();
/// <summary>
/// Converts a <see cref="Vector2"/> <see cref="Span{T}"/> into a <see cref="Span{T}"/> with items of type <see cref="Float2"/>
/// </summary>
/// <param name="span">The input <see cref="Vector2"/> <see cref="Span{T}"/></param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float2"/>, mapping the original <see cref="Span{T}"/></returns>
[Pure]
public static Span<Float2> AsFloat2Span(this Span<Vector2> span) => span.As<Vector2, Float2>();
/// <summary>
/// Converts a <see cref="Vector3"/> array into a <see cref="Span{T}"/> with items of type <see cref="Float3"/>
/// </summary>
/// <param name="array">The input <see cref="Vector3"/> array</param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float3"/>, mapping the original array</returns>
[Pure]
public static Span<Float3> AsFloat3Span(this Vector3[] array) => array.AsSpan().As<Vector3, Float3>();
/// <summary>
/// Converts a <see cref="Vector3"/> <see cref="Span{T}"/> into a <see cref="Span{T}"/> with items of type <see cref="Float3"/>
/// </summary>
/// <param name="span">The input <see cref="Vector3"/> <see cref="Span{T}"/></param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float3"/>, mapping the original <see cref="Span{T}"/></returns>
[Pure]
public static Span<Float3> AsFloat3Span(this Span<Vector3> span) => span.As<Vector3, Float3>();
/// <summary>
/// Converts a <see cref="Vector4"/> array into a <see cref="Span{T}"/> with items of type <see cref="Float4"/>
/// </summary>
/// <param name="array">The input <see cref="Vector4"/> array</param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float4"/>, mapping the original array</returns>
[Pure]
public static Span<Float4> AsFloat4Span(this Vector4[] array) => array.AsSpan().As<Vector4, Float4>();
/// <summary>
/// Converts a <see cref="Vector4"/> <see cref="Span{T}"/> into a <see cref="Span{T}"/> with items of type <see cref="Float4"/>
/// </summary>
/// <param name="span">The input <see cref="Vector4"/> <see cref="Span{T}"/></param>
/// <returns>A <see cref="Span{T}"/> with items of type <see cref="Float4"/>, mapping the original <see cref="Span{T}"/></returns>
[Pure]
public static Span<Float4> AsFloat4Span(this Span<Vector4> span) => span.As<Vector4, Float4>();
/// <summary>
/// Converts a <see cref="Span{T}"/> value with items of type <typeparamref name="TFrom"/> to one with items of type <typeparamref name="TTo"/>
/// </summary>
/// <typeparam name="TFrom">The type of the input items</typeparam>
/// <typeparam name="TTo">The type of items to convert to</typeparam>
/// <param name="span">The input <see cref="Span{T}"/></param>
/// <returns>A <see cref="Span{T}"/> with items of type <typeparamref name="TTo"/></returns>
[Pure]
private static Span<TTo> As<TFrom, TTo>(this Span<TFrom> span)
where TFrom : unmanaged
where TTo : unmanaged
{
if (span.Length == 0) return Span<TTo>.Empty;
ref TTo r0 = ref Unsafe.As<TFrom, TTo>(ref span.GetPinnableReference());
return MemoryMarshal.CreateSpan(ref r0, span.Length);
}
}
}
-1
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Graphics.Buffers.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Tests.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
+26
ファイルの表示
@@ -0,0 +1,26 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests
{
[TestClass]
[TestCategory("HlslVectorTypes")]
public class HlslVectorTypesTests
{
[TestMethod]
public void LocalScalarAssignToBuffer()
{
Float2 f2 = new Float2(1, 2);
using ReadWriteBuffer<Float2> buffer = Gpu.Default.AllocateReadWriteBuffer<Float2>(1);
Action<ThreadIds> action = id => buffer[0] = f2.YX;
Gpu.Default.For(1, action);
Float2[] result = buffer.GetData();
Assert.IsTrue(MathF.Abs(result[0].X - f2.Y) < 0.0001f);
Assert.IsTrue(MathF.Abs(result[0].Y - f2.X) < 0.0001f);
}
}
}
-1
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Tests.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Numerics;
using ComputeSharp.Graphics.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests
-1
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using ComputeSharp.Graphics.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests
-1
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Numerics;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Tests.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using ComputeSharp.Graphics.Buffers;
using ComputeSharp.Tests.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Numerics;
using ComputeSharp.Graphics.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests
-1
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Numerics;
using ComputeSharp.Graphics.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ComputeSharp.Tests