using System.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Resources.Enums; using ComputeSharp.Resources; using ComputeSharp.Resources.Views; #pragma warning disable CS0618 namespace ComputeSharp { /// /// A representing a typed readonly 3D texture stored on GPU memory. /// /// The type of items stored on the texture. /// The type of pixels used on the GPU side. [DebuggerTypeProxy(typeof(Texture3DDebugView<>))] [DebuggerDisplay("{ToString(),raw}")] public sealed class ReadWriteTexture3D : Texture3D where T : unmanaged, IUnorm where TPixel : unmanaged { /// /// Creates a new instance with the specified parameters. /// /// The associated with the current instance. /// The width of the texture. /// The height of the texture. /// The depth of the texture. internal ReadWriteTexture3D(GraphicsDevice device, int width, int height, int depth) : base(device, width, height, depth, ResourceType.ReadWrite) { } /// /// Gets a single value from the current writeable texture. /// /// The horizontal offset of the value to get. /// The vertical offset of the value to get. /// The depthwise offset of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. public ref TPixel this[int x, int y, int z] => throw new InvalidExecutionContextException($"{nameof(ReadWriteTexture3D)}[int,int,int]"); /// /// Gets a single value from the current writeable texture. /// /// The coordinates of the value to get. /// This API can only be used from a compute shader, and will always throw if used anywhere else. public ref TPixel this[Int3 xyz] => throw new InvalidExecutionContextException($"{nameof(ReadWriteTexture3D)}[Int3]"); /// public override string ToString() { return $"ComputeSharp.ReadWriteTexture3D<{typeof(T)},{nameof(TPixel)}>[{Width}, {Height}, {Depth}]"; } } }