Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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/IR/Metadata.h"
17
 
18
namespace llvm {
19
class GlobalVariable;
20
 
21
namespace hlsl {
22
 
23
enum class ResourceClass : uint8_t {
24
  SRV = 0,
25
  UAV,
26
  CBuffer,
27
  Sampler,
28
  Invalid,
29
  NumClasses = Invalid,
30
};
31
 
32
// The value ordering of this enumeration is part of the DXIL ABI. Elements
33
// can only be added to the end, and not removed.
34
enum class ResourceKind : uint32_t {
35
  Invalid = 0,
36
  Texture1D,
37
  Texture2D,
38
  Texture2DMS,
39
  Texture3D,
40
  TextureCube,
41
  Texture1DArray,
42
  Texture2DArray,
43
  Texture2DMSArray,
44
  TextureCubeArray,
45
  TypedBuffer,
46
  RawBuffer,
47
  StructuredBuffer,
48
  CBuffer,
49
  Sampler,
50
  TBuffer,
51
  RTAccelerationStructure,
52
  FeedbackTexture2D,
53
  FeedbackTexture2DArray,
54
  NumEntries,
55
};
56
 
57
class FrontendResource {
58
  MDNode *Entry;
59
 
60
public:
61
  FrontendResource(MDNode *E) : Entry(E) {
62
    assert(Entry->getNumOperands() == 5 && "Unexpected metadata shape");
63
  }
64
 
65
  FrontendResource(GlobalVariable *GV, StringRef TypeStr, ResourceKind RK,
66
                   uint32_t ResIndex, uint32_t Space);
67
 
68
  GlobalVariable *getGlobalVariable();
69
  StringRef getSourceType();
70
  uint32_t getResourceKind();
71
  uint32_t getResourceIndex();
72
  uint32_t getSpace();
73
  MDNode *getMetadata() { return Entry; }
74
};
75
} // namespace hlsl
76
} // namespace llvm
77
 
78
#endif // LLVM_FRONTEND_HLSL_HLSLRESOURCE_H