Repository navigation
Conversation
vk_harness takes VKH_COLOR_FORMAT=<VkFormat>:<bytes> for its color target and writes the target's texels as stored. ps_oracle.py --format picks it (the driver then picks the export format, as for a game pipeline), with an integer-output const template for integer targets. docs gets the export behaviour measured on gfx1036: 32_GR / 32_R take the last enabled channels, a compr export reaches 16-bit UNORM/SNORM/UINT/SINT targets bit for bit, FP16 targets get the halves as f16 (a NaN half becomes 0xfe00). AI-assisted.
docs/shader_validation.md AI-assisted.
docs/shader_validation.md AI-assisted.
Kam471
left a comment
There was a problem hiding this comment.
Reviewed 3a1ed28b on Windows 11 with the RTX 5070 Ti.
Checks
python -I tests/test_ps_oracle.py -v-> Ran 12, OK (2 hardware skips);test_tool_stdout_encoding.py-> 4 OK. Both new format tests are hardware-only, so they skip here.- Built
vk_harnessand checked all 17 format names against Vulkan SDK 1.4.363: everyVkFormatnumber and texel size matches,VKH_COLOR_FORMATaccepts<num>:<bytes>,pixels()handles 1/2/4 dwords and rejects short/long readbacks, and integer targets get the int template. rgb10a2unorm-> VkFormat 64 (A2B10G10R10_UNORM_PACK32) is the correct memory layout for D3DR10G10B10A2(R in the low 10 bits); no format error. The label could sayr10g10b10a2for clarity.
Blocking (docs): docs/shader_validation.md:1587 — the new table's header row is not followed by a |---|---|---| delimiter, so GitHub renders every row as plain text. Add the delimiter row.
Non-blocking harness defects:
runtime/test/vk_harness.cpp:473-477:texel_bytesis only bounded to 1..16, not checked againstfmt.VKH_COLOR_FORMAT=109:3(RGBA32F with 3 bytes declared) sized the readback buffer at 3 bytes/texel whilevkCmdCopyImageToBuffercopied 16, an out-of-bounds device write; a too-large value silently pads the file. In-treeps_oraclealways passes the table's correct value, so this is test-harness hardening.tools/ps_oracle.py:510-514: forfmt="rgba32f"the ambientVKH_COLOR_FORMATis left in place. An outerVKH_COLOR_FORMAT=97:8reaches the harness while the tool decodes 16 bytes/texel. Always set or pop it.
Code and CPU tests are otherwise sound; merge after the delimiter row.
|
Tested 3a1ed28 (based on current
AI-assisted (Claude Code). No game files. |
|
Ran
AI-assisted (Claude Code). Synthetic test shaders only, no game files. |
docs/shader_validation.md AI-assisted.
docs/shader_validation.md tools/ps_oracle.py AI-assisted.
tests/test_ps_oracle.py The RADV test's fake run_harness takes the new fmt argument. AI-assisted.
|
Verified against current main (merges cleanly): tests/test_ps_oracle.py passes (21 tests, the two hardware cases skipping as designed), and 16 of the 17 VkFormat numbers in the new FORMATS table check out exactly against the installed Vulkan headers. One entry deserves a second look: rgb10a2unorm maps to 64, which is VK_FORMAT_A2B10G10R10_UNORM_PACK32 (B in the low bits), while the R10G10B10A2 order is A2R10G10B10_UNORM_PACK32 = 58 — verified against vulkan_core.h here. No added test exercises that row (only rgba16unorm and rg32f are covered), so if 64 was the measured target a note saying so would settle it; otherwise it looks like the top-bit-name swap the translator docs warn about. The vk_harness.cpp part and the gfx1036 measurements could not be reproduced on this CPU-only host. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Tested Setup: the PR diff applied to
No game files. AI-assisted (Claude Code); I ran the commands above and checked the numbers against the logs. |
|
Tested
Synthetic shaders only, no game files. AI-assisted (Claude Code). |
Requested by Lucas · project thread
Claimed in the coordination issue as: EGEN-TOOL-PS-ORACLE-FORMATS, #3381 (comment)
Depends on: #3061 (this branch is on top of it; only the last commit is new).
What and why
tools/ps_oracle.py(#3061) drew into an RGBA32F target only, so the driver always chose the 32_ABGR export format, and how the SPI/CB treat exports for other render-target formats could not be measured. Now:vk_harness:VKH_COLOR_FORMAT=<VkFormat>:<bytes per texel>sets the color target. The readback holds its texels as stored. It exits 77 when the device cannot render to that format.ps_oracle.py --formattakes rgba32f, rgba32u/i, rg32f, r32f/u, rgba16f/unorm/snorm/u/i, rg16f/unorm, rgba8unorm/snorm/u or rgb10a2unorm. The driver picks the export format for that target, as it would for a game pipeline. An integer target gets an integer-outputconsttemplate.docs/shader_validation.md: a table of what reaches the target for each export format, measured on gfx1036.Measured on the AMD Radeon iGPU (gfx1036, driver 26.10.1):
offchannel stored as 0.comprexport's halves are f16 and the CB converts them. An f16 NaN half is stored as0xfe00in an f16 target and as 0 in a normalized one.comprexport's 16-bit halves reach the target bit for bit. They are unorm16, snorm16 or integer values, not f16. RGBA8_UINT (UINT16_ABGR) clamps them to 255.The last point bears on the translator, which decodes every
comprexport's halves as f16 (UnpackHalf2x16) into a float vec4 output. I'm posting that as a separatefinding:, since the fix needs the render-target format.Tested
python -I tests/test_ps_oracle.pyon the gfx1036 (LEONIDA_PS_ORACLE_BUILDset): 12 tests OK. The new hardware test covers acomprexport into RGBA16_UNORM (bit-exact halves) and RG32F with all four channels and with x, w enabled. On the RTX 5080 the hardware tests skip (exit 77 path), the rest pass.scripts/run_gpu_tests.py --filter ps_valu16with thisvk_harness: 2/2 on both GPUs, so the default target is unchanged.tests/test_tool_stdout_encoding.pypasses, andpython -m compileall -q tools testsis clean.AI-assisted.
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator change.)