xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Frontend/HLSL/HLSLResource.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===- HLSLResource.h - HLSL Resource helper objects ----------------------===//
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 This file contains helper objects for working with HLSL Resources.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
14 #define LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
15 
16 #include "llvm/Support/DXILABI.h"
17 
18 namespace llvm {
19 class GlobalVariable;
20 class MDNode;
21 
22 namespace hlsl {
23 
24 // For now we use DXIL ABI enum values directly. This may change in the future.
25 using dxil::ResourceClass;
26 using dxil::ElementType;
27 using dxil::ResourceKind;
28 
29 class FrontendResource {
30   MDNode *Entry;
31 
32 public:
33   FrontendResource(MDNode *E);
34   FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy,
35                    bool IsROV, uint32_t ResIndex, uint32_t Space);
36 
37   GlobalVariable *getGlobalVariable();
38   StringRef getSourceType();
39   ResourceKind getResourceKind();
40   ElementType getElementType();
41   bool getIsROV();
42   uint32_t getResourceIndex();
43   uint32_t getSpace();
getMetadata()44   MDNode *getMetadata() { return Entry; }
45 };
46 } // namespace hlsl
47 } // namespace llvm
48 
49 #endif // LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
50