Skip to content

Commit

Permalink
Update hlsl.meta.slang
Browse files Browse the repository at this point in the history
  • Loading branch information
cheneym2 committed Oct 22, 2024
1 parent 58a5ffc commit 8f25e75
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions source/slang/hlsl.meta.slang
Original file line number Diff line number Diff line change
Expand Up @@ -7073,15 +7073,15 @@ ${{{{
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)`.
/// Take the partial derivative of `p` with respect to $(xOrY) in screen space.
/// @param p The value to take partial derivative for.
/// @return The partial derivative of `p`.
/// @remarks For SPIR-V, this function maps to `OpDPd$(xOrY)`.
/// @category derivative Derivative functions
__generic<T : __BuiltinFloatingPointType>
[__readNone]
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, fragmentprocessing)]
T dd$(xOrY)(T x)
T dd$(xOrY)(T p)
{
__requireComputeDerivative();
__target_switch
Expand All @@ -7095,7 +7095,7 @@ T dd$(xOrY)(T x)
case metal:
__intrinsic_asm "dfd$(xOrY)";
case spirv:
return spirv_asm {OpDPd$(xOrY) $$T result $x};
return spirv_asm {OpDPd$(xOrY) $$T result $p};
case wgsl:
__intrinsic_asm "dpd$(xOrY)";
}
Expand All @@ -7104,7 +7104,7 @@ T dd$(xOrY)(T x)
__generic<T : __BuiltinFloatingPointType, let N : int>
[__readNone]
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, fragmentprocessing)]
vector<T, N> dd$(xOrY)(vector<T, N> x)
vector<T, N> dd$(xOrY)(vector<T, N> p)
{
__requireComputeDerivative();
__target_switch
Expand All @@ -7118,7 +7118,7 @@ vector<T, N> dd$(xOrY)(vector<T, N> x)
case metal:
__intrinsic_asm "dfd$(xOrY)";
case spirv:
return spirv_asm {OpDPd$(xOrY) $$vector<T, N> result $x};
return spirv_asm {OpDPd$(xOrY) $$vector<T, N> result $p};
case wgsl:
__intrinsic_asm "dpd$(xOrY)";
}
Expand All @@ -7127,115 +7127,115 @@ vector<T, N> dd$(xOrY)(vector<T, N> x)
__generic<T : __BuiltinFloatingPointType, let N : int, let M : int>
[__readNone]
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, fragmentprocessing)]
matrix<T, N, M> dd$(xOrY)(matrix<T, N, M> x)
matrix<T, N, M> dd$(xOrY)(matrix<T, N, M> p)
{
__requireComputeDerivative();
__requireComputeDerivative();
__target_switch
{
case hlsl:
__intrinsic_asm "dd$(xOrY)";
default:
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY), x);
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY), p);
}
}

/// 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`.
/// Take the coarse partial derivative of `p` with respect to $(xOrY) in screen space.
/// @param p The value to take partial derivative for.
/// @return The partial derivative of `p`.
/// @remarks For SPIR-V, this function maps to `OpDPd$(xOrY)Coarse`.
/// @category derivative
__generic<T : __BuiltinFloatingPointType>
__glsl_extension(GL_ARB_derivative_control)
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
T dd$(xOrY)_coarse(T x)
T dd$(xOrY)_coarse(T p)
{
__requireComputeDerivative();
__target_switch
{
case hlsl: __intrinsic_asm "dd$(xOrY)_coarse";
case glsl: __intrinsic_asm "dFd$(xOrY)Coarse";
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$T = OpDPd$(xOrY)Coarse $x};
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$T = OpDPd$(xOrY)Coarse $p};
}
}

__generic<T : __BuiltinFloatingPointType, let N : int>
__glsl_extension(GL_ARB_derivative_control)
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
vector<T, N> dd$(xOrY)_coarse(vector<T, N> x)
vector<T, N> dd$(xOrY)_coarse(vector<T, N> p)
{
__requireComputeDerivative();
__target_switch
{
case hlsl: __intrinsic_asm "dd$(xOrY)_coarse";
case glsl: __intrinsic_asm "dFd$(xOrY)Coarse";
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$vector<T,N> = OpDPd$(xOrY)Coarse $x};
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$vector<T,N> = OpDPd$(xOrY)Coarse $p};
}
}

