startup: check the 64 KiB tile plan without a device #1731
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1738"
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 Asimmimx on 2026-11-24T17:58:55Z.
Refs #1149.
What the header does
src/startup_stubs/tile64_plan.hanswers XG texture-computer slot 10 (GetResourceTilingwithout a resource,src/startup_stubs/xg_xs.cpp) for two-dimensional textures with the 64 KiB standard layout0x10a.tile_shape()maps a DXGI format to the texels in one 64 KiB tile (512x256 for 8-byte blocks, 256x256 for 16-byte blocks and 8-bit texels, 256x128 for 16-bit texels, 128x128 for 32-bit texels with 8-bit channels).Plan::supports()decides which descriptions take the plan; everything else still goes to a desktop reserved resource.Plancounts the standard mips (a mip at most half a tile wide and one tile high shares the first tile with all smaller mips), the tiles each one covers and its start in the slice, smallest mip first.Tests that reach it
startup_xg_tile64_tiling(tests/startup_xg_tile64_tiling_check.py) loadsxg_xs.dlland asks slot 10 for 18 shapes in ten formats (BC1, BC3, BC5, BC7, R8G8B8A8, A8 and R16_FLOAT). All 18 take the plan, sosupports()is only ever asked descriptions it accepts. No other test includes the header.Mutation probe
Each mutant was applied alone to
tile64_plan.h. For the existing checkstartup_stub_xg_xswas rebuilt andctest -R '^startup_xg_tile64_tiling$'was run; for the new checkstartup_tile64_plan_checkwas rebuilt andctest -R '^startup_tile64_plan$'was run. The header was restored after each mutant. The new check alone kills every mutant in the last column.(f >= 70 && f <= 72)→(f >= 71 && f <= 72)(f >= 70 && f <= 72)→(f >= 70 && f <= 71)(f >= 79 && f <= 81)→(f >= 80 && f <= 81)(f >= 79 && f <= 81)→(f >= 79 && f <= 80)(f >= 73 && f <= 78)→(f >= 74 && f <= 78)(f >= 73 && f <= 78)→(f >= 73 && f <= 77)(f >= 82 && f <= 84)→(f >= 83 && f <= 84)(f >= 82 && f <= 84)→(f >= 82 && f <= 83)(f >= 94 && f <= 99)→(f >= 95 && f <= 99)(f >= 94 && f <= 99)→(f >= 94 && f <= 98)f >= 60 && f <= 65→f >= 61 && f <= 65f >= 60 && f <= 65→f >= 60 && f <= 64f >= 60 && f <= 65→f >= 60 && f <= 66f >= 48 && f <= 59→f >= 49 && f <= 59f >= 48 && f <= 59→f >= 48 && f <= 58f >= 48 && f <= 59→f >= 47 && f <= 59(f >= 27 && f <= 32)→(f >= 28 && f <= 32)(f >= 27 && f <= 32)→(f >= 27 && f <= 31)(f >= 27 && f <= 32)→(f >= 26 && f <= 32)f == 87 || f == 88 ||→f == 88 ||f == 87 || f == 88 ||→f == 87 ||f == 87 || f == 88 ||→(f >= 87 && f <= 89) ||(f >= 90 && f <= 93)→(f >= 91 && f <= 93)(f >= 90 && f <= 93)→(f >= 90 && f <= 92)return width = 512, height = 256, true;→return width = 256, height = 512, true;return width = 256, height = 128, true;→return width = 128, height = 256, true;if (f >= 60 && f <= 65) return width = 256, height = 256, true;→if (f >= 60 && f <= 65) return width = 256, height = 128, true;d.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D &&→(removed)static_cast<UINT>(d.Layout) == 0x10a &&→(removed)d.Width && d.Height &&→d.Height &&d.Width && d.Height &&→d.Width &&d.Width <= 16384 &&→(removed)d.Height <= 16384 &&→(removed)d.Width <= 16384 &&→d.Width <= 16383 &&d.DepthOrArraySize && d.MipLevels &&→d.MipLevels &&d.DepthOrArraySize && d.MipLevels &&→d.DepthOrArraySize &&d.MipLevels <= max_mips &&→(removed)d.MipLevels <= max_mips &&→d.MipLevels < max_mips &&d.SampleDesc.Count <= 1 &&→(removed)if (w * 2 <= tile_width && h <= tile_height) break;→if (w * 2 < tile_width && h <= tile_height) break;if (w * 2 <= tile_width && h <= tile_height) break;→if (w * 2 <= tile_width && h < tile_height) break;if (w * 2 <= tile_width && h <= tile_height) break;→if (w <= tile_width && h <= tile_height) break;if (w * 2 <= tile_width && h <= tile_height) break;→if (w * 2 <= tile_width && h * 2 <= tile_height) break;h = (std::max)(1u, d.Height >> standard)→h = d.Height >> standardw = (std::max)(1u, static_cast<UINT>(d.Width) >> standard)→w = static_cast<UINT>(d.Width) >> standardwide[standard] = (w + tile_width - 1) / tile_width;→wide[standard] = (w + tile_width - 2) / tile_width + (w < tile_width);high[standard] = (h + tile_height - 1) / tile_height;→high[standard] = (std::max)(1u, h / tile_height);shared_tiles = standard < mips ? 1 : 0;→shared_tiles = 1;shared_tiles = standard < mips ? 1 : 0;→shared_tiles = 0;for (UINT mip = standard; mip-- > 0;) {→for (UINT mip = 0; mip < standard; ++mip) {Existing check: 14 of 50 killed. New check: 47 of 50 killed.
New check
tests/startup_tile64_plan_check.cppincludes the header directly; it needs neither the XG DLL nor a device. It is registered next tostartup_bc64_supports, the device-free check of the siblingbc64_chain.h, rather than next tostartup_xg_tile64_tiling, which sits inside theINTAKE_PYTHONblock and needs the Python environment.UNKNOWN,X32_TYPELESS_G8X24_UINT(8 bytes) andR1_UNORM(1 bit).supports()from both sides, starting from a 256x256 R8 texture: width and height 16384 taken, 16385 and 0 refused; a width of 0x1'00000100 (256 when cut to 32 bits) refused; 2048 slices taken and 0 refused; 16 mips taken, 17 and 0 refused; two samples; 1D, 3D and buffer dimensions; layout0x109, the desktop 64 KiB standard swizzle and unknown; an unknown format.Negative controls
Registered with
WILL_FAIL TRUE:startup_tile64_plan_bc4_control(--mutate bc4): expects the BC4 formats to have no tile shape. PrintsFAIL format 79: 512x256, expected no shapeand the same for 80 and 81.startup_tile64_plan_width_control(--mutate width): expects a 16385-texel width to be taken. PrintsFAIL width 16385 taken.startup_tile64_plan_clamp_control(--mutate clamp): expects the 1024x1 chain without the height clamp (mips 1 to 3 zero tiles high, 9 tiles). PrintsFAIL 1024x1 RGBA8: tile 128x128, 4 standard of 11 mips, 1 shared, 16 tiles per slice; mips: 8x1@8 4x1@4 2x1@2 1x1@1.Not pinned
R11G11B10_FLOAT(26),R10G10B10_XR_BIAS_A2(89) andX24_TYPELESS_G8_UINT(47), are not pinned as refused. The header's comment limits 32-bit formats to 8-bit channels, but a 64 KiB standard tile shape depends only on the texel size, so taking them later (with a 128x128 shape) may be intended. These are the three surviving mutants.R16G16_*,B5G6R5_UNORM) are not pinned as refused for the same reason.SampleDesc.Count == 0is taken bysupports(); the check does not pin it either way.Commands and results
python -B tests/docs_links_check.py:Checked 17 Markdown files and 364 links.No capability skips.startup_tile64_planuses no device.docs/experiments.mdgains a paragraph on the new check and its commands under "Slot-10 tile plan for layout0x10a".Environment
Windows 11 Pro 26300.9974, MSVC from Visual Studio,
devpreset (Debug). Commitad410f54c89503edb2c685d1d145103e676cd8b0onmainat68969ed8.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:24:28Z.
Review: COMMENTED
Peer review of PR #1738 at head
ad410f54c89503edb2c685d1d145103e676cd8b0.Summary
CMakeLists.txt,docs/experiments.md, andtests/startup_tile64_plan_check.cpp. Nosrc/files were modified. Title-neutral, MIT clean-room.startup_tile64_planverifiesx2w_startup::tile64::tile_shape()across all supported format groups (512x256,256x256,256x128,128x128) and three unsupported formats (DXGI_FORMAT_UNKNOWN,DXGI_FORMAT_X32_TYPELESS_G8X24_UINT,DXGI_FORMAT_R1_UNORM);Plan::supports()boundary checks (width/height0,16384,16385,0x100000100ull32-bit wrap, slice/mip bounds, sample count, dimension, layout0x109vs0x10avs desktop standard swizzle); and seven hand-workedPlanlayouts covering 1-texel chains, shared-tile threshold, multi-slice BC4, and non-multiple-of-tile dimensions.startup_tile64_plan_bc4_control,startup_tile64_plan_width_control, andstartup_tile64_plan_clamp_control(WILL_FAIL TRUE) verify failure detection for--mutate bc4|width|clamp.Checks executed
prep-verify 1738):python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py prep-verify 1738 --dir /tmp/rev-x2w-84/1738 --json->git_diff_check: PASS,docs_links_check: PASS,bidi_controls_check: PASS,py_compile: PASS./O2(win2025 1738, Build 26100, MSVC 14.44.35207):python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1738 --wait 600 --targets startup_tile64_plan_check --regex "^startup_tile64_plan"--preset dev): 4/4 passed (startup_tile64_plan0.03s,startup_tile64_plan_bc4_control0.02s,startup_tile64_plan_width_control0.01s,startup_tile64_plan_clamp_control0.01s)./O2(--preset release): 4/4 passed (startup_tile64_plan0.03s,startup_tile64_plan_bc4_control0.02s,startup_tile64_plan_width_control0.01s,startup_tile64_plan_clamp_control0.01s).src/startup_stubs/tile64_plan.h(Win2025 Debug):python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1738 --wait 600 --targets startup_tile64_plan_check --regex "^startup_tile64_plan$" --skip-release --patch /tmp/rev-x2w-84/mut_1738.patch(changingw * 2 <= tile_widthtow <= tile_widthinPlan::Plan) -> Mutant killed:startup_tile64_planfailed on1024x1 RGBA8,1024x512 BC4, and516x128 R16.AI-assisted; commands listed were executed locally.