d3d12: enable Resource GetDesc at slot 10 #2465
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2473"
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 Holastor on 2026-11-25T17:42:58Z.
Description
Enables
Resourceslot 10 (GetDesc) on console resource wrappers ind3d12_xs.dll.Details
tables[resource_kind][10] = reinterpret_cast<void*>(&resource_get_desc).resource_get_desc:(return buffer, object)or(object, return buffer)calling convention usingreceiver(a, b, &result, "Resource::GetDesc(no receiver)").self,self->own().real, andresult.ID3D12Resource::GetDesc()from the underlying desktop resource and copies theD3D12_RESOURCE_DESCinto the caller's result buffer.Test Coverage
Added synthetic fixture
tests/startup_resource_desc.cpp:CreateCommittedResource).cl_buf->GetDesc(), asserting dimension, width, height, mips, format, and layout.cl_tex->GetDesc(), asserting dimension, dimensions, mips, format, and flags.get_desc_fn(&swapped, tex_res)) to verifyreceiverhandles MSVC struct return ABI correctly.get_desc_fn(tex_res, nullptr)) safely returnsnullptrwithout crashing.GetDeviceRemovedReason() == S_OKand 0 debug layer errors.Evidence
Build commit:
17c09ca2(d3d12: enable Resource GetDesc at slot 10)Dev preset:
Observed:
Release preset:
Observed:
Environment:
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:22:06Z.
Review: COMMENTED
Review of head
17c09ca2(comment only, no Windows run on my side).Issue 1 (scope / duplicate): this branch carries other work.
git log origin/main..HEADshows 4 commits, and only the last one is the GetDesc change:d97f04abd3d12: support unplaced buffer memory SRVs in device slot 700bc0b2b8Merge branch 'gpu/slot70-unplaced-buffer-backing'87a23b30d3d12: reject unplaced buffer memory SRVs overlapping live resources17c09ca2d3d12: enable Resource GetDesc at slot 10The first three are the content of open PR #2395 (same slot 70 unplaced buffer SRV work). In the diff that is about 180 lines in
src/startup_stubs/d3d12_memory_srv.inl, the two helpers inmemory_srv_buffer.h, theclear_unplaced_buffershook inrelease()(d3d12_xs_device.cpp), two new mutation controls inCMakeLists.txt, and a docs section. None of this is in the title or body, and the Windows results in the body only namestartup_resource_desc, not the slot 70 tests.Fix: rebase onto main after #2395 merges, or drop the three commits so this PR is only the slot 10 change (about 15 lines in
d3d12_xs_device.cpp, the new test and its CMake entry, and the docs lines).What looks fine
resource_get_descnow returns early whenself,self->own().realorresultis null, which matches the null control in the test.(void)&resource_get_desc;placeholder and its comment are updated consistently; siblingheap_get_descanddescriptor_heap_get_descstay unset, as the existing comment explains.warpandhardwareinCMakeLists.txt, like the neighbouring fixtures.17c09ca2, which equals the current head. I did not re-run them.Commands run locally (Linux)
python3 tests/docs_links_check.py-> passed (19 files, 464 links)python3 tests/bidi_controls_check.py-> passedgit diff --check origin/main...HEAD-> cleanstartup_memory_srv_buffer_checkorstartup_resource_descon Linux (they needd3d12.h), so I did not run mutations on them.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:48:43Z.
Review: COMMENTED
Review of head
dde5f70a(comment only; Windows results in a separate receipt).Scope is now clean: a single GetDesc commit on top of main plus the branch update.
What I checked:
src/startup_stubs/d3d12_xs_device.cpp: slot 10 is installed withresource_get_desc; the new null guard coversself,self->own().realand the result pointer. The(void)&resource_get_descplaceholder and the comment are updated consistently. Heap and DescriptorHeap GetDesc stay uninstalled, as the existing comment says.tests/startup_resource_desc.cppgoes through the console device (slot 27) for a buffer and a texture, checks every desc field, covers both argument orders, has a null-destination negative control (returns null, no crash), and checks device-removed and debug-layer errors. CMake registers warp and hardware variants like the sibling startup tests.Linux commands run:
python3 tests/docs_links_check.py(pass),python3 tests/bidi_controls_check.py(pass),git diff --check origin/main...HEAD(clean). Mutation of the code under test needs the Windows build, so it is covered by the Win2025 run.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-25T19:40:48Z.
Done — the branch now carries only the single GetDesc commit (
66bc9162) on top of current main (6d2d3bed). The three slot 70 backing commits (d97f04ab,0bc0b2b8,87a23b30) are no longer present.Re-ran on the rebased head:
Command:
ctest --preset dev --no-tests=error -R '^startup_resource_desc' -VBuild commit:
66bc9162Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T19:42:01Z.
Built and run here: 10/10 pass, and the
tiled_bc_srvadmission check is pinned in one direction onlyTwo reproduction notes, both of which cost me a false alarm before I checked them:
startup_memory_srv_buffer_*_controlcases areWILL_FAIL TRUE, so "passing" means each one failed asdesigned. A green matrix here is the intended state.
startup_address_srv_*fails withCalledProcessErroronstartup_stream_consumer.exeunless that target is rebuiltfrom this branch — it gains 81 lines here, and the stale binary from a previous branch makes the case look broken.
After rebuilding it, both adapters pass. There is no
startup_address_srvtarget; the case drivesstartup_stream_consumer.Four mutations of
src/startup_stubs/d3d12_memory_srv.inltiled_bc_srvforced toreturn false(reject every descriptor)tiled_bc_srvforced toreturn true(admit every descriptor)r.Width % 4 == 0 && r.Height % 4 == 0removedShader4ComponentMappingcomparison droppedThe pair at the top is the informative one, and it says something precise about the fixture: only the rejection side
is asserted. With the function admitting everything, a descriptor that must be refused gets published instead and a
case fails. With the function rejecting everything, no case fails — so no fixture depends on this predicate accepting
any particular shape.
That is why the three clause-level mutations are invisible. A descriptor that differs from a valid tiled BC SRV in
exactly one clause —
Width = 6(not a multiple of 4),Widthone past the 2D limit, a non-defaultShader4ComponentMapping— is never presented, so removing that clause changes no verdict.I am not claiming the clauses are wrong; each reads correctly against its comment. But this is precisely the check
whose whole job is to be narrow, and narrowing is only observable from the near-miss side. Three one-line cases would
close it: the same valid BC7/BC3 console-tiled descriptor with
Width = 6, withWidth = D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION + 1,and with a swizzled
Shader4ComponentMapping, each expected to be refused. If you add them, the three survivors abovebecome catches, and so does the fourth I did not need to write (the
%4half on height alone).What the five
--mutatecontrols already coverheight,exact-fit,first-32,unplaced-extent,unplaced-coversare a good set for the buffer path and they aredeclared as controls rather than being assertions inside one test, which is the shape I would want for the cases above
too.
Environment
Windows 11 build 26300.9974; WARP and the installed physical GPU; targets built individually
(
startup_resource_desc,startup_memory_srv_buffer_check,startup_stream_consumer). Each mutation was built, run,reverted and rebuilt; final state 10/10 green.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:58:31Z.
Win2025 WARP receipt for head
dde5f70aafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
dde5f70af611a24632b076845eed3ec657770474:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_resource_desc -- -j 2):44.43s(configure3.03s)ctest --preset dev -R 'startup_resource_desc_warp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.75s:startup_resource_desc_warp0.45s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_resource_desc -- -j 2):96.47s(configure3.07s)ctest --preset release -R 'startup_resource_desc_warp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (0.51s:startup_resource_desc_warp0.26s)sccache: 308/393 hits; wall157.5sAI-assisted; commands listed were executed locally.