[Cogl] [PATCH] cogl-gst: allocate textures synchronously
Neil Roberts
neil at linux.intel.com
Mon Jan 13 07:12:59 PST 2014
Just to note in case we do decide to stick with the CoglBitmap approach,
I think there is a small bug. If the first texture fails to allocate it
would need to set tex to NULL so that it would hit the fallback sliced
path below. Otherwise it would just return the unallocated texture.
Regards,
- Neil
Robert Bragg <robert at sixbynine.org> writes:
> From: Robert Bragg <robert at linux.intel.com>
>
> This makes sure video textures being uploaded via
> video_texture_new_from_data are allocated before the function returns.
> This function create a CoglBitmap to wrap the data from gstreamer and by
> allowing cogl to allocate the texture lazily it's possible that the data
> being pointed to by the bitmap won't remain valid until we actually come
> to allocate the texture.
> ---
> cogl-gst/cogl-gst-video-sink.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
> index 5307d87..e68e7bf 100644
> --- a/cogl-gst/cogl-gst-video-sink.c
> +++ b/cogl-gst/cogl-gst-video-sink.c
> @@ -488,7 +488,8 @@ video_texture_new_from_data (CoglContext *ctx,
> cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC))
> {
> tex = cogl_texture_2d_new_from_bitmap (bitmap);
> - if (!tex)
> +
> + if (!cogl_texture_allocate (tex, &internal_error))
> {
> cogl_error_free (internal_error);
> internal_error = NULL;
> @@ -502,6 +503,7 @@ video_texture_new_from_data (CoglContext *ctx,
> /* Otherwise create a sliced texture */
> tex = cogl_texture_2d_sliced_new_from_bitmap (bitmap,
> -1); /* no maximum waste */
> + cogl_texture_allocate (tex, NULL);
> }
>
> cogl_object_unref (bitmap);
> --
> 1.8.5.2
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list