Skip to content

Renderer: decode cache + resident vertex buffers for big draws - #78

Merged
schindlershadow merged 1 commit into
mainfrom
vertex-cache
Nov 16, 2026
Merged

schindlershadow merged 1 commit into
mainfrom
vertex-cache

Conversation

@schindlershadow

@schindlershadow schindlershadow commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Characters are skinned on the GPU, so the vertex data of a model's draws is the same every frame, but every draw was decoded again (68 bytes a vertex), staged and copied into the frame's ring VBO. On the RP6 that copy/upload was the render thread's largest item ("GPU submit"). Draws of 512+ vertices are now decoded once (cache keyed by addresses, count, vertex type, material colour and a hash of the source bytes: any change decodes afresh) and drawn from a resident VBO made once per entry. PSPRECOMP_DECODE_CACHE=0 / PSPRECOMP_GPU_VCACHE=0 turn them off.

RP6, 40 s AI Quick Battle, phone settings (60 fps, render scale 2, Vulkan + Turnip), SurfaceFlinger present times:

  • retail 56.4 -> 57.1 fps
  • NT Lightning mod (39.6k triangles) 49.5 -> 57.6 fps

Desktop: no change (not limited there); hit rate 99.98 %; banter and battle draw the same. Built and run together with #77 on the current main.

Release notes

  • Smoother battles on phones, especially with detailed custom character models.

🤖 Generated with Claude Code

Characters are skinned on the GPU, so the vertex data of a model's
draws is the same every frame, but every draw was decoded again
(GeGpuVertex, 68 bytes a vertex), staged and copied into the frame's
ring VBO. On the RP6 (Adreno 740, Turnip) that copy and upload was the
render thread's largest item ("GPU submit"), and a 40k-triangle mod
body cost ~8 fps on its own.

- psp_ge_vertex.cpp: draws of 512+ vertices are cached by vertex /
  index address, count, vertex type, material ambient/alpha and a hash
  of the source indices + vertices (any change decodes afresh); 64 MB
  budget, cleared when over (generation counter).
  ge_decode_vertices_gpu_cached() hands out the cached copy + its id.
- psp_ge_draw.cpp: such a draw gets its own batch and is drawn from a
  static VBO + VAOs made once per cache entry (dropped with the cache
  generation): no staging, no ring copy, no upload.
- PSPRECOMP_DECODE_CACHE=0 / PSPRECOMP_GPU_VCACHE=0 turn them off.

RP6, 40 s AI Quick Battle, phone's own settings (60 fps, render scale
2, Vulkan + Turnip), SurfaceFlinger present times, 3 samples each:
  retail                        56.4 -> 57.1 fps
  NT Lightning mod (39.6k tris) 49.5 -> 57.6 fps (same as retail)
Desktop (Vulkan, RADV): no change (not limited there); cache hit rate
in a fight 99.98 % (14 entries, 3.1 MB). Visual check: banter and
battle draw the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schindlershadow
schindlershadow merged commit ff4d58f into main Nov 16, 2026
2 checks passed
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.

1 participant