perf(shader): convert runtime-format buffer components at their run-time width #20251
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20251"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Remi-Bon on 2026-11-14T22:41:40Z.
What
The component loop of
genericFormattedLoad(from #21973) converts each component once per (type, bit width) pair found in the format table, then selects the matching result.Unorm, snorm, scaled and integer components now take the component width at run time (
NormalizeFormatComponentWidth), so one conversion per type remains. Float and d16 conversions keep one per width.Rebased on
mainafter #21973 landed: the component loop this PR first added is dropped, only the run-time-width conversion is kept.Tested
Windows 11, AMD Radeon RX 9070. No title was run for this PR.
tbuffertests,ctest -R "format|formatted|gpu_buffer|tbuffer|buffer_load" -VunderANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer: 37/37 onmain(6c70b74203) and on this change, noVUID-in either log, loader inserts the validation layer in both.agc_formatted_buffer_onceonmainand on this change: GPU-selected formatted load 10380 to 8891 words (three loads: 11114 to 9621); one load 3975 to 2322, three 4477 to 2824; pixel shader specialized 4774 to 3137, registration 5403 to 3770.No pipeline build time or frame time is claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T23:32:04Z.
Review: COMMENTED
Reviewed — no blocking findings
The available diff and source support the stated loop refactor, but the review is incomplete because the exposed reader did not provide access to every required repository file.
What I ran
221e5088130b76d86a47d80735e03decda65cf60; no build or tests were run.description.md,commits.md,manifest.json,diff.patch,SpirvFormatConvert.hpp,SpirvFormatConvert.cpp(all 448 lines), andSpirvRuntimeBuffer.cpplines 620–780. The prepared bundle lists four changed files, all marked included; I read three.files.jsonwas not available through the exposed reader.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
SpirvEmitterHelpers.hppwas not read; its full text is marked included in the manifest.NormalizeFormatComponentWidthwere not inspected. Repository search was unavailable through the exposed reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T10:35:13Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: correct the signed normalized conversion so it preserves the SNORM sign and scale.
What I ran
Reviewed head
3aec2e2fa304b70ab81a4871857378b736903cef. I read the prepared description, commit summary, manifest, diff, and all four changed files listed as reviewed. I did not run commands or tests;repo_read.pywas used for targeted source reads.Results
Findings
Blocking
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvFormatConvert.cpp:83— The SNORM path ORs the sign bit into the result of the new width-based UNORM conversion.UnormWidthToF32Bitsreturns an IEEE-754 bit pattern, whose sign bit is bit 31; this sets the result negative for negative SNORM values, but it never divides the magnitude by the SNORM positive maximum. For example, an 8-bit SNORM value of -64 is emitted as -64.0 rather than approximately -0.504. The existingNormalizeFormatComponentpath at this file's lines 159–166 uses the SNORM maximum and should be preserved in the runtime-width path.Non-blocking
None.
Not verified
No tests, build, or runtime checks were performed. The author-reported Windows 11 / AMD Radeon RX 9070 runs and measurements were not independently verified.
files.jsonwas not available through the review reader; the manifest lists four changed files, and all four full texts were read. No files were excluded in the manifest.To get this to a good state
Correct runtime-width SNORM conversion to produce the same normalized values as the existing fixed-width path, then run the focused format and formatted buffer tests on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T17:19:36Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed change adds run-time-width conversions for formatted buffer components and a focused SNORM case; no concrete defect was identified in the code read.
What I ran
Reviewed head
7d2c4bcc0dc9169cdf63a4be8fcc147244ff0aea. No commands or tests were run; this review session provided read-only review tools rather than a shell.Results
Findings
Blocking
None identified.
Non-blocking
None.
Not verified
Tests, builds, runtime behavior, and the author-reported performance measurements were not independently verified. No changed files were excluded;
files.jsonwas unavailable through the review reader.To get this to a good state
Nothing is required.