gl_common: fix gl error when blur is not enabled

blur_textures are not initialized when blur is disabled, but we still
try to resize them in gl_resize.

Don't do that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-10 20:04:11 +00:00
parent e40f16c60e
commit e1c5e7ab8d
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 9 additions and 6 deletions

View File

@ -462,14 +462,16 @@ void gl_resize(struct gl_data *gd, int width, int height) {
gd->height = height;
gd->width = width;
// Resize the temporary textures
glBindTexture(gd->blur_texture_target, gd->blur_texture[0]);
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width, gd->height, 0,
GL_BGRA, GL_UNSIGNED_BYTE, NULL);
if (gd->npasses > 1) {
glBindTexture(gd->blur_texture_target, gd->blur_texture[1]);
if (gd->npasses > 0) {
// Resize the temporary textures used for blur
glBindTexture(gd->blur_texture_target, gd->blur_texture[0]);
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width, gd->height,
0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
if (gd->npasses > 1) {
glBindTexture(gd->blur_texture_target, gd->blur_texture[1]);
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width,
gd->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
}
}
}
@ -669,6 +671,7 @@ bool gl_init(struct gl_data *gd, session_t *ps) {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
gd->npasses = 0;
gl_win_shader_from_string(NULL, win_shader_glsl, &gd->win_shader);
if (!gl_init_blur(gd, ps->o.blur_kerns)) {
return false;