Repository navigation
TEST-728: world props through the deferred material shaders into the G-buffer - #4119
Joaovitor404silva wants to merge 2 commits into
Conversation
vk_sandbox draws the props around a point with one translated game VS/PS pair chosen by signature and descriptor layout: a real camera through the VS constants, DiffuseTex albedo through the bindless set and the PS's own S#, depth, and a fly/walk/drive window. tools/sandbox.py packs the scene (tools/sandbox_scene.py), picks the pair and runs it; --check prints counts only. docs/sandbox.md has the table layout and the measurements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY
…G-buffer tools/gbuffer.py picks a material VS/PS pair by user data and listing layout. The VS pulls its own vertices and the PS writes the five G-buffer targets. The script links the pair's interpolants by DXBC semantic and runs runtime/test/vk_gbuffer. That tool repacks the scene into the game's compressed vertex stream, fills the tables the pair reads, draws into mrt0-4 + D32 and reads every target back. It prints counts and PASS/FAIL only. The scene and camera helpers move from vk_sandbox.cpp to sandbox_common.h. docs/gbuffer.md records the tables, the stream and the target layout. tests/test_gbuffer_pick.py covers picking, linking and the thresholds on hand-made inputs. Depends on: ItsNotRexed#3530 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY
whattheflop
left a comment
There was a problem hiding this comment.
AI-assisted Windows review at 9d9012261f97864951effcb6fc2b0e0b6945f88f. The 23 synthetic picker and scene tests passed with uv CPython 3.12.13. A separate reordered-signature fixture selected [5, 1, 0] and rejected a candidate with a mismatched TEXCOORD index. MSVC 19.38 built and linked both targets on head and vk_sandbox on parent 5a9a8a81. These checks used CPU only.
The still-motion oracle can pass when mrt4 retains its clear value. The render pass clears it to zero, and covered pixels with zero motion count as still. Clearing both motion components to 1.0 would make untouched pixels fail the 0.1 px threshold while preserving valid still pixels. The same readback block copies back mrt3, whose bytes only feed --dump. Please scope the statement that every target is checked to the actual assertions, or add an mrt3 check before using it for lighting.
|
The test itself is sound, but it makes a repo test fail on Windows CI. Verified on Windows 11 / Python 3.13.0 without a GPU: The rest checks out: the negative control works (forcing Minor: AI-assisted review, no game files, no GPU. |
jeremygold02
left a comment
There was a problem hiding this comment.
Please make the 256-color albedo requirement specific to a known reference scene. The CLI accepts arbitrary placed props, and a correctly sampled solid texture currently makes it return FAIL.
I built the unmodified Windows vk_gbuffer from 9d9012261f97864951effcb6fc2b0e0b6945f88f. A synthetic full-screen triangle used an integer texel fetch from the bound 16×16 RGBA8 image. I compared the albedo PPM with the input RGB byte for byte and passed the harness's printed counts through the PR's parse_counts and check_counts(..., True), as the CLI does for a textured draw.
| Texture | Covered | Exact albedo pixels | Shaded / normals facing / still motion | Distinct albedo colors | Checker |
|---|---|---|---|---|---|
| 16×16 color ramp | 256 | 256 | 256 / 256 / 256 | 256 | PASS |
| Solid RGB (27, 87, 109) | 256 | 256 | 256 / 256 / 256 | 1 | FAIL |
The texture bytes were the only change between those two draws. One way to keep the useful regression check is to retain the color-count assertion for the reference scene and report color diversity as a measurement for arbitrary inputs.
I found a separate pairing issue in tools/gbuffer.py. Starting with the PR's PickPair fixture, I kept the PS TEXCOORD0 declared and read in XY. The picker returned the same link [0, 1, 3] for three VS cases, including the matching XY control, XY with Y marked never written, and X alone. The latter two can select a producer that cannot supply the required Y coordinate. Please retain the declared component mask (signature byte 24) alongside the usage mask (byte 25) and reject a candidate when a component the PS always reads is unavailable from the VS. These were picker tests with synthetic signatures.
I also measured the MRT3 question raised in the earlier review. In a third draw I changed only that target's synthetic output from red to zero. All 256 MRT3 RGB pixels changed, the albedo, normal and MRT2 dumps stayed byte-identical, and both runs had identical counts and passed. The readback distinguishes the two outputs.
NVIDIA GeForce RTX 5070, driver 621.01, Intel Core Ultra 7 265K, Windows 11 Home 25H2 build 26200.9974, Python 3.12.10. All 23 picker and scene tests passed. These draws measure the native harness and its verdict using hand-written SPIR-V and synthetic inputs. The authored shader-pair selection and the 150-prop scene were outside this GPU check.
AI-assisted by Codex.
Flyander
left a comment
There was a problem hiding this comment.
The test exercises depth writes and reads them back, so the render-pass dependency must cover every stage Vulkan may use for those writes.
| VkSubpassDescription sd{}; sd.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; | ||
| sd.colorAttachmentCount = NT; sd.pColorAttachments = car; sd.pDepthStencilAttachment = &dar; | ||
| VkSubpassDependency dep{0, VK_SUBPASS_EXTERNAL, | ||
| VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT, |
There was a problem hiding this comment.
[P2] Include early fragment tests in the depth-write dependency. This pipeline enables both depth testing and depth writes, but the external dependency names only LATE_FRAGMENT_TESTS. Vulkan permits depth/stencil writes in either EARLY_FRAGMENT_TESTS or LATE_FRAGMENT_TESTS; the later vkCmdCopyImageToBuffer readback therefore is not ordered against early writes on an implementation that performs them there. Include both stages in srcStageMask (Khronos recommends both when the stage is uncertain: depth synchronization guidance).
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 9d901226 on Windows 11:
pytest tests/test_gbuffer_pick.py tests/test_sandbox_pick.py tests/test_sandbox_scene.py -q-> 23 passed.compileall(gbuffer/sandbox/sandbox_scene) andgit diff --checkclean.vk_gbufferbuilds cleanly against Vulkan 1.4.363 headers.
The new Python coverage is the shader-pair selection (VS with only SV_VertexID, the PS's five MRT exports and its T#/S# slots), the scene packing, and the --link derivation. I could not run the GPU end of it: tools/gbuffer.py needs the user's entity/model/texture carve and a translated pair, neither of which is in this checkout, and the test itself exits 77 when they are missing. The CPU side and the vk_gbuffer build are verified. No blocking issue.
|
Tested
AI-assisted (Claude Code). |
|
Tested 9d90122 merged onto main d0835dd on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:
AI-assisted (Claude Code). |
Claimed in the coordination issue as: TEST-728
Depends on: #3530 (this branch carries #3530's commit rebased on today's main; review only the last commit)
What and why
This draws the placed world props of #3530 through a translated deferred material pair. The vertex shader pulls
its own vertices (
SV_VertexIDonly) and the pixel shader writes the five G-buffer targets ofgbuffer.md (PROC-146). Every target is then read back and checked. There is no lighting or
shadow pass yet.
tools/gbuffer.pypicks the pair by user-data layout and listing, never by name. The translator numbers VSoutputs by param and PS inputs by attribute, while the game links them by semantic. So the script computes the
link from the two DXBC signatures and passes it on.
runtime/test/vk_gbufferrepacks each mesh into the game's compressed vertex stream and fills the tables thepair reads: frame, object, view, viewport, index and T#/S#. It draws into mrt0–4 + D32 and reads every target
back. It prints counts only: covered, shaded, albedo colours, normals facing the camera, still motion vectors.
docs/gbuffer_sandbox.mdrecords the tables, the vertex stream layout and the targets. One finding there: thethree position fields hold model z, y, x, in that order.
runtime/test/sandbox_common.hholds the scene loader and camera code moved out ofvk_sandbox.cpp.vk_sandboxbehaves the same.Tested
NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24, Windows 11, one retail Xbox Series install (1.0.2.1).
python -I tests/test_gbuffer_pick.py: 11 tests OK, on hand-made listings and DXBC signatures. Also run:tests/test_sandbox_pick.pyandtests/test_sandbox_scene.pyOK,python -m compileall -q tools tests.cmake --build runtime/build --target vk_sandbox vk_gbuffer: no warnings.tools/gbuffer.pyon the TEST-520: real-shader sandbox, placed props through a translated VS/PS pair #3530 test scene (150 props, 446 draws, 442 textured), 640×360: PASS. 114,503pixels covered, the same as
tools/sandbox.py --checkat that camera. 114,503 shaded, 7,325 albedo colours,98,778 normals facing the camera, 114,503 still motion vectors (largest 0.003 px).
normals_facingto a few percent ofcovered.AI-assisted (Claude Code). A separate code review pass found 8 low-severity issues, all fixed here.
Checklist
docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code
https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY