Skip to content
Draft
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: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1734,11 +1734,17 @@ set_tests_properties(startup_indirect_draw_indexed_hardware startup_indirect_dra
startup_indirect_rectlist_hardware PROPERTIES SKIP_RETURN_CODE 77)
foreach(backend IN ITEMS warp hardware)
add_test(NAME startup_indirect_mesh_request_${backend} COMMAND startup_indirect_draw_indexed ${backend} mesh)
add_test(NAME startup_indirect_mesh57_targets_${backend} COMMAND startup_indirect_draw_indexed ${backend} mesh)
add_test(NAME startup_indirect_mesh57_targets_off_${backend} COMMAND startup_indirect_draw_indexed ${backend} mesh)
add_test(NAME startup_indirect_mesh_create_result_${backend} COMMAND startup_indirect_draw_indexed ${backend} mesh)
set_tests_properties(startup_indirect_mesh_create_result_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77
ENVIRONMENT "X2W_FIXED_MESH_CREATE_FIXTURE=1")
set_tests_properties(startup_indirect_mesh_request_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77
ENVIRONMENT "X2W_MESH_REQUEST_FIXTURE=1")
set_tests_properties(startup_indirect_mesh57_targets_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77
ENVIRONMENT "X2W_MESH_REQUEST_FIXTURE=1;X2W_TEST_MESH57_TARGETS=1")
set_tests_properties(startup_indirect_mesh57_targets_off_${backend} PROPERTIES TIMEOUT 30 SKIP_RETURN_CODE 77
ENVIRONMENT "X2W_MESH_REQUEST_FIXTURE=1;X2W_TEST_MESH57_TARGETS=0")
endforeach()
add_test(NAME startup_missing_shader_fallback_warp COMMAND startup_indirect_draw_indexed warp missing-shader-fallback)
add_test(NAME startup_missing_shader_fallback_off_warp COMMAND startup_indirect_draw_indexed warp missing-shader-fallback-off)
Expand Down
6 changes: 6 additions & 0 deletions docs/experiments/native-fixed-mesh57.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ The three fixture variants use one color target, six color targets with depth/st

The ten tests above passed on the working tree based on `671b9ac`, Windows build 26200, with the debug layer enabled on WARP and an NVIDIA GeForce RTX 4060 Laptop GPU (driver 32.0.16.1656).

## Mesh-only depth

A reviewed mesh-only profile specifies zero color targets, enabled depth writes and a typed DSV format. The creation descriptor has a zero PS pointer and length, and the exact PS span in the profile is empty. Versions 2–5 use a zeroed pixel entry and retain their MS layout and bindings.

`native_fixed_mesh57_depth_only_hardware` checks all eight D32 depth texels after slot 61 execution. The WARP fixture checks the physical-adapter refusal, which follows the slot-86 mesh-only guard for a known WARP device removal. Both fixtures check missing and changed profiles, a color target, a zero depth-write mask and a typeless DSV.

## Per-pixel texture selection

