Skip to content
Open
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: 16 additions & 0 deletions docs/d3d12_vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,21 @@ What is implemented (all of it testable without the game):
`ClearUnorderedAccessViewFloat` packs RGB9E5 with round-half-up (clamping negative/NaN to 0 and +Inf/overflow to
65408, bumping on 512) and `ClearUnorderedAccessViewUint` writes 0, matching WARP (`d3d12_r9g9b9e5_uav_test`,
`d3d12_uav_clear_test`);
- R32_UINT and R9G9B9E5 views (D3D-RGB9E5-UINT-ALIAS-VIEW): on the title's device only, the one behind the Xbox-ABI
proxy (`set_device_outer`, which `D3D12XboxCreateDevice` calls), an `R32_UINT` texture and an
`R9G9B9E5_SHAREDEXP` one that allow unordered access take shader-resource views in each other's format. The
console title packs light as RGB9E5 bits into `R32_UINT` textures from compute shaders, which cannot store that
format, and samples them through `R9G9B9E5_SHAREDEXP` views of the same texture (sky, sky and light probes,
bounced light, cloud and sky volumes); the console allows that view, desktop D3D12 refuses it, and a device
without the proxy still does (the PC tests and the WARP parity comparisons use one). Such a texture is a
`MUTABLE_FORMAT` image with `{R32_UINT, E5B9G9R9_UFLOAT_PACK32}` in its format list, both formats of Vulkan's
32-bit compatibility class (an `R32_UINT`-backed `R9G9B9E5` UAV texture already has that list); a view in the other
format is `SAMPLED_BIT` only, and its T# names `5_9_9_9_FLOAT` (132) or `32_UINT` (20) at the texture's own
address. Unordered-access views keep the PC rule (the title stores the words through `R32_UINT`; most GPUs have no
`E5B9G9R9` storage), and so do textures without unordered access, multisampled and reserved ones: a mutable image
may lose the driver's compression, so other `R32_UINT` textures keep a plain image. Found by comparing with
fxceless/victory-fork, a fork of VIctory that fixed the same black sky, probes and fog by pointing the sampled
texture at the written one; here one image takes both views (`d3d12_rgb9e5_alias_view_test`);
- the descriptor shader samples `B5G5R5A1_UNORM` through a 2D SRV. Opaque and transparent red check bit 15,
and mixed-channel texels check the five-bit color fields;
- `B5G5R5A1_UNORM` with `ALLOW_UNORDERED_ACCESS` on a GPU whose `VK_FORMAT_A1R5G5B5_UNORM_PACK16` lacks
Expand Down Expand Up @@ -3615,6 +3630,7 @@ to be recovered from call sites (or the NDA GDK headers, if a developer has acce
| Device slots 48/73/78/79/80 | Public HLE `Freminet`/`ScarlettX` (third-party, not Microsoft documentation) | `d3d12_xs_device.cpp` routes `CreateCommandQueueX` (48), `CreateCommandListX` (73), `SetFrameIntervalX` (78), `ScheduleFrameEventX` (79) and `WaitFrameEventX` (80) before it indexes the PC vtable. Queue and list creation use the existing create paths. The frame-event calls are a per-device token counter: `WaitFrameEventX` returns at once with a fresh non-zero token, because there is no vblank source before a presenter exists. The five indices can be moved with `LEONIDA_XS_QUEUE_X_SLOT`, `LEONIDA_XS_LIST_X_SLOT`, `LEONIDA_XS_FRAME_INTERVAL_SLOT`, `LEONIDA_XS_SCHEDULE_EVENT_SLOT` and `LEONIDA_XS_WAIT_EVENT_SLOT` (3..127; a value that names a slot the proxy already handles keeps that slot's handler); a trace that disagrees wins. |
| Indirect argument type 105 | The retail title's startup creates five one-argument command signatures (device slot 41) with no root signature; one has type 105 and a 12-byte stride. Its two `ExecuteIndirect` sites, read statically, set the compute state first, as the `DISPATCH` sites do, and pass one command from the same argument buffer, on a second command list | `d3d12_xs_device.cpp` creates it as `DISPATCH` (`D3D12_DISPATCH_ARGUMENTS`). What the console does differently for it is **Open**. |
| Device slot 61 | The retail title's boot under `gta6rt --run` (stop 20 of the RT-5 measurements in #6910): called as `(desc, dest handle)` once per sampler | `d3d12_xs_device.cpp` routes it to the PC `CreateSampler` (slot 22) with the description's PC `D3D12_SAMPLER_DESC` prefix, for a caller in an image the guest loader mapped; the PC slot 61 is `CreateMetaCommand`, which any other caller (a host test driving the device through the proxy) still gets. The layout of the description beyond the PC fields is **Open**. |
| `R32_UINT` / `R9G9B9E5_SHAREDEXP` views of one texture | fxceless/victory-fork (third-party, a fork of VIctory): the title writes packed light as `R32_UINT` from compute and samples it through `R9G9B9E5_SHAREDEXP` views; with two host textures everything read was black | On the title's device (the one behind the proxy) a UAV texture of either format is a mutable image listing both, and takes SRVs in the other format; a device without the proxy keeps desktop D3D12's refusal. Not run on a retail title yet. Details in §3.2's format list. |
| Device slot 74 | The retail title's boot under `gta6rt --run`: called as `(pointer, u32, pointer)` | **Stand-in.** `d3d12_xs_device.cpp` answers `S_OK` and does nothing, for a caller in an image the guest loader mapped; the PC slot 74 is `ShaderCacheControl`, which the call does not fit and which any other caller still gets. What the console method is, and what it should do, is **Open**. |
| Command-allocator slot 9 | The retail title's boot under `gta6rt --run`: called past the 9-slot PC allocator, as `(function pointer, context, ...)`; `SetAllocatorCallbackX` is the name the commit that added it uses | **Stand-in.** The allocator proxy records the callback and its context (`allocator_proxy_callback`, `allocator_proxy_callback_context`) and answers `S_OK`. **Nothing calls the callback**: the Vulkan layer backs command buffers itself. Whether the title depends on being called back is **Open**. |
| Device slot 81, queue `PresentX`/`SuspendX`/`ResumeX` | XCL (GPL-2.0-only, third-party): `GetFrameStatisticsX` at device slot 81, `PresentX` at queue slot 30 (older runtime layout) or 32 (newer); `SuspendX`/`ResumeX` slots unmeasured | `set_presentation_handler` forwards 78-81 and the queue routes to a presenter (`attach_xbox_presentation`; `gta6rt` creates no `XboxPresentation` yet). Without one, slot 81 answers `S_FALSE` with a zero count (no statistics yet) and the queue slots stay refused. Moved with `LEONIDA_XS_FRAME_STATISTICS_SLOT` (3..127) and `LEONIDA_XS_PRESENT_X_SLOT` (default 30); `SuspendX` and `ResumeX` are routed only when `LEONIDA_XS_SUSPEND_X_SLOT` / `LEONIDA_XS_RESUME_X_SLOT` are set (queue slots 19..127; two routes on one slot are refused with a log). |
Expand Down
23 changes: 23 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,29 @@ if(TARGET Vulkan::Headers)
target_compile_definitions(d3d12_r9g9b9e5_uav_test PRIVATE
LEONIDA_TEST_CS_R9G9B9E5_UAV_SPV="${LEONIDA_TEST_CS_R9G9B9E5_UAV}")
endif()
# D3D-RGB9E5-UINT-ALIAS-VIEW: on the title's device (behind the Xbox-ABI proxy) R32_UINT and R9G9B9E5_SHAREDEXP
# UAV textures take SRVs in each other's format; compute stores packed words through an R32_UINT UAV and a second
# dispatch samples them through an R9G9B9E5 SRV of the same texture. A device without the proxy keeps refusing.
add_executable(d3d12_rgb9e5_alias_view_test test/d3d12_rgb9e5_alias_view_test.cpp)
target_link_libraries(d3d12_rgb9e5_alias_view_test PRIVATE gta6rt_d3d12_com)
target_compile_definitions(d3d12_rgb9e5_alias_view_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
target_compile_options(d3d12_rgb9e5_alias_view_test PRIVATE /W4 /permissive- /utf-8)
add_test(NAME d3d12_rgb9e5_alias_view COMMAND d3d12_rgb9e5_alias_view_test)
set_tests_properties(d3d12_rgb9e5_alias_view PROPERTIES SKIP_RETURN_CODE 77)
if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
# The same store-then-sample shader as d3d12_r9g9b9e5_uav_test, compiled to an output of this test's own.
set(LEONIDA_TEST_CS_RGB9E5_ALIAS ${CMAKE_CURRENT_BINARY_DIR}/generated/cs_rgb9e5_alias_view.spv)
add_custom_command(
OUTPUT ${LEONIDA_TEST_CS_RGB9E5_ALIAS}
COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} -V --target-env vulkan1.3 -o ${LEONIDA_TEST_CS_RGB9E5_ALIAS}
${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/cs_r9g9b9e5_uav.comp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/glsl/cs_r9g9b9e5_uav.comp
COMMENT "Compiling cs_r9g9b9e5_uav.comp for d3d12_rgb9e5_alias_view_test"
VERBATIM)
target_sources(d3d12_rgb9e5_alias_view_test PRIVATE ${LEONIDA_TEST_CS_RGB9E5_ALIAS})
target_compile_definitions(d3d12_rgb9e5_alias_view_test PRIVATE
LEONIDA_TEST_CS_RGB9E5_ALIAS_SPV="${LEONIDA_TEST_CS_RGB9E5_ALIAS}")
endif()

# Debug markers as VK_EXT_debug_utils labels, and private data on every object (D3D-24).
add_executable(d3d12_debug_markers_test test/d3d12_debug_markers_test.cpp)
Expand Down
Loading
Loading