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
16 changes: 15 additions & 1 deletion docs/d3d12_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,21 @@ sets them, and it does so twice.

`amd_fidelityfx_upscaler_xbox.dll` does neither. Its 29 `RTS0` parts carry `Flags = 0`, and no instruction in it uses
the constant `0x3000000`. So the bits are not a property of every console root signature; this builder adds them. The
game executable is not in the package, so whether its root signatures carry them is open.
retail executable's root signatures do not carry them either (old upstream PR 7140): its direct call passes a 1.1
description with `Flags = 0x80` (`LOCAL_ROOT_SIGNATURE`), and its root-signature decoder reads `Flags` as a
zero-extended 16-bit value.

The mask stays unconditional, because it can't touch a public flag: it clears bits 24-31
(`kXboxRootSignatureFlagHighByte`, `runtime/shims/d3d12_xs_rootsig.h`), and every public
`D3D12_ROOT_SIGNATURE_FLAGS` value is in bits 0-11 (the highest is `SAMPLER_HEAP_DIRECTLY_INDEXED`, `0x800`). So it is
safe on every descriptor and blob, whatever built it. `root_sig_public_flags_test` pins this:

- the helpers keep every flag value in `[0, 0xFFFF]`;
- the shims' serializers give the host's blob byte for byte for each public flag the host takes. Where the host
refuses only `CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED` or `SAMPLER_HEAP_DIRECTLY_INDEXED` (Windows 10's in-box `d3d12.dll`),
they serialize on purpose: the blob is the host's blob without those bits, with the full flags in `RTS0` and a valid
container hash (`kDirectlyIndexedFlags`, `runtime/shims/d3d12_xs_rootsig.h`);
- a blob with `0x03000080` comes back as `0x80`.

**Version 1.2 on older runtimes.** The in-box `d3d12.dll` of Windows 10 (measured on 22H2, 10.0.19045, without the
Agility SDK) and of Windows 11 23H2 (#361) serializes root signatures only up to 1.1. On Windows 10 it rejects even an
Expand Down
17 changes: 17 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,20 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME)
target_compile_options(root_sig_test PRIVATE /W4 /permissive- /utf-8)
target_link_options(root_sig_test PRIVATE /OPT:NOREF)

# The flag mask keeps every public root-signature flag: helpers over [0, 0xFFFF], the shims against the host
# serializer and deserializer (old upstream PR 7140).
add_executable(root_sig_public_flags_test
test/root_sig_public_flags_test.cpp
shims/registry.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_xs_pso_stream.cpp
)
target_link_libraries(root_sig_public_flags_test PRIVATE gta6rt_d3d12_xs_rootsig ${D3D12_LIBRARY})
target_compile_definitions(root_sig_public_flags_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
target_compile_options(root_sig_public_flags_test PRIVATE /W4 /permissive- /utf-8)
target_link_options(root_sig_public_flags_test PRIVATE /OPT:NOREF)

# RTS0 parser oracle: synthetic descriptors only, serialized by the real PC
# d3d12.dll and parsed back by rt::rootsig::parse_rts0. A layout mismatch
# fails here with the blob bytes, never silently in a draw.
Expand Down Expand Up @@ -1385,6 +1399,9 @@ if(BUILD_TESTING)
if(TARGET root_sig_test)
add_test(NAME root_sig COMMAND root_sig_test)
endif()
if(TARGET root_sig_public_flags_test)
add_test(NAME root_sig_public_flags COMMAND root_sig_public_flags_test)
endif()
add_executable(command_list_test test/command_list_test.cpp)
add_test(NAME command_list COMMAND command_list_test)
# Which SPIR-V modules declare a storage image or buffer they may write (src/spirv_stores.h), on hand-built words.
Expand Down
Loading
Loading