Skip to content

Commit 9f2de6a

Browse files
authored
Merge pull request #494 from funch0za/master
[FIX] adding validation checks for GLSL and FPE shader programs inside functions that use glUseProgram
2 parents 4114c24 + 535c4b2 commit 9f2de6a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/gl/fpe.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ void realize_glenv(int ispoint, int first, int count, GLenum type, const void* i
10841084
glstate->fpe_bound_changed = 0;
10851085
}
10861086
// activate program if needed
1087-
if(glstate->glsl->program) {
1087+
if(gl4es_glIsProgram(glstate->glsl->program)) {
10881088
// but first, check if some fixedpipeline state (like GL_ALPHA_TEST) need to alter the original program
10891089
fpe_state_t state;
10901090
fpe_ReleventState(&state, glstate->fpe_state, 0);
@@ -1111,8 +1111,10 @@ void realize_glenv(int ispoint, int first, int count, GLenum type, const void* i
11111111
{
11121112
glstate->gleshard->program = program;
11131113
glstate->gleshard->glprogram = glprogram;
1114-
gles_glUseProgram(glstate->gleshard->program);
1115-
DBG(printf("Use GLSL program %d\n", glstate->gleshard->program);)
1114+
if (gl4es_glIsProgram(glstate->gleshard->program)) {
1115+
gles_glUseProgram(glstate->gleshard->program);
1116+
DBG(printf("Use GLSL program %d\n", glstate->gleshard->program);)
1117+
}
11161118
}
11171119
// synchronize uniforms with parent!
11181120
if(glprogram != glstate->glsl->glprogram)
@@ -1123,8 +1125,10 @@ void realize_glenv(int ispoint, int first, int count, GLenum type, const void* i
11231125
{
11241126
glstate->gleshard->program = glstate->fpe->prog;
11251127
glstate->gleshard->glprogram = glstate->fpe->glprogram;
1126-
gles_glUseProgram(glstate->gleshard->program);
1127-
DBG(printf("Use FPE program %d\n", glstate->gleshard->program);)
1128+
if (gl4es_glIsProgram(glstate->gleshard->program)) {
1129+
gles_glUseProgram(glstate->gleshard->program);
1130+
DBG(printf("Use FPE program %d\n", glstate->gleshard->program);)
1131+
}
11281132
}
11291133
}
11301134
program_t *glprogram = glstate->gleshard->glprogram;

0 commit comments

Comments
 (0)