Skip to content

Shader tools: keep DXC timings out of JSON output - #29

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
BBareth:codex/shaders-json-compile
Nov 22, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
BBareth:codex/shaders-json-compile

Conversation

@BBareth

@BBareth BBareth commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Sends DXC sample timings to stderr alongside compilation progress. This keeps stdout parseable when xcl shaders --json --compile N has a sample to compile.

Validation

  • Used a synthetic shader to reproduce invalid JSON on the prior Windows build under Wine.
  • Parsed the updated command's stdout as JSON, verified the DXC result fields, and checked that stderr contains the timing. The sample exercised the DXC failure path because the compiler was unavailable.
  • Shader aggregation unit test passed on Windows GNU under Wine.

ivall added a commit that referenced this pull request Nov 22, 2026
…ads, console heaps and resources, merged ES+GS

- Run from <Game>/Binaries/XSX: the package root is the folder above whose
  MicrosoftGame.config names the exe.
- XMemGetWorkingSetStatistics writes only the limit and the use (the structure
  differs between GDK versions; zeroing 0x78 bytes broke EOSSDK's stack cookie).
- The title's executable takes TLS slot 0, as a process's executable has it
  (code built with /GA reads it without _tls_index); xcl.exe's TLS moves.
- Command queue #23 SignalX.
- Title textures: the first upload waits for the title's next submit and all
  uploads go in batches (one list, one wait); XCL's own submits do not refresh;
  close write-watch ranges are scanned as one. The render thread no longer stalls
  in CreatePlacedResourceX (UE's garbage collector ended the game after 10 s).
- CreateHeap and CreatePlacedResource (#29) with console flags / layouts retried
  the PC's way.
- Merged ES+GS of older kits: an ES program ends with s_setpc_b64 into the GS.
- end_title suspends the title's threads before releasing its fences (a running
  title reset command allocators the GPU still ran: device hang at the end).
- Diagnostics: stack-cookie failures reported with the function, the CRT's
  invalid-parameter handler, first-chance C++ exceptions of title code,
  THREADNAME_INFO, XCL_THREAD_DUMP_AT (unwound stacks), XCL_ACTIVITY.
- HANDOFF: Fortnite's state (splash screen; the login is an Xbox Live sign-in).
@ivall
ivall merged commit b9002e0 into xcl-dev:main Nov 22, 2026
@ivall

ivall commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Merged, thanks. Checked locally on Windows (MSVC): unit tests and the e2e tests, including the new one, pass.

Xeltax added a commit to Xeltax/xcl that referenced this pull request Nov 24, 2026
…GPU-view page shows

Queue method ivall#31 (ivall#29 of the older layout) maps pages of the title's
memory into GPU views; it was a stub. Its batches are now decoded and
checked against the batch count and the pool, and each 64 KiB page of
a GPU view records the pool page it was given and the physical page the
title had mapped there (kernelx::mirrors). A bad call records nothing;
releasing a view drops its pages.

XCL keeps a physical page's data where it was mapped last, and the
title maps most streamed pages into the CPU view behind the GPU view
too, so `mapped_source` answers where that page is now (`page_now`),
else the pool page itself. Each title mapping is remembered per address
(Away::title), written once the page is in place and forgotten when the
reservation goes; a page freed while its allocation lives is no longer
looked for (Away::freed).

Nothing reads the record yet: textures are unchanged; the queue logs its
counts. (ivall#1031)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers pushed a commit that referenced this pull request Nov 24, 2026
…ites

`pc_resource_desc` takes ALLOW_UNORDERED_ACCESS from a depth buffer the
console also lets shaders write (the PC refuses ALLOW_DEPTH_STENCIL with
ALLOW_UNORDERED_ACCESS). Only CreatePlacedResourceX (#44) moved such a
resource's initial state off UNORDERED_ACCESS as well (to DEPTH_WRITE).
The other paths that create a resource of the converted description
only masked the state with PC_RESOURCE_STATES: the committed fallback of
CreateCommittedResource (#27 / #76 / #127, reached without unified
memory or when its coherent window is full), the PC-way retry and the
committed fallback of CreatePlacedResource (#29), and its memory-of-its-
own path for textures larger on the PC. A console texture with flags
DEPTH_STENCIL | UNORDERED_ACCESS created in UNORDERED_ACCESS was then
asked for in a state D3D12 refuses for a resource without the UAV flag
(E_INVALIDARG; the #29 own-memory path fell back to COMMON).

`device_x::pc_initial_state` does both steps; #44 uses it with no change
in behaviour, and the four other sites use it with the console flags
(or the PC description's, which keep ALLOW_DEPTH_STENCIL).

Tests: a unit test of the helper; a GPU test placing a 256x256 D16
depth+UAV texture in UNORDERED_ACCESS as XCL now does (not run here).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers pushed a commit that referenced this pull request Nov 24, 2026
…ormat

Device #29 CreatePlacedResource for console code (dev_create_placed_resource_x)
makes the resource from the PC's description (pc_resource_desc: 118 becomes
R24G8_TYPELESS, 116/117 R10G10B10A2, 86/115 R8G8B8A8) but passed the title's
optimized clear value on as it was, still in the console's format. D3D12
wants the clear value's format to match the resource's, and refuses it
(E_INVALIDARG) on every route: memory of its own, the retry with the PC's
description and the committed fallback. CreateCommittedResource and
CreatePlacedResourceX already convert it with pc_clear; this path now does
the same, once, for all its routes.

Measured with the new GPU test (a 256x256 D16_UNORM_S8_UINT depth target
with a 118 clear value): without the change all three routes return
0x80070057; with it the resource is made as R24G8_TYPELESS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers added a commit to theaustinayers/xcl that referenced this pull request Nov 25, 2026
The queue's CopyPageMappingsBatchX (xcl-dev#29 of the older layout, xcl-dev#31 in the
newer one) maps pages of the title's pool into GPU views; it is a stub
here. Its arguments are decoded apart from what is done with them, so
the record that follows takes a checked list.

mirrors::decode_batches turns one call into (GPU-view page, pool page or
None for unmapped) in the call's order: batches of 24 bytes (first
destination, number of ranges, pointer to them), ranges of three u32
(kind 0: consecutive pool pages, 1: one pool page repeated, 2: unmapped,
3: left as they are; start; count). The whole call is checked before
anything is returned: an unreadable batch or range, a range leaving the
pool, an unknown kind or more than 1 << 20 pages refuse it. No lock.
Not called yet; mirrors::PAGE names the 64 KiB page.

Tested: cargo check -p xcl --tests (no new warnings);
cargo test --release -p xcl --lib hle::kernelx: 53 passed, 0 failed, 1 ignored, including
the new the_page_mapping_batches_are_decoded_whole.

Builds on xcl-dev#1055 by Xeltax (f532d33): the decoding, its
checks, the Batch test helper and the cases of the test.
Builds on xcl-dev#2308 by adiologydev (31fe59c): the decoding
split from the record. The batch layout is a fact xcl-dev#1055 cites; no code
from elsewhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers added a commit to theaustinayers/xcl that referenced this pull request Nov 25, 2026
…dev#1031)

Queue method xcl-dev#29 (xcl-dev#31 in the newer layout) is how a title maps the pages
its texture streaming fills into the GPU views its textures are in. It
was a stub: every mapping was dropped, a GPU-view page kept showing its
CPU view at the same offset, and streamed textures uploaded as zeros.

Its arm now goes to q_copy_page_mappings, which hands the call to
kernelx::mirrors::apply_batches (the record, the tiles, the textures and
the writes of the commits before this one) and sums what it did. A call
the decoder refuses records nothing and logs one warning. The result is
S_OK either way, as the stub's was. The fifth argument does not reach
queue_dispatch and is ignored. This is the only commit of the series
that changes what a title sees.

XCL_PAGE_MAPPINGS=0 (mirrors::page_mappings, parsed by the pure
page_mappings_on) leaves slot 29 to the stub and logs that once; the
record then stays empty and every new path is behind one atomic load.
README names the switch.

Tested: the_queue_page_mapping_method_records_and_can_be_switched_off
(new): a call over a pair of views of the test's own records a named
pool page with no page and an unmapped page as showing nothing, leaves an
untouched page on its CPU view, and returns S_OK; a call with a range of
an unknown kind records nothing and returns S_OK; the switch parses.
Modules queue_tests + hle::kernelx: 61 passed, 0 failed, 1 ignored
(release, software adapter).

Builds on xcl-dev#1055 by Xeltax (f532d33): the queue arm, the
totals and the warning text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers added a commit to theaustinayers/xcl that referenced this pull request Nov 25, 2026
…gsBatchX maps pages into GPU views)

Twenty commits: the fourteen of the plan (kernelx keeps the page the title
mapped at an address, decodes the method's batches, records which physical
page each GPU-view page shows and follows it when it moves; the tiles of a
GPU view and the textures over it show and read the pages mapped there;
queue method xcl-dev#29 / xcl-dev#31 does it, XCL_PAGE_MAPPINGS=0 for the stub) and six
from two reviews (a page that leaves plain memory has its tiles linked
again, a released block of unified memory leaves no shown page, the queue
of tiles to link again is bounded, XCL's own writes where a page is kept
are known writes, GPU writes are noted per list only while the mappings
are on, the tests own their pairs and report skips).

No conflicts with the depth-buffer registry, the fold bound, the safe
texture read or the trace and device-removal lines on world-main.

Left by the reviews, not fixed: a release runs forget_mirrors on the title
thread (a cost, to be measured); a free and a GPU write of the same call
number are ordered by the call, not by the change. The race of an upload
with the title unmapping the texture's pages is not closed here:
XCL_TEXTURE_SAFE_READ=1 stays the workaround.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants