Skip to content

Commit d982395

Browse files
author
joaosaffran
committed
changing version namings
1 parent 9e2b122 commit d982395

File tree

6 files changed

+34
-31
lines changed

6 files changed

+34
-31
lines changed

llvm/include/llvm/BinaryFormat/DXContainer.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ struct SignatureElement {
427427

428428
static_assert(sizeof(SignatureElement) == 4 * sizeof(uint32_t),
429429
"PSV Signature elements must fit in 16 bytes.");
430-
431430
} // namespace v0
432431

433432
namespace v1 {
@@ -468,7 +467,6 @@ struct RuntimeInfo : public v0::RuntimeInfo {
468467
sys::swapByteOrder(GeomData.MaxVertexCount);
469468
}
470469
};
471-
472470
} // namespace v1
473471

474472
namespace v2 {
@@ -585,37 +583,39 @@ struct ProgramSignatureElement {
585583

586584
static_assert(sizeof(ProgramSignatureElement) == 32,
587585
"ProgramSignatureElement is misaligned");
588-
589-
// following dx12 naming
590-
// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_root_constants
591-
struct RootConstants {
586+
namespace RST0 {
587+
namespace v0 {
588+
struct RootDescriptor {
592589
uint32_t ShaderRegister;
593590
uint32_t RegisterSpace;
594-
uint32_t Num32BitValues;
595-
596591
void swapBytes() {
597592
sys::swapByteOrder(ShaderRegister);
598593
sys::swapByteOrder(RegisterSpace);
599-
sys::swapByteOrder(Num32BitValues);
600594
}
601595
};
602-
struct RootDescriptor_V1_0 {
603-
uint32_t ShaderRegister;
604-
uint32_t RegisterSpace;
596+
} // namespace v0
597+
598+
namespace v1 {
599+
struct RootDescriptor : public v0::RootDescriptor {
600+
uint32_t Flags;
605601
void swapBytes() {
606-
sys::swapByteOrder(ShaderRegister);
607-
sys::swapByteOrder(RegisterSpace);
602+
v0::RootDescriptor::swapBytes();
603+
sys::swapByteOrder(Flags);
608604
}
609605
};
610-
611-
struct RootDescriptor_V1_1 {
606+
} // namespace v1
607+
} // namespace RST0
608+
// following dx12 naming
609+
// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_root_constants
610+
struct RootConstants {
612611
uint32_t ShaderRegister;
613612
uint32_t RegisterSpace;
614-
uint32_t Flags;
613+
uint32_t Num32BitValues;
614+
615615
void swapBytes() {
616616
sys::swapByteOrder(ShaderRegister);
617617
sys::swapByteOrder(RegisterSpace);
618-
sys::swapByteOrder(Flags);
618+
sys::swapByteOrder(Num32BitValues);
619619
}
620620
};
621621

llvm/include/llvm/MC/DXContainerRootSignature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ struct RootParameter {
1919
dxbc::RootParameterHeader Header;
2020
union {
2121
dxbc::RootConstants Constants;
22-
dxbc::RootDescriptor_V1_0 Descriptor_V10;
23-
dxbc::RootDescriptor_V1_1 Descriptor_V11;
22+
dxbc::RST0::v0::RootDescriptor Descriptor_V10;
23+
dxbc::RST0::v1::RootDescriptor Descriptor_V11;
2424
};
2525
};
2626
struct RootSignatureDesc {

llvm/include/llvm/Object/DXContainer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ struct RootDescriptorView_V1_0 : RootParameterView {
161161
llvm::to_underlying(dxbc::RootParameterType::UAV)));
162162
}
163163

164-
llvm::Expected<dxbc::RootDescriptor_V1_0> read() {
165-
return readParameter<dxbc::RootDescriptor_V1_0>();
164+
llvm::Expected<dxbc::RST0::v0::RootDescriptor> read() {
165+
return readParameter<dxbc::RST0::v0::RootDescriptor>();
166166
}
167167
};
168168

@@ -177,8 +177,8 @@ struct RootDescriptorView_V1_1 : RootParameterView {
177177
llvm::to_underlying(dxbc::RootParameterType::UAV)));
178178
}
179179

180-
llvm::Expected<dxbc::RootDescriptor_V1_1> read() {
181-
return readParameter<dxbc::RootDescriptor_V1_1>();
180+
llvm::Expected<dxbc::RST0::v1::RootDescriptor> read() {
181+
return readParameter<dxbc::RST0::v1::RootDescriptor>();
182182
}
183183
};
184184

@@ -229,9 +229,9 @@ class RootSignature {
229229
case dxbc::RootParameterType::SRV:
230230
case dxbc::RootParameterType::UAV:
231231
if (Version == 1)
232-
DataSize = sizeof(dxbc::RootDescriptor_V1_0);
232+
DataSize = sizeof(dxbc::RST0::v0::RootDescriptor);
233233
else
234-
DataSize = sizeof(dxbc::RootDescriptor_V1_1);
234+
DataSize = sizeof(dxbc::RST0::v1::RootDescriptor);
235235
break;
236236
}
237237
size_t EndOfSectionByte = getNumStaticSamplers() == 0

llvm/include/llvm/ObjectYAML/DXContainerYAML.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct RootParameterYamlDesc {
9595
uint32_t Type;
9696
uint32_t Visibility;
9797
uint32_t Offset;
98-
RootParameterYamlDesc() {};
98+
RootParameterYamlDesc(){};
9999
RootParameterYamlDesc(uint32_t T) : Type(T) {
100100
switch (T) {
101101

llvm/lib/MC/DXContainerRootSignature.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ size_t RootSignatureDesc::getSize() const {
4141
case llvm::to_underlying(dxbc::RootParameterType::SRV):
4242
case llvm::to_underlying(dxbc::RootParameterType::UAV):
4343
if (Version == 1)
44-
Size += sizeof(dxbc::RootDescriptor_V1_0);
44+
Size += sizeof(dxbc::RST0::v0::RootDescriptor);
4545
else
46-
Size += sizeof(dxbc::RootDescriptor_V1_1);
46+
Size += sizeof(dxbc::RST0::v1::RootDescriptor);
4747

4848
break;
4949
}

llvm/lib/ObjectYAML/DXContainerYAML.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "llvm/ObjectYAML/DXContainerYAML.h"
1515
#include "llvm/ADT/STLForwardCompat.h"
1616
#include "llvm/ADT/ScopeExit.h"
17+
#include "llvm/BinaryFormat/DXContainer.h"
1718
#include "llvm/Object/DXContainer.h"
1819
#include "llvm/Support/Error.h"
1920
#include "llvm/Support/ScopedPrinter.h"
@@ -80,7 +81,8 @@ DXContainerYAML::RootSignatureYamlDesc::create(
8081
NewP.Constants.RegisterSpace = Constants.RegisterSpace;
8182
} else if (auto *RDV = dyn_cast<object::DirectX::RootDescriptorView_V1_0>(
8283
&ParamView)) {
83-
llvm::Expected<dxbc::RootDescriptor_V1_0> DescriptorOrErr = RDV->read();
84+
llvm::Expected<dxbc::RST0::v0::RootDescriptor> DescriptorOrErr =
85+
RDV->read();
8486
if (Error E = DescriptorOrErr.takeError())
8587
return std::move(E);
8688
auto Descriptor = *DescriptorOrErr;
@@ -89,7 +91,8 @@ DXContainerYAML::RootSignatureYamlDesc::create(
8991
NewP.Descriptor.RegisterSpace = Descriptor.RegisterSpace;
9092
} else if (auto *RDV = dyn_cast<object::DirectX::RootDescriptorView_V1_1>(
9193
&ParamView)) {
92-
llvm::Expected<dxbc::RootDescriptor_V1_1> DescriptorOrErr = RDV->read();
94+
llvm::Expected<dxbc::RST0::v1::RootDescriptor> DescriptorOrErr =
95+
RDV->read();
9396
if (Error E = DescriptorOrErr.takeError())
9497
return std::move(E);
9598
auto Descriptor = *DescriptorOrErr;

0 commit comments

Comments
 (0)