The `native_fixed_mesh57_waterfall_{warp,hardware}` fixture draws a triangle covering eight pixels. The guest PS uses READFIRSTLANE, CMPX, an indexed descriptor load, IMAGE_SAMPLE and a WREXEC retry. Neighboring pixels select different Texture2D views. With a unit UV gradient the two views return red and green from mip 1. The `waterfall_fine` variant holds UV constant and both views return blue from mip 0. The shader computes quad derivatives before sampling the per-pixel texture. Both gradient cases passed on WARP and the RTX 4060 Laptop with the debug layer enabled. Run `ctest --preset dev --no-tests=error -R '^native_fixed_mesh57_(pixel_heap|waterfall(_fine)?)_(warp|hardware)$'` to reproduce.
Expand Down
1 change: 1 addition & 0 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@ ctest --preset dev --no-tests=error -R '^startup_hook_(window|overlap)$' -V
| `X2W_PIPELINE_COLOUR=1` | diagnostic only, debug switch, in render mode: a `DrawInstanced`, `DrawIndexedInstanced` or `ExecuteIndirect` draw that draws nothing gets one flat marker tile in render target 0, in a colour taken from its pipeline key, and logs `x2w-draw colour #rrggbb for <key> <reason>` once per key ([details](experiments/pipeline-colour-fallback.md)). Not a fallback: the refused draw still draws nothing, and the tiles can tint later passes. Unset, nothing is drawn or logged |
| `X2W_SHADER_CACHE=<dir>` | translation cache: the runtime writes source requests `req_<key>.{a,b,root}`, when needed RTV variants `req_<key>.rtv`, and for device slot 67 compute pipelines `req_<key>.{desc,sa,sb,data,root,c67}` (see [Compute pipeline requests](#compute-pipeline-requests)). A console pipeline that an `ExecuteIndirect` draw (list slot 61) refuses writes the same request as a direct draw, once per pipeline, and draws nothing (`startup_indirect_requests_warp`). Only direct draws poll for its manifest, so such a pipeline stays in the `missing` count until a direct draw uses it; the `x2w-render totals` line counts `pipelines first looked up by ExecuteIndirect N`. This is a per-process lookup count. Check for the ready marker `req_<key>.a` to confirm a complete request is available. Run `tools/startup/gfx2hlsl.py --pending <dir>` while the process is running, or start the run with `run.ps1 -Translate` (see [Translating shaders during a run](#translating-shaders-during-a-run)). Active draws poll for an absent manifest at most once per second per pipeline and use the published translation on a subsequent draw. The translator compiles `.vs.cso` and `.ps.cso` with `fxc.exe`: `X2W_FXC`, else the Windows SDK 10.0.26100.0 copy, else the newest `Windows Kits\10\bin\<version>\x64`, else `PATH`. When none exists it writes `<key>.fail` naming `X2W_FXC` without publishing a new manifest. `X2W_FXC=` (empty) publishes the manifest alone. Rerun `--pending` with compilation enabled to fill in missing bytecode for an existing manifest. At its first native slot-57 profile lookup the runtime lists the directory's top-level file names once and logs `x2w-draw cache index: <n> names in <ms> ms` (`src/startup_stubs/cache_index.h`). A `<variant>.mesh57-state` profile is opened only when that listing has its name, so a profile written while the process runs is read by the next process. Manifests and every other cache file are still looked up on disk. |
| `X2W_NATIVE_SHADERS=<dir>` (`run.ps1 -NativeShaders <dir>`) | experimental, in render mode: translates device slot 67 compute requests in the stand-in with the C++ compiler; `<dir>` holds `dxcompiler.dll` and `dxil.dll`. See [Translating compute programs in the stand-in](#translating-compute-programs-in-the-stand-in) |
| `X2W_MESH57_CAPTURE_STATE=1` | In `X2W_SHADER_CACHE`, archives [slot 57 creation state](experiments/native-fixed-mesh57.md) and queues `req_<variant>.t57` for matching-root indirect mesh calls with resolved attachments sharing one sample description. Each `targets <rtv-count> <ordered-rtv-formats...> dsv <format> writable <0-or-1> samples <count> <quality>` line is one distinct tuple. Formats are decimal desktop DXGI view formats, with DSV format 0 for no depth view. The sidecar keeps up to eight tuples and adds an `overflow <observations>` line once the cap is reached and another tuple is observed. Placeholder calls supply evidence for their creation variant as well. Background writes are best effort. |
| `X2W_D3D12_LINEAR_BUFFERS=1` or `=copy` | opt-in backing for linear buffers placed at a title address (device slot 133, initial state `COMMON`): shared where the adapter, extent and memory allow it (private allocations larger than 256 MiB are skipped only with `X2W_D3D12_CAP_EXISTING_HEAP=1`), otherwise copied from title memory at each submission, otherwise the default backing is kept and the refusal recorded; `copy` never shares. Unset or `0`, slot 133 keeps its default backing. See [Linear buffer backing (device slot 133, opt-in)](#linear-buffer-backing-device-slot-133-opt-in) |
| `X2W_D3D12_CAP_EXISTING_HEAP=1` | opt-in 256 MiB (`unplaced_existing_heap_allowed`) allocation-size cap on `OpenExistingHeapFromAddress` in device slot 133 (`startup_slot133_heap_cap_*`). Unset (default), private allocations larger than 256 MiB keep the formerly aliased path: a capped copied placement is refused by `CopyBufferRegion` (list slot 15) as `title_backed_source`, losing a late guest write made after recording and before submit. Set, allocations larger than 256 MiB skip `OpenExistingHeapFromAddress` so multi-GiB startup blocks are not pinned in `WorkingSetSize` and `NonLocal` GPU memory |
| `X2W_D3D12_ROOT_SRV_AT_DRAW=1` | opt-in, render mode: a graphics root SRV (slot 44) without an upload mapping is not copied into the upload ring, since no draw reads that desktop binding (default: a 64 KiB copy at every slot 44 call). Translated draws copy the SRV themselves and are unaffected (`startup_root_srv_draw_*`). See [the experiment note](experiments/startup-root-srv-at-draw.md) |
Expand Down
1 change: 1 addition & 0 deletions src/startup_stubs/d3d12_capture.inl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct PipelineInfo {
std::vector<unsigned char> desc;
std::vector<unsigned char> state_a, state_b; // slot 57: the two state blocks, copied at creation (the title frees them)
mutable FixedMeshBytes fixed_ms, fixed_ps;
mutable std::optional<u64> fixed_mesh_capture_variant; // retained after the request releases its stage copies
mutable std::vector<x2w::PixelHeapSpan> mesh57_pixel_spans;
mutable UINT mesh57_heap_word = UINT_MAX; // R32_UINT at guest root constant[heap_word] & 1023.
mutable std::vector<x2w_startup::Mesh57BufferRead> mesh57_reads; // Host SRV register order.
Expand Down
Loading
Loading