Repository navigation
PSX3DS v0.2.5 — Real-HW Performance Boost & Texel-Exact PICA200 Sampling
PSX3DS v0.2.5 — Real-Hardware Performance Boost (Eliminate PICA200 Readback/Sync Stalls, Early Scissor Culling, 128-Slot Stale-First TexCache) & Texel-Exact Hardware Sampling
v0.2.5 resolves the two issues reported on real New 3DS hardware running World Soccer Jikkyou Winning Eleven 3 - Final Ver. (Japan) (SLPM_861.62 + SCPH5500.BIN): ~20 FPS real-hardware framerate bottlenecks and display/texture sampling glitches (broken menu text, dotted player shadows, and off-by-one/wrapped polygon texel rows).
English Release Notes
1. Eliminate Per-Frame PICA200 Readback & Re-Upload Stalls on No-Op GP0(0x80) (src/gpu/gpu.c, src/gpu_hw/gpu_citro3d.c)
- Root Cause: Winning Eleven 3 issues an unmasked self-copy
GP0(0x80)(0, 0) -> (0, 0)of2 x 512at the end of every frame. Previously this forcedhw_sync_to_shadow(C3D_FrameEnd(0)+ synchronousC3D_SyncTextureCopyDMA readback + D-cache invalidation + CPU Morton un-swizzle) followed by a CPU tile upload and a second GPU stall on the next frame — two full PICA200 pipeline stalls per frame. - Fix:
gpu_vram_copy_is_noop()short-circuits unmasked self-copies (sx == dxmod 1024,sy == dymod 512,check_mask == 0,set_mask == 0) while preserving cycle-accurate command scheduling and full execution when mask bits are active. MaskedGP0(0xA0)CPU->VRAM loads now also synchronize destination shadow VRAM before testing mask bit 15.
2. Early Scissor Bounding-Box Culling & Reduced GSPGPU / PICA200 Sync Overhead (src/gpu_hw/gpu_citro3d.c)
- Early Scissor Culling: Primitives completely outside the active drawing area (
~39%of draw calls in Winning Eleven 3 3D matches, including flashing off-screen stadium billboard CLUTs) are now culled at the top ofhw_draw()before texture-page decoding, CLUT hashing, or batch breaks.flush_cpu_dirty_if_needed()now tests only the scissor-clipped primitive bounding box. - Single Vertex D-Cache Flush per Submission: Vertex ring buffers (
expanded to 8192 vertices x 2) now callGSPGPU_FlushDataCacheonce perC3D_FrameEnd()submission instead of once per batch (eliminating ~360 GSPGPU IPC syscalls per match frame on real 3DS hardware). - Stall-Free
upload_texUpdates:flush_cpu_dirty_if_needed()now stalls the open GPU frame only ifupload_texwas already sampled in that open frame, and flushes D-cache only for the dirty 8-pixel tile-row span instead of the full 1 MiB texture.
3. 128-Slot Lazy TexCache & clut_dirty Victim Priority (src/gpu_hw/gpu_texcache.c, include/psx3ds/gpu_hw.h)
- Root Cause: Animated palettes rewritten every frame left stale
clut_dirtyslots in the cache until all slots filled and began evicting clean, active 3D match textures. - Fix: Victim selection now recycles free allocated slots,
texel_dirtyslots, and staleclut_dirtyslots before evicting any clean active texture (while keepingA <-> Bpalette toggles zero-redecode when capacity permits). Capacity is expanded to 128 lazily allocated slots on New 3DS (capped at a 24 MiB LINEAR RAM budget) and 32 slots on Old 3DS (small_mem).
4. Coalesced ARM11 L1 I-Cache Invalidation & Idle Bottom-Screen UI Throttling (src/jit/arm_jit.c, src/platform/3ds/jit_mem_3ds.c, src/platform/3ds/main_3ds.c)
- Coalesced
svc 0x94:jit_compile_at_pc()now cleans D-cache per block (jit_mem_commit_dcache) and executes a single ARM11 L1 I-cache + BTB invalidation (jit_mem_flush_icache) after the entire eager compilation pass (up to 33 blocks) finishes, before returning to native execution. - Bottom-Screen UI Throttling: During active gameplay with no new button/touch input, the software-rendered bottom status UI now redraws every 16th frame (~3.75 Hz) instead of every 4th frame, redrawing immediately on any input.
5. Texel-Exact PS1 Hardware Polygon & Sprite Sampling (src/gpu_hw/gpu_citro3d.c)
- Root Cause: PICA200 samples fragment centers in bottom-up
t = 1.0 - v / Htexture coordinates underGPU_REPEAT. Polygon vertices (PRIM_TRI/PRIM_QUAD) lacked the PS1+0.5texel offset and integer pixel sample alignment, causingv = 0edges to wrap to row255, constant/decreasingvto sample rowv - 1(corrupting"Europe Zone"->"Europe Zore"), and minified polygons to turn player shadows into dotted lines. - Fix: Vertex UVs now use
1/16-texel fixed point (HW_UV_SHIFT = 4), the VRAM render-target projection shifts geometry by+7/16pixel to align PICA200 pixel centers with PS1 integer sample points,set_uv_transformapplies a1/64-texel floor nudge across the flippedtaxis, andtri_uv_to_hwappliesfloor(u + 0.5)with per-triangle(du/dx + du/dy) / 16gradient compensation. Menus/dialogs now matchgpu_softpixel-for-pixel (0.00%diff) and 3D match scenes match within0.05%(Gouraud rounding only).
中文更新说明 (v0.2.5)
- 大幅优化 New 3DS 实机帧率(消除每帧 GPU 回读停顿与高频同步开销):
- 跳过无掩码自拷贝
GP0(0x80):《实况足球 3 最终版》在每一帧末尾都会发送(0,0) -> (0,0)2x512的自拷贝指令,旧版会触发整帧 PICA200 同步回读与次帧重传(每帧 2 次 GPU 管线停顿)。现已通过gpu_vram_copy_is_noop()直接短路跳过,比赛与菜单实测readbacks = 0、stalls = 0、ring_wraps = 0。 - 提前视口裁剪(Early Scissor Culling):在解码纹理页前提前剔除完全落在绘图裁剪区外的图元(剔除《实况足球 3》比赛画面约
39%的场外无效绘制与场边闪烁广告牌调色板)。 - 合并顶点缓冲 D-Cache 刷新与
upload_tex按需同步:每帧提交(C3D_FrameEnd)仅执行 1 次顶点 D-Cache 刷新(消除每帧约 360 次GSPGPU_FlushDataCache系统调用),顶点环扩容至8192;CPU 脏瓦片上传仅在当前未闭合帧已采样过upload_tex时才等待同步,且仅刷新脏瓦片所在行区间。 - 128 槽位纹理缓存与动态调色板优先回收:优先回收已失效的动态调色板(
clut_dirty)与脏纹素槽位,绝不驱逐活跃干净纹理(比赛纹理缓存命中率达99.94%);New 3DS 扩容至128槽位(24 MiB 线性内存上限按需分配),Old 3DS 扩容至32槽位。 - 合并 JIT L1 指令缓存刷新与下屏 UI 降频:
jit_compile_at_pc预编译整批代码块后仅执行一次svc 0x94全量 I-Cache 刷新;游戏无按键/触控输入时下屏软件 UI 降频至每 16 帧刷新一次。
- 跳过无掩码自拷贝
- 彻底修复多边形与 UI 贴图采样显示错误:
- 引入
1/16纹素定点 UV、VRAM 投影+7/16像素对齐、翻转t轴1/64纹素向下取整偏置,以及三角形梯度补偿tri_uv_to_hw,精确还原 PS1 硬件整数像素采样与floor(u + 0.5)纹素寻址。 - 彻底修复了菜单文字错位断裂(如
"Europe Zone"误显示为"Europe Zore")、v = 0贴图边缘回绕至第 255 行、球员脚下阴影变成断续黑点线、以及带掩码GP0(0xA0)写入未先行同步目标区域等问题。
- 引入