Skip to content

Commit f0e6a46

Browse files
author
joaosaffran
committed
moving RootSignatureValidations to out of BinaryFormat
1 parent 7b5e9d8 commit f0e6a46

File tree

4 files changed

+59
-36
lines changed

4 files changed

+59
-36
lines changed

llvm/include/llvm/BinaryFormat/DXContainer.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -601,42 +601,6 @@ struct RootSignatureHeader {
601601
sys::swapByteOrder(Flags);
602602
}
603603
};
604-
605-
struct RootSignatureValidations {
606-
607-
static bool isValidRootFlag(uint32_t Flags) { return (Flags & ~0xfff) == 0; }
608-
609-
static bool isValidVersion(uint32_t Version) {
610-
return (Version == 1 || Version == 2);
611-
}
612-
613-
static bool isValidParameterType(dxbc::RootParameterType Type) {
614-
switch (Type) {
615-
case dxbc::RootParameterType::Constants32Bit:
616-
return true;
617-
default:
618-
return false;
619-
}
620-
}
621-
622-
static bool isValidShaderVisibility(dxbc::ShaderVisibility Visibility) {
623-
switch (Visibility) {
624-
625-
case ShaderVisibility::All:
626-
case ShaderVisibility::Vertex:
627-
case ShaderVisibility::Hull:
628-
case ShaderVisibility::Domain:
629-
case ShaderVisibility::Geometry:
630-
case ShaderVisibility::Pixel:
631-
case ShaderVisibility::Amplification:
632-
case ShaderVisibility::Mesh:
633-
return true;
634-
default:
635-
return false;
636-
}
637-
}
638-
};
639-
640604
} // namespace dxbc
641605
} // namespace llvm
642606

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//===-- llvm/BinaryFormat/RootSignaturesValidation.h ------------*- 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+
// Validation logic for Root Signatures
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_ROOTSIGNATURE_VALIDATION_H
14+
#define LLVM_ROOTSIGNATURE_VALIDATION_H
15+
16+
#include "llvm/BinaryFormat/DXContainer.h"
17+
namespace llvm {
18+
19+
namespace dxbc {
20+
21+
struct RootSignatureValidations {
22+
23+
static bool isValidRootFlag(uint32_t Flags) { return (Flags & ~0xfff) == 0; }
24+
25+
static bool isValidVersion(uint32_t Version) {
26+
return (Version == 1 || Version == 2);
27+
}
28+
29+
static bool isValidParameterType(dxbc::RootParameterType Type) {
30+
switch (Type) {
31+
case dxbc::RootParameterType::Constants32Bit:
32+
return true;
33+
default:
34+
return false;
35+
}
36+
}
37+
38+
static bool isValidShaderVisibility(dxbc::ShaderVisibility Visibility) {
39+
switch (Visibility) {
40+
41+
case ShaderVisibility::All:
42+
case ShaderVisibility::Vertex:
43+
case ShaderVisibility::Hull:
44+
case ShaderVisibility::Domain:
45+
case ShaderVisibility::Geometry:
46+
case ShaderVisibility::Pixel:
47+
case ShaderVisibility::Amplification:
48+
case ShaderVisibility::Mesh:
49+
return true;
50+
default:
51+
return false;
52+
}
53+
}
54+
};
55+
} // namespace dxbc
56+
} // namespace llvm
57+
#endif // LLVM_ROOTSIGNATURE_VALIDATION_H

llvm/lib/Object/DXContainer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "llvm/Object/DXContainer.h"
1010
#include "llvm/BinaryFormat/DXContainer.h"
11+
#include "llvm/BinaryFormat/RootSignatureValidation.h"
1112
#include "llvm/Object/Error.h"
1213
#include "llvm/Support/Alignment.h"
1314
#include "llvm/Support/Endian.h"

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/ADT/Twine.h"
1717
#include "llvm/Analysis/DXILMetadataAnalysis.h"
1818
#include "llvm/BinaryFormat/DXContainer.h"
19+
#include "llvm/BinaryFormat/RootSignatureValidation.h"
1920
#include "llvm/IR/Constants.h"
2021
#include "llvm/IR/DiagnosticInfo.h"
2122
#include "llvm/IR/Function.h"

0 commit comments

Comments
 (0)