double buffered uniforms seem to work now

This commit is contained in:
olebeck 2025-06-30 21:07:42 +02:00
parent 5005772243
commit 9cab1ac14d
2 changed files with 12 additions and 17 deletions

View File

@ -511,15 +511,15 @@ GXMRenderer::GXMRenderer(DWORD width, DWORD height)
vertexStreams[0].indexSource = SCE_GXM_INDEX_SOURCE_INDEX_16BIT;
if (SCE_ERR(
sceGxmShaderPatcherCreateVertexProgram,
this->shaderPatcher,
this->mainVertexProgramId,
vertexAttributes,
3,
vertexStreams,
1,
&this->mainVertexProgram
)) {
sceGxmShaderPatcherCreateVertexProgram,
this->shaderPatcher,
this->mainVertexProgramId,
vertexAttributes,
3,
vertexStreams,
1,
&this->mainVertexProgram
)) {
return;
}
}
@ -1070,7 +1070,6 @@ void GXMRenderer::StartScene()
this->sceneStarted = true;
this->quadsUsed = 0;
// wait for this uniform buffer to become available
this->activeUniformBuffer = (this->activeUniformBuffer + 1) % VITA_GXM_UNIFORM_BUFFER_COUNT;
sceGxmNotificationWait(&this->fragmentNotifications[this->activeUniformBuffer]);
}
@ -1253,13 +1252,10 @@ void GXMRenderer::Flip()
// end scene
++this->fragmentNotifications[this->activeUniformBuffer].value;
++this->vertexNotifications[this->activeUniformBuffer].value;
sceGxmEndScene(
this->context,
nullptr, //&this->vertexNotifications[this->activeUniformBuffer],
// nullptr
&this->fragmentNotifications[this->activeUniformBuffer] // wait for fragment processing to finish for this
// buffer, otherwise lighting corrupts
nullptr,
&this->fragmentNotifications[this->activeUniformBuffer]
);
sceGxmPadHeartbeat(
&this->displayBuffersSurface[this->backBufferIndex],

View File

@ -17,7 +17,7 @@
DEFINE_GUID(GXM_GUID, 0x682656F3, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x58, 0x4D);
#define VITA_GXM_DISPLAY_BUFFER_COUNT 3
#define VITA_GXM_UNIFORM_BUFFER_COUNT 6 // hacky solution to corruption while drawing next frame, sync not working
#define VITA_GXM_UNIFORM_BUFFER_COUNT 2
struct GXMTextureCacheEntry {
IDirect3DRMTexture* texture;
@ -207,7 +207,6 @@ class GXMRenderer : public Direct3DRMRenderer {
uint16_t* quadIndices;
int quadsUsed = 0;
int activeUniformBuffer = 0;
SceGxmNotification vertexNotifications[VITA_GXM_UNIFORM_BUFFER_COUNT];
SceGxmNotification fragmentNotifications[VITA_GXM_UNIFORM_BUFFER_COUNT];
SDL_Gamepad* gamepad;