__generic<T : __BuiltinFloatingPointType, let N : int, let M : int>
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
matrix<T, N, M> dd$(xOrY)_coarse(matrix<T, N, M> x)
matrix<T, N, M> dd$(xOrY)_coarse(matrix<T, N, M> p)
{
__requireComputeDerivative();
__requireComputeDerivative();
__target_switch
{
case hlsl:
__intrinsic_asm "dd$(xOrY)_coarse";
default:
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY)_coarse, x);
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY)_coarse, p);
}
}

/// 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`.
/// Take the fine partial derivative of `p` with respect to $(xOrY) in screen space.
/// @param p The value to take partial derivative for.
/// @return The partial derivative of `p`.
/// @remarks For SPIR-V, this function maps to `OpDPd$(xOrY)Fine`.
/// @category derivative
__generic<T : __BuiltinFloatingPointType>
__glsl_extension(GL_ARB_derivative_control)
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
T dd$(xOrY)_fine(T x)
T dd$(xOrY)_fine(T p)
{
__requireComputeDerivative();
__target_switch
{
case hlsl: __intrinsic_asm "dd$(xOrY)_fine";
case glsl: __intrinsic_asm "dFd$(xOrY)Fine";
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$T = OpDPd$(xOrY)Fine $x};
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$T = OpDPd$(xOrY)Fine $p};
}
}

__generic<T : __BuiltinFloatingPointType, let N : int>
__glsl_extension(GL_ARB_derivative_control)
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
vector<T, N> dd$(xOrY)_fine(vector<T, N> x)
vector<T, N> dd$(xOrY)_fine(vector<T, N> p)
{
__requireComputeDerivative();
__target_switch
{
case hlsl: __intrinsic_asm "dd$(xOrY)_fine";
case glsl: __intrinsic_asm "dFd$(xOrY)Fine";
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$vector<T,N> = OpDPd$(xOrY)Fine $x};
case spirv: return spirv_asm {OpCapability DerivativeControl; result:$$vector<T,N> = OpDPd$(xOrY)Fine $p};
}
}

__generic<T : __BuiltinFloatingPointType, let N : int, let M : int>
[__readNone]
[require(glsl_hlsl_spirv, fragmentprocessing_derivativecontrol)]
matrix<T, N, M> dd$(xOrY)_fine(matrix<T, N, M> x)
matrix<T, N, M> dd$(xOrY)_fine(matrix<T, N, M> p)
{
__requireComputeDerivative();
__requireComputeDerivative();
__target_switch
{
case hlsl:
__intrinsic_asm "dd$(xOrY)_fine";
default:
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY)_fine, x);
MATRIX_MAP_UNARY(T, N, M, dd$(xOrY)_fine, p);
}
}

Expand Down Expand Up @@ -8554,14 +8554,14 @@ 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`.
/// @param p The value to sum x and y partial derivative magnitudes for.
/// @return The sum of abs(ddx(`p`)) and abs(ddy(`p`)).
/// @remarks For SPIR-V, this function maps to `OpFwidth`.
/// @category derivative
__generic<T : __BuiltinFloatingPointType>
[__readNone]
[require(glsl_hlsl_metal_spirv_wgsl, fragmentprocessing)]
T fwidth(T x)
T fwidth(T p)
{
__requireComputeDerivative();
__target_switch
Expand All @@ -8575,7 +8575,7 @@ T fwidth(T x)
case spirv:
return spirv_asm
{
OpFwidth $$T result $x;
OpFwidth $$T result $p;
};
case wgsl:
__intrinsic_asm "fwidth($0)";
Expand Down

0 comments on commit 8f25e75

Please sign in to comment.