startup: give formatted buffer loads the word 3 of title-created typed views; add xyzw #2410
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2418"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T16:07:43Z.
Refs #2138
Refs #2274
Follows #2138 (descriptor word 3 for
buffer_load_format_x/xy/xyz), now merged.Problem
#2138 takes word 3 (FORMAT and DST_SEL) only from a hardware buffer descriptor that the title wrote into a table. A typed buffer view that the title creates through the runtime (
CreateShaderResourceView,BUFFER) leaves a view token in the table instead, so the draw is refused as "missing hardware descriptor".buffer_load_format_xyzwis still not translated.Change
src/startup_stubs/buffer_format_word3.h(new, pure):view_word3()builds word 3 the way the console driver does from the view. FORMAT comes from the DXGI format, for the 14 formats the switch decodes (R32G32B32A32_FLOATis 77). DST_SEL comes fromShader4ComponentMapping: channels become 4 to 7, forced 0 and 1 become 0 and 1.descriptor_word3_refusal()refuses a hardware word with a reserved DST_SEL (2 or 3).llvm-mc -mcpu=gfx1013encodings of the tbufferformat:operand and equalDESC_FORMAT_CODES.src/startup_stubs/d3d12_draw.inl, in main'sformatted_buffers_ready():formatted-load draws refusedinx2w-render totals. The existing log lines and reason strings are unchanged.tools/startup/gfx2hlsl.py:buffer_load_format_xyzwuses the same switch with four registers.Tests
startup_buffer_format_word3_table(pure Python, added to the Linux job and AGENTS.md)DESC_FORMAT_CODES, agrees withFETCH_DXGIand withformatted_buffer_supported(). A header that givesR32G32B32A32_FLOATcode 74 must fail.startup_buffer_format_word3and_mapping_control(WILL_FAIL)startup_vertex_fetch_formats_{controls,warp,hardware}xyzwcases: identity, z and w defaults, and (w, 1, 0, x). Each must also fail through the xyz translation. The old "xyzw must stay refused" assertion is replaced by these.startup_formatted_view_draw_{warp,hardware}(new)buffer_load_format_xyzw idxeninto anR32G32B32A32_FLOATtarget, compared as four 32-bit words. Eight title-created views:R32G32B32A32_FLOAT,R16G16B16A16_FLOAT,R16G16_FLOAT(z, w default),R16G16_SNORM(-32768 and 0),R32G32B32A32_FLOATmapped (w, 0, x, 1),R8G8B8A8_UNORMmapped (z, 1, 0, w);R32_UINTand a raw view must refuse the draw with their reason and leave the clear value. Negative control: a translation whose W selector reads the Z field must fail. Runs withX2W_D3D12_DEBUG=1and requires no debug message of severity 0 to 2.Results
Commit under test: the head of this branch, rebased on
main7092683a. Windows 11 build 10.0.26300.10075. Debug layer on forstartup_formatted_view_draw_*(asserted). Adapters: WARP 10.0.26100.10068 and NVIDIA GeForce RTX 5090, driver 32.0.16.2135.Expected: all pass. Observed: 17 of 17 passed, 0 failed, 0 skipped (no capability skip, exit 77, occurred). The hardware tests ran on the RTX 5090, the
_warptests on WARP. Also passing with the main-venv Python:docs_links_check,bidi_controls_check,git diff --check origin/main..HEADempty.Not covered
R16G16_UINTandR8G8B8A8_UINTare in the DXGI table (the table-equality test requires every decoded format to have one) but have no device case instartup_formatted_view_draw.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T16:09:03Z.
APPROVED. Extended buffer loads with xyzw support.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:46:45Z.
Review: COMMENTED
Review of head
9a91918d(after updating with main). Code and fixture tests only; this PR does not claim a game-startup result, and I did not run any game.What I checked:
buffer_format_word3.h: pure word-3 builder and reserved DST_SEL refusal; the DXGI table matchesDESC_FORMAT_CODESand the 14 decoded formats.gfx2hlsl.py:buffer_load_format_xyzwnow uses the same switch as the x/xy/xyz forms (four registers); the old compute-only guard is gone because the draw refuses undecodable formats first.startup_formatted_view_draw_{warp,hardware}reads back real D3D12 output compared as 32-bit words, with a negative control (W selector reads Z) and refusal cases (R32_UINT, raw view).startup_vertex_fetch_formatsgains three xyzw WARP cases. SiblingFETCH_DXGI/FETCH_FORMATSstay consistent (table test). No other open or merged PR covers xyzw or typed-view word 3 (#2138 is the merged base).Commands run (Linux, this head):
python3 -B tests/startup_buffer_format_word3_table_check.py,startup_vertex_fetch_formats_check.py,startup_buffer_address_check.py,startup_formatted_view_draw_check.py: all passpython3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py: okgit diff --check origin/main...HEAD: cleanNo blocking findings. Win2025 WARP run follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T19:41:52Z.
Hardware run and Windows 11 MSVC build at head
76b211d8.Environment: Windows 11 Pro build 26300.9974, Debug (
devpreset), MSVC toolset 14.44.35207 (cl 19.44.35230.0).startup_stream_draw_hardware,startup_address_srv_hardwareandstartup_mubuf_descriptor_hardwareprintadapter=NVIDIA GeForce RTX 3070 Ti driver=32.0.16.2101;startup_mubuf_descriptor_hardwarealso printsx2w-d3d12 debug layer: 0x00000000 enabled. The other three hardware logs print neither line (see the last paragraph). The runs were serial (-j1). The PR body reports an RTX 5090 and WARP run, so this adds an RTX 3070 Ti (a different NVIDIA GPU generation).Build:
cmake --build --preset devexited 0. This PR changes C++ (src/startup_stubs/,tests/), so the build was rerun at this head.Tests, with the regex from the PR body:
ctest --preset dev --no-tests=error -j1 -R '^startup_(buffer_format_word3|buffer_format_word3_mapping_control|buffer_format_word3_table|formatted_view_draw_(warp|hardware)|buffer_address_(controls|warp|hardware)|vertex_fetch_formats_(controls|warp|hardware)|address_srv_(warp|hardware)|mubuf_descriptor_(warp|hardware)|stream_draw_(warp|hardware))$' -E hardware -V: 11/11 passed (startup_buffer_format_word3,startup_buffer_format_word3_mapping_control,startup_buffer_format_word3_table,startup_vertex_fetch_formats_controls,startup_buffer_address_controls,startup_vertex_fetch_formats_warp,startup_buffer_address_warp,startup_stream_draw_warp,startup_formatted_view_draw_warp,startup_address_srv_warp,startup_mubuf_descriptor_warp).ctest --preset dev --no-tests=error -j1 -R '^startup_(buffer_format_word3|buffer_format_word3_mapping_control|buffer_format_word3_table|formatted_view_draw_(warp|hardware)|buffer_address_(controls|warp|hardware)|vertex_fetch_formats_(controls|warp|hardware)|address_srv_(warp|hardware)|mubuf_descriptor_(warp|hardware)|stream_draw_(warp|hardware))$' -Nlists 6 hardware tests:startup_vertex_fetch_formats_hardware,startup_buffer_address_hardware,startup_stream_draw_hardware,startup_formatted_view_draw_hardware,startup_address_srv_hardware,startup_mubuf_descriptor_hardware.ctest --preset dev --no-tests=error -j1 -R '^(startup_vertex_fetch_formats_hardware|startup_buffer_address_hardware|startup_stream_draw_hardware|startup_formatted_view_draw_hardware|startup_address_srv_hardware|startup_mubuf_descriptor_hardware)$' -V: 6/6 passed. 0 capability skips (77). Together with the 11 above, 17/17 passed, the same count as the PR body.What the hardware tests print:
startup_formatted_view_draw_hardware:hardware: 8 typed-view cases through the translated buffer_load_format_xyzw. Six cases arebit-exact(R32G32B32A32_FLOAT,R16G16B16A16_FLOAT,R16G16_FLOAT, missing z and w,R16G16_SNORM, -32768 and 0,R32G32B32A32_FLOAT as (w, 0, x, 1),R8G8B8A8_UNORM as (z, 1, 0, w)).R32_UINTandraw viewprintrefused and logged. The controla W selector read from the Z field fails (w = z)prints as expected.startup_vertex_fetch_formats_hardware: 14 buffer formats withcompared_words=320 mismatches=0and 15 mutations that fail; 17 descriptor cases with 19 mutations that fail; 3xyzwdescriptor cases (descriptor xyzw,with missing z and w,read as w, 1, 0, x) withmismatches=0, each followed bythe xyz form fails.startup_buffer_address_hardware: 3 cases withmismatches=0, 4 controls and 4 translation mutations that fail as expected.startup_stream_draw_hardware,startup_address_srv_hardware: exact pixels, as printed.startup_mubuf_descriptor_hardware:missing metadata, unsupported FORMAT and unresolved storage stayed blue; valid zero and one drew black and red.The WARP counterparts print the same case lists (
adapter=Microsoft Basic Render Driver, driver 10.0.26100.9818), for examplewarp: 8 typed-view cases through the translated buffer_load_format_xyzw.Not covered by this run: the logs of
startup_vertex_fetch_formats_hardware,startup_buffer_address_hardwareandstartup_formatted_view_draw_hardwareprint no adapter name, and onlystartup_mubuf_descriptor_hardwareprints a debug-layer line, so I can not state the adapter or the debug-layer result for those from the logs (the PR body saysstartup_formatted_view_draw_*asserts the debug layer); no AMD or Intel GPU; no Release build; theR16G16_UINTandR8G8B8A8_UINTformats have no device case, as the PR body says under "Not covered"; the suites outside the regex were not run, as the PR body also says.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:02:44Z.
Win2025 WARP receipt for head
9a91918dafter updating with main. Hardware variants not run (VM has only WARP).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
9a91918d53050159f632516f08ac6de99e90358c:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check startup_stream_consumer -- -j 2):47.65s(configure2.78s)ctest --preset dev -R '^startup_(buffer_format_word3|buffer_format_word3_mapping_control|buffer_format_word3_table|formatted_view_draw_warp|buffer_address_(controls|warp)|vertex_fetch_formats_(controls|warp)|address_srv_warp|mubuf_descriptor_warp|stream_draw_warp)$' --parallel 2 --no-tests=error --output-on-failure): 11/11 passed (38.63s:startup_buffer_address_warp2.33s,startup_stream_draw_warp3.19s,startup_mubuf_descriptor_warp1.36s,startup_address_srv_warp0.80s,startup_buffer_address_controls0.66s,startup_vertex_fetch_formats_controls0.18s,startup_buffer_format_word30.05s,startup_buffer_format_word3_mapping_control0.01s,startup_buffer_format_word3_table0.12s,startup_formatted_view_draw_warp2.81s,startup_vertex_fetch_formats_warp38.09s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check startup_stream_consumer -- -j 2):93.92s(configure2.27s)ctest --preset release -R '^startup_(buffer_format_word3|buffer_format_word3_mapping_control|buffer_format_word3_table|formatted_view_draw_warp|buffer_address_(controls|warp)|vertex_fetch_formats_(controls|warp)|address_srv_warp|mubuf_descriptor_warp|stream_draw_warp)$' --parallel 2 --no-tests=error --output-on-failure): 11/11 passed (19.60s:startup_stream_draw_warp2.49s,startup_buffer_address_warp1.73s,startup_mubuf_descriptor_warp0.88s,startup_address_srv_warp0.54s,startup_buffer_address_controls0.44s,startup_vertex_fetch_formats_controls0.13s,startup_buffer_format_word30.03s,startup_buffer_format_word3_mapping_control0.01s,startup_buffer_format_word3_table0.10s,startup_formatted_view_draw_warp1.75s,startup_vertex_fetch_formats_warp19.48s)tests/mesh_heap_sampler_check.pyok (0.7s),tests/startup_buffer_address_check.pyok (0.5s),tests/startup_buffer_format_word3_table_check.pyok (0.1s),tests/startup_compute_request_offline_check.pyok (0.5s),tests/startup_compute_translate_check.pyok (0.2s),tests/startup_flat_param_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_check.pyok (0.1s),tests/startup_gfx2hlsl_add_sub_co_ci_check.pyok (0.2s),tests/startup_gfx2hlsl_bit_alu_check.pyok (0.7s),tests/startup_gfx2hlsl_capture_check.pyok (1.1s),tests/startup_gfx2hlsl_cmp16_check.pyok (0.3s),tests/startup_gfx2hlsl_compare_dst_check.pyok (0.1s),tests/startup_gfx2hlsl_compute_check.pyok (0.4s),tests/startup_gfx2hlsl_cselect_mask_check.pyok (0.1s),tests/startup_gfx2hlsl_cvt_alu_check.pyok (0.1s),tests/startup_gfx2hlsl_f32_lg_check.pyok (1.3s),tests/startup_gfx2hlsl_f32_nan_check.pyok (5.1s),tests/startup_gfx2hlsl_getpc_refusal_check.pyok (0.1s),tests/startup_gfx2hlsl_handler_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_arity_check.pyok (0.1s),tests/startup_gfx2hlsl_image_get_lod_check.pyok (0.1s),tests/startup_gfx2hlsl_int_med3_check.pyok (0.1s),tests/startup_gfx2hlsl_join_symbols_check.pyok (0.2s),tests/startup_gfx2hlsl_loop_constants_check.pyok (0.1s),tests/startup_gfx2hlsl_mask_overwrite_check.pyok (0.1s),tests/startup_gfx2hlsl_operand_count_check.pyok (0.3s),tests/startup_gfx2hlsl_pack_absdiff_check.pyok (2.6s),tests/startup_gfx2hlsl_readfirstlane_recompute_check.pyok (0.1s),tests/startup_gfx2hlsl_readfirstlane_uniform_check.pyok (0.1s),tests/startup_gfx2hlsl_refusals_check.pyok (0.5s),tests/startup_gfx2hlsl_root_check.pyok (0.7s),tests/startup_gfx2hlsl_sad_check.pyok (0.3s),tests/startup_gfx2hlsl_saveexec_same_reg_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_arity_check.pyok (0.2s),tests/startup_gfx2hlsl_scalar_brev_fold_check.pyok (0.1s),tests/startup_gfx2hlsl_scalar_m0_check.pyok (0.1s),tests/startup_gfx2hlsl_sdwa_cvt_check.pyok (0.3s),tests/startup_gfx2hlsl_sgpr_spill_check.pyok (0.1s),tests/startup_gfx2hlsl_shift64_check.pyok (0.2s),tests/startup_gfx2hlsl_smem_offset_check.pyok (0.1s),tests/startup_gfx2hlsl_sop2_complement_check.pyok (6.6s),tests/startup_gfx2hlsl_sopk_accum_check.pyok (0.9s),tests/startup_gfx2hlsl_sopk_signext_check.pyok (0.2s),tests/startup_gfx2hlsl_swap_check.pyok (0.3s),tests/startup_gfx2hlsl_vopc_sdwa_check.pyok (4.8s),tests/startup_gfx2hlsl_waitcnt_depctr_check.pyok (0.1s),tests/startup_gfx2hlsl_watch_check.pyok (2.6s),tests/startup_image_2d_array_check.pyok (0.2s),tests/startup_image_3d_check.pyok (0.1s),tests/startup_image_gather_lz_check.pyok (0.6s),tests/startup_image_load_d16_check.pyok (0.9s),tests/startup_image_sample_a16_check.pyok (0.2s),tests/startup_image_sample_b_check.pyok (0.2s),tests/startup_image_sample_c_check.pyok (0.3s),tests/startup_image_sample_l_check.pyok (0.2s),tests/startup_image_sample_lod_check.pyok (0.7s),tests/startup_inline_sampler_check.pyok (0.2s),tests/startup_mesh57_skeleton_check.pyok (0.2s),tests/startup_run_ps1_check.pyok (10.4s),tests/startup_run_sh_check.pyskipped (0.1s),tests/startup_sampler_heap_check.pyok (0.1s),tests/startup_shader_cache_rekey_check.pyok (2.0s),tests/startup_smem_address_check.pyok (0.1s),tests/startup_stream_fetch_check.pyok (0.3s),tests/startup_stream_interface_check.pyok (0.3s),tests/startup_translator_check.pyok (0.5s)sccache: 302/965 hits; wall224.8sAI-assisted; commands listed were executed locally.