python3kgae updated this revision to Diff 469074.
python3kgae added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136134/new/

https://reviews.llvm.org/D136134

Files:
  clang/include/clang/Basic/HLSLRuntime.h
  clang/lib/CodeGen/CGHLSLRuntime.cpp
  clang/lib/CodeGen/CGHLSLRuntime.h
  clang/lib/Sema/HLSLExternalSemaSource.cpp
  llvm/include/llvm/Frontend/HLSL/HLSLResource.h

Index: llvm/include/llvm/Frontend/HLSL/HLSLResource.h
===================================================================
--- llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -21,6 +21,15 @@
 
 namespace hlsl {
 
+enum class ResourceClass : uint8_t {
+  SRV = 0,
+  UAV,
+  CBuffer,
+  Sampler,
+  Invalid,
+  NumClasses = Invalid,
+};
+
 // The value ordering of this enumeration is part of the DXIL ABI. Elements
 // can only be added to the end, and not removed.
 enum class ResourceKind : uint32_t {
Index: clang/lib/Sema/HLSLExternalSemaSource.cpp
===================================================================
--- clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -17,11 +17,12 @@
 #include "clang/Basic/HLSLRuntime.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/Sema.h"
+#include "llvm/Frontend/HLSL/HLSLResource.h"
 
 #include <functional>
 
 using namespace clang;
-using namespace hlsl;
+using namespace llvm::hlsl;
 
 namespace {
 
Index: clang/lib/CodeGen/CGHLSLRuntime.h
===================================================================
--- clang/lib/CodeGen/CGHLSLRuntime.h
+++ clang/lib/CodeGen/CGHLSLRuntime.h
@@ -71,7 +71,7 @@
 protected:
   CodeGenModule &CGM;
   uint32_t ResourceCounters[static_cast<uint32_t>(
-      hlsl::ResourceClass::NumClasses)] = {0};
+      llvm::hlsl::ResourceClass::NumClasses)] = {0};
 
   llvm::Value *emitInputSemantic(llvm::IRBuilder<> &B, const ParmVarDecl &D);
 
@@ -93,7 +93,7 @@
 private:
   void addBufferResourceAnnotation(llvm::GlobalVariable *GV,
                                    llvm::StringRef TyName,
-                                   hlsl::ResourceClass RC,
+                                   llvm::hlsl::ResourceClass RC,
                                    llvm::hlsl::ResourceKind RK,
                                    BufferResBinding &Binding);
   void addConstant(VarDecl *D, Buffer &CB);
Index: clang/lib/CodeGen/CGHLSLRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -24,7 +24,7 @@
 
 using namespace clang;
 using namespace CodeGen;
-using namespace hlsl;
+using namespace clang::hlsl;
 using namespace llvm;
 
 namespace {
@@ -176,8 +176,9 @@
     layoutBuffer(Buf, DL);
     GlobalVariable *GV = replaceBuffer(Buf);
     M.getGlobalList().push_back(GV);
-    hlsl::ResourceClass RC =
-        Buf.IsCBuffer ? hlsl::ResourceClass::CBuffer : hlsl::ResourceClass::SRV;
+    llvm::hlsl::ResourceClass RC = Buf.IsCBuffer
+                                       ? llvm::hlsl::ResourceClass::CBuffer
+                                       : llvm::hlsl::ResourceClass::SRV;
     llvm::hlsl::ResourceKind RK = Buf.IsCBuffer
                                       ? llvm::hlsl::ResourceKind::CBuffer
                                       : llvm::hlsl::ResourceKind::TBuffer;
@@ -193,7 +194,7 @@
 
 void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
                                                 llvm::StringRef TyName,
-                                                hlsl::ResourceClass RC,
+                                                llvm::hlsl::ResourceClass RC,
                                                 llvm::hlsl::ResourceKind RK,
                                                 BufferResBinding &Binding) {
   uint32_t Counter = ResourceCounters[static_cast<uint32_t>(RC)]++;
@@ -201,13 +202,13 @@
 
   NamedMDNode *ResourceMD = nullptr;
   switch (RC) {
-  case hlsl::ResourceClass::UAV:
+  case llvm::hlsl::ResourceClass::UAV:
     ResourceMD = M.getOrInsertNamedMetadata("hlsl.uavs");
     break;
-  case hlsl::ResourceClass::SRV:
+  case llvm::hlsl::ResourceClass::SRV:
     ResourceMD = M.getOrInsertNamedMetadata("hlsl.srvs");
     break;
-  case hlsl::ResourceClass::CBuffer:
+  case llvm::hlsl::ResourceClass::CBuffer:
     ResourceMD = M.getOrInsertNamedMetadata("hlsl.cbufs");
     break;
   default:
@@ -290,8 +291,9 @@
 
   QualType QT(Ty, 0);
   BufferResBinding Binding(D->getAttr<HLSLResourceBindingAttr>());
-  addBufferResourceAnnotation(
-      GV, QT.getAsString(), static_cast<hlsl::ResourceClass>(RC), RK, Binding);
+  addBufferResourceAnnotation(GV, QT.getAsString(),
+                              static_cast<llvm::hlsl::ResourceClass>(RC), RK,
+                              Binding);
 }
 
 CGHLSLRuntime::BufferResBinding::BufferResBinding(
Index: clang/include/clang/Basic/HLSLRuntime.h
===================================================================
--- clang/include/clang/Basic/HLSLRuntime.h
+++ clang/include/clang/Basic/HLSLRuntime.h
@@ -20,14 +20,6 @@
 namespace clang {
 namespace hlsl {
 
-enum class ResourceClass : uint8_t {
-  SRV = 0,
-  UAV,
-  CBuffer,
-  Sampler,
-  NumClasses
-};
-
 constexpr ShaderStage
 getStageFromEnvironment(const llvm::Triple::EnvironmentType &E) {
   uint32_t Pipeline =
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to