From 58a5ffca7c51b412b11215e669416ed7c8f53d74 Mon Sep 17 00:00:00 2001 From: Adam Cheney Date: Mon, 21 Oct 2024 22:26:17 -0400 Subject: [PATCH] Document derivative core module functions Fixes #5307 --- source/slang/hlsl.meta.slang | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index ed011320c4..1d9d3906ba 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -7073,6 +7073,10 @@ ${{{{ const char* diffDimensions[2] = {"x", "y"}; for (auto xOrY : diffDimensions) { }}}} +/// Take the partial derivative of `x` with respect to $(xOrY) in screen space. +/// @param x The value to take partial derivative for. +/// @return The partial derivative of `x` +/// @remarks for SPIR-V, this function maps to `OpDPd$(xOrY)`. /// @category derivative Derivative functions __generic [__readNone] @@ -7135,6 +7139,10 @@ matrix dd$(xOrY)(matrix x) } } +/// Take the coarse partial derivative of `x` with respect to $(xOrY) in screen space. +/// @param x The value to take partial derivative for. +/// @return The partial derivative of `x` +/// @remarks for SPIR-V, this function maps to `OpDPd$(xOrY)Coarse`. /// @category derivative __generic __glsl_extension(GL_ARB_derivative_control) @@ -7181,6 +7189,10 @@ matrix dd$(xOrY)_coarse(matrix x) } } +/// Take the fine partial derivative of `x` with respect to $(xOrY) in screen space. +/// @param x The value to take partial derivative for. +/// @return The partial derivative of `x` +/// @remarks for SPIR-V, this function maps to `OpDPd$(xOrY)Fine`. /// @category derivative __generic __glsl_extension(GL_ARB_derivative_control) @@ -8542,6 +8554,9 @@ matrix frexp(matrix x, out matrix exp) } /// Texture filter width. +/// @param x The value to sum x and y partial derivative magnitudes for. +/// @return The sum of abs(ddx(`x`)) and abs(ddy(`x`)). +/// @remarks for SPIR-V, this function maps to `OpFwidth`. /// @category derivative __generic [__readNone]