From 789827aecac750d4660560942a869fd65af304bf Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 9 Aug 2022 14:38:33 +0200 Subject: [PATCH] Change ComputeSharp sample APIs to Sample method --- .../Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs | 8 ++++---- .../Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs | 8 ++++---- .../Resources/Interfaces/IReadOnlyTexture2D{T}.cs | 8 ++++---- .../Resources/Interfaces/IReadOnlyTexture3D{T}.cs | 8 ++++---- .../Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs | 4 ++-- .../Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs | 4 ++-- .../Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs | 4 ++-- .../Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs | 4 ++-- .../Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs | 4 ++-- .../Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs | 4 ++-- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs index 89e461b7..6c896ce0 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture2D{TPixel}.cs @@ -34,17 +34,17 @@ public interface IReadOnlyNormalizedTexture2D : IGraphicsResource ref readonly TPixel this[Int2 xy] { get; } /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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 TPixel this[float u, float v] { get; } + ref readonly TPixel Sample(float u, float v); /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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 TPixel this[Float2 uv] { get; } + ref readonly TPixel Sample(Float2 uv); } diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs index 9faa16f0..8b5c3f7d 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyNormalizedTexture3D{TPixel}.cs @@ -40,18 +40,18 @@ public interface IReadOnlyNormalizedTexture3D : IGraphicsResource ref readonly TPixel this[Int3 xyz] { get; } /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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 TPixel this[float u, float v, float w] { get; } + ref readonly TPixel Sample(float u, float v, float w); /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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 TPixel this[Float3 uvw] { get; } + ref readonly TPixel Sample(Float3 uvw); } diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs index 578542f4..e0e32110 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture2D{T}.cs @@ -34,17 +34,17 @@ public interface IReadOnlyTexture2D : IGraphicsResource ref readonly T this[Int2 xy] { get; } /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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; } + ref readonly T Sample(float u, float v); /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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; } + ref readonly T Sample(Float2 uv); } diff --git a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs index 822e9dea..c08086c0 100644 --- a/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Interfaces/IReadOnlyTexture3D{T}.cs @@ -40,18 +40,18 @@ public interface IReadOnlyTexture3D : IGraphicsResource ref readonly T this[Int3 xyz] { get; } /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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; } + ref readonly T Sample(float u, float v, float w); /// - /// Gets a single value from the current readonly texture with linear sampling. + /// Retrieves 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; } + ref readonly T Sample(Float3 uvw); } diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs index befbf989..376267a5 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs @@ -37,10 +37,10 @@ public sealed class ReadOnlyTexture2D : Texture2D, IReadOnlyNormal public ref readonly TPixel this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(Int2)}]"); /// - public ref readonly TPixel this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(float)}, {typeof(float)}]"); + public ref readonly TPixel Sample(float u, float v) => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}.{nameof(Sample)}({typeof(float)}, {typeof(float)})"); /// - public ref readonly TPixel this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}[{typeof(Float2)}]"); + public ref readonly TPixel Sample(Float2 uv) => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture2D)}.{nameof(Sample)}({typeof(Float2)})"); /// public override string ToString() diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs index 20982a21..f27322f2 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs @@ -38,10 +38,10 @@ public sealed class ReadOnlyTexture3D : Texture3D, IReadOnlyNormal public ref readonly TPixel this[Int3 xyz] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture3D)}[{typeof(Int3)}]"); /// - public ref readonly TPixel this[float u, float v, float w] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture3D)}[{typeof(float)}, {typeof(float)}, {typeof(float)}]"); + public ref readonly TPixel Sample(float u, float v, float w) => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture3D)}.{nameof(Sample)}({typeof(float)}, {typeof(float)}, {typeof(float)})"); /// - public ref readonly TPixel this[Float3 uvw] => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture3D)}[{typeof(Float3)}]"); + public ref readonly TPixel Sample(Float3 uvw) => throw new InvalidExecutionContextException($"{typeof(ReadOnlyTexture3D)}.{nameof(Sample)}({typeof(Float3)})"); /// public override string ToString() diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs index ab938544..c52f1ec2 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.ReadOnly.cs @@ -95,10 +95,10 @@ partial class ReadWriteTexture2D public ref readonly TPixel this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(Int2)}]"); /// - public ref readonly TPixel this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(float)}, {typeof(float)}]"); + public ref readonly TPixel Sample(float u, float v) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}.{nameof(Sample)}({typeof(float)}, {typeof(float)})"); /// - public ref readonly TPixel this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(Float2)}]"); + public ref readonly TPixel Sample(Float2 uv) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}.{nameof(Sample)}({typeof(Float2)})"); /// public int Width => this.owner.Width; diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs index 10714b5b..56c278f0 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T}.ReadOnly.cs @@ -95,10 +95,10 @@ partial class ReadWriteTexture2D public ref readonly T this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(Int2)}]"); /// - public ref readonly T this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(float)}, {typeof(float)}]"); + public ref readonly T Sample(float u, float v) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}.{nameof(Sample)}({typeof(float)}, {typeof(float)})"); /// - public ref readonly T this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}[{typeof(Float2)}]"); + public ref readonly T Sample(Float2 uv) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture2D.ReadOnly)}.{nameof(Sample)}({typeof(Float2)})"); /// public int Width => this.owner.Width; diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs index 9d08103a..29df6f79 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.ReadOnly.cs @@ -92,10 +92,10 @@ partial class ReadWriteTexture3D public ref readonly TPixel this[Int3 xyz] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(Int3)}]"); /// - public ref readonly TPixel this[float u, float v, float w] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(float)}, {typeof(float)}, {typeof(float)}]"); + public ref readonly TPixel Sample(float u, float v, float w) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}.{nameof(Sample)}({typeof(float)}, {typeof(float)}, {typeof(float)})"); /// - public ref readonly TPixel this[Float3 uvw] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(Float3)}]"); + public ref readonly TPixel Sample(Float3 uvw) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}.{nameof(Sample)}({typeof(Float3)})"); /// public int Width => this.owner.Width; diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs index 7930bf39..9161f98f 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T}.ReadOnly.cs @@ -92,10 +92,10 @@ partial class ReadWriteTexture3D public ref readonly T this[Int3 xyz] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(Int3)}]"); /// - public ref readonly T this[float u, float v, float w] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(float)}, {typeof(float)}, {typeof(float)}]"); + public ref readonly T Sample(float u, float v, float w) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}.{nameof(Sample)}({typeof(float)}, {typeof(float)}, {typeof(float)})"); /// - public ref readonly T this[Float3 uvw] => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}[{typeof(Float3)}]"); + public ref readonly T Sample(Float3 uvw) => throw new InvalidExecutionContextException($"{typeof(ReadWriteTexture3D.ReadOnly)}.{nameof(Sample)}({typeof(Float3)})"); /// public int Width => this.owner.Width;