File tree Expand file tree Collapse file tree 5 files changed +15
-8
lines changed Expand file tree Collapse file tree 5 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ enum class RootElementFlag : uint32_t {
159
159
};
160
160
161
161
#define ROOT_PARAMETER (Val, Enum ) Enum = Val,
162
- enum RootParameterType : uint32_t {
162
+ enum class RootParameterType : uint32_t {
163
163
#include " DXContainerConstants.def"
164
164
};
165
165
@@ -176,7 +176,7 @@ inline bool isValidParameterType(uint32_t V) {
176
176
}
177
177
178
178
#define SHADER_VISIBILITY (Val, Enum ) Enum = Val,
179
- enum ShaderVisibility : uint32_t {
179
+ enum class ShaderVisibility : uint32_t {
180
180
#include " DXContainerConstants.def"
181
181
};
182
182
Original file line number Diff line number Diff line change @@ -139,7 +139,8 @@ struct RootParameterView {
139
139
140
140
struct RootConstantView : RootParameterView {
141
141
static bool classof (const RootParameterView *V) {
142
- return V->Header .ParameterType == dxbc::RootParameterType::Constants32Bit;
142
+ return V->Header .ParameterType ==
143
+ (uint32_t )dxbc::RootParameterType::Constants32Bit;
143
144
}
144
145
145
146
llvm::Expected<dxbc::RootConstants> read () {
@@ -183,7 +184,10 @@ class RootSignature {
183
184
getParameter (const dxbc::RootParameterHeader &Header) const {
184
185
size_t DataSize;
185
186
186
- switch (Header.ParameterType ) {
187
+ if (!dxbc::isValidParameterType (Header.ParameterType ))
188
+ return parseFailed (" invalid parameter type" );
189
+
190
+ switch (static_cast <dxbc::RootParameterType>(Header.ParameterType )) {
187
191
case dxbc::RootParameterType::Constants32Bit:
188
192
DataSize = sizeof (dxbc::RootConstants);
189
193
break ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ size_t RootSignatureDesc::getSize() const {
34
34
35
35
for (const auto &P : Parameters) {
36
36
switch (P.Header .ParameterType ) {
37
- case dxbc::RootParameterType::Constants32Bit:
37
+ case static_cast < uint32_t >( dxbc::RootParameterType::Constants32Bit) :
38
38
Size += sizeof (dxbc::RootConstants);
39
39
break ;
40
40
}
@@ -75,7 +75,7 @@ void RootSignatureDesc::write(raw_ostream &OS) const {
75
75
const auto &P = Parameters[I];
76
76
77
77
switch (P.Header .ParameterType ) {
78
- case dxbc::RootParameterType::Constants32Bit:
78
+ case static_cast < uint32_t >( dxbc::RootParameterType::Constants32Bit) :
79
79
support::endian::write (BOS, P.Constants .ShaderRegister ,
80
80
llvm::endianness::little);
81
81
support::endian::write (BOS, P.Constants .RegisterSpace ,
Original file line number Diff line number Diff line change 19
19
#include " llvm/Support/Errc.h"
20
20
#include " llvm/Support/Error.h"
21
21
#include " llvm/Support/raw_ostream.h"
22
+ #include < cstdint>
22
23
23
24
using namespace llvm ;
24
25
@@ -276,7 +277,7 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
276
277
277
278
switch (Param.Type ) {
278
279
279
- case dxbc::RootParameterType::Constants32Bit:
280
+ case static_cast < uint32_t >( dxbc::RootParameterType::Constants32Bit) :
280
281
NewParam.Constants .Num32BitValues = Param.Constants .Num32BitValues ;
281
282
NewParam.Constants .RegisterSpace = Param.Constants .RegisterSpace ;
282
283
NewParam.Constants .ShaderRegister = Param.Constants .ShaderRegister ;
Original file line number Diff line number Diff line change 16
16
#include " llvm/BinaryFormat/DXContainer.h"
17
17
#include " llvm/Support/Error.h"
18
18
#include " llvm/Support/ScopedPrinter.h"
19
+ #include < cstdint>
19
20
#include < system_error>
20
21
21
22
namespace llvm {
@@ -279,8 +280,9 @@ void MappingTraits<llvm::DXContainerYAML::RootParameterYamlDesc>::mapping(
279
280
IO &IO, llvm::DXContainerYAML::RootParameterYamlDesc &P) {
280
281
IO.mapRequired (" ParameterType" , P.Type );
281
282
IO.mapRequired (" ShaderVisibility" , P.Visibility );
283
+
282
284
switch (P.Type ) {
283
- case dxbc::RootParameterType::Constants32Bit:
285
+ case static_cast < uint32_t >( dxbc::RootParameterType::Constants32Bit) :
284
286
IO.mapRequired (" Constants" , P.Constants );
285
287
break ;
286
288
}
You can’t perform that action at this time.
0 commit comments