diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs new file mode 100644 index 00000000..eda6c900 --- /dev/null +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture1D{TPixel}.cs @@ -0,0 +1,29 @@ +namespace ComputeSharp; + +/// +/// An interface representing a typed readonly 1D texture containing normalized pixel data stored on GPU memory. +/// This interface can only be used to wrap instances. +/// +/// The type of normalized pixels used on the GPU side. +public interface IReadOnlyNormalizedTexture1D : IGraphicsResource + where TPixel : unmanaged +{ + /// + /// Gets the width of the current texture. + /// + int Width { get; } + + /// + /// Gets a single value from the current readonly texture. + /// + /// The horizontal 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 TPixel this[int x] { get; } + + /// + /// Retrieves a single value from the current readonly texture with linear sampling. + /// + /// The horizontal 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 TPixel Sample(float u); +} diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs new file mode 100644 index 00000000..14ae0c64 --- /dev/null +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture1D{T}.cs @@ -0,0 +1,29 @@ +namespace ComputeSharp; + +/// +/// An interface representing a typed readonly 1D 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 IReadOnlyTexture1D : IGraphicsResource + where T : unmanaged +{ + /// + /// Gets the width of the current texture. + /// + int Width { get; } + + /// + /// Gets a single value from the current readonly texture. + /// + /// The horizontal 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] { get; } + + /// + /// Retrieves a single value from the current readonly texture with linear sampling. + /// + /// The horizontal 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 Sample(float u); +} diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs new file mode 100644 index 00000000..0d65f74d --- /dev/null +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadWriteNormalizedTexture1D{TPixel}.cs @@ -0,0 +1,22 @@ +namespace ComputeSharp; + +/// +/// An interface representing a typed writeable 1D texture containing normalized pixel data stored on GPU memory. +/// This interface can only be used to wrap instances. +/// +/// The type of normalized pixels used on the GPU side. +public interface IReadWriteNormalizedTexture1D : IGraphicsResource + where TPixel : unmanaged +{ + /// + /// Gets the width of the current texture. + /// + int Width { get; } + + /// + /// Gets a single value from the current writeable texture. + /// + /// The horizontal 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 TPixel this[int x] { get; } +}