clang 22.0.0git
HLSLRuntime.h
Go to the documentation of this file.
1//===- HLSLRuntime.h - HLSL Runtime -----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// Defines helper utilities for supporting the HLSL runtime environment.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_BASIC_HLSLRUNTIME_H
15#define CLANG_BASIC_HLSLRUNTIME_H
16
19#include <cstdint>
20
21namespace clang {
22namespace hlsl {
23
24constexpr ShaderStage
25getStageFromEnvironment(const llvm::Triple::EnvironmentType &E) {
26 uint32_t Pipeline =
27 static_cast<uint32_t>(E) - static_cast<uint32_t>(llvm::Triple::Pixel);
28
29 if (Pipeline > (uint32_t)ShaderStage::Invalid)
31 return static_cast<ShaderStage>(Pipeline);
32}
33
34constexpr bool isInitializedByPipeline(LangAS AS) {
36}
37
38#define ENUM_COMPARE_ASSERT(Value) \
39 static_assert( \
40 getStageFromEnvironment(llvm::Triple::Value) == ShaderStage::Value, \
41 "Mismatch between llvm::Triple and clang::ShaderStage for " #Value);
42
58
59static_assert(getStageFromEnvironment(llvm::Triple::UnknownEnvironment) ==
61 "Mismatch between llvm::Triple and "
62 "clang::ShaderStage for Invalid");
63static_assert(getStageFromEnvironment(llvm::Triple::MSVC) ==
65 "Mismatch between llvm::Triple and "
66 "clang::ShaderStage for Invalid");
67
68} // namespace hlsl
69} // namespace clang
70
71#endif // CLANG_BASIC_HLSLRUNTIME_H
Provides definitions for the various language-specific address spaces.
#define ENUM_COMPARE_ASSERT(Value)
Definition HLSLRuntime.h:38
Defines the clang::LangOptions interface.
constexpr ShaderStage getStageFromEnvironment(const llvm::Triple::EnvironmentType &E)
Definition HLSLRuntime.h:25
constexpr bool isInitializedByPipeline(LangAS AS)
Definition HLSLRuntime.h:34
The JSON file list parser is used to communicate input to InstallAPI.
LangAS
Defines the address space values used by the address space qualifier of QualType.
ShaderStage
Shader programs run in specific pipeline stages.
Definition LangOptions.h:44