mirror of
https://github.com/brl/mutter.git
synced 2025-02-08 17:44:09 +00:00
cogl: COGL_FEATURE_TEXTURE_NPOT_BASIC is always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
This commit is contained in:
parent
007297f1a6
commit
48f04c7968
@ -562,12 +562,8 @@ create_migration_texture (CoglContext *ctx,
|
|||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
/* 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, width, height));
|
||||||
width, height));
|
|
||||||
|
|
||||||
_cogl_texture_set_internal_format (tex, internal_format);
|
_cogl_texture_set_internal_format (tex, internal_format);
|
||||||
|
|
||||||
@ -581,9 +577,6 @@ create_migration_texture (CoglContext *ctx,
|
|||||||
cogl_object_unref (tex);
|
cogl_object_unref (tex);
|
||||||
tex = NULL;
|
tex = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
|
@ -174,12 +174,6 @@ cogl_is_context (void *object);
|
|||||||
* experimental since it's only useable with experimental API... */
|
* experimental since it's only useable with experimental API... */
|
||||||
/**
|
/**
|
||||||
* CoglFeatureID:
|
* CoglFeatureID:
|
||||||
* @COGL_FEATURE_ID_TEXTURE_NPOT_BASIC: The hardware supports non power
|
|
||||||
* of two textures, but you also need to check the
|
|
||||||
* %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT
|
|
||||||
* features to know if the hardware supports npot texture mipmaps
|
|
||||||
* or repeat modes other than
|
|
||||||
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
|
||||||
* @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
|
||||||
@ -229,8 +223,7 @@ cogl_is_context (void *object);
|
|||||||
*/
|
*/
|
||||||
typedef enum _CoglFeatureID
|
typedef enum _CoglFeatureID
|
||||||
{
|
{
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
|
COGL_FEATURE_ID_TEXTURE_NPOT = 1,
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT,
|
|
||||||
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
|
COGL_FEATURE_ID_TEXTURE_RECTANGLE,
|
||||||
COGL_FEATURE_ID_OFFSCREEN,
|
COGL_FEATURE_ID_OFFSCREEN,
|
||||||
COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
|
COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
|
||||||
|
@ -333,12 +333,6 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
|||||||
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
|
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
|
||||||
* cogl_vertex_buffer_indices_new().
|
* cogl_vertex_buffer_indices_new().
|
||||||
* @COGL_FEATURE_DEPTH_RANGE: cogl_material_set_depth_range() support
|
* @COGL_FEATURE_DEPTH_RANGE: cogl_material_set_depth_range() support
|
||||||
* @COGL_FEATURE_TEXTURE_NPOT_BASIC: The hardware supports non power
|
|
||||||
* of two textures, but you also need to check the
|
|
||||||
* %COGL_FEATURE_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_TEXTURE_NPOT_REPEAT
|
|
||||||
* features to know if the hardware supports npot texture mipmaps
|
|
||||||
* or repeat modes other than
|
|
||||||
* %COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
|
|
||||||
* @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
|
||||||
@ -367,7 +361,6 @@ typedef enum
|
|||||||
COGL_FEATURE_PBOS = (1 << 12),
|
COGL_FEATURE_PBOS = (1 << 12),
|
||||||
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_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),
|
||||||
|
@ -82,9 +82,6 @@ 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)) ||
|
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
/* 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));
|
||||||
|
|
||||||
@ -97,9 +94,6 @@ cogl_texture_new_with_size (unsigned int width,
|
|||||||
cogl_object_unref (tex);
|
cogl_object_unref (tex);
|
||||||
tex = NULL;
|
tex = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
@ -209,7 +203,6 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
gboolean can_convert_in_place,
|
gboolean can_convert_in_place,
|
||||||
CoglError **error)
|
CoglError **error)
|
||||||
{
|
{
|
||||||
CoglContext *ctx = _cogl_bitmap_get_context (bitmap);
|
|
||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglError *internal_error = NULL;
|
CoglError *internal_error = NULL;
|
||||||
|
|
||||||
@ -233,10 +226,6 @@ _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) &&
|
|
||||||
_cogl_util_is_pot (bitmap->height)) ||
|
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
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));
|
||||||
|
|
||||||
@ -249,9 +238,6 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
cogl_object_unref (tex);
|
cogl_object_unref (tex);
|
||||||
tex = NULL;
|
tex = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
|
@ -83,13 +83,6 @@ _cogl_texture_2d_gl_can_create (CoglContext *ctx,
|
|||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
|
|
||||||
/* If NPOT textures aren't supported then the size must be a power
|
|
||||||
of two */
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
|
|
||||||
(!_cogl_util_is_pot (width) ||
|
|
||||||
!_cogl_util_is_pot (height)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
ctx->driver_vtable->pixel_format_to_gl (ctx,
|
ctx->driver_vtable->pixel_format_to_gl (ctx,
|
||||||
internal_format,
|
internal_format,
|
||||||
&gl_intformat,
|
&gl_intformat,
|
||||||
|
@ -407,10 +407,8 @@ _cogl_driver_update_features (CoglContext *ctx,
|
|||||||
gl_minor,
|
gl_minor,
|
||||||
gl_extensions);
|
gl_extensions);
|
||||||
|
|
||||||
flags |= COGL_FEATURE_TEXTURE_NPOT
|
flags |= COGL_FEATURE_TEXTURE_NPOT;
|
||||||
| COGL_FEATURE_TEXTURE_NPOT_BASIC;
|
|
||||||
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);
|
|
||||||
|
|
||||||
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,
|
||||||
|
@ -305,11 +305,8 @@ _cogl_driver_update_features (CoglContext *context,
|
|||||||
flags |= COGL_FEATURE_OFFSCREEN;
|
flags |= COGL_FEATURE_OFFSCREEN;
|
||||||
/* Note GLES 2 core doesn't support mipmaps for npot textures or
|
/* Note GLES 2 core doesn't support mipmaps for npot textures or
|
||||||
* repeat modes other than CLAMP_TO_EDGE. */
|
* repeat modes other than CLAMP_TO_EDGE. */
|
||||||
flags |= COGL_FEATURE_TEXTURE_NPOT_BASIC;
|
|
||||||
flags |= COGL_FEATURE_DEPTH_RANGE;
|
flags |= COGL_FEATURE_DEPTH_RANGE;
|
||||||
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE);
|
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE);
|
||||||
COGL_FLAGS_SET (context->features,
|
|
||||||
COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
|
||||||
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_RANGE, TRUE);
|
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_RANGE, TRUE);
|
||||||
COGL_FLAGS_SET (context->features,
|
COGL_FLAGS_SET (context->features,
|
||||||
COGL_FEATURE_ID_MIRRORED_REPEAT, TRUE);
|
COGL_FEATURE_ID_MIRRORED_REPEAT, TRUE);
|
||||||
@ -349,11 +346,8 @@ _cogl_driver_update_features (CoglContext *context,
|
|||||||
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_TEXTURE, TRUE);
|
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_TEXTURE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
flags |= (COGL_FEATURE_TEXTURE_NPOT |
|
flags |= COGL_FEATURE_TEXTURE_NPOT;
|
||||||
COGL_FEATURE_TEXTURE_NPOT_BASIC);
|
|
||||||
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_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE);
|
|
||||||
|
|
||||||
if (context->glMapBuffer)
|
if (context->glMapBuffer)
|
||||||
{
|
{
|
||||||
|
@ -582,12 +582,8 @@ create_fallback_texture (CoglContext *ctx,
|
|||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((_cogl_util_is_pot (width) && _cogl_util_is_pot (height)) ||
|
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
/* 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, width, height));
|
||||||
width, height));
|
|
||||||
|
|
||||||
_cogl_texture_set_internal_format (tex, internal_format);
|
_cogl_texture_set_internal_format (tex, internal_format);
|
||||||
|
|
||||||
@ -601,9 +597,6 @@ create_fallback_texture (CoglContext *ctx,
|
|||||||
cogl_object_unref (tex);
|
cogl_object_unref (tex);
|
||||||
tex = NULL;
|
tex = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
|
@ -361,12 +361,8 @@ test_utils_texture_new_with_size (CoglContext *ctx,
|
|||||||
CoglTexture *tex;
|
CoglTexture *tex;
|
||||||
CoglError *skip_error = NULL;
|
CoglError *skip_error = NULL;
|
||||||
|
|
||||||
if ((test_utils_is_pot (width) && test_utils_is_pot (height)) ||
|
|
||||||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
/* 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, width, height));
|
||||||
width, height));
|
|
||||||
|
|
||||||
cogl_texture_set_components (tex, components);
|
cogl_texture_set_components (tex, components);
|
||||||
|
|
||||||
@ -376,9 +372,6 @@ test_utils_texture_new_with_size (CoglContext *ctx,
|
|||||||
cogl_object_unref (tex);
|
cogl_object_unref (tex);
|
||||||
tex = NULL;
|
tex = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
@ -439,10 +432,6 @@ 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)) &&
|
|
||||||
test_utils_is_pot (cogl_bitmap_get_height (bitmap))) ||
|
|
||||||
(cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC)))
|
|
||||||
{
|
|
||||||
tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap));
|
tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap));
|
||||||
|
|
||||||
cogl_texture_set_premultiplied (tex, premultiplied);
|
cogl_texture_set_premultiplied (tex, premultiplied);
|
||||||
@ -460,9 +449,6 @@ test_utils_texture_new_from_bitmap (CoglBitmap *bitmap,
|
|||||||
cogl_error_free (internal_error);
|
cogl_error_free (internal_error);
|
||||||
internal_error = NULL;
|
internal_error = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
tex = NULL;
|
|
||||||
|
|
||||||
if (!tex)
|
if (!tex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user