[mutter] compositor: Drop ARB_texture_rectangle awareness
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] compositor: Drop ARB_texture_rectangle awareness
- Date: Thu, 18 Apr 2019 19:06:20 +0000 (UTC)
commit 2a15e5f16a278adf4f0dc0e291ae7d0415c576fc
Author: Adam Jackson <ajax redhat com>
Date: Fri Mar 8 11:46:43 2019 -0500
compositor: Drop ARB_texture_rectangle awareness
The GL/GLES versions we require imply full NPOT texture support, so the
ARB_texture_rectangle path will never be hit.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
src/compositor/cogl-utils.c | 14 +-------
src/compositor/meta-texture-rectangle.c | 61 ---------------------------------
src/compositor/meta-texture-rectangle.h | 36 -------------------
src/compositor/meta-texture-tower.c | 26 ++------------
src/compositor/meta-window-actor.c | 33 +++++-------------
src/meson.build | 2 --
6 files changed, 12 insertions(+), 160 deletions(-)
---
diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c
index 68db1118d..1d47d8895 100644
--- a/src/compositor/cogl-utils.c
+++ b/src/compositor/cogl-utils.c
@@ -77,13 +77,6 @@ meta_create_texture_pipeline (CoglTexture *src_texture)
* Creates a texture of the given size with the specified components
* for use as a frame buffer object.
*
- * If non-power-of-two textures are not supported on the system, then
- * the texture will be created as a texture rectangle; in this case,
- * hardware repeating isn't possible, and texture coordinates are also
- * different, but Cogl hides these issues from the application, except from
- * GLSL shaders. Since GLSL is never (or at least almost never)
- * present on such a system, this is not typically an issue.
- *
* If %META_TEXTURE_ALLOW_SLICING is present in @flags, and the texture
* is larger than the texture size limits of the system, then the texture
* will be created as a sliced texture. This also will cause problems
@@ -101,12 +94,7 @@ meta_create_texture (int width,
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CoglTexture *texture;
- gboolean should_use_rectangle = FALSE;
-
- if (should_use_rectangle)
- texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
- else
- texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
+ texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
cogl_texture_set_components (texture, components);
if ((flags & META_TEXTURE_ALLOW_SLICING) != 0)
diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c
index a41cdc89d..a95ee5ccf 100644
--- a/src/compositor/meta-texture-tower.c
+++ b/src/compositor/meta-texture-tower.c
@@ -25,7 +25,6 @@
#include <math.h>
#include <string.h>
-#include "compositor/meta-texture-rectangle.h"
#include "compositor/meta-texture-tower.h"
#ifndef M_LOG2E
@@ -346,34 +345,15 @@ get_paint_level (int width, int height)
return (int)(0.5 + lambda);
}
-static gboolean
-is_power_of_two (int x)
-{
- return (x & (x - 1)) == 0;
-}
-
static void
texture_tower_create_texture (MetaTextureTower *tower,
int level,
int width,
int height)
{
- if ((!is_power_of_two (width) || !is_power_of_two (height)) &&
- meta_texture_rectangle_check (tower->textures[level - 1]))
- {
- ClutterBackend *backend = clutter_get_default_backend ();
- CoglContext *context = clutter_backend_get_cogl_context (backend);
- CoglTextureRectangle *texture_rectangle;
-
- texture_rectangle = cogl_texture_rectangle_new_with_size (context, width, height);
- tower->textures[level] = COGL_TEXTURE (texture_rectangle);
- }
- else
- {
- tower->textures[level] = cogl_texture_new_with_size (width, height,
- COGL_TEXTURE_NO_AUTO_MIPMAP,
- TEXTURE_FORMAT);
- }
+ tower->textures[level] = cogl_texture_new_with_size (width, height,
+ COGL_TEXTURE_NO_AUTO_MIPMAP,
+ TEXTURE_FORMAT);
tower->invalid[level].x1 = 0;
tower->invalid[level].y1 = 0;
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index f850cb222..837a4c3e9 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -31,7 +31,6 @@
#include "compositor/meta-cullable.h"
#include "compositor/meta-surface-actor-x11.h"
#include "compositor/meta-surface-actor.h"
-#include "compositor/meta-texture-rectangle.h"
#include "compositor/meta-window-actor-private.h"
#include "compositor/region-utils.h"
#include "meta/meta-enum-types.h"
@@ -1507,6 +1506,7 @@ build_and_scan_frame_mask (MetaWindowActor *self,
int stride;
cairo_t *cr;
cairo_surface_t *surface;
+ CoglError *error = NULL;
stex = meta_surface_actor_get_texture (priv->surface);
g_return_if_fail (stex);
@@ -1559,31 +1559,14 @@ build_and_scan_frame_mask (MetaWindowActor *self,
cairo_destroy (cr);
cairo_surface_destroy (surface);
- if (meta_texture_rectangle_check (paint_tex))
- {
- mask_texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width, tex_height));
- cogl_texture_set_components (mask_texture, COGL_TEXTURE_COMPONENTS_A);
- cogl_texture_set_region (mask_texture,
- 0, 0, /* src_x/y */
- 0, 0, /* dst_x/y */
- tex_width, tex_height, /* dst_width/height */
- tex_width, tex_height, /* width/height */
- COGL_PIXEL_FORMAT_A_8,
- stride, mask_data);
- }
- else
- {
- CoglError *error = NULL;
+ mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
+ COGL_PIXEL_FORMAT_A_8,
+ stride, mask_data, &error));
- mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
- COGL_PIXEL_FORMAT_A_8,
- stride, mask_data, &error));
-
- if (error)
- {
- g_warning ("Failed to allocate mask texture: %s", error->message);
- cogl_error_free (error);
- }
+ if (error)
+ {
+ g_warning ("Failed to allocate mask texture: %s", error->message);
+ cogl_error_free (error);
}
meta_shaped_texture_set_mask_texture (stex, mask_texture);
diff --git a/src/meson.build b/src/meson.build
index 9919b5cfb..8ed6cb0cf 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -291,8 +291,6 @@ mutter_sources = [
'compositor/meta-surface-actor-x11.h',
'compositor/meta-sync-ring.c',
'compositor/meta-sync-ring.h',
- 'compositor/meta-texture-rectangle.c',
- 'compositor/meta-texture-rectangle.h',
'compositor/meta-texture-tower.c',
'compositor/meta-texture-tower.h',
'compositor/meta-window-actor.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]