From 7cc0e897d55e296f60dfce0f80975d6940258b52 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 14 Oct 2020 16:43:03 -0400 Subject: [PATCH] opengl: Don't assert if vs_flip_loc == -1. This can be -1 if the GLSL compiler removed it, or if you bound a program without a vertex shader at all. --- mojoshader_opengl.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index df2a4d1..8b1d2a1 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -2927,18 +2927,19 @@ void MOJOSHADER_glProgramViewportInfo(int viewportW, int viewportH, } // if #ifdef MOJOSHADER_FLIP_RENDERTARGET - assert(ctx->bound_program->vs_flip_loc != -1); - - /* Some compilers require that vpFlip be a float value, rather than int. - * However, there's no real reason for it to be a float in the API, so we - * do a cast in here. That's not so bad, right...? - * -flibit - */ - const int flip = renderTargetBound ? -1 : 1; - if (flip != ctx->bound_program->current_flip) - { - ctx->glUniform1f(ctx->bound_program->vs_flip_loc, (float) flip); - ctx->bound_program->current_flip = flip; + if (ctx->bound_program->vs_flip_loc != -1) + { + /* Some compilers require that vpFlip be a float value, rather than int. + * However, there's no real reason for it to be a float in the API, so we + * do a cast in here. That's not so bad, right...? + * -flibit + */ + const int flip = renderTargetBound ? -1 : 1; + if (flip != ctx->bound_program->current_flip) + { + ctx->glUniform1f(ctx->bound_program->vs_flip_loc, (float) flip); + ctx->bound_program->current_flip = flip; + } // if } // if #endif } // MOJOSHADER_glViewportInfo