Description
Add environment
parameter to Clang availability attribute. The allowed values for this parameter are a subset of the llvm::Triple
environment component valid values. If the environment
parameters is present, the declared availability attribute applies to targets with the same platform and environment.
This parameter will be initially used for annotating HLSL functions for the shadermodel
platform. In HLSL the built-in function availability can depend not just on the shader model version but also on the target shader stage. For example derivative functions ddx
and ddy
were introduced in Shader Model 2.0 for use only in pixel shaders, in Shader Model 6.6 their support was extended to compute, mesh and amplification shaders, and they are not available in any other shader stage.
With the new environment
parameter the ddx
availability annotation would look like this:
__attribute__((availability(shadermodel, introduced = 2.0, environment = pixel)))
__attribute__((availability(shadermodel, introduced = 6.6, environment = compute)))
__attribute__((availability(shadermodel, introduced = 6.6, environment = mesh)))
__attribute__((availability(shadermodel, introduced = 6.6, environment = amplification)))
__attribute__((clang_builtin_alias(__builtin_hlsl_ddx)))
float ddx(float val);
Related to microsoft/hlsl-specs#204.
Metadata
Metadata
Assignees
Type
Projects
Status