Skip to content

Commit

Permalink
OpenGL: Take another crack at point sprite garbage
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Sep 28, 2021
1 parent 4c87c16 commit f8d0443
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/FNA3D_Driver_OpenGL.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ static void OPENGL_DrawIndexedPrimitives(
if (tps)
{
renderer->glEnable(GL_POINT_SPRITE);
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
}

/* Draw! */
Expand Down Expand Up @@ -1577,6 +1578,7 @@ static void OPENGL_DrawIndexedPrimitives(

if (tps)
{
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
renderer->glDisable(GL_POINT_SPRITE);
}
}
Expand Down Expand Up @@ -1608,6 +1610,7 @@ static void OPENGL_DrawInstancedPrimitives(
if (tps)
{
renderer->glEnable(GL_POINT_SPRITE);
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
}

/* Draw! */
Expand Down Expand Up @@ -1635,6 +1638,7 @@ static void OPENGL_DrawInstancedPrimitives(

if (tps)
{
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
renderer->glDisable(GL_POINT_SPRITE);
}
}
Expand All @@ -1653,6 +1657,7 @@ static void OPENGL_DrawPrimitives(
if (tps)
{
renderer->glEnable(GL_POINT_SPRITE);
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
}

/* Draw! */
Expand All @@ -1664,6 +1669,7 @@ static void OPENGL_DrawPrimitives(

if (tps)
{
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
renderer->glDisable(GL_POINT_SPRITE);
}
}
Expand Down Expand Up @@ -6016,20 +6022,22 @@ FNA3D_Device* OPENGL_CreateDevice(
else if (!renderer->useES3)
{
/* Compatibility contexts require that point sprites be enabled
* explicitly. However, Apple's drivers have a blatant spec
* violation that disallows a simple glEnable. So, here we are.
* explicitly. However, drivers (and the Steam overlay) are
* really fucking bad at not knowing that point sprite state
* should only affect point rendering. So, here we are.
* -flibit
*/
renderer->togglePointSprite = 0;
if (SDL_strcmp(SDL_GetPlatform(), "Mac OS X") == 0)
const char *os = SDL_GetPlatform();
if ( (SDL_strcmp(os, "Mac OS X") == 0) || /* Mainly Intel */
(SDL_strcmp(os, "Linux") == 0) ) /* Mainly Gallium */
{
renderer->togglePointSprite = 1;
}
else
{
renderer->glEnable(GL_POINT_SPRITE);
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
}
renderer->glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, 1);
}

/* Initialize renderer members not covered by SDL_memset('\0') */
Expand Down

0 comments on commit f8d0443

Please sign in to comment.