[cogl/cogl-1.18] atlas: defer checks until allocation
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-1.18] atlas: defer checks until allocation
- Date: Thu, 9 Jan 2014 16:01:09 +0000 (UTC)
commit bab33bf0f3ea2a19e0900aca8f3e7604e79485ea
Author: Robert Bragg <robert linux intel com>
Date: Mon Jun 24 11:50:56 2013 +0100
atlas: defer checks until allocation
This defers checking the internal format and whether accelerated
migration is supported until allocating the texture.
Reviewed-by: Neil Roberts <neil linux intel com>
(cherry picked from commit 83b05cbe3969789bc3ec78480c0937a6722efbf1)
cogl/cogl-atlas-texture.c | 48 ++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c
index 5e2fd96..2ae71b3 100644
--- a/cogl/cogl-atlas-texture.c
+++ b/cogl/cogl-atlas-texture.c
@@ -658,32 +658,8 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
* data structure */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL);
- /* If we can't use FBOs then it will be too slow to migrate textures
- and we shouldn't use the atlas */
- if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
- {
- _cogl_set_error (error,
- COGL_SYSTEM_ERROR,
- COGL_SYSTEM_ERROR_UNSUPPORTED,
- "Atlasing disabled because migrations "
- "would be too slow");
- return NULL;
- }
-
COGL_NOTE (ATLAS, "Adding texture of size %ix%i", width, height);
- /* If the texture is in a strange format then we won't use it */
- if (!_cogl_atlas_texture_can_use_format (internal_format))
- {
- COGL_NOTE (ATLAS, "Texture can not be added because the "
- "format is unsupported");
- _cogl_set_error (error,
- COGL_TEXTURE_ERROR,
- COGL_TEXTURE_ERROR_FORMAT,
- "Texture format unsuitable for atlasing");
- return NULL;
- }
-
/* We need to allocate the texture now because we need the pointer
to set as the data for the rectangle in the atlas */
atlas_tex = g_new (CoglAtlasTexture, 1);
@@ -713,6 +689,30 @@ _cogl_atlas_texture_allocate (CoglTexture *tex,
CoglAtlas *atlas;
GSList *l;
+ /* If the texture is in a strange format then we won't use it */
+ if (!_cogl_atlas_texture_can_use_format (atlas_tex->format))
+ {
+ COGL_NOTE (ATLAS, "Texture can not be added because the "
+ "format is unsupported");
+ _cogl_set_error (error,
+ COGL_TEXTURE_ERROR,
+ COGL_TEXTURE_ERROR_FORMAT,
+ "Texture format unsuitable for atlasing");
+ return FALSE;
+ }
+
+ /* If we can't use FBOs then it will be too slow to migrate textures
+ and we shouldn't use the atlas */
+ if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
+ {
+ _cogl_set_error (error,
+ COGL_SYSTEM_ERROR,
+ COGL_SYSTEM_ERROR_UNSUPPORTED,
+ "Atlasing disabled because migrations "
+ "would be too slow");
+ return FALSE;
+ }
+
/* Look for an existing atlas that can hold the texture */
for (l = ctx->atlases; l; l = l->next)
/* Try to make some space in the atlas for the texture */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]