From 92b712f6e478a20d4ef7b853c4d162574dedcf83 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 6 Aug 2010 11:44:39 +0100 Subject: [PATCH] cogl-atlas: Increase the default minimum texture size When initially creating a texture it would start with a minimum size of 256x256. This increases the size so that it would try to match 1MB of memory. --- cogl/cogl-atlas.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c index 5b96f00ac..1231e6848 100644 --- a/cogl/cogl-atlas.c +++ b/cogl/cogl-atlas.c @@ -498,9 +498,21 @@ _cogl_atlas_reserve_space (CoglAtlas *atlas, } else { - /* Start with an initial size of 256x256 */ - map_width = 256; - map_height = 256; + /* At least on Intel hardware, the texture size will be rounded + up to at least 1MB so we might as well try to aim for that as + an initial minimum size. If the format is only 1 byte per + pixel we can use 1024x1024, otherwise we'll assume it will + take 4 bytes per pixel and use 512x512. */ + if (_cogl_get_format_bpp (atlas->texture_format) == 1) + { + map_width = 1024; + map_height = 1024; + } + else + { + map_width = 512; + map_height = 512; + } } new_map = _cogl_atlas_create_map (map_width, map_height,