Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hal/dx12/d3d12/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,11 @@ type D3D12_COMMAND_SIGNATURE_DESC struct {
type D3D12_INDIRECT_ARGUMENT_DESC struct {
Type D3D12_INDIRECT_ARGUMENT_TYPE
// Union for different argument types
Union [8]byte
// The largest member (D3D12_INDIRECT_ARGUMENT_DESC_CONSTANT) is three
// uint32 values, so the C union occupies 12 bytes and the full descriptor
// is 16 bytes including Type. Keeping the exact size matters because
// CreateCommandSignature reads the native descriptor layout directly.
Union [12]byte
}

// D3D12_DISCARD_REGION describes a discard region.
Expand Down
17 changes: 17 additions & 0 deletions hal/dx12/d3d12/types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//go:build windows && !(js && wasm)

package d3d12

import (
"testing"
"unsafe"
)

func TestIndirectArgumentDescABI(t *testing.T) {
if got := unsafe.Sizeof(D3D12_INDIRECT_ARGUMENT_DESC{}); got != 16 {
t.Fatalf("D3D12_INDIRECT_ARGUMENT_DESC size = %d, want 16", got)
}
if got := unsafe.Offsetof(D3D12_INDIRECT_ARGUMENT_DESC{}.Union); got != 4 {
t.Fatalf("D3D12_INDIRECT_ARGUMENT_DESC.Union offset = %d, want 4", got)
}
}
Loading