Skip to content

TEST-520: real-shader sandbox, placed props through a translated VS/PS pair - #3530

Open
Joaovitor404silva wants to merge 1 commit into
ItsNotRexed:mainfrom
Joaovitor404silva:real-shader-sandbox
Open

Joaovitor404silva wants to merge 1 commit into
ItsNotRexed:mainfrom
Joaovitor404silva:real-shader-sandbox

Conversation

@Joaovitor404silva

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-520 (claim)

What and why

The next steps of docs/first_light.md §5: placed world props drawn by one of the game's own translated VS/PS pairs, with a real camera through the VS constants, the material's TTPF albedo through the bindless set, and the game's own sampler.

  • runtime/test/vk_sandbox.cpp: draws every prop of a packed scene with the pair: vertex buffers (position, normal, UV), D32 depth, one indexed draw and one descriptor table per draw, raw V#s and T# in the heap, the T# words and the PS's S# literal in the descriptor hash table, and the sampler built from those S# words (gfx10::decode). Headless (--out) or a window with fly / walk / drive movement (walk and drive follow the scene's own triangles). It recreates the swapchain on resize and minimise.
  • tools/sandbox_scene.py: packs the props around a point from the user's own world_index.py --entities-out rows, rpf9dump models manifests and rpf9dump ttpf textures (stdlib only).
  • tools/sandbox.py: picks the pair by what the shaders read, not by name: input signature, user SGPR 8 as a 32-bit pointer, bindings, and the descriptor loads in the listing (the material → program table is in the executable, docs/models.md: material shader hashes lead to effects; effect records select the draw programs #2519). Then it runs vk_sandbox. --check renders one frame and prints only counts (exit 0 / 1, 77 when the tool, pair or entities file is missing).
  • docs/sandbox.md: the table layout the pair reads (offsets of the world rows, view-projection, light direction, colour, T#), how to reproduce, measurements and limits. Indexed from docs/README.md.

Lighting stays the pair's own max(0.25, n·l). Shadows and the deferred passes are out of scope (§6 of the doc).

Tested

On an NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24, Windows 11, MSVC RelWithDebInfo build of vk_sandbox, with the user's own 1.0.2.1 package:

  • tools/sandbox.py --check on one levels.rpf window: 150 props, 446 draws, 442 textured (107 textures from the map and terrain TTPF pools): PASS, 114,503 of 230,400 pixels covered, 4,736 distinct colours (147 with no textures).
  • Pair picker on the 1.0.2.1 corpus: 2 VS and 4 PS match the full pattern.
  • Window: about 90 fps. A 60-frame windowed run ends on the same pixels as the headless render. Resized three times and minimised during a 900-frame run with no error. Walk / drive eye heights measured at 1.70 m / 1.20 m over the roof.
  • Error paths: a truncated scene file is refused, and an unwritable --out exits 1.
  • python -I tests/test_sandbox_pick.py (6 tests) and python -I tests/test_sandbox_scene.py (6 tests): synthetic listings, indexes and meshes, no game data. python -m compileall -q tools tests.

AI-assisted (Claude Code). All numbers above were measured on this machine.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. Counts only; no images, shader names or listings beyond the short descriptor-load patterns the picker matches.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 (MSVC 14.51, Python 3.13.1; head merged with main 4c52ce2). The merge conflicts in docs/README.md (main added the shader_inputs.md row where this adds sandbox.md); I kept both rows. It would need a rebase to merge as is.

  • vk_sandbox builds clean from the head with MSVC (the CMake list gains vk_sandbox; it has no ctest entry).
  • python -I tests/test_sandbox_pick.py and python -I tests/test_sandbox_scene.py pass.
  • Not run: tools/sandbox.py --check and the window need the game's package, and I used none, so the render itself, the pair picker on the real corpus and both GPUs are untested here. There is also no negative control: the PR adds new files and the Python tests have nothing on main to run against.

@sh1shu1

sh1shu1 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested feee3e6 on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: pass, no regression against main f847748.

  • ctest: 140/140 passed, same 8 skips as main f847748
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 153/199 native, 184/199 with LEONIDA_W64_EMULATE=1, 0 failed; identical to main f847748
    AI-assisted (Claude Code, Claude Fable 5.1).

@zzEmmazz

Copy link
Copy Markdown
Contributor

Tested feee3e6c, applied alone on main f847748c: it builds and its unit tests pass; one docs check fails. Build and unit tests only, the render itself was not run.

Windows 11 (26200), MSVC 14.50 (VS 2026), Ninja RelWithDebInfo. Two GPUs: Ryzen 7 9700X iGPU (RDNA2, AMD 32.0.21042.62) and RTX 3070 (NVIDIA 610.74), picked with LEONIDA_VK_DEVICE.

  • Fails: python -I tests/test_docs_repo_paths.py reports backticked paths that name no tracked file: docs/sandbox.md:11 runtime/test/vk_sandbox. The file is runtime/test/vk_sandbox.cpp; the same failure in a plain git archive of the head. It passes on f847748c.
  • python -I tests/test_sandbox_pick.py: 6 tests OK. python -I tests/test_sandbox_scene.py: 6 tests OK. python -I tests/test_docs_links.py: OK. python -m compileall -q tools tests: clean.
  • vk_sandbox builds with MSVC 14.50 with no warning. Without arguments it prints its usage and exits 2 with either GPU selected.
  • python -I tools/sandbox.py --check with an empty work folder: exit 77, unsupported: no matching translated shader pair.

Not checked: tools/sandbox.py --check on a real package (the 150-prop frame, the pixel and colour counts, the pair count over the corpus), the window, resize and movement modes, and the truncated-scene and unwritable-output paths. GitHub reports a conflict with the newest main.

AI-assisted; measured on my PC.

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
@memorypressure

Copy link
Copy Markdown

Two things before this can land. (1) It breaks tests/test_docs_repo_paths.py — reproduced on the merged tree: docs/sandbox.md:11 cites runtime/test/vk_sandbox, which names no tracked file; the guard wants the source path runtime/test/vk_sandbox.cpp. That is the only test failure. (2) docs/README.md conflicts with current main (both sides appended an index row) — trivial resolution, but the head needs a rebase. Otherwise everything checks out at the merged tree: compileall clean, test_sandbox_pick and test_sandbox_scene pass (6+6, 12 under pytest), tools/sandbox.py --check exits 77 with the documented message, and the diff has no base64/hex blobs — fixtures are hand-written listings, the only write is binary. The C++/CMake side and every rendering figure in docs/sandbox.md (442/446 draws, the fly/walk/drive window) need a GPU plus the package and stand as the author's measurements. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

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.

5 participants