diff options
author | Helena Kotas <hekotas@microsoft.com> | 2024-05-19 10:46:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-19 10:46:12 -0700 |
commit | 3f33c4c14e79e68007cf1460e4a0e606eb199da5 (patch) | |
tree | 375cffc00e08ba25d9c66a89df93cee86805a3ff /clang/lib/Headers/hlsl/hlsl_intrinsics.h | |
parent | c34079c9455515fd1eb4feaa7613a57e88b7209d (diff) | |
download | llvm-3f33c4c14e79e68007cf1460e4a0e606eb199da5.zip llvm-3f33c4c14e79e68007cf1460e4a0e606eb199da5.tar.gz llvm-3f33c4c14e79e68007cf1460e4a0e606eb199da5.tar.bz2 |
[Clang][HLSL] Add environment parameter to availability attribute (#89809)
Add `environment` parameter to Clang availability attribute. The allowed
values for this parameter are a subset of values allowed in the
`llvm::Triple` environment component. If the `environment` parameters is
present, the declared availability attribute applies only to targets
with the same platform and environment.
This new parameter will be initially used for annotating HLSL functions
for the `shadermodel` platform because in HLSL built-in function
availability can depend not just on the shader model version (mapped to
`llvm::Triple::OSType`) but also on the target shader stage (mapped to
`llvm::Triple::EnvironmentType`). See example in #89802 and
microsoft/hlsl-specs#204 for more details.
The environment parameter is currently supported only for HLSL.
Fixes #89802
Diffstat (limited to 'clang/lib/Headers/hlsl/hlsl_intrinsics.h')
-rw-r--r-- | clang/lib/Headers/hlsl/hlsl_intrinsics.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h index 3390f09..bc72e8a0 100644 --- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h +++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h @@ -18,14 +18,21 @@ namespace hlsl { #define _HLSL_BUILTIN_ALIAS(builtin) \ __attribute__((clang_builtin_alias(builtin))) -#define _HLSL_AVAILABILITY(environment, version) \ - __attribute__((availability(environment, introduced = version))) +#define _HLSL_AVAILABILITY(platform, version) \ + __attribute__((availability(platform, introduced = version))) +#define _HLSL_AVAILABILITY_STAGE(platform, version, stage) \ + __attribute__(( \ + availability(platform, introduced = version, environment = stage))) #ifdef __HLSL_ENABLE_16_BIT -#define _HLSL_16BIT_AVAILABILITY(environment, version) \ - __attribute__((availability(environment, introduced = version))) +#define _HLSL_16BIT_AVAILABILITY(platform, version) \ + __attribute__((availability(platform, introduced = version))) +#define _HLSL_16BIT_AVAILABILITY_STAGE(platform, version, stage) \ + __attribute__(( \ + availability(platform, introduced = version, environment = stage))) #else #define _HLSL_16BIT_AVAILABILITY(environment, version) +#define _HLSL_16BIT_AVAILABILITY_STAGE(environment, version, stage) #endif //===----------------------------------------------------------------------===// |