Skip to content

runtime: map a PSO-cache graphics user-data record to a root signature, and draw with it - #4732

Closed
YaBulochka wants to merge 2 commits into
ProjectLeonida:mainfrom
YaBulochka:feat/gfx-pso-synthetic
Closed

YaBulochka wants to merge 2 commits into
ProjectLeonida:mainfrom
YaBulochka:feat/gfx-pso-synthetic

Conversation

@YaBulochka

@YaBulochka YaBulochka commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Starts the graphics side of the PSO-cache work: a portable reduction from one decoded graphics-stage user-data record (PS\0\x09 cache, #4358) to the layer's rt::rootsig::RootSignature, packed with the existing rt::rootsig::pack. No d3d12.h, no Vulkan, no cache file.

The mapping is deliberately conservative:

  • one distinct 0x42 table index (SS) becomes one descriptor-table parameter; each (SS, II) pair becomes one range (II is the D3D12 range type order), with the entry's base register/space/count;
  • each 0x401 entry becomes a 32-bit-constants parameter of a dwords;
  • 0x2 (sampler) and 0x100 consume no user-data dword and are reported as notes;
  • a descriptor without a slot, a slot without a descriptor, a kind/range-type mismatch, a zero count, an unknown kind, or a layout that spills the 32 user SGPRs is refused with a reason, never partially mapped.

What the record does not carry is not invented: the root-parameter order (Order::Record or Order::Table, both marked as hypotheses), the 0x401 base shader register (0 with a note), and the stage visibility (caller-supplied) are explicit options/notes. One record is one stage's block, so it produces its own signature; the current layer packs a single block for all graphics stages (#4312), which is why the synthetic pipeline will use the record of the stage it exercises.

runtime/test/pso_user_signature_test.cpp has 63 checks: the measured shape (SRV table + 0x401 constants, CBV table), both orders, interleaved tables, the console-dword diagnostic (27 vs 32), every refusal, and the canonical encode/decode round-trip. Linux build and ctest: 51/51, including pso_user_signature.

The draw: a mapped record actually renders

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records of the measured shape and turns each into a root signature through the same mapper:

  • A: one 0x401 constants parameter (4 dwords) and one SRV table (SS=1, II=0);
  • B: the same constants plus one table with an SRV and a CBV range (II=2).

The portable RootSignature is converted to a D3D12_VERSIONED_ROOT_SIGNATURE_DESC 1.1 (D3D12_ROOT_PARAMETER1 / D3D12_DESCRIPTOR_RANGE1), serialized with the host D3D12SerializeVersionedRootSignature, created through the Xbox-ABI proxy, and the layer parses the blob back into s0..s31. The graphics PSO adds ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT because a record carries no flags and an input layout requires it; that is the only field the test adds and it is documented in the source.

Two draws into a 64x64 R8G8B8A8_UNORM target, each with its own mapped signature, check 4096/4096 pixels:

top-left      64,128,0,255      (1024 px)
bottom-right 192,32,0,255      (1024 px)
background     0,0,255,255      (2048 px)

Root constants reach the VS (clip-space offset) and the PS (tint); the table lands in s4:s5. The mapper's negative cases (zero count, an extra 0x42 slot, an SRV/CBV kind mismatch) are checked at CPU level.

Verified with the xwin cross build under Wine and Proton 11.0 on RADV:

d3d12_pso_usersig_draw  Passed   4096/4096 pixels
d3d12_draw              Passed   (unchanged)
pso_user_signature      Passed   63 checks

The test honours LEONIDA_VK_VALIDATION=1; under Wine it refuses to start when the layer is not enumerable, like the neighbouring tests. With the Khronos layer forced as an implicit layer it runs with no VUID from this test; the one device-creation message it sees (VUID-vkCreateDevice-ppEnabledExtensionNames-01387, VK_EXT_external_memory_dma_buf without VK_KHR_external_memory_fd) also reproduces in d3d12_draw, so it is a pre-existing layer-side device-creation gap, not this test's.

Dependency: docs/pso_cache.md and the decoder this consumes are in #4358; the header refers to that PR until it lands. Next step is the Windows/Wine synthetic draw test (root signature from such a record, one triangle, readback), which needs the cross build and is not in this PR.

Claim: D3D-479, #4683.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and ran pso_user_signature_test at 02f734242 on Windows 11: all checks passed, exit 0.

The new portable mapping (runtime/src/pso_user_signature.{h,cpp}) reduces one PSO-cache graphics user-data record to RootSignature parameters: distinct 0x42 SS -> one descriptor table, each (SS, II) -> one range, each 0x401 -> 32-bit constants, samplers/0x100 -> no dword, and records with unpaired slots are refused rather than silently dropping user data. The tests cover the 32-dword packing rule, the one-dword-per-table case, the spill refusal and the mapping order. The header documents what the record does not carry (parameter order, base register, visibility) instead of guessing. No blocking issue.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

At 02f73424, two constant entries produce a root signature that Windows rejects. The mapper returns ok=true. Both parameters use register b0 in space 0 with visibility ALL. The Windows serializer returns 0x80070057 and reports an overlapping CBV range. Changing only the second register to b1 makes the serializer return 0x00000000.

Please reject this ambiguous binding with a reason when the record does not supply a distinct register. This keeps the caller from using an invalid signature.

To reproduce on Windows 11, save these two files in a new folder next to the PR checkout. Name the checkout head. Run cmake -S . -B build -A x64, then cmake --build build --config Release, then build\Release\probe.exe. The probe uses two hand-built entries.

CMakeLists.txt

cmake_minimum_required(VERSION 3.20)
project(probe LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(src ../head/runtime/src)
add_executable(probe main.cpp ${src}/pso_user_signature.cpp ${src}/root_signature.cpp)
target_include_directories(probe PRIVATE ${src})
target_link_libraries(probe PRIVATE d3d12)

main.cpp

#include "pso_user_signature.h"
#include <windows.h>
#include <d3d12.h>
#include <cstdio>
int main() {
    rt::pso::UserRecord record{{{0x401,1,1},{0x401,1,1}}, {}};
    auto r = rt::pso::map_user_record(record);
    if (!r.ok || r.signature.params.size()!=2) return 1;
    D3D12_ROOT_PARAMETER p[2]{};
    for (int i=0;i<2;i++) {
        auto &v=r.signature.params[i];
        p[i].ParameterType=D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
        p[i].Constants={v.shader_register,v.register_space,v.num_values};
        p[i].ShaderVisibility=(D3D12_SHADER_VISIBILITY)v.visibility;
    }
    D3D12_ROOT_SIGNATURE_DESC d{2,p,0,nullptr,D3D12_ROOT_SIGNATURE_FLAG_NONE};
    for (int n=0;n<=1;n++) {
        p[1].Constants.ShaderRegister+=n;
        ID3DBlob *blob=nullptr,*err=nullptr;
        auto hr=D3D12SerializeRootSignature(&d,D3D_ROOT_SIGNATURE_VERSION_1,&blob,&err);
        std::printf("map_ok=%d registers=%u,%u serialize=0x%08lx %s\n",r.ok,p[0].Constants.ShaderRegister,p[1].Constants.ShaderRegister,hr,err?(char*)err->GetBufferPointer():"");
        if (blob) blob->Release();
        if (err) err->Release();
    }
}

AI-assisted.

@Atomic258

Copy link
Copy Markdown
Contributor

Re-ran at head 02f73424 on Windows 11, NVIDIA GeForce RTX 5090 (driver 617.42) — this test is CPU-only (no Vulkan), built with MSVC 14.44 / Ninja / RelWithDebInfo.

cmake --build runtime\build --target pso_user_signature_test
.\runtime\build\pso_user_signature_test.exe

Result: all checks passed (63 checks), exit 0. Confirms the earlier Windows 11 run at the same SHA on this machine class. No game data.

AI-assisted (Devin).

@memorypressure

Copy link
Copy Markdown

Reviewed on Linux: the mapping module is careful — every unplaceable record shape is refused with a specific error rather than guessed, notes are phrased for tests, and all fixtures are hand-built records (no cache file, no game data); API use matches the existing root_signature.h. It could not be compiled on this verifier host (no cmake builds), so correctness rests on the CI build legs, which were still queued. Note the header comments reference PR #4358's decoder and docs/pso_cache.md, which are not in this tree yet — comments only, so nothing breaks, but the constants land ahead of their documentation. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

YaBulochka added a commit to YaBulochka/Leonida that referenced this pull request Nov 23, 2026
…record

D3D-479's next step after the record mapper (ItsNotRexed#4732): the portable
RootSignature map_user_record produces is converted to a
D3D12_VERSIONED_ROOT_SIGNATURE_DESC, serialized by the host d3d12.dll and
created through the Xbox-ABI proxy, then used by a real draw.

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records
of the shape ItsNotRexed#4358 measures: a 0x401 constants parameter before one SRV
table, and the same constants before one table holding an SRV and a CBV
range. Both map and both root signatures are created; the two draws use
vs_draw.vert and a new ps_pso_usersig.frag so the record's constants show
up as s0/s1 (a clip-space offset) and s2/s3 (a tint) of the 32 user-data
dwords the layer packs, with the table VA at s4:s5. All 4096 pixels of a
64x64 R8G8B8A8 target match (top-left 64,128,0,255; bottom-right
192,32,0,255; background 0,0,255,255). The mapper's zero-count,
extra-slot and SRV/CBV-mismatch refusals are checked at CPU level before
the GPU part. LEONIDA_VK_VALIDATION=1 is honoured as in the neighbouring
GPU tests, and a missing layer fails instead of silently running without
it. ctest d3d12_pso_usersig_draw, skip code 77.

Depends on: ItsNotRexed#4732 (pso_user_signature) and ItsNotRexed#4358 (cache format).
@YaBulochka YaBulochka changed the title runtime: map a PSO-cache graphics user-data record to a root signature runtime: map a PSO-cache graphics user-data record to a root signature, and draw with it Nov 23, 2026
@DenRakEiw

Copy link
Copy Markdown
Contributor

Tested e00f3931 on NVIDIA GeForce RTX 5090 (Blackwell, driver 32.0.16.1088) and AMD Radeon(TM) Graphics (iGPU, driver 31.0.22044.1), Windows 11, MSVC 19.44 / Ninja / Vulkan SDK 1.4.363.0 (LEONIDA_VK_VALIDATION=1, no game files): pass on RTX 5090; 128-byte push-constant failure on AMD iGPU.

  • Trial-merged onto origin/main (3faac557): clean; pso_user_signature_test and d3d12_pso_usersig_draw_test built cleanly.
  • RTX 5090: ctest -R pso_user -V -> 2/2 passed (pso_user_signature + d3d12_pso_usersig_draw: 4096/4096 pixels matched, 0.46s total, 0 Vulkan validation errors).
  • AMD Radeon iGPU (LEONIDA_VK_DEVICE=AMD): pso_user_signature passed, but d3d12_pso_usersig_draw failed at line 342 because the AMD Windows driver reports maxPushConstantsSize 128:
    [rt] d3d12: pipelines need 144 bytes of push constants (uniform-buffer fallback not built yet); maxPushConstantsSize 128
    line 342: SUCCEEDED(device->CreateGraphicsPipelineState(&pso_desc, IID_PPV_ARGS(&pso_a.p)))
    
    Might be worth skipping cleanly (exit 77) on 128-byte push-constant devices until the uniform-buffer fallback lands.

AI-assisted (Gemini 4 Neon).

@searyecheesepeaceful

Copy link
Copy Markdown

Tested e00f393 on Intel UHD 770 (driver 32.0.101.7088), Windows 11, MSVC 19.44, Vulkan SDK 1.4.357.0: pass.

Native MSVC build of d3d12_pso_usersig_draw_test, run with LEONIDA_VK_VALIDATION=1: exit 0, harness prints "device: Intel(R) UHD Graphics 770 (validation on)", 0 VUID lines on stderr.

  • D3D-479: two mapped PSO-cache records became D3D12 root signatures and drew: 4096/4096 pixels matched (top-left 64,128,0,255; bottom-right 192,32,0,255; background 0,0,255,255)
  • mapper refusals: zero count, extra 0x42 slot and SRV/CBV mismatch all refused
  • map_user_record: both synthetic records map and pack to 4 constants + 2 table dwords

AI-assisted.

@tunczzz

tunczzz commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested e00f3931 (merge base 98fa503f) on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5070 Ti (Blackwell, subgroup 32..32), driver 616.56. Result: pass.

  • Runtime built from this head: MSVC 19.44 (BuildTools 2022), Ninja, RelWithDebInfo, -DLEONIDA_VULKAN_HEADERS_FETCH=ON. Vulkan SDK 1.4.363.0 was installed, so the *_validated ctests ran with its validation layer. glslangValidator and llvm-mc 21 came from WSL Ubuntu. Build exit 0.
  • ctest -j 3: 175/175 passed. New here: d3d12_pso_usersig_draw, pso_user_signature PASS.
  • scripts/run_gpu_tests.py --build <this build>: 170/217 passed, 47 skipped, 0 failed.
  • The merge base 98fa503f is older than main 3faac557, so main's newer tests aren't in this tree. Every test that exists in both gives the same result as on main 3faac557 (ctest 177/177, GPU 170/217).

Not run: other GPUs/vendors, Linux. No game files.

AI-assisted (Claude Code).

Edited: an earlier version said the Vulkan SDK and its validation layer weren't installed. SDK 1.4.363.0 had been installed the night before this run; the results above are unchanged.

@searyecheesepeaceful

Copy link
Copy Markdown

Tested e00f393 on NVIDIA GeForce RTX 4080, driver 617.42, Windows 11 (clang-cl cross-build): pso_user_signature_test exits 0 with "all checks passed", and d3d12_pso_usersig_draw_test exits 0 with no FAIL lines. The draw test printed no pixel summary in this run, so the pass rests on its exit code.

AI-assisted.

YaBulochka added a commit to YaBulochka/Leonida that referenced this pull request Nov 23, 2026
…record

D3D-479's next step after the record mapper (ItsNotRexed#4732): the portable
RootSignature map_user_record produces is converted to a
D3D12_VERSIONED_ROOT_SIGNATURE_DESC, serialized by the host d3d12.dll and
created through the Xbox-ABI proxy, then used by a real draw.

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records
of the shape ItsNotRexed#4358 measures: a 0x401 constants parameter before one SRV
table, and the same constants before one table holding an SRV and a CBV
range. Both map and both root signatures are created; the two draws use
vs_draw.vert and a new ps_pso_usersig.frag so the record's constants show
up as s0/s1 (a clip-space offset) and s2/s3 (a tint) of the 32 user-data
dwords the layer packs, with the table VA at s4:s5. All 4096 pixels of a
64x64 R8G8B8A8 target match (top-left 64,128,0,255; bottom-right
192,32,0,255; background 0,0,255,255). The mapper's zero-count,
extra-slot and SRV/CBV-mismatch refusals are checked at CPU level before
the GPU part. LEONIDA_VK_VALIDATION=1 is honoured as in the neighbouring
GPU tests, and a missing layer fails instead of silently running without
it. ctest d3d12_pso_usersig_draw, skip code 77.

Depends on: ItsNotRexed#4732 (pso_user_signature) and ItsNotRexed#4358 (cache format).
@YaBulochka
YaBulochka force-pushed the feat/gfx-pso-synthetic branch from e00f393 to ca5d45a Compare November 23, 2026 16:40
@thehollowedone

Copy link
Copy Markdown

Independent Windows GPU recheck of ca5d45a3 on an RTX 3080 Ti (driver 621.35, Vulkan SDK 1.4.363.0).

The focused d3d12_pso_usersig_draw test passed without skips. Both synthetic records mapped and serialized to root signatures, and the two draws matched all 4,096 expected pixels. The shaders used the root constants in the draw. The test also checked and bound the descriptor-table layout. Both shader modules passed spirv-val, and Vulkan core and synchronization validation reported zero diagnostics.

I ran the valid mapping and draw cases from the fixture. Synthetic inputs only. AI-assisted.

YaBulochka added a commit to YaBulochka/Leonida that referenced this pull request Nov 23, 2026
…record

D3D-479's next step after the record mapper (ItsNotRexed#4732): the portable
RootSignature map_user_record produces is converted to a
D3D12_VERSIONED_ROOT_SIGNATURE_DESC, serialized by the host d3d12.dll and
created through the Xbox-ABI proxy, then used by a real draw.

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records
of the shape ItsNotRexed#4358 measures: a 0x401 constants parameter before one SRV
table, and the same constants before one table holding an SRV and a CBV
range. Both map and both root signatures are created; the two draws use
vs_draw.vert and a new ps_pso_usersig.frag so the record's constants show
up as s0/s1 (a clip-space offset) and s2/s3 (a tint) of the 32 user-data
dwords the layer packs, with the table VA at s4:s5. All 4096 pixels of a
64x64 R8G8B8A8 target match (top-left 64,128,0,255; bottom-right
192,32,0,255; background 0,0,255,255). The mapper's zero-count,
extra-slot and SRV/CBV-mismatch refusals are checked at CPU level before
the GPU part. LEONIDA_VK_VALIDATION=1 is honoured as in the neighbouring
GPU tests, and a missing layer fails instead of silently running without
it. ctest d3d12_pso_usersig_draw, skip code 77.

Depends on: ItsNotRexed#4732 (pso_user_signature) and ItsNotRexed#4358 (cache format).
@YaBulochka
YaBulochka force-pushed the feat/gfx-pso-synthetic branch from ca5d45a to 6c4fadf Compare November 23, 2026 19:58
@YaBulochka

Copy link
Copy Markdown
Contributor Author

checked: rebased onto main@867d922f0 and re-measured, clang-cl 23.1.5 + xwin 10.0.26100, Wine 11.13 (GE-Proton 11-13), RADV gfx1036.

The rebase only clashed in runtime/CMakeLists.txt, where main added d3d12_pso_validation_test in the same block; both registrations are kept.

  • pso_user_signature_test: all checks pass, including "the layer's refusal is the spill rule".
  • d3d12_pso_usersig_draw under Wine: D3D-479: two mapped PSO-cache records became D3D12 root signatures and drew: 4096/4096 pixels matched (top-left 64,128,0,255; bottom-right 192,32,0,255; background 0,0,255,255).
  • The mapper refusals the test expects still hold: zero count, extra 0x42 slot, SRV/CBV mismatch.

@emreYilmaz28845

Copy link
Copy Markdown

Tested 6c4fadfb8a8e4b056cc04f92a6028c467c836b5f (the head rebased onto main 867d922f0 at 20:10Z) on RTX 5070 Ti (driver 621.1) and AMD Radeon RDNA2 iGPU gfx1036 (2.0.353), Windows 11: pass — the first check of the rebased head (the five earlier checks were e00f3931 and ca5d45a3). AI-assisted. No game files used.

Windows 11, MSVC 14.44.35207 (VS Build Tools 2022, -G "Visual Studio 17 2022" -A x64, RelWithDebInfo), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0. Worktree at the head as pushed, no extra commits; the head is still 6c4fadfb after the run.

ctest -R "^(pso_user_signature|d3d12_pso_usersig_draw)$" RTX 5070 Ti Radeon iGPU gfx1036
validation off 2/2 pass 2/2 pass
LEONIDA_VK_VALIDATION=1 2/2 pass, 0 validation errors 2/2 pass, 0 validation errors
  • pso_user_signature: "all checks passed" — the mapper and its refusal cases (zero count, an extra 0x42 slot, SRV/CBV mismatch).
  • d3d12_pso_usersig_draw: "D3D-479: two mapped PSO-cache records became D3D12 root signatures and drew: 4096/4096 pixels matched" on both GPUs, also with the layer on — the CMakeLists-only rebase clash the author reported left the draw path intact.

Control. The whole feature is new in this PR: git show 867d922f0:runtime/CMakeLists.txt has zero matches for pso_usersig/pso_user_signature, and src/pso_user_signature.cpp/.h do not exist on main — on plain main neither test target builds, so the pass cannot come from main's code.

Commands: cmake -S runtime -B runtime/build -G "Visual Studio 17 2022" -A x64, cmake --build runtime/build --config RelWithDebInfo --target pso_user_signature_test d3d12_pso_usersig_draw_test, then the ctest line above with LEONIDA_VK_DEVICE=NVIDIA|AMD and LEONIDA_VK_VALIDATION=1, one GPU at a time.

@itsRevela

Copy link
Copy Markdown
Contributor

Tested 6c4fadfb merged onto main 867d922f on an NVIDIA GeForce RTX 3070 Ti (driver 610.88), Windows 11, MSVC 19.44 + Ninja, RelWithDebInfo: pass.

Full runtime ctest (269 tests): The new pso_user_signature and d3d12_pso_usersig_draw tests pass. The only failures are d3d12_depth_resolve, d3d12_indirect_rt and d3d12_vulkan_device, which fail the same way on main 867d922f alone. No new failure against that main.

AI-assisted (Claude Code).

YaBulochka added a commit to YaBulochka/Leonida that referenced this pull request Nov 23, 2026
…record

D3D-479's next step after the record mapper (ProjectLeonida#4732): the portable
RootSignature map_user_record produces is converted to a
D3D12_VERSIONED_ROOT_SIGNATURE_DESC, serialized by the host d3d12.dll and
created through the Xbox-ABI proxy, then used by a real draw.

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records
of the shape ProjectLeonida#4358 measures: a 0x401 constants parameter before one SRV
table, and the same constants before one table holding an SRV and a CBV
range. Both map and both root signatures are created; the two draws use
vs_draw.vert and a new ps_pso_usersig.frag so the record's constants show
up as s0/s1 (a clip-space offset) and s2/s3 (a tint) of the 32 user-data
dwords the layer packs, with the table VA at s4:s5. All 4096 pixels of a
64x64 R8G8B8A8 target match (top-left 64,128,0,255; bottom-right
192,32,0,255; background 0,0,255,255). The mapper's zero-count,
extra-slot and SRV/CBV-mismatch refusals are checked at CPU level before
the GPU part. LEONIDA_VK_VALIDATION=1 is honoured as in the neighbouring
GPU tests, and a missing layer fails instead of silently running without
it. ctest d3d12_pso_usersig_draw, skip code 77.

Depends on: ProjectLeonida#4732 (pso_user_signature) and ProjectLeonida#4358 (cache format).
@YaBulochka
YaBulochka force-pushed the feat/gfx-pso-synthetic branch from 6c4fadf to c5a07fa Compare November 23, 2026 21:33
@YaBulochka

Copy link
Copy Markdown
Contributor Author

Rebased onto main 6312c057f and pushed (c5a07fac4, force-with-lease). Both commits replayed cleanly on the newer base.

Tests (Linux, clang-cl + xwin Windows SDK cross-build, RelWithDebInfo, Wine 11.x):

  • cmake --build build/windows --target pso_user_signature_test d3d12_pso_usersig_draw_test — both build.
  • wine pso_user_signature_test.exe — all checks passed (exit 0), including the 32-dword block/spill cases and the console-model count.

The d3d12_pso_usersig_draw half is a GPU draw test (4096 draws) and is out of scope for this batch; the earlier Wine result in the thread stays the reference for it. AI-assisted.

Add a portable mapper for one decoded graphics-stage record from the
PS\0\x09 PSO cache (D3D-479; format in docs/pso_cache.md, ProjectLeonida#4358): one
descriptor table per distinct 0x42 SS, one D3D12_DESCRIPTOR_RANGE per
(SS, II) slot pair, one 32-bit-constants parameter per 0x401 entry, then
rt::rootsig::pack into the 32 user-data dwords. What the record does not
carry is not invented: the parameter order is Record or ascending SS
(both labelled hypotheses), the 0x401 base register is 0 with a note, the
visibility comes from the caller, and an undecoded extra 0x42 slot
refuses the record instead of producing a partial mapping.

One record is one stage's user-data block, so it maps to its own root
signature; a graphics PSO carries 3-5 distinct records and concatenating
them would double-count parameters.

CPU test runtime/test/pso_user_signature_test.cpp (ctest
pso_user_signature, no GPU or game data) covers the measured shape, both
orders, interleaved tables, the extra-slot and slot-pair refusals, the
spill rule, and the canonical codec round-trip.

Depends on: ProjectLeonida#4358 (cache decoder and docs/pso_cache.md).
…record

D3D-479's next step after the record mapper (ProjectLeonida#4732): the portable
RootSignature map_user_record produces is converted to a
D3D12_VERSIONED_ROOT_SIGNATURE_DESC, serialized by the host d3d12.dll and
created through the Xbox-ABI proxy, then used by a real draw.

runtime/test/d3d12_pso_usersig_draw_test.cpp builds two synthetic records
of the shape ProjectLeonida#4358 measures: a 0x401 constants parameter before one SRV
table, and the same constants before one table holding an SRV and a CBV
range. Both map and both root signatures are created; the two draws use
vs_draw.vert and a new ps_pso_usersig.frag so the record's constants show
up as s0/s1 (a clip-space offset) and s2/s3 (a tint) of the 32 user-data
dwords the layer packs, with the table VA at s4:s5. All 4096 pixels of a
64x64 R8G8B8A8 target match (top-left 64,128,0,255; bottom-right
192,32,0,255; background 0,0,255,255). The mapper's zero-count,
extra-slot and SRV/CBV-mismatch refusals are checked at CPU level before
the GPU part. LEONIDA_VK_VALIDATION=1 is honoured as in the neighbouring
GPU tests, and a missing layer fails instead of silently running without
it. ctest d3d12_pso_usersig_draw, skip code 77.

Depends on: ProjectLeonida#4732 (pso_user_signature) and ProjectLeonida#4358 (cache format).
@YaBulochka

Copy link
Copy Markdown
Contributor Author

One more rebase: main moved to 5d74c2723 (a README-only commit) after the base I tested, so the branch is now on that tip (6cf6f7a8f, force-with-lease). git diff between the previous head and this one lists only README.md, so every test result above still applies unchanged.

@LandSharkLizard

Copy link
Copy Markdown

Tested c5a07fac4 (rebased onto main 6312c057f) on NVIDIA GeForce RTX 5090 (driver 621.01, 32-wide subgroups), Windows 11, MSVC 19.44 / Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.1 (LEONIDA_REQUIRE_VULKAN=ON): pass — first Windows + GPU check of this head (the 21:33Z note left the GPU draw half to a later batch).

main has moved one commit past the rebase base (5d74c272, README-only) — it touches none of this PR's files, so no overlap. No game files. AI-assisted.

@LandSharkLizard

Copy link
Copy Markdown

Addendum: the head moved to 6cf6f7a8f while I was running this check (rebase onto main 5d74c272, the README-only commit I noted). I verified git diff c5a07fac4 6cf6f7a8f lists only README.md (+2 lines, not part of the build), so the results above apply to 6cf6f7a8f as well: Tested 6cf6f7a on RTX 5090 (621.01), Windows 11: pass (same build of the tree minus the README line).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.