Skip to content

Commit

Permalink
Reset vertex buffers every 8 frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Dec 11, 2020
1 parent 851fff5 commit ad044a7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/SysVita/Graphics/GraphicsContextVita.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
extern bool pause_emu;
bool gWaitRendering = false;

static int frame_reset_counter = 0;
#define FRAME_RESET_NUM 8

#define MAX_INDEXES 0xFFFF
uint16_t *gIndexes;
float *gVertexBuffer;
Expand Down Expand Up @@ -174,9 +177,12 @@ void IGraphicsContext::BeginFrame()
vglStartRendering();
if (g_ROM.CLEAR_SCENE_HACK) ClearColBuffer( c32(0xff000000) );
glEnableClientState(GL_VERTEX_ARRAY);
gVertexBuffer = gVertexBufferPtr;
gColorBuffer = gColorBufferPtr;
gTexCoordBuffer = gTexCoordBufferPtr;
frame_reset_counter = (frame_reset_counter + 1) % FRAME_RESET_NUM;
if (!frame_reset_counter) {
gVertexBuffer = gVertexBufferPtr;
gColorBuffer = gColorBufferPtr;
gTexCoordBuffer = gTexCoordBufferPtr;
}
vglIndexPointerMapped(gIndexes);

if (new_frame) {
Expand Down

0 comments on commit ad044a7

Please sign in to comment.