From f1d88decdb9eb5e07f61e1b009bd2e22365cf649 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 24 Apr 2022 14:54:20 +0200 Subject: [PATCH] Add more HLSL intrinsics --- src/ComputeSharp.Core/Intrinsics/Hlsl.cs | 30 +- src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs | 684 ++++++++++++++++++ .../Intrinsics/Hlsl.ttinclude | 174 +++++ 3 files changed, 887 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs index 535b8b38..a09a054b 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs @@ -1,4 +1,5 @@ -using ComputeSharp.Exceptions; +using ComputeSharp.Core.Intrinsics.Attributes; +using ComputeSharp.Exceptions; namespace ComputeSharp; @@ -7,6 +8,13 @@ namespace ComputeSharp; /// public static partial class Hlsl { + /// + /// Submits an error message to the information queue and terminates the current draw or dispatch call being executed. + /// + /// This operation does nothing on rasterizers that do not support it. + [HlslIntrinsicName("abort")] + public static void Abort() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Abort)}()"); + /// /// Blocks execution of all threads in a group until all memory accesses have been completed. /// @@ -316,4 +324,24 @@ public static partial class Hlsl /// The original value. /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static void InterlockedXor(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})"); + + /// + /// Returns a lighting coefficient vector. + /// + /// The dot product of the normalized surface normal and the light vector. + /// The dot product of the half-angle vector and the surface normal. + /// A specular exponent. + /// The lighting coefficient vector. + /// + /// This function returns a lighting coefficient vector (ambient, diffuse, specular, 1) where: + /// + /// Ambient: 1. + /// Diffuse: n * l < 0 ? 0 : n * l. + /// Specular: n * l < 0 || n * h < 0 ? 0 : (n * h) ^ m. + /// + /// Where the vector n is the normal vector, l is the direction to light and h is the half vector. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + [HlslIntrinsicName("lit")] + public static float Lit(float nDotL, float nDotH, float m) => default; } diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs index 931bfcea..768df5ba 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.g.cs @@ -4492,6 +4492,510 @@ partial class Hlsl [HlslIntrinsicName("cross")] public static Float3 Cross(Float3 x, Float3 y) => default; + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static float DerivativeOfDx(float x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float2 DerivativeOfDx(Float2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float3 DerivativeOfDx(Float3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float4 DerivativeOfDx(Float4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float1x1 DerivativeOfDx(Float1x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float1x2 DerivativeOfDx(Float1x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float1x3 DerivativeOfDx(Float1x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float1x4 DerivativeOfDx(Float1x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float2x1 DerivativeOfDx(Float2x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float2x2 DerivativeOfDx(Float2x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float2x3 DerivativeOfDx(Float2x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float2x4 DerivativeOfDx(Float2x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float3x1 DerivativeOfDx(Float3x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float3x2 DerivativeOfDx(Float3x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float3x3 DerivativeOfDx(Float3x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float3x4 DerivativeOfDx(Float3x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float4x1 DerivativeOfDx(Float4x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float4x2 DerivativeOfDx(Float4x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float4x3 DerivativeOfDx(Float4x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx")] + public static Float4x4 DerivativeOfDx(Float4x4 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_coarse")] + public static float DerivativeOfDxLowPrecision(float x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_coarse")] + public static Float2 DerivativeOfDxLowPrecision(Float2 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_coarse")] + public static Float3 DerivativeOfDxLowPrecision(Float3 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_coarse")] + public static Float4 DerivativeOfDxLowPrecision(Float4 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_fine")] + public static float DerivativeOfDxHighPrecision(float x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_fine")] + public static Float2 DerivativeOfDxHighPrecision(Float2 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_fine")] + public static Float3 DerivativeOfDxHighPrecision(Float3 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space x-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddx_fine")] + public static Float4 DerivativeOfDxHighPrecision(Float4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static float DerivativeOfDy(float x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float2 DerivativeOfDy(Float2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float3 DerivativeOfDy(Float3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float4 DerivativeOfDy(Float4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float1x1 DerivativeOfDy(Float1x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float1x2 DerivativeOfDy(Float1x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float1x3 DerivativeOfDy(Float1x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float1x4 DerivativeOfDy(Float1x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float2x1 DerivativeOfDy(Float2x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float2x2 DerivativeOfDy(Float2x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float2x3 DerivativeOfDy(Float2x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float2x4 DerivativeOfDy(Float2x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float3x1 DerivativeOfDy(Float3x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float3x2 DerivativeOfDy(Float3x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float3x3 DerivativeOfDy(Float3x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float3x4 DerivativeOfDy(Float3x4 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float4x1 DerivativeOfDy(Float4x1 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float4x2 DerivativeOfDy(Float4x2 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float4x3 DerivativeOfDy(Float4x3 x) => default; + + /// + /// Returns the partial derivative of the specified value with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy")] + public static Float4x4 DerivativeOfDy(Float4x4 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_coarse")] + public static float DerivativeOfDyLowPrecision(float x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_coarse")] + public static Float2 DerivativeOfDyLowPrecision(Float2 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_coarse")] + public static Float3 DerivativeOfDyLowPrecision(Float3 x) => default; + + /// + /// Computes a low precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The low precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_coarse")] + public static Float4 DerivativeOfDyLowPrecision(Float4 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_fine")] + public static float DerivativeOfDyHighPrecision(float x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_fine")] + public static Float2 DerivativeOfDyHighPrecision(Float2 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_fine")] + public static Float3 DerivativeOfDyHighPrecision(Float3 x) => default; + + /// + /// Computes a high precision partial derivative with respect to the screen-space y-coordinate. + /// + /// The specified value. + /// The high precision partial derivative with respect to the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("ddy_fine")] + public static Float4 DerivativeOfDyHighPrecision(Float4 x) => default; + /// /// Converts the specified value from radians to degrees. /// @@ -6282,6 +6786,186 @@ partial class Hlsl [HlslIntrinsicName("frexp")] public static Float4x4 Frexp(Float4x4 x, out Float4x4 exp) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Frexp)}({typeof(Float4x4)}, {typeof(Float4x4)})"); + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static float Fwidth(float x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float2 Fwidth(Float2 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float3 Fwidth(Float3 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float4 Fwidth(Float4 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float1x1 Fwidth(Float1x1 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float1x2 Fwidth(Float1x2 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float1x3 Fwidth(Float1x3 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float1x4 Fwidth(Float1x4 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float2x1 Fwidth(Float2x1 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float2x2 Fwidth(Float2x2 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float2x3 Fwidth(Float2x3 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float2x4 Fwidth(Float2x4 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float3x1 Fwidth(Float3x1 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float3x2 Fwidth(Float3x2 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float3x3 Fwidth(Float3x3 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float3x4 Fwidth(Float3x4 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float4x1 Fwidth(Float4x1 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float4x2 Fwidth(Float4x2 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float4x3 Fwidth(Float4x3 x) => default; + + /// + /// Returns the absolute value of the partial derivatives of the specified value. + /// + /// The specified value. + /// The absolute value of the partial derivatives of the input parameter. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + [HlslIntrinsicName("fwidth")] + public static Float4x4 Fwidth(Float4x4 x) => default; + /// /// Determines if the specified floating-point value is finite. /// diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude b/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude index c6b47260..71b56dd8 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.ttinclude @@ -739,6 +739,146 @@ var Intrinsics = new[] } }, new + { + Name = "DerivativeOfDx", + HlslName = "ddx", + Summary = "Returns the partial derivative of the specified value with respect to the screen-space x-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } }, + new { Return = "Float1x1", Params = new[] { "Float1x1" } }, + new { Return = "Float1x2", Params = new[] { "Float1x2" } }, + new { Return = "Float1x3", Params = new[] { "Float1x3" } }, + new { Return = "Float1x4", Params = new[] { "Float1x4" } }, + new { Return = "Float2x1", Params = new[] { "Float2x1" } }, + new { Return = "Float2x2", Params = new[] { "Float2x2" } }, + new { Return = "Float2x3", Params = new[] { "Float2x3" } }, + new { Return = "Float2x4", Params = new[] { "Float2x4" } }, + new { Return = "Float3x1", Params = new[] { "Float3x1" } }, + new { Return = "Float3x2", Params = new[] { "Float3x2" } }, + new { Return = "Float3x3", Params = new[] { "Float3x3" } }, + new { Return = "Float3x4", Params = new[] { "Float3x4" } }, + new { Return = "Float4x1", Params = new[] { "Float4x1" } }, + new { Return = "Float4x2", Params = new[] { "Float4x2" } }, + new { Return = "Float4x3", Params = new[] { "Float4x3" } }, + new { Return = "Float4x4", Params = new[] { "Float4x4" } } + } + }, + new + { + Name = "DerivativeOfDxLowPrecision", + HlslName = "ddx_coarse", + Summary = "Computes a low precision partial derivative with respect to the screen-space x-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The low precision partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } } + } + }, + new + { + Name = "DerivativeOfDxHighPrecision", + HlslName = "ddx_fine", + Summary = "Computes a high precision partial derivative with respect to the screen-space x-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The high precision partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } } + } + }, + new + { + Name = "DerivativeOfDy", + HlslName = "ddy", + Summary = "Returns the partial derivative of the specified value with respect to the screen-space y-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } }, + new { Return = "Float1x1", Params = new[] { "Float1x1" } }, + new { Return = "Float1x2", Params = new[] { "Float1x2" } }, + new { Return = "Float1x3", Params = new[] { "Float1x3" } }, + new { Return = "Float1x4", Params = new[] { "Float1x4" } }, + new { Return = "Float2x1", Params = new[] { "Float2x1" } }, + new { Return = "Float2x2", Params = new[] { "Float2x2" } }, + new { Return = "Float2x3", Params = new[] { "Float2x3" } }, + new { Return = "Float2x4", Params = new[] { "Float2x4" } }, + new { Return = "Float3x1", Params = new[] { "Float3x1" } }, + new { Return = "Float3x2", Params = new[] { "Float3x2" } }, + new { Return = "Float3x3", Params = new[] { "Float3x3" } }, + new { Return = "Float3x4", Params = new[] { "Float3x4" } }, + new { Return = "Float4x1", Params = new[] { "Float4x1" } }, + new { Return = "Float4x2", Params = new[] { "Float4x2" } }, + new { Return = "Float4x3", Params = new[] { "Float4x3" } }, + new { Return = "Float4x4", Params = new[] { "Float4x4" } } + } + }, + new + { + Name = "DerivativeOfDyLowPrecision", + HlslName = "ddy_coarse", + Summary = "Computes a low precision partial derivative with respect to the screen-space y-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The low precision partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } } + } + }, + new + { + Name = "DerivativeOfDyHighPrecision", + HlslName = "ddy_fine", + Summary = "Computes a high precision partial derivative with respect to the screen-space y-coordinate.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The high precision partial derivative with respect to the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } } + } + }, + new { Name = "Degrees", HlslName = "degrees", @@ -1116,6 +1256,40 @@ var Intrinsics = new[] } }, new + { + Name = "Fwidth", + HlslName = "fwidth", + Summary = "Returns the absolute value of the partial derivatives of the specified value.", + Parameters = new[] + { + new { IsOut = false, Name = "x", Info = "The specified value." } + }, + Returns = "The absolute value of the partial derivatives of the input parameter.", + Overloads = new[] + { + new { Return = "float", Params = new[] { "float" } }, + new { Return = "Float2", Params = new[] { "Float2" } }, + new { Return = "Float3", Params = new[] { "Float3" } }, + new { Return = "Float4", Params = new[] { "Float4" } }, + new { Return = "Float1x1", Params = new[] { "Float1x1" } }, + new { Return = "Float1x2", Params = new[] { "Float1x2" } }, + new { Return = "Float1x3", Params = new[] { "Float1x3" } }, + new { Return = "Float1x4", Params = new[] { "Float1x4" } }, + new { Return = "Float2x1", Params = new[] { "Float2x1" } }, + new { Return = "Float2x2", Params = new[] { "Float2x2" } }, + new { Return = "Float2x3", Params = new[] { "Float2x3" } }, + new { Return = "Float2x4", Params = new[] { "Float2x4" } }, + new { Return = "Float3x1", Params = new[] { "Float3x1" } }, + new { Return = "Float3x2", Params = new[] { "Float3x2" } }, + new { Return = "Float3x3", Params = new[] { "Float3x3" } }, + new { Return = "Float3x4", Params = new[] { "Float3x4" } }, + new { Return = "Float4x1", Params = new[] { "Float4x1" } }, + new { Return = "Float4x2", Params = new[] { "Float4x2" } }, + new { Return = "Float4x3", Params = new[] { "Float4x3" } }, + new { Return = "Float4x4", Params = new[] { "Float4x4" } } + } + }, + new { Name = "IsFinite", HlslName = "isfinite",