using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace ComputeSharp
{
///
/// A that indicates the number of threads to use to run a given compute shader
///
[DebuggerDisplay("(X: {X}, Y: {Y}, Z: {Z})")]
public readonly struct NumThreads
{
///
/// The X id of the current thread
///
public readonly int X;
///
/// The Y id of the current thread
///
public readonly int Y;
///
/// The Z id of the current thread
///
public readonly int Z;
///
/// Creates a new instance with the specified parameters
///
/// The number of threads in the X axis
/// The number of threads in the Y axis
public NumThreads(int x, int y)
{
X = x;
Y = y;
Z = 1;
}
///
/// Creates a new instance with the specified parameters
///
/// The number of threads in the X axis
/// The number of threads in the Y axis
/// The number of threads in the Z axis
public NumThreads(int x, int y, int z)
{
X = x;
Y = y;
Z = z;
}
///
/// Creates a new instance from a value tuple
///
/// The tuple with the thread X and Y counts
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator NumThreads((int X, int Y) xy) => new NumThreads(xy.X, xy.Y);
///
/// Creates a new instance from a value tuple
///
/// The tuple with the thread X, Y and Z counts
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator NumThreads((int X, int Y, int Z) xyz) => new NumThreads(xyz.X, xyz.Y, xyz.Z);
}
}