Repository navigation
Runtime: reserved resources and GetResourceTiling on Vulkan (D3D-20) - #295
Conversation
1f08173 to
878929f
Compare
|
Rebased onto |
|
Update: Tested 9087308 on RTX 3090, driver 616.56, Windows 11 23H2: pass. Original report: Tested 878929f (merged on current main) and 1f08173 on RTX 3090, driver 616.56, Windows 11: fail ( What passed (878929f): The failure: The layer is not the one failing here. The host PC runtime refuses these resources. All three cases are reserved Texture2D arrays with a full mip chain: 1000×300×3 RGBA8 sRGB, 512×512×2 RGBA32F and 2048×1024×2 BC7. I checked with a small standalone program on the same machine. The host reports Suggestion: when only the host refuses (ours succeeds), log it and skip that case instead of counting a mismatch, and fail only when ours refuses something the host accepts. Do the same when the host refuses and ours accepts. Whether the layer should accept these at all is a separate question. The Xbox runtime is the reference there, not a given PC driver. AI-assisted test run and analysis; synthetic tests only, no game files. |
@CharlyRien found in ProjectLeonida#295 that an RTX 3090 on driver 616.56 (tiled tier 3) refuses reserved texture arrays whose mips reach the packed tail (cases 2, 6 and 8), which an RTX 5070 on 621.01 accepts; the comparison counted that as a mismatch. A layout the host refuses is now logged and skipped; one the host accepts and the layer refuses is still a mismatch; with every layout skipped the comparison reports itself skipped. The skip path was checked by making the host refuse one case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @CharlyRien, that's exactly it, and the suggestion is what I did in Retested on the RTX 5070 (621.01): |
|
Tested 9087308 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
The first run had No game files used. AI-assisted run (Claude Code). |
CreateReservedResource (and 1 and 2) reserve the whole resource linearly, as docs/d3d12_vulkan.md section 4.2 plans for the first boot: a committed resource on a default heap underneath, so every tile is backed and starts zeroed. D3D12's description rules are kept as measured on the PC runtime (ROW_MAJOR buffers, 64KB swizzle layouts for textures, a format with a tile shape; GetHeapProperties is E_INVALIDARG on a reserved resource). The Xbox tiled layout word 0x101 is accepted as 64KB_UNDEFINED_SWIZZLE. GetResourceTiling comes from src/resource_tiling.h: the standard 64 KiB tile shapes, standard and packed mips, per-mip tile counts and the tile order. The device test compares it with the host PC runtime for 18 buffer, 2D, array, block-compressed and volume layouts; resource_tiling_test checks the same arithmetic without a GPU. Packed-mip tile counts are the driver's choice and are this layer's own rule (tight linear size in whole tiles). UpdateTileMappings and CopyTileMappings log once and do nothing; what that loses (aliasing, unmapped tiles keeping data) is written down in section 4.2. Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharlyRien found in ProjectLeonida#295 that an RTX 3090 on driver 616.56 (tiled tier 3) refuses reserved texture arrays whose mips reach the packed tail (cases 2, 6 and 8), which an RTX 5070 on 621.01 accepts; the comparison counted that as a mismatch. A layout the host refuses is now logged and skipped; one the host accepts and the layer refuses is still a mismatch; with every layout skipped the comparison reports itself skipped. The skip path was checked by making the host refuse one case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @CharlyRien for the retest and @kotorvr for testing. Rebased onto |
9087308 to
b4e31e3
Compare
…value 9 The resolve-region test on main now signals 5 and 6, so a wait on 5 returned before the copies ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested b4e31e3 on RTX 4090 (driver 621.14), Windows 11 26200, MSVC 19.44: pass
This re-tests the new head (earlier pass: 9087308). No game files used. AI-assisted run (Claude Code). |
|
Tested: PR head b4e31e3 merged onto main 4abd545, ctest 20/20. |
Claimed in #156 as: D3D-20
What and why
docs/d3d12_vulkan.md§4.2 plans reserved resources for the first boot: "reserve the full size linearly; tile mapping calls are logged, not emulated". Before this PR,CreateReservedResource,GetResourceTilingand the queue's tile-mapping calls were all stubs. A game that streams textures through reserved resources readsGetResourceTilingto size its tile heaps and mapping calls, so this PR implements that too, and checks it against the PC runtime.Creation (
d3d12_vulkan_device.cpp):CreateReservedResource,CreateReservedResource1andCreateReservedResource2create a committed resource on a default heap underneath.CreateReservedResource1refuses protected sessions.CreateReservedResource2ignores castable formats, because typeless resources are already mutable-format images.ROW_MAJOR; textures must be64KB_UNDEFINED_SWIZZLE, in a format with a tile shape. Anything else isE_INVALIDARG, including64KB_STANDARD_SWIZZLE, becauseCheckFeatureSupport(Runtime: implement CheckFeatureSupport for format support, VA limits, and options (D3D-11) #241) reportsStandardSwizzle64KBSupportedas FALSE.GetHeapPropertieson a reserved resource is alsoE_INVALIDARG.0x101(the slot-76 path, §4.2) is accepted as64KB_UNDEFINED_SWIZZLE. This is marked as an assumption.Tiling (
runtime/src/resource_tiling.h, a pure header): what D3D12 defines.GetResourceTilingfillsD3D12_PACKED_MIP_INFO,D3D12_TILE_SHAPEand the subresource tilings, honouringFirstSubresourceTilingToGetand the in/out count. A resource that isn't reserved reports no tiles, as on the PC runtime.UpdateTileMappings/CopyTileMappingslog once and do nothing. What that loses is written down in §4.2:If the trace shows the game relies on either, the next step is sparse binding on top of D3D-16's heaps.
CopyTilesstays a stub.Measured on the PC runtime (RTX 5070; recorded in §4.2 and in the test comments):
D3D12_PACKED_TILE, so this implementation follows the docs.Neighbours: #286 (D3D-16, heaps and placed resources).
CheckFeatureSupport(#241, merged) still reportsTiledResourcesTieras not supported, so a game that checks the tier will create committed resources instead; this PR leaves that alone. Raising the tier is a call for the maintainers once the trace shows what the game does, since tile mappings aren't emulated.Tested
RTX 5070, NVIDIA driver 621.01, Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, Windows SDK 10.0.26100, rebased on
83d0637:d3d12_vulkan_device_testwithLEONIDA_VK_VALIDATION=1: passes with 0 validation errors (it also passes without validation). New coverage:GetResourceTilingagainst the host PC runtime for 18 reserved layouts (buffer; RGBA8/sRGB, R8, R16F, RGBA16F, RGBA32F; BC1/BC3/BC7; arrays; textures smaller or thinner than a tile; a short mip chain; four volumes).E_INVALIDARGcases,S_FALSEfor a null output, andGetHeapProperties.resource_tiling_test(new, CPU-only, runs in CI): the same arithmetic, with expected values taken from the PC runtime.d3d12_com_testandvk_command_replay_testpass under validation.ctest -E loader: 13/13 pass.python -m compileall -q make_game.py tools tests: ok.loader_testwas skipped. It hangs and then exits with0xc0000409on this machine, onmainas well, and builds only from files this PR doesn't touch (see Runtime: query heaps on Vulkan: occlusion, timestamps, pipeline statistics (D3D-15) #278).AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)🤖 Generated with Claude Code