mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
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:
parent
e40f16c60e
commit
e1c5e7ab8d
1 changed files with 9 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue