After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 657840 - Atlas-ed bitmaps converted too many times
Atlas-ed bitmaps converted too many times
Status: RESOLVED FIXED
Product: cogl
Classification: Platform
Component: CoglTexture
unspecified
Other All
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-08-31 16:31 UTC by Neil Roberts
Modified: 2011-09-05 19:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
texture: Call _cogl_texture_prepare_for_upload in set_region impl (13.01 KB, patch)
2011-08-31 16:31 UTC, Neil Roberts
none Details | Review

Description Neil Roberts 2011-08-31 16:31:23 UTC
Quoted from a message on clutter-devel-list:

When I call clutter_texture_set_from_data with an RGB-888 bitmap and I'm
using the atlas,
_cogl_atlas_texture_new_from_bitmap ends up being called. This one calls
_cogl_atlas_texture_set_region_with_border, which
calls _cogl_texture_set_region_from_bitmap
**** 5 **** times. Since the bitmap is RGB and the atlas is RGBA, the bitmap
gets converted to
RGBA 5 times, which seems wasteful.

http://lists.clutter-project.org/pipermail/clutter-devel-list/2011-August/000252.html
Comment 1 Neil Roberts 2011-08-31 16:31:25 UTC
Created attachment 195323 [details] [review]
texture: Call _cogl_texture_prepare_for_upload in set_region impl

Instead of calling _cogl_texutre_prepare_for_upload in
cogl_texture_set_region_from_bitmap the call is now deferred to the
implementation of the virtual for set_region. This is needed if the
texture backend is using a different format for the actual GL texture
than what is reported by cogl_texture_get_format. This happens for
example with atlas textures which report the original internal format
specified when the texture was created but actually always store the
data in an RGBA texture.

Also when creating an atlas texture from a bitmap it was preparing the
bitmap to be uploaded to the original format instead of the format of
the actual texture used for the atlas. Then it was using
cogl_texture_set_region_from_bitmap to upload the 5 pieces to make the
copies of the edge pixels. This would end up converting the image to
the actual format 5 times. The atlas textures have now been changed to
prepare the bitmap for the right format.
Comment 2 Robert Bragg 2011-09-05 19:55:00 UTC
thanks, I landed the patch in master as 503f138fb67f6c0