mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
auto-texture: revert _new_with_size semantics
This reverts the change in semantics for cogl_texture_new_with_size so that it goes back to allocating textures synchronously and returning NULL if there was a failure to allocate. Only the new/2.0 texture apis will have the lazy allocation behaviour so we avoid breaking existing code. This also fixes a potential crasher by removing a code path that was passing NULL to cogl_texture_allocate() that would have caused and abort if there were an error. Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
08fecbaa84
commit
8ae53cea08
@ -109,14 +109,19 @@ cogl_texture_new_with_size (unsigned int width,
|
|||||||
internal_format));
|
internal_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NB: This api existed before Cogl introduced lazy allocation of
|
||||||
|
* textures and so we maintain its original synchronous allocation
|
||||||
|
* semantics and return NULL if allocation fails... */
|
||||||
|
if (!cogl_texture_allocate (tex, &skip_error))
|
||||||
|
{
|
||||||
|
cogl_error_free (skip_error);
|
||||||
|
cogl_object_unref (tex);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (tex &&
|
if (tex &&
|
||||||
flags & COGL_TEXTURE_NO_AUTO_MIPMAP)
|
flags & COGL_TEXTURE_NO_AUTO_MIPMAP)
|
||||||
{
|
{
|
||||||
/* To be able to iterate the slices of a #CoglTexture2DSliced we
|
|
||||||
* need to ensure the texture is allocated... */
|
|
||||||
if (!cogl_texture_allocate (tex, NULL))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
|
cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
|
||||||
0, 0, 1, 1,
|
0, 0, 1, 1,
|
||||||
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
|
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
|
||||||
|
@ -112,14 +112,7 @@ uint32_t cogl_texture_error_quark (void);
|
|||||||
*
|
*
|
||||||
* Creates a new #CoglTexture with the specified dimensions and pixel format.
|
* Creates a new #CoglTexture with the specified dimensions and pixel format.
|
||||||
*
|
*
|
||||||
* The storage for the texture is not necesarily created before this
|
* Return value: A newly created #CoglTexture or %NULL on failure
|
||||||
* function returns. The storage can be explicitly allocated using
|
|
||||||
* cogl_texture_allocate() or preferably you can let Cogl
|
|
||||||
* automatically allocate the storage lazily when uploading data when
|
|
||||||
* Cogl may know more about how the texture will be used and can
|
|
||||||
* optimize how it is allocated.
|
|
||||||
*
|
|
||||||
* Return value: A newly created #CoglTexture
|
|
||||||
*
|
*
|
||||||
* Since: 0.8
|
* Since: 0.8
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user