Merge branch 'gtk4-arb_fbo' into 'master'

Switch to GL_ARB_framebuffer_object

See merge request GNOME/gtk!2079
This commit is contained in:
Matthias Clasen 2020-06-20 17:12:52 +00:00
commit 79b1d24128
2 changed files with 21 additions and 21 deletions

View File

@ -348,7 +348,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
paint_data = gdk_gl_context_get_paint_data (paint_context); paint_data = gdk_gl_context_get_paint_data (paint_context);
if (paint_data->tmp_framebuffer == 0) if (paint_data->tmp_framebuffer == 0)
glGenFramebuffersEXT (1, &paint_data->tmp_framebuffer); glGenFramebuffers (1, &paint_data->tmp_framebuffer);
if (source_type == GL_RENDERBUFFER) if (source_type == GL_RENDERBUFFER)
{ {
@ -390,19 +390,19 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale); cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
framebuffer = paint_data->tmp_framebuffer; framebuffer = paint_data->tmp_framebuffer;
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer); glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
if (source_type == GL_RENDERBUFFER) if (source_type == GL_RENDERBUFFER)
{ {
/* Create a framebuffer with the source renderbuffer and /* Create a framebuffer with the source renderbuffer and
make it the current target for reads */ make it the current target for reads */
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER_EXT, source); GL_RENDERBUFFER, source);
} }
else else
{ {
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, source, 0); GL_TEXTURE_2D, source, 0);
} }
glPixelStorei (GL_PACK_ALIGNMENT, 4); glPixelStorei (GL_PACK_ALIGNMENT, 4);
@ -418,7 +418,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glPixelStorei (GL_PACK_ROW_LENGTH, 0); glPixelStorei (GL_PACK_ROW_LENGTH, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindFramebuffer (GL_FRAMEBUFFER, 0);
cairo_surface_mark_dirty (image); cairo_surface_mark_dirty (image);

View File

@ -366,17 +366,17 @@ gtk_gl_area_ensure_buffers (GtkGLArea *area)
priv->have_buffers = TRUE; priv->have_buffers = TRUE;
glGenFramebuffersEXT (1, &priv->frame_buffer); glGenFramebuffers (1, &priv->frame_buffer);
if ((priv->has_depth_buffer || priv->has_stencil_buffer)) if ((priv->has_depth_buffer || priv->has_stencil_buffer))
{ {
if (priv->depth_stencil_buffer == 0) if (priv->depth_stencil_buffer == 0)
glGenRenderbuffersEXT (1, &priv->depth_stencil_buffer); glGenRenderbuffers (1, &priv->depth_stencil_buffer);
} }
else if (priv->depth_stencil_buffer != 0) else if (priv->depth_stencil_buffer != 0)
{ {
/* Delete old depth/stencil buffer */ /* Delete old depth/stencil buffer */
glDeleteRenderbuffersEXT (1, &priv->depth_stencil_buffer); glDeleteRenderbuffers (1, &priv->depth_stencil_buffer);
priv->depth_stencil_buffer = 0; priv->depth_stencil_buffer = 0;
} }
@ -549,20 +549,20 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
else if (priv->needs_resize) else if (priv->needs_resize)
gtk_gl_area_allocate_buffers (area); gtk_gl_area_allocate_buffers (area);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, priv->frame_buffer); glBindFramebuffer (GL_FRAMEBUFFER, priv->frame_buffer);
if (priv->texture != NULL) if (priv->texture != NULL)
glFramebufferTexture2D (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, priv->texture->id, 0); GL_TEXTURE_2D, priv->texture->id, 0);
if (priv->depth_stencil_buffer) if (priv->depth_stencil_buffer)
{ {
if (priv->has_depth_buffer) if (priv->has_depth_buffer)
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer); GL_RENDERBUFFER, priv->depth_stencil_buffer);
if (priv->has_stencil_buffer) if (priv->has_stencil_buffer)
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer); GL_RENDERBUFFER, priv->depth_stencil_buffer);
} }
} }
@ -578,14 +578,14 @@ gtk_gl_area_delete_buffers (GtkGLArea *area)
if (priv->depth_stencil_buffer != 0) if (priv->depth_stencil_buffer != 0)
{ {
glDeleteRenderbuffersEXT (1, &priv->depth_stencil_buffer); glDeleteRenderbuffers (1, &priv->depth_stencil_buffer);
priv->depth_stencil_buffer = 0; priv->depth_stencil_buffer = 0;
} }
if (priv->frame_buffer != 0) if (priv->frame_buffer != 0)
{ {
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); glBindFramebuffer (GL_FRAMEBUFFER, 0);
glDeleteFramebuffersEXT (1, &priv->frame_buffer); glDeleteFramebuffers (1, &priv->frame_buffer);
priv->frame_buffer = 0; priv->frame_buffer = 0;
} }
} }
@ -716,8 +716,8 @@ gtk_gl_area_snapshot (GtkWidget *widget,
else else
glDisable (GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); status = glCheckFramebufferStatus (GL_FRAMEBUFFER);
if (status == GL_FRAMEBUFFER_COMPLETE_EXT) if (status == GL_FRAMEBUFFER_COMPLETE)
{ {
Texture *texture; Texture *texture;