diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs new file mode 100644 index 00000000..578542f4 --- /dev/null +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs @@ -0,0 +1,50 @@ +namespace ComputeSharp; + +/// +/// An interface representing a typed readonly 2D texture containing raw data stored on GPU memory. +/// This interface can only be used to wrap instances. +/// +/// The type of raw data used on the GPU side. +public interface IReadOnlyTexture2D : IGraphicsResource + where T : unmanaged +{ + /// + /// Gets the width of the current texture. + /// + int Width { get; } + + /// + /// Gets the height of the current texture. + /// + int Height { get; } + + /// + /// Gets a single value from the current readonly texture. + /// + /// The horizontal offset of the value to get. + /// The vertical offset of the value to get. + /// This API can only be used from a compute shader, and will always throw if used anywhere else. + ref readonly T this[int x, int y] { get; } + + /// + /// Gets a single value from the current readonly 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. + ref readonly T this[Int2 xy] { get; } + + /// + /// Gets a single value from the current readonly texture with linear sampling. + /// + /// The horizontal normalized offset of the value to get. + /// The vertical normalized offset of the value to get. + /// This API can only be used from a compute shader, and will always throw if used anywhere else. + ref readonly T this[float u, float v] { get; } + + /// + /// Gets a single value from the current readonly texture with linear sampling. + /// + /// The normalized coordinates of the value to get. + /// This API can only be used from a compute shader, and will always throw if used anywhere else. + ref readonly T this[Float2 uv] { get; } +} diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs new file mode 100644 index 00000000..822e9dea --- /dev/null +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs @@ -0,0 +1,57 @@ +namespace ComputeSharp; + +/// +/// An interface representing a typed readonly 3D texture containing raw data stored on GPU memory. +/// This interface can only be used to wrap instances. +/// +/// The type of raw data used on the GPU side. +public interface IReadOnlyTexture3D : IGraphicsResource + where T : unmanaged +{ + /// + /// Gets the width of the current texture. + /// + int Width { get; } + + /// + /// Gets the height of the current texture. + /// + int Height { get; } + + /// + /// Gets the depth of the current texture. + /// + int Depth { get; } + + /// + /// Gets a single value from the current readonly 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. + ref readonly T this[int x, int y, int z] { get; } + + /// + /// Gets a single value from the current readonly 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. + ref readonly T this[Int3 xyz] { get; } + + /// + /// Gets a single value from the current readonly texture with linear sampling. + /// + /// The horizontal normalized offset of the value to get. + /// The vertical normalized offset of the value to get. + /// The depthwise normalized offset of the value to get. + /// This API can only be used from a compute shader, and will always throw if used anywhere else. + ref readonly T this[float u, float v, float w] { get; } + + /// + /// Gets a single value from the current readonly texture with linear sampling. + /// + /// The normalized coordinates of the value to get. + /// This API can only be used from a compute shader, and will always throw if used anywhere else. + ref readonly T this[Float3 uvw] { get; } +}