Skip to content

Commit 2527580

Browse files
author
joaosaffran
committed
fix test
1 parent 9ee2964 commit 2527580

File tree

4 files changed

+35
-23
lines changed

4 files changed

+35
-23
lines changed

llvm/include/llvm/ObjectYAML/DXContainerYAML.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,8 @@ struct DescriptorTableYaml {
113113
SmallVector<DescriptorRangeYaml> Ranges;
114114
};
115115

116-
117-
using ParameterData = std::variant<
118-
RootConstantsYaml,
119-
RootDescriptorYaml,
120-
DescriptorTableYaml
121-
>;
116+
using ParameterData =
117+
std::variant<RootConstantsYaml, RootDescriptorYaml, DescriptorTableYaml>;
122118

123119
struct RootParameterYamlDesc {
124120
uint32_t Type;
@@ -127,9 +123,7 @@ struct RootParameterYamlDesc {
127123
ParameterData Data;
128124

129125
RootParameterYamlDesc(){};
130-
RootParameterYamlDesc(uint32_t T) : Type(T) {
131-
132-
}
126+
RootParameterYamlDesc(uint32_t T) : Type(T) {}
133127
};
134128

135129
struct RootSignatureYamlDesc {

llvm/lib/ObjectYAML/DXContainerEmitter.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,20 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
280280
auto Header = dxbc::RootParameterHeader{Param.Type, Param.Visibility,
281281
Param.Offset};
282282

283-
if(std::holds_alternative<DXContainerYAML::RootConstantsYaml>(Param.Data)){
284-
auto ConstantYaml = std::get<DXContainerYAML::RootConstantsYaml>(Param.Data);
283+
if (std::holds_alternative<DXContainerYAML::RootConstantsYaml>(
284+
Param.Data)) {
285+
auto ConstantYaml =
286+
std::get<DXContainerYAML::RootConstantsYaml>(Param.Data);
285287

286288
dxbc::RootConstants Constants;
287289
Constants.Num32BitValues = ConstantYaml.Num32BitValues;
288290
Constants.RegisterSpace = ConstantYaml.RegisterSpace;
289291
Constants.ShaderRegister = ConstantYaml.ShaderRegister;
290292
RS.ParametersContainer.addParameter(Header, Constants);
291-
} else if (std::holds_alternative<DXContainerYAML::RootDescriptorYaml>(Param.Data)){
292-
auto DescriptorYaml = std::get<DXContainerYAML::RootDescriptorYaml>(Param.Data);
293+
} else if (std::holds_alternative<DXContainerYAML::RootDescriptorYaml>(
294+
Param.Data)) {
295+
auto DescriptorYaml =
296+
std::get<DXContainerYAML::RootDescriptorYaml>(Param.Data);
293297

294298
if (RS.Version == 1) {
295299
dxbc::RST0::v0::RootDescriptor Descriptor;
@@ -301,11 +305,13 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
301305
Descriptor.RegisterSpace = DescriptorYaml.RegisterSpace;
302306
Descriptor.ShaderRegister = DescriptorYaml.ShaderRegister;
303307
Descriptor.Flags = DescriptorYaml.getEncodedFlags();
304-
RS.ParametersContainer.addParameter(Header, Descriptor);
308+
RS.ParametersContainer.addParameter(Header, Descriptor);
305309
}
306-
}else if (std::holds_alternative<DXContainerYAML::DescriptorTableYaml>(Param.Data)) {
310+
} else if (std::holds_alternative<DXContainerYAML::DescriptorTableYaml>(
311+
Param.Data)) {
307312
mcdxbc::DescriptorTable Table;
308-
auto TableYaml = std::get<DXContainerYAML::DescriptorTableYaml>(Param.Data);
313+
auto TableYaml =
314+
std::get<DXContainerYAML::DescriptorTableYaml>(Param.Data);
309315

310316
for (const auto &R : TableYaml.Ranges) {
311317
if (RS.Version == 1) {

llvm/lib/ObjectYAML/DXContainerYAML.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ DXContainerYAML::RootSignatureYamlDesc::create(
9393
YamlDescriptor.RegisterSpace = Descriptor.RegisterSpace;
9494
if (Version > 1) {
9595
#define ROOT_DESCRIPTOR_FLAG(Num, Val) \
96-
YamlDescriptor.Val = \
96+
YamlDescriptor.Val = \
9797
(Descriptor.Flags & \
9898
llvm::to_underlying(dxbc::RootDescriptorFlag::Val)) > 0;
9999
#include "llvm/BinaryFormat/DXContainerConstants.def"
@@ -403,24 +403,24 @@ void MappingTraits<llvm::DXContainerYAML::RootParameterYamlDesc>::mapping(
403403
switch (P.Type) {
404404
case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit): {
405405
DXContainerYAML::RootConstantsYaml Constants;
406-
if(IO.outputting())
406+
if (IO.outputting())
407407
Constants = std::get<DXContainerYAML::RootConstantsYaml>(P.Data);
408408
IO.mapRequired("Constants", Constants);
409409
P.Data = Constants;
410410
} break;
411411
case llvm::to_underlying(dxbc::RootParameterType::CBV):
412412
case llvm::to_underlying(dxbc::RootParameterType::SRV):
413-
case llvm::to_underlying(dxbc::RootParameterType::UAV):{
413+
case llvm::to_underlying(dxbc::RootParameterType::UAV): {
414414
DXContainerYAML::RootDescriptorYaml Descriptor;
415-
if(IO.outputting())
415+
if (IO.outputting())
416416
Descriptor = std::get<DXContainerYAML::RootDescriptorYaml>(P.Data);
417417
IO.mapRequired("Descriptor", Descriptor);
418418
P.Data = Descriptor;
419419
} break;
420420
case llvm::to_underlying(dxbc::RootParameterType::DescriptorTable): {
421421
DXContainerYAML::DescriptorTableYaml Table;
422-
if(IO.outputting())
423-
Table = std::get<DXContainerYAML::DescriptorTableYaml>(P.Data);
422+
if (IO.outputting())
423+
Table = std::get<DXContainerYAML::DescriptorTableYaml>(P.Data);
424424
IO.mapRequired("Table", Table);
425425
P.Data = Table;
426426
} break;

llvm/test/ObjectYAML/DXContainer/RootSignature-MultipleParameters.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Parts:
1414
Size: 200
1515
RootSignature:
1616
Version: 2
17-
NumRootParameters: 3
17+
NumRootParameters: 4
1818
RootParametersOffset: 24
1919
NumStaticSamplers: 0
2020
StaticSamplersOffset: 60
@@ -37,6 +37,18 @@ Parts:
3737
ShaderRegister: 31
3838
RegisterSpace: 32
3939
DATA_STATIC_WHILE_SET_AT_EXECUTE: true
40+
- ParameterType: 0
41+
ShaderVisibility: 3
42+
Table:
43+
NumRanges: 1
44+
RangesOffset: 116
45+
Ranges:
46+
- RangeType: 0
47+
NumDescriptors: 41
48+
BaseShaderRegister: 42
49+
RegisterSpace: 43
50+
OffsetInDescriptorsFromTableStart: -1
51+
DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS: true
4052
AllowInputAssemblerInputLayout: true
4153
DenyGeometryShaderRootAccess: true
4254

0 commit comments

Comments
 (0)