Merge pull request #104 from Sergio0694/feature/dispatch-ids
Added DispatchSize and ThreadIds.Normalized types
このコミットが含まれているのは:
22ファイル変更
+834
-185
検索条件に一致するファイルはありません
@@ -14,6 +14,7 @@
|
||||
- [HLSL vector and matrix types](#hlsl-vector-and-matrix-types)
|
||||
- [HLSL intrinsics](#hlsl-intrinsics)
|
||||
- [Shader constants](#shader-constants)
|
||||
- [Dispatch info](#dispatch-info)
|
||||
- [Working with images](#working-with-images)
|
||||
- [Shader metaprogramming](#shader-metaprogramming)
|
||||
- [Requirements](#requirements)
|
||||
@@ -172,6 +173,19 @@ public readonly struct SampleShaderWithConstants : IComputeShader
|
||||
}
|
||||
```
|
||||
|
||||
## Dispatch info
|
||||
|
||||
As shown in the [Quick start](#quick-start) paragraph, **ComputeSharp** includes a number of special types that allow shaders to access a number of useful dispatch info values, such as the current iteration coordinate or the target dispatch range. Here is a list of all the available types in this category:
|
||||
|
||||
- `ThreadIds`: indicates the ids of a given GPU thread running a compute shader. That is, it enables a shader to access info on the current iteration index along each axis.
|
||||
- `ThreadIds.Normalized`: indicates the normalized ids of a given GPU thread running a compute shader. These ids represent equivalent info to those from `ThreadIds`, but normalized in the [0, 1] range. The range used for the normalization is the one given by the target dispatch size.
|
||||
- `DispatchSize`: indicates the size of the current shader dispatch being executed. That is, it enables a shader to access info on the targeted number of invocations along each axis.
|
||||
- `GroupIds`: indicates the ids of a given GPU thread running a compute shader within a dispatch group. That is, it enables a shader to access info on the index of the current thread with respect to the currently running group.
|
||||
- `GroupSize`: indicates the size info of a given GPU thread group running a compute shader. That is, it enables a shader to access info on the size of the thread groups being used.
|
||||
- `GridIds`: indicates the ids of the current thread group within the dispatch grid. That is, it enables a shader to access info on the index of the current thread group with respect to the dispatch grid.
|
||||
|
||||
For more info on how all these values relate to the corresponding HLSL inputs, see the `[numthreads]` docs [here](https://docs.microsoft.com/windows/win32/direct3dhlsl/sm5-attributes-numthreads). Note that `ThreadIds`, `GroupIds` and `GridIds` map to `SV_DispatchThreadID`, `SV_GroupThreadID` and `SV_GroupID` respectively, and the `GroupIds.Index` property maps to `SV_GroupIndex`.
|
||||
|
||||
## Working with images
|
||||
|
||||
As mentioned in the [GPU resource types](#gpu-resource-types) paragraph, there are several texture types that are specialized to work on image pixels, such as `ReadWriteTexture2D<T, TPixel>`. Let's imagine we want to write a compute shader that applies some image processing filter: we will need to load an image (eg. using [ImageSharp](https://github.com/SixLabors/ImageSharp), or just the `System.Drawing` APIs) and then process it on the GPU, but without spending time on the CPU to convert pixels from a format such as RGBA32 to the normalized `float` values we want our shader to work on. We can do this by utilizing the `ReadWriteTexture2D<T, TPixel>` type as follows:
|
||||
@@ -194,7 +208,7 @@ try
|
||||
using var texture = Gpu.Default.AllocateReadWriteTexture2D<Bgra32, Float4>(bitmapSpan, bitmap.Width, bitmap.Height);
|
||||
|
||||
// Run our shader on the texture we just created
|
||||
Gpu.Default.For(bitmap.Width, bitmap.Height, new GaussianBlur(texture));
|
||||
Gpu.Default.For(bitmap.Width, bitmap.Height, new GrayscaleEffect(texture));
|
||||
|
||||
// When the shader has completed, copy the processed texture back
|
||||
texture.CopyTo(bitmapSpan);
|
||||
@@ -211,7 +225,7 @@ With the compute shader being like this:
|
||||
|
||||
```csharp
|
||||
[AutoConstructor]
|
||||
public readonly partial struct GaussianBlur : IComputeShader
|
||||
public readonly partial struct GrayscaleEffect : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteTexture2D<Float4> texture;
|
||||
|
||||
|
||||
@@ -51,10 +51,7 @@
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int width = texture.Width;
|
||||
int height = texture.Height;
|
||||
|
||||
Float2 uv = ((Float2)ThreadIds.XY - (Float2)(new Int2(width, height)) * 0.5f) / height;
|
||||
Float2 uv = (ThreadIds.XY - (Float2)DispatchSize.XY * 0.5f) / DispatchSize.Y;
|
||||
Float3 col = 0;
|
||||
float t = time * 0.3f;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Float2 position = ((Float2)(256 * ThreadIds.XY)) / texture.Width + time;
|
||||
Float2 position = ((Float2)(256 * ThreadIds.XY)) / DispatchSize.X + time;
|
||||
Float4 color = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
|
||||
@@ -158,15 +158,14 @@
|
||||
Float3 camPos = 0.5f * time * new Float3(1.0f, 0.0f, 0.0f);
|
||||
Float3 target = camPos + new Float3(1.0f, 0.0f * Hlsl.Cos(time), 0.0f * Hlsl.Sin(0.4f * time));
|
||||
Float3 camDir = Hlsl.Normalize(target - camPos);
|
||||
Float3 camUp = new Float3(0.0f, 1.0f, 0.0f);
|
||||
Float3 camUp = new(0.0f, 1.0f, 0.0f);
|
||||
|
||||
camUp = Hlsl.Normalize(camUp - Hlsl.Dot(camDir, camUp) * camDir);
|
||||
|
||||
Float3 camRight = Hlsl.Normalize(Hlsl.Cross(camDir, camUp));
|
||||
Float2 resolution = new(texture.Width, texture.Height);
|
||||
Float2 coord = -1.0f + 2.0f * (Float2)ThreadIds.XY / resolution;
|
||||
Float2 coord = -1.0f + 2.0f * (Float2)ThreadIds.XY / DispatchSize.XY;
|
||||
|
||||
coord.X *= resolution.X / resolution.Y;
|
||||
coord.X *= (float)DispatchSize.X / DispatchSize.Y;
|
||||
|
||||
Float3 rayDir = Hlsl.Normalize(camDir + (coord.X * camRight + coord.Y * camUp) * FieldOfView);
|
||||
|
||||
|
||||
@@ -90,8 +90,7 @@
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Int2 resolution = new(texture.Width, texture.Height);
|
||||
Float2 p = ((Float2)ThreadIds.XY * 2.0f - resolution) / Hlsl.Min(resolution.X, resolution.Y);
|
||||
Float2 p = ((Float2)ThreadIds.XY * 2.0f - DispatchSize.XY) / Hlsl.Min(DispatchSize.X, DispatchSize.Y);
|
||||
Float3 ro = new(0.0f, -0.2f, time * 4.0f);
|
||||
Float3 ray = Hlsl.Normalize(new Float3(p, 1.5f));
|
||||
|
||||
|
||||
@@ -133,10 +133,9 @@
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Int2 resolution = new(texture.Width, texture.Height);
|
||||
Float2 q = (Float2)ThreadIds.XY / resolution;
|
||||
Float2 p = (ThreadIds.XY - 0.5f * (Float2)resolution) / resolution.Y;
|
||||
Float2 bsMo = -0.5f * (Float2)resolution / resolution.Y;
|
||||
Float2 q = (Float2)ThreadIds.XY / DispatchSize.XY;
|
||||
Float2 p = (ThreadIds.XY - 0.5f * (Float2)DispatchSize.XY) / DispatchSize.Y;
|
||||
Float2 bsMo = -0.5f * (Float2)DispatchSize.XY / DispatchSize.Y;
|
||||
float scaledTime = time * 3.0f;
|
||||
Float3 ro = new(0, 0, scaledTime);
|
||||
|
||||
|
||||
@@ -116,17 +116,14 @@
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int width = texture.Width;
|
||||
int height = texture.Height;
|
||||
|
||||
Float2 uv = ((Float2)ThreadIds.XY - (Float2)(new Int2(width, height)) * 0.5f) / height;
|
||||
Float2 uv = (ThreadIds.XY - (Float2)DispatchSize.XY * 0.5f) / DispatchSize.Y;
|
||||
float gSc = 7.0f;
|
||||
Float2 p = uv * gSc - new Float2(-1, -0.5f) * time / 2.0f;
|
||||
float sf = 2.0f / height * gSc;
|
||||
float sf = 2.0f / DispatchSize.Y * gSc;
|
||||
float lSc = 6.0f;
|
||||
float lw = 1.0f / lSc / gSc;
|
||||
Float2 d = DistanceField(p, out Float2 ang) - 2.5f / lSc;
|
||||
Float3 col = new Float3(1.0f, 0.9f, 0.8f);
|
||||
Float3 col = new(1.0f, 0.9f, 0.8f);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
|
||||
@@ -50,4 +50,5 @@ CMPS0042 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator,
|
||||
CMPS0043 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0044 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0045 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0046 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0046 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
CMPS0047 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
|
||||
@@ -17,10 +17,12 @@
|
||||
<Compile Include="..\ComputeSharp\Core\Attributes\__Internals\ComputeRoot32BitConstantsAttribute.cs" Link="Core\Attributes\__Internals\ComputeRoot32BitConstantsAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Attributes\__Internals\IComputeShaderSourceAttribute.cs" Link="Core\Attributes\__Internals\IComputeShaderSourceAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Attributes\__Internals\ShaderMethodSourceAttribute.cs" Link="Core\Attributes\__Internals\ShaderMethodSourceAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\DispatchSize.cs" Link="Core\Dispatch\DispatchSize.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\GridIds.cs" Link="Core\Dispatch\GridIds.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\GroupIds.cs" Link="Core\Dispatch\GroupIds.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\GroupSize.cs" Link="Core\Dispatch\GroupSize.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\ThreadIds.cs" Link="Core\Dispatch\ThreadIds.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\GridIds.cs" Link="Core\Dispatch\GridIds.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Dispatch\ThreadIds.Normalized.cs" Link="Core\Dispatch\ThreadIds.Normalized.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Exceptions\InvalidExecutionContextException.cs" Link="Core\Exceptions\InvalidExecutionContextException.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Exceptions\MissingMethodSourceException.cs" Link="Core\Exceptions\MissingMethodSourceException.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Extensions\MethodInfoExtensions.cs" Link="Core\Extensions\MethodInfoExtensions.cs" />
|
||||
|
||||
@@ -652,5 +652,18 @@ namespace ComputeSharp.SourceGenerators.Diagnostics
|
||||
isEnabledByDefault: true,
|
||||
description: "A type representing a compute shader contains an instance property declaration.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="DiagnosticDescriptor"/> for an invalid <see cref="DispatchSize"/> usage.
|
||||
/// </summary>
|
||||
public static readonly DiagnosticDescriptor InvalidDispatchSizeUsage = new(
|
||||
id: "CMPS0047",
|
||||
title: "Invalid DispatchSize usage",
|
||||
messageFormat: "The DispatchSize type can only be used within the main body of a compute shader",
|
||||
category: typeof(IComputeShader).FullName,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true,
|
||||
description: "The DispatchSize type can only be used within the main body of a compute shader.",
|
||||
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
|
||||
}
|
||||
}
|
||||
@@ -227,6 +227,37 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
}
|
||||
}
|
||||
|
||||
// Programmatically load mappings for the normalized thread ids
|
||||
foreach (var property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{typeof(ThreadIds.Normalized).Name}{Type.Delimiter}{property.Name}";
|
||||
|
||||
switch (property.Name)
|
||||
{
|
||||
case string name when name.Length == 1:
|
||||
knownMembers.Add(key, $"{typeof(ThreadIds).Name}.{char.ToLower(name[0])} / (float)__{char.ToLower(name[0])}");
|
||||
break;
|
||||
case string name when name.Length == 2:
|
||||
{
|
||||
string
|
||||
numerator = $"float2({typeof(ThreadIds).Name}.{char.ToLower(name[0])}, {typeof(ThreadIds).Name}.{char.ToLower(name[1])})",
|
||||
denominator = $"float2(__{char.ToLower(name[0])}, __{char.ToLower(name[1])})";
|
||||
|
||||
knownMembers.Add(key, $"{numerator} / {denominator}");
|
||||
break;
|
||||
}
|
||||
case string name when name.Length == 3:
|
||||
{
|
||||
string
|
||||
numerator = $"float3({typeof(ThreadIds).Name}.{char.ToLower(name[0])}, {typeof(ThreadIds).Name}.{char.ToLower(name[1])}, {typeof(ThreadIds).Name}.{char.ToLower(name[2])})",
|
||||
denominator = $"float3(__{char.ToLower(name[0])}, __{char.ToLower(name[1])}, __{char.ToLower(name[2])})";
|
||||
|
||||
knownMembers.Add(key, $"{numerator} / {denominator}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Programmatically load mappings for the group size
|
||||
foreach (var property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
@@ -240,11 +271,33 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
case string name when name.Length == 1:
|
||||
knownMembers.Add(key, $"__GroupSize__get_{name}");
|
||||
break;
|
||||
case string name when name.Length == 1:
|
||||
knownMembers.Add(key, $"__GroupSize__get_{name[0]} * __GroupSize__get_{name[1]}");
|
||||
case string name when name.Length == 2:
|
||||
knownMembers.Add(key, $"int2(__GroupSize__get_{name[0]}, __GroupSize__get_{name[1]})");
|
||||
break;
|
||||
case string name when name.Length == 3:
|
||||
knownMembers.Add(key, $"int3(__GroupSize__get_{name[0]}, __GroupSize__get_{name[1]}, __GroupSize__get_{name[2]})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Programmatically load mappings for the dispatch size
|
||||
foreach (var property in typeof(DispatchSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
string key = $"{typeof(DispatchSize).FullName}{Type.Delimiter}{property.Name}";
|
||||
|
||||
switch (property.Name)
|
||||
{
|
||||
case nameof(DispatchSize.Count):
|
||||
knownMembers.Add(key, "__x * __y * __z");
|
||||
break;
|
||||
case string name when name.Length == 1:
|
||||
knownMembers.Add(key, $"__GroupSize__get_{name[0]} * __GroupSize__get_{name[1]} * __GroupSize__get_{name[2]}");
|
||||
knownMembers.Add(key, $"__{char.ToLower(name[0])}");
|
||||
break;
|
||||
case string name when name.Length == 2:
|
||||
knownMembers.Add(key, $"int2(__{char.ToLower(name[0])}, __{char.ToLower(name[1])})");
|
||||
break;
|
||||
case string name when name.Length == 3:
|
||||
knownMembers.Add(key, $"int3(__{char.ToLower(name[0])}, __{char.ToLower(name[1])}, __{char.ToLower(name[2])})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,10 +83,11 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
// Special dispatch types are not supported from static constants
|
||||
DiagnosticDescriptor? descriptor = typeName switch
|
||||
{
|
||||
_ when typeName == typeof(ThreadIds).FullName => InvalidThreadIdsUsage,
|
||||
_ when typeName == typeof(ThreadIds).FullName || typeName == typeof(ThreadIds.Normalized).FullName => InvalidThreadIdsUsage,
|
||||
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
|
||||
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
|
||||
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
|
||||
_ when typeName == typeof(DispatchSize).FullName => InvalidDispatchSizeUsage,
|
||||
_ => null
|
||||
};
|
||||
|
||||
|
||||
@@ -284,10 +284,11 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
{
|
||||
DiagnosticDescriptor? descriptor = typeName switch
|
||||
{
|
||||
_ when typeName == typeof(ThreadIds).FullName => InvalidThreadIdsUsage,
|
||||
_ when typeName == typeof(ThreadIds).FullName || typeName == typeof(ThreadIds.Normalized).FullName => InvalidThreadIdsUsage,
|
||||
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
|
||||
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
|
||||
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
|
||||
_ when typeName == typeof(DispatchSize).FullName => InvalidDispatchSizeUsage,
|
||||
_ => null
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the size of the current shader dispatch being executed.
|
||||
/// That is, it enables a shader to access info on the targeted number of invocations along each axis.
|
||||
/// </summary>
|
||||
public static class DispatchSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the total number of dispatch invocations being executed.
|
||||
/// </summary>
|
||||
public static int Count => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(Count)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of dispatch invocations being executed on the X axis.
|
||||
/// </summary>
|
||||
public static int X => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(X)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of dispatch invocations being executed on the Y axis.
|
||||
/// </summary>
|
||||
public static int Y => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(Y)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of dispatch invocations being executed on the Z axis.
|
||||
/// </summary>
|
||||
public static int Z => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(DispatchSize)}.{nameof(ZZZ)}");
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the ids of the current thread group within the dispatch grid.
|
||||
/// That is, it enables a shader to access info on the index of the current thread group with respect to the dispatch grid.
|
||||
/// </summary>
|
||||
public static class GridIds
|
||||
{
|
||||
@@ -23,182 +24,182 @@ namespace ComputeSharp
|
||||
public static int Z => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZZ)}");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the ids of a given GPU thread running a compute shader within a dispatch group.
|
||||
/// That is, it enables a shader to access info on the index of the current thread with respect to the currently running group.
|
||||
/// </summary>
|
||||
public static class GroupIds
|
||||
{
|
||||
@@ -28,182 +29,182 @@ namespace ComputeSharp
|
||||
public static int Z => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GroupIds)}.{nameof(ZZZ)}");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the size info of a given GPU thread group running a compute shader within.
|
||||
/// A <see langword="class"/> that indicates the size info of a given GPU thread group running a compute shader.
|
||||
/// That is, it enables a shader to access info on the size of the thread groups being used.
|
||||
/// </summary>
|
||||
public static class GroupSize
|
||||
{
|
||||
@@ -28,182 +29,182 @@ namespace ComputeSharp
|
||||
public static int Z => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GroupSize)}.{nameof(ZZZ)}");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
namespace ComputeSharp
|
||||
{
|
||||
/// <inheritdoc cref="ThreadIds"/>
|
||||
public static partial class ThreadIds
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the normalized ids of a given GPU thread running a compute shader.
|
||||
/// These ids represent equivalent info to those from <see cref="ThreadIds"/>, but normalized in the [0, 1] range.
|
||||
/// The range used for the normalization is the one given by the target dispatch size (see <see cref="DispatchSize"/>).
|
||||
/// </summary>
|
||||
public static class Normalized
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the normalized X id of the current thread.
|
||||
/// </summary>
|
||||
public static float X => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(X)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the normalized Y id of the current thread.
|
||||
/// </summary>
|
||||
public static float Y => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(Y)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the normalized Z id of the current thread.
|
||||
/// </summary>
|
||||
public static float Z => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float2 XX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float2 XY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float2 XZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float2 YX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float2 YY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float2 YZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float2 ZX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float2 ZY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float2 ZZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 XXX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 XXY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 XXZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 XYX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 XYY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 XYZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 XZX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 XZY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 XZZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 YXX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 YXY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 YXZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 YYX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 YYY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 YYZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 YZX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 YZY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 YZZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZXX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZXY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZXZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZYX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZYY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZYZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZZX => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZZY => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Float3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Float3 ZZZ => throw new InvalidExecutionContextException($"{typeof(Normalized)}.{nameof(ZZZ)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,9 @@ namespace ComputeSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that indicates the ids of a given GPU thread running a compute shader.
|
||||
/// That is, it enables a shader to access info on the current iteration index along each axis.
|
||||
/// </summary>
|
||||
public static class ThreadIds
|
||||
public static partial class ThreadIds
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the X id of the current thread.
|
||||
@@ -23,182 +24,182 @@ namespace ComputeSharp
|
||||
public static int Z => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(Z)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(XZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(YZZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZXX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZXY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZXZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZYX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZYY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZYZ)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZZX)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZZY)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// Gets an <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
|
||||
/// </summary>
|
||||
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(ThreadIds)}.{nameof(ZZZ)}");
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
public void InvalidDispatchInfoUsage_LocalFunction(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
@@ -176,6 +177,7 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
public void InvalidDispatchInfoUsage_StaticMethod(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
@@ -202,6 +204,71 @@ namespace ComputeSharp.Tests.SourceGenerators
|
||||
VerifyGeneratedDiagnostics<IComputeShaderSourceGenerator>(source, diagnosticsId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[DataRow(nameof(ThreadIds), "CMPS0006")]
|
||||
[DataRow(nameof(GroupIds), "CMPS0007")]
|
||||
[DataRow(nameof(GroupSize), "CMPS0008")]
|
||||
[DataRow(nameof(GridIds), "CMPS0009")]
|
||||
[DataRow(nameof(DispatchSize), "CMPS0047")]
|
||||
public void InvalidDispatchInfoUsage_ConstantProperty(string typeName, string diagnosticsId)
|
||||
{
|
||||
string source = $@"
|
||||
using ComputeSharp;
|
||||
|
||||
namespace ComputeSharp
|
||||
{{
|
||||
public class ReadWriteBuffer<T> {{ }}
|
||||
public static class {typeName} {{ public static int X => 0; }}
|
||||
}}
|
||||
|
||||
namespace MyFancyApp.Sample
|
||||
{{
|
||||
public struct MyShader : IComputeShader
|
||||
{{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
private static int Foo => {typeName}.X;
|
||||
|
||||
public void Execute()
|
||||
{{
|
||||
buffer[0] = Foo;
|
||||
}}
|
||||
}}
|
||||
}}";
|
||||
|
||||
VerifyGeneratedDiagnostics<IComputeShaderSourceGenerator>(source, diagnosticsId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidThreadIdsNormalizedUsage()
|
||||
{
|
||||
string source = $@"
|
||||
using ComputeSharp;
|
||||
|
||||
namespace ComputeSharp
|
||||
{{
|
||||
public class ReadWriteBuffer<T> {{ }}
|
||||
public static class ThreadIds {{ public static class Normalized {{ public static int X => 0; }} }}
|
||||
}}
|
||||
|
||||
namespace MyFancyApp.Sample
|
||||
{{
|
||||
public struct MyShader : IComputeShader
|
||||
{{
|
||||
public ReadWriteBuffer<float> buffer;
|
||||
|
||||
private static int Foo => ThreadIds.Normalized.X;
|
||||
|
||||
public void Execute()
|
||||
{{
|
||||
buffer[0] = Foo;
|
||||
}}
|
||||
}}
|
||||
}}";
|
||||
|
||||
VerifyGeneratedDiagnostics<IComputeShaderSourceGenerator>(source, "CMPS0006");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidObjectCreationExpression_Explicit()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ComputeSharp.Interop;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@@ -64,6 +65,47 @@ namespace ComputeSharp.Tests
|
||||
}
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public unsafe void Verify_ThreadIdsNormalized(Device device)
|
||||
{
|
||||
using ReadWriteTexture3D<Float4> buffer = device.Get().AllocateReadWriteTexture3D<Float4>(10, 20, 30);
|
||||
|
||||
device.Get().For(buffer.Width, buffer.Height, buffer.Depth, new ThreadIdsNormalizedShader(buffer));
|
||||
|
||||
Float4[,,] data = buffer.ToArray();
|
||||
float* value = stackalloc float[4];
|
||||
|
||||
for (int z = 0; z < 30; z++)
|
||||
{
|
||||
for (int x = 0; x < 10; x++)
|
||||
{
|
||||
for (int y = 0; y < 20; y++)
|
||||
{
|
||||
*(Float4*)value = data[z, y, x];
|
||||
|
||||
Assert.AreEqual(x / (float)buffer.Width, value[0], 0.000001f);
|
||||
Assert.AreEqual(y / (float)buffer.Height, value[1], 0.000001f);
|
||||
Assert.AreEqual(z / (float)buffer.Depth, value[2], 0.000001f);
|
||||
Assert.AreEqual(x / (float)buffer.Width, value[3], 0.000001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct ThreadIdsNormalizedShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteTexture3D<Float4> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ;
|
||||
buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY;
|
||||
buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X;
|
||||
}
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public unsafe void Verify_GroupIds(Device device)
|
||||
@@ -138,6 +180,8 @@ namespace ComputeSharp.Tests
|
||||
Assert.AreEqual(15, data[1]);
|
||||
Assert.AreEqual(7, data[2]);
|
||||
Assert.AreEqual(4 * 15 * 7, data[3]);
|
||||
Assert.AreEqual(4 + 15, data[4]);
|
||||
Assert.AreEqual(4 + 15 + 7, data[5]);
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
@@ -151,6 +195,8 @@ namespace ComputeSharp.Tests
|
||||
buffer[1] = GroupSize.Y;
|
||||
buffer[2] = GroupSize.Z;
|
||||
buffer[3] = GroupSize.Count;
|
||||
buffer[4] = (int)Hlsl.Dot(GroupSize.XY, Float2.One);
|
||||
buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, Float3.One);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,5 +226,41 @@ namespace ComputeSharp.Tests
|
||||
buffer[ThreadIds.X] = GridIds.X;
|
||||
}
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public void Verify_DispatchSize(Device device)
|
||||
{
|
||||
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer<int>(6);
|
||||
|
||||
device.Get().For(11, 22, 3, new DispatchSizeShader(buffer));
|
||||
|
||||
ReflectionServices.GetShaderInfo<DispatchSizeShader>(out var info);
|
||||
|
||||
int[] data = buffer.ToArray();
|
||||
|
||||
Assert.AreEqual(data[0], 11 * 22 * 3);
|
||||
Assert.AreEqual(data[1], 11);
|
||||
Assert.AreEqual(data[2], 22);
|
||||
Assert.AreEqual(data[3], 3);
|
||||
Assert.AreEqual(data[4], 11 + 22);
|
||||
Assert.AreEqual(data[5], 11 + 22 + 3);
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct DispatchSizeShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<int> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[0] = DispatchSize.Count;
|
||||
buffer[1] = DispatchSize.X;
|
||||
buffer[2] = DispatchSize.Y;
|
||||
buffer[3] = DispatchSize.Z;
|
||||
buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, Float2.One);
|
||||
buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, Float3.One);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@@ -21,13 +19,13 @@ namespace ComputeSharp.Tests
|
||||
|
||||
float[] results = buffer.ToArray();
|
||||
|
||||
Assert.IsTrue(Math.Abs(3.14f - results[0]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(results[1] - results[2]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(1 - results[3]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(2 - results[4]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(3 - results[5]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(4 - results[6]) < 0.00001f);
|
||||
Assert.IsTrue(Math.Abs(3.14f - results[7]) < 0.00001f);
|
||||
Assert.AreEqual(3.14f, results[0], 0.00001f);
|
||||
Assert.AreEqual(results[1], results[2], 0.00001f);
|
||||
Assert.AreEqual(1, results[3], 0.00001f);
|
||||
Assert.AreEqual(2, results[4], 0.00001f);
|
||||
Assert.AreEqual(3, results[5], 0.00001f);
|
||||
Assert.AreEqual(4, results[6], 0.00001f);
|
||||
Assert.AreEqual(3.14f, results[7], 0.00001f);
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする