Add 1D and 3D texture resource types
このコミットが含まれているのは:
1 親
d509767d45
コミット
7216a7b72e
4ファイル変更
+102
-10
検索条件に一致するファイルはありません
@@ -3,7 +3,7 @@
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// An attribute for a <see cref="D2D1TextureResource"/> field in a D2D1 shader indicating the index of the D2D1 resource.
|
||||
/// An attribute for resource fields in a D2D1 shader indicating the index of the D2D1 resource.
|
||||
/// This is needed to bind an input resource in a shader to the correct input. Using this attribute is mandatory.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@@ -15,14 +15,14 @@ public sealed class D2DResourceIndexAttribute : Attribute
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="D2DResourceIndexAttribute"/> type with the specified arguments.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the annotated <see cref="D2D1TextureResource"/> field.</param>
|
||||
/// <param name="index">The index of the annotated resource field.</param>
|
||||
public D2DResourceIndexAttribute(int index)
|
||||
{
|
||||
Index = index;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the annotated <see cref="D2D1TextureResource"/> field.
|
||||
/// Gets the index of the annotated resource field.
|
||||
/// </summary>
|
||||
public int Index { get; }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> representing a <see cref="Float4"/> readonly 1D texture stored on GPU memory.
|
||||
/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
|
||||
/// </summary>
|
||||
[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
|
||||
public readonly struct D2D1TextureResource1D
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the width of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource1D)}.{nameof(Width)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture.
|
||||
/// </summary>
|
||||
/// <param name="x">The horizontal offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[int x] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(int)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture with linear sampling.
|
||||
/// </summary>
|
||||
/// <param name="u">The horizontal normalized offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[float u] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(float)}]");
|
||||
}
|
||||
+7
-7
@@ -7,19 +7,19 @@ namespace ComputeSharp.D2D1;
|
||||
/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
|
||||
/// </summary>
|
||||
[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
|
||||
public readonly struct D2D1TextureResource
|
||||
public readonly struct D2D1TextureResource2D
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the width of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}.{nameof(Width)}");
|
||||
public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}.{nameof(Width)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the height of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}.{nameof(Height)}");
|
||||
public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}.{nameof(Height)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture.
|
||||
@@ -27,14 +27,14 @@ public readonly struct D2D1TextureResource
|
||||
/// <param name="x">The horizontal offset of the value to get.</param>
|
||||
/// <param name="y">The vertical offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[int x, int y] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(int)}, {typeof(int)}]");
|
||||
public ref readonly Float4 this[int x, int y] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(int)}, {typeof(int)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture.
|
||||
/// </summary>
|
||||
/// <param name="xy">The coordinates of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(Int2)}]");
|
||||
public ref readonly Float4 this[Int2 xy] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(Int2)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture with linear sampling.
|
||||
@@ -42,12 +42,12 @@ public readonly struct D2D1TextureResource
|
||||
/// <param name="u">The horizontal normalized offset of the value to get.</param>
|
||||
/// <param name="v">The vertical normalized offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(float)}, {typeof(float)}]");
|
||||
public ref readonly Float4 this[float u, float v] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(float)}, {typeof(float)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture with linear sampling.
|
||||
/// </summary>
|
||||
/// <param name="uv">The normalized coordinates of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource)}[{typeof(Float2)}]");
|
||||
public ref readonly Float4 this[Float2 uv] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource2D)}[{typeof(Float2)}]");
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="struct"/> representing a <see cref="Float4"/> readonly 3D texture stored on GPU memory.
|
||||
/// This can be used from D2D1 pixel shaders to be able to pass arbitrary inputs to them.
|
||||
/// </summary>
|
||||
[AutoConstructorBehavior(AutoConstructorBehavior.IgnoreAndSetToDefault)]
|
||||
public readonly struct D2D1TextureResource3D
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the width of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Width => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Width)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the height of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Height => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Height)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the depth of the current texture.
|
||||
/// </summary>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public int Depth => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}.{nameof(Depth)}");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture.
|
||||
/// </summary>
|
||||
/// <param name="x">The horizontal offset of the value to get.</param>
|
||||
/// <param name="y">The vertical offset of the value to get.</param>
|
||||
/// <param name="z">The depthwise offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[int x, int y, int z] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(int)}, {typeof(int)}, {typeof(int)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture.
|
||||
/// </summary>
|
||||
/// <param name="xyz">The coordinates of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[Int3 xyz] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(Int3)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture with linear sampling.
|
||||
/// </summary>
|
||||
/// <param name="u">The horizontal normalized offset of the value to get.</param>
|
||||
/// <param name="v">The vertical normalized offset of the value to get.</param>
|
||||
/// <param name="w">The depthwise offset of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[float u, float v, float w] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(float)}, {typeof(float)}, {typeof(float)}]");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single <see cref="Float4"/> value from the current readonly texture with linear sampling.
|
||||
/// </summary>
|
||||
/// <param name="uvw">The normalized coordinates of the value to get.</param>
|
||||
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else.</remarks>
|
||||
public ref readonly Float4 this[Float3 uvw] => throw new InvalidExecutionContextException($"{typeof(D2D1TextureResource3D)}[{typeof(Float3)}]");
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする