mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
cogl-texture: refuse downloading textures in cogl_texture_get_data() on GLES
On drivers that do not support glGetTexImage2D (i.e. on GLES), cogl_texture_get_data() has a "feature" that allows it to download texture data by rendering the texture on an intermediate framebuffer object and then reading back the data from there. However, this feature requires the user to have previously set an "active" framebuffer object in the context, which makes this very tricky because it is not clear to the developer that he needs to do that in order for some code to work on GLES (of course it works on desktop GL, so nobody notices...) and additionally the code actually crashes if an active fbo is not set! This patch basically removes this feature in order to prevent the crash and is in line with how this code has evolved in cogl-2.0: https://git.gnome.org/browse/cogl/commit/?id=6d6a277b8e9a63a8268046e5258877ba94a1da5b https://bugzilla.gnome.org/show_bug.cgi?id=789961
This commit is contained in:
parent
db866eb052
commit
d8f2f583e6
@ -1156,25 +1156,13 @@ cogl_texture_get_data (CoglTexture *texture,
|
|||||||
tg_data.success = FALSE;
|
tg_data.success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: In some cases _cogl_texture_2d_download_from_gl may fail
|
/* XXX: In some cases this api may fail to read back the texture
|
||||||
* to read back the texture data; such as for GLES which doesn't
|
* data; such as for GLES which doesn't support glGetTexImage
|
||||||
* support glGetTexImage, so here we fallback to drawing the
|
*/
|
||||||
* texture and reading the pixels from the framebuffer. */
|
|
||||||
if (!tg_data.success)
|
if (!tg_data.success)
|
||||||
{
|
{
|
||||||
if (!_cogl_texture_draw_and_read (texture, target_bmp,
|
cogl_object_unref (target_bmp);
|
||||||
closest_gl_format,
|
return 0;
|
||||||
closest_gl_type,
|
|
||||||
&ignore_error))
|
|
||||||
{
|
|
||||||
/* We have no more fallbacks so we just give up and
|
|
||||||
* hope for the best */
|
|
||||||
g_warning ("Failed to read texture since draw-and-read "
|
|
||||||
"fallback failed: %s", ignore_error->message);
|
|
||||||
cogl_error_free (ignore_error);
|
|
||||||
cogl_object_unref (target_bmp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Was intermediate used? */
|
/* Was intermediate used? */
|
||||||
|
Loading…
Reference in New Issue
Block a user