gl-renderer: Assume default GL_UNPACK_* states

Revert pixel store's GL_UNPACK_* changes to default values right after
use so that other part of the code can assume the default state.

Fixes: #928

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
Loïc Molinari 2024-07-22 18:44:02 +02:00 committed by Marius Vlad
parent 84d83f5bf8
commit 95c3f96870
2 changed files with 5 additions and 14 deletions

View File

@ -1867,14 +1867,10 @@ draw_output_border_texture(struct gl_renderer *gr,
glBindTexture(GL_TEXTURE_2D, img->tex);
}
if (go->border_status & (1 << side)) {
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
if (go->border_status & (1 << side))
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
img->tex_width, img->height, 0,
GL_BGRA_EXT, GL_UNSIGNED_BYTE, img->data);
}
sconf->input_tex_filter = GL_NEAREST;
sconf->input_tex[0] = img->tex;
@ -2553,8 +2549,6 @@ gl_renderer_flush_damage(struct weston_paint_node *pnode)
glActiveTexture(GL_TEXTURE0);
if (gb->needs_full_upload || quirks->gl_force_full_upload) {
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
wl_shm_buffer_begin_access(buffer->shm_buffer);
for (j = 0; j < gb->num_textures; j++) {
@ -2606,6 +2600,10 @@ gl_renderer_flush_damage(struct weston_paint_node *pnode)
wl_shm_buffer_end_access(buffer->shm_buffer);
done:
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
pixman_region32_fini(&gb->texture_damage);
pixman_region32_init(&gb->texture_damage);
gb->needs_full_upload = false;

View File

@ -208,10 +208,6 @@ gl_color_curve_lut_3x1d(struct gl_renderer *gr,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei(GL_UNPACK_ALIGNMENT, sizeof (float));
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, lut_len, nr_rows, 0,
GL_RED_EXT, GL_FLOAT, lut);
@ -250,9 +246,6 @@ gl_3d_lut(struct gl_renderer *gr,
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
gr->tex_image_3d(GL_TEXTURE_3D, 0, GL_RGB32F, dim_size, dim_size, dim_size, 0,
GL_RGB, GL_FLOAT, lut);