From 37818d86ac6f0a914b1577256c00f85e8726d6fa Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 30 Sep 2023 19:18:54 +0200 Subject: [PATCH] Reorder D2D1PixelShader APIs to match interface --- .../Shaders/Interop/D2D1PixelShader.cs | 234 +++++++++--------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs index 2122a91d..53e0b7a1 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs @@ -13,6 +13,123 @@ namespace ComputeSharp.D2D1.Interop; /// public static class D2D1PixelShader { + /// + /// Gets the size of the constant buffer for a D2D1 pixel shader of a specified type. + /// + /// The type of D2D1 pixel shader to retrieve info for. + /// The size of the constant buffer for a D2D1 pixel shader of type . + public static int GetConstantBufferSize() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ConstantBufferSize; + } + + /// + /// Gets the number of inputs from an input D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input count for. + /// The number of inputs for the D2D1 pixel shader of type . + public static int GetInputCount() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputCount; + } + + /// + /// Gets the number of resource textures for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the resource texture count for. + /// The number of resource texture for the D2D1 pixel shader of type . + public static int GetResourceTextureCount() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ResourceTextureCount; + } + + /// + /// Gets the input types for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input types for. + /// The input types of the target D2D1 pixel shader. + public static ReadOnlyMemory GetInputTypes() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputTypes; + } + + /// + /// Gets the available input descriptions for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input descriptions for. + /// A with the available input descriptions for the shader. + public static ReadOnlyMemory GetInputDescriptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputDescriptions; + } + + /// + /// Gets the available resource texture descriptions for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the resource texture descriptions for. + /// A with the available resource texture descriptions for the shader. + public static ReadOnlyMemory GetResourceTextureDescriptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ResourceTextureDescriptions; + } + + /// + /// Gets the pixel options from an input D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the pixel options for. + /// The pixel options for the D2D1 pixel shader of type . + public static D2D1PixelOptions GetPixelOptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.PixelOptions; + } + + /// + /// Gets the buffer precision for the output buffer of a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the output buffer precision for. + /// The output buffer precision for the D2D1 pixel shader of type . + public static D2D1BufferPrecision GetOutputBufferPrecision() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.BufferPrecision; + } + + /// + /// Gets the channel depth for the output buffer of a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the output buffer channel depth for. + /// The output buffer channel depth for the D2D1 pixel shader of type . + public static D2D1ChannelDepth GetOutputBufferChannelDepth() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ChannelDepth; + } + /// /// Loads the bytecode from an input D2D1 pixel shader. /// @@ -268,110 +385,6 @@ public static class D2D1PixelShader return CompileBytecode(requestedShaderProfile, requestedCompileOptions, out effectiveShaderProfile, out effectiveCompileOptions); } - /// - /// Gets the pixel options from an input D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the pixel options for. - /// The pixel options for the D2D1 pixel shader of type . - public static D2D1PixelOptions GetPixelOptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.PixelOptions; - } - - /// - /// Gets the number of inputs from an input D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input count for. - /// The number of inputs for the D2D1 pixel shader of type . - public static int GetInputCount() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputCount; - } - - /// - /// Gets the number of resource textures for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the resource texture count for. - /// The number of resource texture for the D2D1 pixel shader of type . - public static int GetResourceTextureCount() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ResourceTextureCount; - } - - /// - /// Gets the input types for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input types for. - /// The input types of the target D2D1 pixel shader. - public static ReadOnlyMemory GetInputTypes() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputTypes; - } - - /// - /// Gets the available input descriptions for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input descriptions for. - /// A with the available input descriptions for the shader. - public static ReadOnlyMemory GetInputDescriptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputDescriptions; - } - - /// - /// Gets the available resource texture descriptions for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the resource texture descriptions for. - /// A with the available resource texture descriptions for the shader. - public static ReadOnlyMemory GetResourceTextureDescriptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ResourceTextureDescriptions; - } - - /// - /// Gets the buffer precision for the output buffer of a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the output buffer precision for. - /// The output buffer precision for the D2D1 pixel shader of type . - public static D2D1BufferPrecision GetOutputBufferPrecision() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.BufferPrecision; - } - - /// - /// Gets the channel depth for the output buffer of a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the output buffer channel depth for. - /// The output buffer channel depth for the D2D1 pixel shader of type . - public static D2D1ChannelDepth GetOutputBufferChannelDepth() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ChannelDepth; - } - /// /// Gets the constant buffer from an input D2D1 pixel shader. /// @@ -391,19 +404,6 @@ public static class D2D1PixelShader return dataLoader.GetResultingDispatchData(); } - /// - /// Gets the size of the constant buffer for a D2D1 pixel shader of a specified type. - /// - /// The type of D2D1 pixel shader to retrieve info for. - /// The size of the constant buffer for a D2D1 pixel shader of type . - public static int GetConstantBufferSize() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ConstantBufferSize; - } - /// /// Gets the constant buffer from an input D2D1 pixel shader. ///