From 8515473a8961de340f0585ed9aa548887e56cf98 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 25 Aug 2019 20:07:51 +0200 Subject: [PATCH] Added Int3 struct --- .../Primitives/Int/Int3.cs | 305 ++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 src/ComputeSharp.Shaders/Primitives/Int/Int3.cs diff --git a/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs b/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs new file mode 100644 index 00000000..f9e8e16c --- /dev/null +++ b/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs @@ -0,0 +1,305 @@ +using System.Runtime.InteropServices; +using ComputeSharp.Graphics.Exceptions; + +namespace ComputeSharp.Shaders.Primitives.Int +{ + /// + /// A that maps the int3 HLSL type + /// + [StructLayout(LayoutKind.Sequential, Size = sizeof(int) * 3)] + public struct Int3 + { + /// + /// Creates a new instance with the specified parameters + /// + /// The value to assign to the first vector component + /// The value to assign to the second vector component + /// The value to assign to the third vector component + public Int3(int x, int y, int z) + { + X = x; + Y = y; + Z = z; + } + + /// + /// Gets or sets the value of the first vector component + /// + public int X { get; set; } + + /// + /// Gets or sets the value of the second vector component + /// + public int Y { get; set; } + + /// + /// Gets or sets the value of the third vector component + /// + public int Z { get; set; } + + /// + /// Gets or sets the value of the first color component + /// + public float R + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(R)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(R)}"); + } + + /// + /// Gets or sets the value of the second color component + /// + public float G + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(G)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(G)}"); + } + + /// + /// Gets or sets the value of the third color component + /// + public float B + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(B)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(B)}"); + } + + /// + /// Gets or sets a specific component in the current instance + /// + /// The index of the component to access + public float this[int i] + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}[int]"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}[int]"); + } + + /// + /// Gets an value with the value for all components + /// + public Int2 XX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XX)}"); + + /// + /// Gets or sets an value with the and values + /// + public Int2 XY + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XY)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XY)}"); + } + + /// + /// Gets or sets an value with the and values + /// + public Int2 XZ + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZ)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZ)}"); + } + + /// + /// Gets or sets an value with the and values + /// + public Int2 YX + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YX)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YX)}"); + } + + /// + /// Gets an value with the value for all components + /// + public Int2 YY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YY)}"); + + /// + /// Gets or sets an value with the and values + /// + public Int2 YZ + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZ)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZ)}"); + } + + /// + /// Gets or sets an value with the and values + /// + public Int2 ZX + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZX)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZX)}"); + } + + /// + /// Gets or sets an value with the and values + /// + public Int2 ZY + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZY)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZY)}"); + } + + /// + /// Gets an value with the value for all components + /// + public Int2 ZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZ)}"); + + /// + /// Gets an value with the value for all components + /// + public Int2 XXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXX)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 XXY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXY)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 XXZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XXZ)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 XYX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYX)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 XYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYY)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 XYZ + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYZ)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XYZ)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 XZX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZX)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 XZY + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZY)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZY)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 XZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(XZZ)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 YXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXX)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 YXY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXY)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 YXZ + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXZ)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YXZ)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 YYX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYX)}"); + + /// + /// Gets an value with the value for all components + /// + public Int2 YYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYY)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 YYZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YYZ)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 YZX + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZX)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZX)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 YZY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZY)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 YZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(YZZ)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 ZXX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXX)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 ZXY + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXY)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXY)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 ZXZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZXZ)}"); + + /// + /// Gets or sets an value with the , and values + /// + public Int2 ZYX + { + get => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYX)}"); + set => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYX)}"); + } + + /// + /// Gets an value with the , and values + /// + public Int2 ZYY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYY)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 ZYZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZYZ)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 ZZX => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZX)}"); + + /// + /// Gets an value with the , and values + /// + public Int2 ZZY => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZY)}"); + + /// + /// Gets an value with the value for all components + /// + public Int2 ZZZ => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(ZZZ)}"); + } +}