Commit Graph

16 Commits

Author SHA1 Message Date
b620db492f rendering(r6b): use 16-byte descriptor stride for D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
Xbox Series shaders (10,584 shaders / 39.9% of the corpus) index directly-indexed sampler heaps at 16-byte stride (4-dword hardware S#). Previously the runtime hardcoded 32-byte stride for SAMPLER heaps, so every odd sampler slot (0x430, 0x4b0, etc.) read zeroed upper bytes and fell back to fallback_sampler_ (NEAREST + CLAMP_TO_EDGE -> 1D clamped road stripes and nearest-neighbor textures), while even slots read wrong sampler N/2.

Introduce sampler_descriptor_size = 16 and descriptor_increment(type) across GetDescriptorHandleIncrementSize, CreateSampler/CreateSampler2, DescriptorHeap, CopyDescriptors*, scan_title_table, materialize_table, console_heap_range_plausible, local_write_through/copy_title_slots/pull_title_descriptors/local_mirror_table, proxy_create_sampler_x, and d3d12_com.cpp; add packed 16-byte even/odd sampler regression tests.
2026-11-29 06:36:03 -05:00
aa23d709c9 A sampled view of a placed texture that waits for its memory is remembered, not bound
CreateShaderResourceView asked for the image to tell a texture from a buffer. In the base that accessor binds a deferred placed image, so with prepare_on_bind the memory was bound before write_image_descriptor could remember the view, and #939's first-use path never ran (xbox_staged_texture_views, xbox_visible_texture_views). A texture that still waits for its memory is recognised without asking for the image. xbox_placed_texture_first_use expected a placed sampled texture to wait without prepare_on_bind as well; in the merge it waits only with it (the base backs every other title image when it is made), and the test says so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:53:43 -05:00
154e4ec034 Merge the #984 result (main + RT-PROTON-STORY-LOAD) into #939
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by
one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the
two solve one problem in two ways the base's is the frame and #939's plugs into it.

A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions
ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's
proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease,
raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages),
the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's
duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in.

A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow
#939's rule that a device which ever had a handler has no queue fallback.

B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h,
pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile
and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps
the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad
lists as triangle indices.

B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list,
shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where
both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch,
executable shaders, default A8 views).

C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h,
rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp,
replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its
rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the
label fence on the base's submit.

D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test,
main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with
#939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's
answering first; --first-run-ui kept without host speech in its profile.

E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py,
scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's
v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the
base's executable-shader step with #939's cache fix; 366 registered tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:26:00 -05:00
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
db19bbd345 runtime: connect native pipelines and title resources to the offline first-run UI
Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic.

The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
2026-11-24 21:19:30 +08:00
08490f05d2 d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path
The d3d12_xs shim's device now hands callers console-shaped command
lists (160-slot vtable, object body at +0x18 with the write cursor
pinned at the record limits, console slots 27-30 recorded not
forwarded, slot map measured to the PC table: 60->58, 61->59,
146->80). Queue layout detection is atomic and device-wide; SignalX
(slot 23/25 by layout) forwards as Signal, PresentX (30/32) reaches
the presentation core, and ambiguous slot 18 serves the timestamp-
frequency getter until the layout is proven.

AllocateUploadMemory (console slot 148) carves a bump arena out of
persistently-mapped UPLOAD-heap buffers; the six root-VA setters and
the IA/SO view setters translate arena pointers to buffer device
addresses in proxy-owned copies. Impossible sizes and non-power-of-
two alignments are refused before any arithmetic that could wrap.

PC-compiled callers opt into real PC-shaped lists with
console_lists=false on create_device_proxy, and PC-compiled guests
with LEONIDA_D3D12_LISTS=pc — the fixture path check_tiny_frame.py
sets, so a guest ClearRenderTargetView at PC slot 48 reaches the
real list. The GPU tests take the flag; unmeasured console slots
stay console-shaped for the title path.

docs/d3d12_xs_console_abi.md records the measured ABI.

