mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
When internally using an FBO, check for allocation errors
Both the cogl_texture_get_data and _cogl_blit_begin implementations will internally try to create an FBO for a texture and have fallbacks if the FBO fails. However neither of them were catching errors when allocating the framebuffer so the fallback wouldn't work properly. This patch just adds an explicit call to cogl_framebuffer_allocate for these uses and causes it to use the next fallback if it fails. Based on a patch by Adel Gadllah. https://bugzilla.gnome.org/show_bug.cgi?id=669368 Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
fd0dfbf3d5
commit
ec1bb4ce39
@ -55,6 +55,12 @@ _cogl_blit_texture_render_begin (CoglBlitData *data)
|
||||
if (fbo == COGL_INVALID_HANDLE)
|
||||
return FALSE;
|
||||
|
||||
if (!cogl_framebuffer_allocate (fbo, NULL))
|
||||
{
|
||||
cogl_handle_unref (fbo);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fbo);
|
||||
cogl_handle_unref (fbo);
|
||||
|
||||
@ -141,6 +147,7 @@ static gboolean
|
||||
_cogl_blit_framebuffer_begin (CoglBlitData *data)
|
||||
{
|
||||
CoglHandle dst_fbo, src_fbo;
|
||||
gboolean ret;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
@ -155,22 +162,35 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
|
||||
(data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
||||
|
||||
if (dst_fbo == COGL_INVALID_HANDLE)
|
||||
return FALSE;
|
||||
|
||||
ret = FALSE;
|
||||
else
|
||||
{
|
||||
if (!cogl_framebuffer_allocate (dst_fbo, NULL))
|
||||
ret = FALSE;
|
||||
else
|
||||
{
|
||||
src_fbo = _cogl_offscreen_new_to_texture_full
|
||||
(data->src_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
|
||||
(data->src_tex,
|
||||
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL,
|
||||
0 /* level */);
|
||||
|
||||
if (src_fbo == COGL_INVALID_HANDLE)
|
||||
ret = FALSE;
|
||||
else
|
||||
{
|
||||
cogl_handle_unref (dst_fbo);
|
||||
return FALSE;
|
||||
if (!cogl_framebuffer_allocate (src_fbo, NULL))
|
||||
ret = FALSE;
|
||||
else
|
||||
_cogl_push_framebuffers (dst_fbo, src_fbo);
|
||||
|
||||
cogl_handle_unref (src_fbo);
|
||||
}
|
||||
}
|
||||
|
||||
_cogl_push_framebuffers (dst_fbo, src_fbo);
|
||||
cogl_handle_unref (src_fbo);
|
||||
cogl_handle_unref (dst_fbo);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -210,6 +230,12 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
|
||||
if (fbo == COGL_INVALID_HANDLE)
|
||||
return FALSE;
|
||||
|
||||
if (!cogl_framebuffer_allocate (fbo, NULL))
|
||||
{
|
||||
cogl_handle_unref (fbo);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (fbo);
|
||||
cogl_handle_unref (fbo);
|
||||
|
||||
|
@ -1026,6 +1026,12 @@ get_texture_bits_via_offscreen (CoglTexture *texture,
|
||||
if (framebuffer == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!cogl_framebuffer_allocate (framebuffer, NULL))
|
||||
{
|
||||
cogl_object_unref (framebuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cogl_push_framebuffer (framebuffer);
|
||||
|
||||
_cogl_read_pixels_with_rowstride (x, y, width, height,
|
||||
|
Loading…
Reference in New Issue
Block a user