Navigation Menu

Skip to content

Commit

Permalink
Skip GL_PROGRAM_POINT_SIZE for ES contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Apr 23, 2019
1 parent 8977654 commit 9600ad8
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions mojoshader_opengl.c
Expand Up @@ -279,6 +279,7 @@ struct MOJOSHADER_glContext
void (*profilePushSampler)(GLint loc, GLuint sampler);
int (*profileMustPushConstantArrays)(void);
int (*profileMustPushSamplers)(void);
void (*profileToggleProgramPointSize)(int enable);
};


Expand Down Expand Up @@ -919,6 +920,20 @@ static void impl_ARB1_PushSampler(GLint loc, GLuint sampler)

#endif // SUPPORT_PROFILE_ARB1

#if SUPPORT_PROFILE_GLSL || SUPPORT_PROFILE_ARB1

static void impl_REAL_ToggleProgramPointSize(int enable)
{
toggle_gl_state(GL_PROGRAM_POINT_SIZE, enable);
} // impl_REAL_ToggleProgramPointSize

static void impl_NOOP_ToggleProgramPointSize(int enable)
{
// No-op, this profile's GL context forces this to always be on
} // impl_NOOP_ToggleProgramPointSize

#endif // SUPPORT_PROFILE_GLSL || SUPPORT_PROFILE_ARB1


const char *MOJOSHADER_glGetError(void)
{
Expand Down Expand Up @@ -1463,6 +1478,10 @@ MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile,
ctx->profilePushSampler = impl_GLSL_PushSampler;
ctx->profileMustPushConstantArrays = impl_GLSL_MustPushConstantArrays;
ctx->profileMustPushSamplers = impl_GLSL_MustPushSamplers;
if (strcmp(profile, MOJOSHADER_PROFILE_GLSLES) == 0)
ctx->profileToggleProgramPointSize = impl_NOOP_ToggleProgramPointSize;
else
ctx->profileToggleProgramPointSize = impl_REAL_ToggleProgramPointSize;
} // if
#endif

Expand All @@ -1488,6 +1507,7 @@ MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile,
ctx->profilePushSampler = impl_ARB1_PushSampler;
ctx->profileMustPushConstantArrays = impl_ARB1_MustPushConstantArrays;
ctx->profileMustPushSamplers = impl_ARB1_MustPushSamplers;
ctx->profileToggleProgramPointSize = impl_REAL_ToggleProgramPointSize;
} // if
#endif

Expand All @@ -1507,6 +1527,7 @@ MOJOSHADER_glContext *MOJOSHADER_glCreateContext(const char *profile,
assert(ctx->profilePushSampler != NULL);
assert(ctx->profileMustPushConstantArrays != NULL);
assert(ctx->profileMustPushSamplers != NULL);
assert(ctx->profileToggleProgramPointSize != NULL);

retval = ctx;
ctx = current_ctx;
Expand Down Expand Up @@ -2402,10 +2423,7 @@ void MOJOSHADER_glProgramReady(void)

if (program->uses_pointsize != ctx->pointsize_enabled)
{
if (program->uses_pointsize)
ctx->glEnable(GL_PROGRAM_POINT_SIZE);
else
ctx->glDisable(GL_PROGRAM_POINT_SIZE);
ctx->profileToggleProgramPointSize(program->uses_pointsize);
ctx->pointsize_enabled = program->uses_pointsize;
} // if

Expand Down

0 comments on commit 9600ad8

Please sign in to comment.