mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
cogl: COGL_FEATURE_TEXTURE_NPOT_MIPMAP is always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
This commit is contained in:
parent
302a171c08
commit
007297f1a6
@ -563,8 +563,7 @@ create_migration_texture (CoglContext *ctx,
|
|||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
/* First try creating a fast-path non-sliced texture */
|
/* First try creating a fast-path non-sliced texture */
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||||
|
@ -180,8 +180,6 @@ cogl_is_context (void *object);
|
|||||||
* features to know if the hardware supports npot texture mipmaps
|
* features to know if the hardware supports npot texture mipmaps
|
||||||
* or repeat modes other than
|
* or repeat modes other than
|
||||||
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
||||||
* @COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in
|
|
||||||
* conjuntion with non power of two textures.
|
|
||||||
* @COGL_FEATURE_ID_TEXTURE_NPOT: Non power of two textures are supported
|
* @COGL_FEATURE_ID_TEXTURE_NPOT: Non power of two textures are supported
|
||||||
* by the hardware. This is a equivalent to the
|
* by the hardware. This is a equivalent to the
|
||||||
* %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP
|
* %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP
|
||||||
@ -232,7 +230,6 @@ cogl_is_context (void *object);
|
|||||||
typedef enum _CoglFeatureID
|
typedef enum _CoglFeatureID
|
||||||
{
|
{
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
|
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP,
|
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT,
|
COGL_FEATURE_ID_TEXTURE_NPOT,
|
||||||
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
|
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
|
||||||
COGL_FEATURE_ID_OFFSCREEN,
|
COGL_FEATURE_ID_OFFSCREEN,
|
||||||
|
@ -339,8 +339,6 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
|||||||
* features to know if the hardware supports npot texture mipmaps
|
* features to know if the hardware supports npot texture mipmaps
|
||||||
* or repeat modes other than
|
* or repeat modes other than
|
||||||
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
||||||
* @COGL_FEATURE_TEXTURE_NPOT_MIPMAP: Mipmapping is supported in
|
|
||||||
* conjuntion with non power of two textures.
|
|
||||||
* @COGL_FEATURE_POINT_SPRITE: Whether
|
* @COGL_FEATURE_POINT_SPRITE: Whether
|
||||||
* cogl_material_set_layer_point_sprite_coords_enabled() is supported.
|
* cogl_material_set_layer_point_sprite_coords_enabled() is supported.
|
||||||
* @COGL_FEATURE_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is
|
* @COGL_FEATURE_MAP_BUFFER_FOR_READ: Whether cogl_buffer_map() is
|
||||||
@ -370,7 +368,6 @@ typedef enum
|
|||||||
COGL_FEATURE_UNSIGNED_INT_INDICES = (1 << 13),
|
COGL_FEATURE_UNSIGNED_INT_INDICES = (1 << 13),
|
||||||
COGL_FEATURE_DEPTH_RANGE = (1 << 14),
|
COGL_FEATURE_DEPTH_RANGE = (1 << 14),
|
||||||
COGL_FEATURE_TEXTURE_NPOT_BASIC = (1 << 15),
|
COGL_FEATURE_TEXTURE_NPOT_BASIC = (1 << 15),
|
||||||
COGL_FEATURE_TEXTURE_NPOT_MIPMAP = (1 << 16),
|
|
||||||
COGL_FEATURE_POINT_SPRITE = (1 << 18),
|
COGL_FEATURE_POINT_SPRITE = (1 << 18),
|
||||||
COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21),
|
COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21),
|
||||||
COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22),
|
COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22),
|
||||||
|
@ -83,8 +83,7 @@ cogl_texture_new_with_size (unsigned int width,
|
|||||||
_COGL_GET_CONTEXT (ctx, NULL);
|
_COGL_GET_CONTEXT (ctx, NULL);
|
||||||
|
|
||||||
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
/* First try creating a fast-path non-sliced texture */
|
/* First try creating a fast-path non-sliced texture */
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
|
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
|
||||||
@ -236,8 +235,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
/* If that doesn't work try a fast path 2D texture */
|
/* If that doesn't work try a fast path 2D texture */
|
||||||
if ((_cogl_util_is_pot (bitmap->width) &&
|
if ((_cogl_util_is_pot (bitmap->width) &&
|
||||||
_cogl_util_is_pot (bitmap->height)) ||
|
_cogl_util_is_pot (bitmap->height)) ||
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
tex = COGL_TEXTURE (_cogl_texture_2d_new_from_bitmap (bitmap,
|
tex = COGL_TEXTURE (_cogl_texture_2d_new_from_bitmap (bitmap,
|
||||||
can_convert_in_place));
|
can_convert_in_place));
|
||||||
|
@ -408,11 +408,9 @@ _cogl_driver_update_features (CoglContext *ctx,
|
|||||||
gl_extensions);
|
gl_extensions);
|
||||||
|
|
||||||
flags |= COGL_FEATURE_TEXTURE_NPOT
|
flags |= COGL_FEATURE_TEXTURE_NPOT
|
||||||
| COGL_FEATURE_TEXTURE_NPOT_BASIC
|
| COGL_FEATURE_TEXTURE_NPOT_BASIC;
|
||||||
| COGL_FEATURE_TEXTURE_NPOT_MIPMAP;
|
|
||||||
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT, TRUE);
|
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT, TRUE);
|
||||||
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
||||||
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE);
|
|
||||||
|
|
||||||
if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions))
|
if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions))
|
||||||
COGL_FLAGS_SET (private_features,
|
COGL_FLAGS_SET (private_features,
|
||||||
|
@ -350,13 +350,10 @@ _cogl_driver_update_features (CoglContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags |= (COGL_FEATURE_TEXTURE_NPOT |
|
flags |= (COGL_FEATURE_TEXTURE_NPOT |
|
||||||
COGL_FEATURE_TEXTURE_NPOT_BASIC |
|
COGL_FEATURE_TEXTURE_NPOT_BASIC);
|
||||||
COGL_FEATURE_TEXTURE_NPOT_MIPMAP);
|
|
||||||
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TEXTURE_NPOT, TRUE);
|
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TEXTURE_NPOT, TRUE);
|
||||||
COGL_FLAGS_SET (context->features,
|
COGL_FLAGS_SET (context->features,
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
||||||
COGL_FLAGS_SET (context->features,
|
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE);
|
|
||||||
|
|
||||||
if (context->glMapBuffer)
|
if (context->glMapBuffer)
|
||||||
{
|
{
|
||||||
|
@ -583,8 +583,7 @@ create_fallback_texture (CoglContext *ctx,
|
|||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
/* First try creating a fast-path non-sliced texture */
|
/* First try creating a fast-path non-sliced texture */
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||||
|
@ -362,8 +362,7 @@ test_utils_texture_new_with_size (CoglContext *ctx,
|
|||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((test_utils_is_pot (width) && test_utils_is_pot (height)) ||
|
if ((test_utils_is_pot (width) && test_utils_is_pot (height)) ||
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
/* First try creating a fast-path non-sliced texture */
|
/* First try creating a fast-path non-sliced texture */
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
|
||||||
@ -442,8 +441,7 @@ test_utils_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
/* If that doesn't work try a fast path 2D texture */
|
/* If that doesn't work try a fast path 2D texture */
|
||||||
if ((test_utils_is_pot (cogl_bitmap_get_width (bitmap)) &&
|
if ((test_utils_is_pot (cogl_bitmap_get_width (bitmap)) &&
|
||||||
test_utils_is_pot (cogl_bitmap_get_height (bitmap))) ||
|
test_utils_is_pot (cogl_bitmap_get_height (bitmap))) ||
|
||||||
(cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
(cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
||||||
cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
|
|
||||||
{
|
{
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap));
|
tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user