Skip to content

Commit

Permalink
[DirectX backend] PartSize not include PartHeader
Browse files Browse the repository at this point in the history
PartSize for a part in dx container is only the size of the content of the part, not include size of the PartHeader.

Differential Revision: https://reviews.llvm.org/D141207
  • Loading branch information
python3kgae committed Jan 10, 2023
1 parent e3becfa commit 78a73dd
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/MC/MCDXContainerWriter.cpp
Expand Up @@ -104,7 +104,7 @@ uint64_t DXContainerObjectWriter::writeObject(MCAssembler &Asm,
// Write section header.
W.write<char>(ArrayRef<char>(Sec.getName().data(), 4));

uint64_t PartSize = SectionSize + sizeof(dxbc::PartHeader);
uint64_t PartSize = SectionSize;

if (Sec.getName() == "DXIL")
PartSize += sizeof(dxbc::ProgramHeader);
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
Expand Up @@ -19,7 +19,7 @@ define i32 @add(i32 %a, i32 %b) {
!4 = !{i32 2, !"Debug Info Version", i32 3}

; DXC: - Name: HASH
; DXC: Size: 28
; DXC: Size: 20
; DXC: Hash:
; DXC: IncludesSource: true
; DXC: Digest: [
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
Expand Up @@ -10,7 +10,7 @@ define i32 @add(i32 %a, i32 %b) {
}

; DXC: - Name: HASH
; DXC: Size: 28
; DXC: Size: 20
; DXC: Hash:
; DXC: IncludesSource: false
; DXC: Digest: [
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
Expand Up @@ -15,7 +15,7 @@ define double @div(double %a, double %b) {


; DXC: - Name: SFI0
; DXC-NEXT: Size: 16
; DXC-NEXT: Size: 8
; DXC-NEXT: Flags:
; DXC-NEXT: Doubles: true
; DXC-NOT: {{[A-Za-z]+: +true}}
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
Expand Up @@ -13,7 +13,7 @@ define double @add(double %a, double %b) {
}

; DXC: - Name: SFI0
; DXC-NEXT: Size: 16
; DXC-NEXT: Size: 8
; DXC-NEXT: Flags:
; DXC-NEXT: Doubles: true
; DXC-NOT: {{[A-Za-z]+: +true}}
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/CodeGen/DirectX/embed-dxil.ll
Expand Up @@ -42,11 +42,11 @@ define i32 @add(i32 %a, i32 %b) {
; DXC-NEXT: MajorVersion: 6
; DXC-NEXT: MinorVersion: 5
; DXC-NEXT: ShaderKind: 6
; DXC-NEXT: Size: [[#div(SIZE,4) - 2]]
; DXC-NEXT: Size: [[#div(SIZE,4)]]
; DXC-NEXT: DXILMajorVersion: [[#]]
; DXC-NEXT: DXILMinorVersion: [[#]]
; DXC-NEXT: DXILSize: [[#SIZE - 32]]
; DXC-NEXT: DXILSize: [[#SIZE - 24]]
; DXC-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE,
; DXC: - Name: SFI0
; DXC-NEXT: Size: 16
; DXC-NEXT: Size: 8
; DXC-NOT: Flags:

0 comments on commit 78a73dd

Please sign in to comment.