Skip to content

Implement the ddy_fine HLSL Function #99101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
12 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 0 comments
Open
12 tasks
Tracked by #99235

Implement the ddy_fine HLSL Function #99101

farzonl opened this issue Jul 16, 2024 · 0 comments
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.

Comments

@farzonl
Copy link
Member

farzonl commented Jul 16, 2024

  • Implement ddy_fine clang builtin,
  • Link ddy_fine clang builtin with hlsl_intrinsics.h
  • Add sema checks for ddy_fine to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for ddy_fine to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/ddy_fine.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/ddy_fine-errors.hlsl
  • Create the int_dx_ddy_fine intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_ddy_fine to 86 in DXIL.td
  • Create the ddy_fine.ll and ddy_fine_errors.ll tests in llvm/test/CodeGen/DirectX/
  • Create the int_spv_ddy_fine intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the ddy_fine lowering and map it to int_spv_ddy_fine in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/ddy_fine.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
86 DerivFineY 6.0 ('library', 'pixel', 'compute', 'amplification', 'mesh', 'node')

SPIR-V

OpDPdyFine:

Description:

Result is the partial derivative of P with respect to the window y
coordinate.Uses local differencing based on the value of P for the
current fragment and its immediate neighbor(s).

Result Type must be a scalar or vector of floating-point
type
using the IEEE 754 encoding. The component width must
be 32 bits.

The type of P must be the same as Result Type. P is the value to
take the derivative of.

This instruction is only valid in the Fragment Execution
Model
.

Capability:
DerivativeControl

Word Count Opcode Results Operands

4

211

<id>
Result Type

Result <id>

<id>
P

Test Case(s)

Example 1

//dxc ddy_fine_test.hlsl -T lib_6_8 -enable-16bit-types -O0

export float4 fn(float4 p1) {
    return ddy_fine(p1);
}

HLSL:

Computes a high precision partial derivative with respect to the screen-space x-coordinate.

Syntax

float ddy_fine(
  in float value
);

Parameters

value [in]

Type: float

The input value.

Return value

Type: float

The high precision partial derivative of value.

Remarks

The following overloaded versions are also available:

float2 ddy_fine(float2 value);
float3 ddy_fine(float3 value);
float4 ddy_fine(float4 value);  

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 5 and higher shader models yes

 

This function is supported in the following types of shaders:

Vertex Hull Domain Geometry Pixel Compute
x

 

See also

Intrinsic Functions

Shader Model 5

@farzonl farzonl added backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues. labels Jul 16, 2024
@damyanp damyanp moved this to Ready in HLSL Support Oct 30, 2024
@damyanp damyanp moved this from Ready to Planning in HLSL Support Oct 30, 2024
@davidcook-msft davidcook-msft moved this from Planning to Ready in HLSL Support Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: Ready
Development

No branches or pull requests

1 participant