Skip to content

Commit

Permalink
OpenGL ES Renderer: Fix TBO-based polygon state uploading.
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerman committed Jul 24, 2024
1 parent d58c0e9 commit d6532b9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions desmume/src/OGLRender_3_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ Render3DError OpenGLRenderer_3_2::BeginRender(const GFX3D_State &renderState, co
OGLPolyStates *polyStates = this->_pendingPolyStates;

#if defined(GL_VERSION_3_1) || defined(GL_ES_VERSION_3_2)
if (OGLRef.tboPolyStatesID != 0)
if ( (OGLRef.tboPolyStatesID != 0) && (this->_variantID & OpenGLVariantFamily_Standard) )
{
// Some drivers seem to have problems with GL_TEXTURE_BUFFER used as the target for
// glMapBufferRange() or glBufferSubData(), causing certain polygons to intermittently
Expand Down Expand Up @@ -2862,7 +2862,15 @@ Render3DError OpenGLRenderer_3_2::BeginRender(const GFX3D_State &renderState, co
#if defined(GL_VERSION_3_1) || defined(GL_ES_VERSION_3_2)
else if (OGLRef.tboPolyStatesID != 0)
{
glUnmapBuffer(GL_TEXTURE_BUFFER);
if (this->_variantID & OpenGLVariantFamily_Standard)
{
glUnmapBuffer(GL_TEXTURE_BUFFER);
}
else
{
glBindBuffer(GL_TEXTURE_BUFFER, OGLRef.tboPolyStatesID);
glBufferSubData(GL_TEXTURE_BUFFER, 0, CLIPPED_POLYLIST_SIZE * sizeof(OGLPolyStates), this->_pendingPolyStates);
}
}
#endif
else
Expand Down

0 comments on commit d6532b9

Please sign in to comment.