Skip to content

Implement the EvaluateAttributeCentroid HLSL Function #99110

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
9 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 0 comments
Open
9 tasks
Tracked by #99235

Implement the EvaluateAttributeCentroid HLSL Function #99110

farzonl opened this issue Jul 16, 2024 · 0 comments
Labels
backend:DirectX 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 EvaluateAttributeCentroid clang builtin,
  • Link EvaluateAttributeCentroid clang builtin with hlsl_intrinsics.h
  • Add sema checks for EvaluateAttributeCentroid to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for EvaluateAttributeCentroid to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/EvaluateAttributeCentroid.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/EvaluateAttributeCentroid-errors.hlsl
  • Create the int_dx_EvaluateAttributeCentroid intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_EvaluateAttributeCentroid to 89 in DXIL.td
  • Create the EvaluateAttributeCentroid.ll and EvaluateAttributeCentroid_errors.ll tests in llvm/test/CodeGen/DirectX/

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
89 EvalCentroid 6.0 ('pixel',)

SPIR-V

There is no support for EvaluateAttributeCentroid when targeting SPIR-V.

Test Case(s)

Example 1

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

[numthreads(1, 1, 1)]
[shader("pixel")]
float4 fn(float4 p1 : COLOR ) : SV_Target {

	return EvaluateAttributeCentroid(p1);
}

HLSL:

Evaluates at the pixel centroid.

Syntax

numeric EvaluateAttributeCentroid(
  in attrib numeric value
);

Parameters

value [in]

Type: attrib numeric

The input value.

Remarks

Interpolation mode can be linear or linear_no_perspective on the variable. Use of centroid or sample is ignored. Attributes with constant interpolation are also allowed, in which case the sample index is ignored.

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 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
@pow2clk pow2clk moved this from Planning to Designing in HLSL Support Nov 19, 2024
@damyanp damyanp removed the status in HLSL Support Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: No status
Development

No branches or pull requests

1 participant