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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ target_link_libraries(startup_stream_consumer PRIVATE d3d12_xs_shim startup_stub
target_sources(startup_stream_consumer PRIVATE tests/startup_frame_copy.cpp)
target_sources(startup_stream_consumer PRIVATE tests/startup_root_reset.cpp)
target_sources(startup_stream_consumer PRIVATE tests/startup_memory_srv_diag.cpp)
target_sources(startup_stream_consumer PRIVATE tests/startup_pixel_uav.cpp)

add_executable(startup_stream_depth tests/startup_stream_depth.cpp $<TARGET_OBJECTS:startup_stream_setup_obj>)
target_compile_features(startup_stream_depth PRIVATE cxx_std_17)
Expand Down Expand Up @@ -4422,6 +4423,12 @@ if(EXISTS "${INTAKE_PYTHON}")
"${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_d16_srv_check.py"
"$<TARGET_FILE:startup_stream_consumer>" "${backend}")
set_tests_properties(startup_d16_srv_${backend} PROPERTIES TIMEOUT 90 SKIP_RETURN_CODE 77)
# A translated pixel-stage image store bound from the title's table (#1996 item F): the stored texel and
# every other word of four textures read back, each refusal by its reason, and the exec controls.
add_test(NAME startup_pixel_uav_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}"
"${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_pixel_uav_check.py"
"$<TARGET_FILE:startup_stream_consumer>" "${backend}")
set_tests_properties(startup_pixel_uav_${backend} PROPERTIES TIMEOUT 240 SKIP_RETURN_CODE 77)
add_test(NAME startup_frame_copy_${backend} COMMAND "${CMAKE_COMMAND}" -E env "X2W_FXC=${STARTUP_FXC}"
"${INTAKE_PYTHON}" -B "${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_frame_copy_check.py"
"$<TARGET_FILE:startup_stream_consumer>" ${backend})
Expand Down
2 changes: 1 addition & 1 deletion docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ to check RGBA8 texel and alpha values, rebinding, and a mismatched 2D view on ha

## Offline vertex buffer stores

`tools/startup/gfx2hlsl.py` lowers vertex-stage `buffer_store_dword`, `dwordx2`, `dwordx3` and `dwordx4` in the `off` form to `RWByteAddressBuffer.Store*`. The descriptor must come from a root-table slot, and the manifest becomes version 2 with a `uav <slot> table <param> <byte offset>` line. This is offline only: the shipped runtime refuses version 2 manifests, so no store runs in a game. Refused forms: `glc`, `slc`, `offen`, `idxen`, pixel stage, a descriptor also used for a load, a descriptor whose base was changed, and an immediate or inline offset that is not a multiple of four. A register offset is rounded down to a multiple of four.
`tools/startup/gfx2hlsl.py` lowers vertex-stage `buffer_store_dword`, `dwordx2`, `dwordx3` and `dwordx4` in the `off` form to `RWByteAddressBuffer.Store*`. The descriptor must come from a root-table slot, and the manifest becomes version 2 with a `uav <slot> table <param> <byte offset>` line. This is offline only: the shipped runtime refuses the `raw` uav line by name (it binds only pixel-stage `tex2d` stores), so no buffer store runs in a game. Refused forms: `glc`, `slc`, `offen`, `idxen`, pixel stage, a descriptor also used for a load, a descriptor whose base was changed, and an immediate or inline offset that is not a multiple of four. A register offset is rounded down to a multiple of four.

The descriptor modifications that compute buffer stores accept are accepted here too, with the same checks: the stride clear of DW1 and the structured-to-raw conversion (stride DW1[29:16] extracted, optionally clamped to at least 1, DW2 NUM_RECORDS scaled by it, DW3 OOB_SELECT set to 3, stride cleared), all four words from one descriptor load. The store and manifest are those of the unmodified descriptor. In the vertex stage, as in compute, a descriptor load through a pointer other than the untouched pair is tagged with the constant high word of a 32-bit table pointer, or otherwise with its own load, so the conversion cannot mix words of two loads. Any other modification stays refused. As for compute, matching out-of-range behavior would need a UAV view sized to the converted byte count; the runtime binds no vertex-stage UAV yet.

Expand Down
23 changes: 21 additions & 2 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -2204,11 +2204,30 @@ These are measured on one executable; treat them as hypotheses for others.
`uav <index> tex2d table <table> <offset>` line. The cache-policy bits are accepted. A partial
channel mask (a typed store writes all four channels), other dimensions, `d16`, `a16`, `tfe`,
`lwe`, `r128`, `image_store_mip`, a store outside a pixel or compute stage, and a program that loads
and stores the same image are refused by name. The runtime does not bind UAVs on the translated
graphics path yet: it logs and does not use a translation whose manifest has a `uav` line. A
and stores the same image are refused by name. A
hand-assembled program stores four distinct values at texel (1, 2). The desktop draw reads all 16
texels of a 4x4 image back; deleting the store or exchanging x and y must fail. Run
`ctest --preset release --no-tests=error -R '^startup_pixel_image_store_' -V`.
- **Binding pixel-stage image stores.** A translated draw binds each `uav N tex2d table P O` line
as a UAV range `u0..` placed after the SRVs in the translated root signature's view table. The view is made from the unordered-access
view the title created at that table entry (`resolve_pixel_uavs` in `d3d12_draw.inl`), on
mip 0 of a 2D texture, and the texture is in `UNORDERED_ACCESS` for the draw. Refusals are logged
with their reason and nothing is bound in place of the view. When the manifest is loaded, the
translation is not used for another image kind, a buffer line (`uav N raw table P O`,
the vertex-stage store of #2059), a view qualifier (`float`, `uint`, `sint`, as in the compute line), another source, extra fields such as
`channels`, an index out of order or more than eight views. At draw time,
the draw is not translated for no table at the parameter, an entry outside the bound table, an
entry without a view, a view that is not a UAV, a resource without `ALLOW_UNORDERED_ACCESS`, an
array, 3D, 1D or multisampled resource, a view of another dimension, mip or plane, an integer,
sRGB or non-colour format, a format without typed UAV store, and a texture that is also an SRV,
a render target or the depth texture of the draw; these checks run before any view of the draw is
written or any texture changes state. Indirect draws refuse a translation with a `uav` line. Compute UAVs and barriers between
draws that write and read the same texture are not covered. `tests/startup_pixel_uav_check.py`
draws the program above through the runtime with four 4x4 two-mip textures in which every word is
a distinct sentinel. The texel lands only in the texture the table names, and every other word of
the four textures stays unchanged; each refusal leaves every word unchanged. The exec-off variant
leaves the texel, and must fail once recompiled without its guard. Run
`ctest --preset release --no-tests=error -R '^startup_pixel_uav_' -V`.
- **Explicit mip loads.** For 2D textures, 2D arrays and 3D textures, `image_load_mip` passes the final
address register to `Texture.Load` as the mip level (`int4(x, y, slice, mip)` for an array, whose four
registers are x, y, slice and mip). Ordinary `image_load` still reads mip zero.
Expand Down
Loading
Loading