Split from #2490 (third of three): fixes the run_tiny_frame failure
the revert reported. AI-assisted. Hardware verification on the
earlier identical code is in #2490's thread (RTX 3060 Ti-5080, RX
7600/9060/9070/7900 XT, Intel UHD, RADV; 177/177). Wine/clang-cl on
the build host: xs_proxy_mock PASS incl. the overflow regression,
queue_proxy child-runner section fails identically on unmodified
main (Wine env), loader_test 86/0 upstream count.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 09:24:20 -07:00
57c175391d Revert #2490: its console-ABI list proxy breaks run_tiny_frame (please rebase and split)
With it, d3d12_xs reads list slot 48 as the console's IASetVertexBuffers, so the PC-shaped fixture list's
ClearRenderTargetView never runs and Close fails. The branch also changes runtime/src/pe_loader.cpp and carried
committed conflict markers in docs/fssm_crosscheck.md. Its docs rows go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 04:42:53 -05:00
fa5f26db8e Merge origin/main: DXGI device fields coexist with the console-ABI device state 2026-11-22 20:39:59 -07:00
7cc353106f d3d12_xs: PC-shaped lists for PC callers, atomic queue layout, S_OK queue tail
Review findings from shdann's Windows run of the new console queue/list
work:

- d3d12_debug_markers (and every GPU harness compiled against the PC
  headers) drove lists through the console-shaped proxy, so PC slots past
  26 — including the PIX markers at 56-58, which have no console
  counterpart — reached unrelated console methods or were dropped.
  create_device_proxy gains console_lists: false hands the real
  (PC-shaped) list back from CreateCommandList. The GPU tests pass false;
  the title path keeps the console default.
- queue_proxy asserted E_NOTIMPL for the queue's console tail, but those
  slots deliberately answer S_OK now — frame pacing flows through them.
  The test's contract is updated; the fence tail stays refused.
- ChildProxy::queue_layout was a plain unsigned char read and written
  from many threads; it is atomic like the device-wide detection it
  caches.

xs_proxy_mock_test and loader_test pass under Wine; the modified test
objects compile clean under clang-cl. The GPU harnesses need a real
adapter — covered by shdann's Windows run.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 18:41:23 -07:00
c6fe50f76d Merge pull request #3717 from Oguzhan Ozdemir 2026-11-22 17:03:32 -05:00
9cae273a63 test(d3d12): compare POINT and LINEAR M2 draws against CPU pixels 2026-11-23 00:24:11 +03:00
7be6847cf0 d3d12: a pipeline registers its shaders' literal S#s
A shader that builds its S# from immediates (literal_samplers in the
translator index) names no heap slot, so nothing gave that S# a sampler
and a hash-table key: register_samplers (#1169) had no caller outside its
test. The shader's lookup found the fallback sampler and sampled with
the wrong filter and address modes.

ShaderLibrary now keeps each entry's literal_samplers, and
CreateGraphicsPipelineState / CreateComputePipelineState register those
of every stage that uses the bindless set.

Test: ps_m2_literal.asm (ps_m2 with the S# from s_mov literals) in
d3d12_m2_textured_test: no key for the words before its PSO, a sampler
index after it. Fails on main, passes here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:05:25 -03:00
89a080b20d test(runtime): index an unbounded SRV table in the M2 shader 2026-11-22 14:37:21 +01:00
e4f1093278 M2 test: sampler control (ps_m2_uoff, WRAP left / CLAMP right, CPU-predicted pixels)
With U in range, a POINT/CLAMP sampler, a POINT/WRAP one and the fallback sampler give the same pixels, so the
first pass cannot tell which sampler a draw used. The control adds 1 to U before image_sample and picks the sampler
per half through the sampler table: 4096 of 4096 pixels match the CPU prediction and 1536 differ from the plain pass.

Sampler control suggested and measured by @Vonsek in #1489.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:10:05 +01:00
c4e08989d7 M2 review: run_gpu_tests skips ps_m2/vs_m2, replay refuses set-0 pipelines without bind_descriptor_sets, test includes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:46:14 +01:00
40f239be13 M2: pipelines bind the bindless set 0; textured quad through the descriptor path (d3d12_m2_textured_test)
Pipelines (graphics and compute) whose translated shader declares set-0 bindings were refused. Their layout now
holds the device's bindless set 0 and replay binds it at every draw and dispatch. d3d12_m2_textured_test drives
heaps, SRVs, a POINT sampler, two root descriptor tables and DrawIndexedInstanced with a translated PS that
loads the T#/S# from the tables; 4096 of 4096 pixels match, and the descriptor hash table is checked.
d3d12_translated_draw_test is registered with ctest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:34:41 +01:00