Skip to content
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

Implement the GetRenderTargetSampleCount HLSL Function #99102

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

Implement the GetRenderTargetSampleCount HLSL Function #99102

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 GetRenderTargetSampleCount clang builtin,
  • Link GetRenderTargetSampleCount clang builtin with hlsl_intrinsics.h
  • Add sema checks for GetRenderTargetSampleCount to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for GetRenderTargetSampleCount to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/GetRenderTargetSampleCount.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/GetRenderTargetSampleCount-errors.hlsl
  • Create the int_dx_GetRenderTargetSampleCount intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_GetRenderTargetSampleCount to 77 in DXIL.td
  • Create the GetRenderTargetSampleCount.ll and GetRenderTargetSampleCount_errors.ll tests in llvm/test/CodeGen/DirectX/

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
77 RenderTargetGetSampleCount 6.0 ('pixel',)

SPIR-V

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

Test Case(s)

Example 1

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

[numthreads(1, 1, 1)]
[shader("pixel")]
uint fn( ) : SV_Target {

	return GetRenderTargetSampleCount();
}

HLSL:

Gets the number of samples for a render target.

UINT GetRenderTargetSampleCount()

Parameters

Item Description
None

Return Value

The number of samples.

Remarks

Use this function and GetRenderTargetSamplePosition to find out the number and position of the sampling locations for a render target.

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 4 and higher shader models yes
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

See also

Intrinsic Functions (DirectX HLSL)

@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
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