Skip to content

Commit 108a7d5

Browse files
Joao SaffranJoao Saffran
authored andcommitted
Merge branch 'validation/check-descriptors-are-bound' into validation/textures-not-bind-root-signatures
2 parents 7a1bc21 + 6da5fb0 commit 108a7d5

File tree

10 files changed

+177
-169
lines changed

10 files changed

+177
-169
lines changed

llvm/include/llvm/Analysis/DXILResource.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ class DXILResourceTypeMap;
3333

3434
namespace dxil {
3535

36-
inline StringRef getResourceClassName(ResourceClass RC) {
37-
switch (RC) {
38-
case ResourceClass::SRV:
39-
return "SRV";
40-
case ResourceClass::UAV:
41-
return "UAV";
42-
case ResourceClass::CBuffer:
43-
return "CBuffer";
44-
case ResourceClass::Sampler:
45-
return "Sampler";
46-
}
47-
llvm_unreachable("Unhandled ResourceClass");
48-
}
49-
5036
// Returns the resource name from dx_resource_handlefrombinding or
5137
// dx_resource_handlefromimplicitbinding call
5238
LLVM_ABI StringRef getResourceNameFromBindingCall(CallInst *CI);

llvm/include/llvm/Support/DXILABI.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef LLVM_SUPPORT_DXILABI_H
1818
#define LLVM_SUPPORT_DXILABI_H
1919

20+
#include "llvm/ADT/StringRef.h"
2021
#include <cstdint>
2122

2223
namespace llvm {
@@ -99,6 +100,8 @@ enum class SamplerFeedbackType : uint32_t {
99100
const unsigned MinWaveSize = 4;
100101
const unsigned MaxWaveSize = 128;
101102

103+
StringRef getResourceClassName(ResourceClass RC);
104+
102105
} // namespace dxil
103106
} // namespace llvm
104107

llvm/lib/Analysis/DXILResource.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/IR/Metadata.h"
2121
#include "llvm/IR/Module.h"
2222
#include "llvm/InitializePasses.h"
23+
#include "llvm/Support/DXILABI.h"
2324
#include "llvm/Support/FormatVariadic.h"
2425
#include <cstdint>
2526
#include <optional>

llvm/lib/Support/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ add_llvm_component_library(LLVMSupport
182182
DivisionByConstantInfo.cpp
183183
DAGDeltaAlgorithm.cpp
184184
DJB.cpp
185+
DXILABI.cpp
185186
DynamicAPInt.cpp
186187
ELFAttributes.cpp
187188
ELFAttrParserCompact.cpp

llvm/lib/Support/DXILABI.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
#include "llvm/Support/DXILABI.h"
3+
#include "llvm/Support/ErrorHandling.h"
4+
5+
using namespace llvm;
6+
namespace llvm {
7+
namespace dxil {
8+
StringRef getResourceClassName(dxil::ResourceClass RC) {
9+
switch (RC) {
10+
case dxil::ResourceClass::SRV:
11+
return "SRV";
12+
case dxil::ResourceClass::UAV:
13+
return "UAV";
14+
case dxil::ResourceClass::CBuffer:
15+
return "CBuffer";
16+
case dxil::ResourceClass::Sampler:
17+
return "Sampler";
18+
}
19+
llvm_unreachable("Unhandled ResourceClass");
20+
}
21+
} // namespace dxil
22+
} // namespace llvm

llvm/lib/Target/DirectX/DXContainerGlobals.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ void DXContainerGlobals::addRootSignature(Module &M,
162162

163163
auto &RSA = getAnalysis<RootSignatureAnalysisWrapper>().getRSInfo();
164164
const Function *EntryFunction = MMI.EntryPropertyVec[0].Entry;
165-
const std::optional<mcdxbc::RootSignatureDesc> &RS =
166-
RSA.getDescForFunction(EntryFunction);
165+
const mcdxbc::RootSignatureDesc *RS = RSA.getDescForFunction(EntryFunction);
167166

168167
if (!RS)
169168
return;

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ PreservedAnalyses DXILOpLowering::run(Module &M, ModuleAnalysisManager &MAM) {
919919
PA.preserve<DXILResourceAnalysis>();
920920
PA.preserve<DXILMetadataAnalysis>();
921921
PA.preserve<ShaderFlagsAnalysis>();
922+
PA.preserve<RootSignatureAnalysis>();
922923
return PA;
923924
}
924925

0 commit comments

Comments
 (0)