Skip to content

Commit

Permalink
Document derivative core module functions
Browse files Browse the repository at this point in the history
Fixes #5307
  • Loading branch information
cheneym2 committed Oct 22, 2024
1 parent 3e84726 commit 58a5ffc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/slang/hlsl.meta.slang
Original file line number Diff line number Diff line change
Expand Up @@ -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<T : __BuiltinFloatingPointType>
[__readNone]
Expand Down Expand Up @@ -7135,6 +7139,10 @@ matrix<T, N, M> dd$(xOrY)(matrix<T, N, M> 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<T : __BuiltinFloatingPointType>
__glsl_extension(GL_ARB_derivative_control)
Expand Down Expand Up @@ -7181,6 +7189,10 @@ matrix<T, N, M> dd$(xOrY)_coarse(matrix<T, N, M> 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<T : __BuiltinFloatingPointType>
__glsl_extension(GL_ARB_derivative_control)
Expand Down Expand Up @@ -8542,6 +8554,9 @@ matrix<T, N, M> frexp(matrix<T, N, M> x, out matrix<int, N, M, L> 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<T : __BuiltinFloatingPointType>
[__readNone]
Expand Down

0 comments on commit 58a5ffc

Please sign in to comment.