summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-03-08 11:57:35 -0500
committerAdam Jackson <ajax@redhat.com>2019-04-18 12:53:14 -0400
commitd79f17614289f0831d973181d8fcfec72a221847 (patch)
treea3dc8fa20c3ec985606e2eef2607bb9c60c6f529
parentce6acf9dca74b9e2b65e802dd95004d9016ccccc (diff)
downloadmutter-d79f17614289f0831d973181d8fcfec72a221847.tar.gz
cogl: Remove texture_rectangle awareness from the GLX TFP code
GL 2.1 implies ARB_texture_non_power_of_two so this will never be hit. https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
-rw-r--r--cogl/cogl/cogl-context-private.h2
-rw-r--r--cogl/cogl/cogl-context.c3
-rw-r--r--cogl/cogl/winsys/cogl-winsys-glx.c106
-rw-r--r--cogl/cogl/winsys/cogl-winsys-private.h7
4 files changed, 12 insertions, 106 deletions
diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h
index fc3b77c3e..bc92d07c3 100644
--- a/cogl/cogl/cogl-context-private.h
+++ b/cogl/cogl/cogl-context-private.h
@@ -295,8 +295,6 @@ struct _CoglContext
gboolean buffer_map_fallback_in_use;
size_t buffer_map_fallback_offset;
- CoglWinsysRectangleState rectangle_state;
-
CoglSamplerCache *sampler_cache;
/* FIXME: remove these when we remove the last xlib based clutter
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index b5535d8f1..9a575d88e 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -172,9 +172,6 @@ cogl_context_new (CoglDisplay *display,
memset (context->features, 0, sizeof (context->features));
context->feature_flags = 0;
memset (context->private_features, 0, sizeof (context->private_features));
-
- context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_UNKNOWN;
-
memset (context->winsys_features, 0, sizeof (context->winsys_features));
if (!display)
diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c
index 98edfe3a1..3e595338f 100644
--- a/cogl/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/cogl/winsys/cogl-winsys-glx.c
@@ -2526,51 +2526,6 @@ get_fbconfig_for_depth (CoglContext *context,
}
static gboolean
-should_use_rectangle (CoglContext *context)
-{
-
- if (context->rectangle_state == COGL_WINSYS_RECTANGLE_STATE_UNKNOWN)
- {
- if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
- {
- const char *rect_env;
-
- /* Use the rectangle only if it is available and either:
-
- the COGL_PIXMAP_TEXTURE_RECTANGLE environment variable is
- set to 'force'
-
- *or*
-
- the env var is set to 'allow' or not set and NPOTs textures
- are not available */
-
- context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_DISABLE;
-
- if ((rect_env = g_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
- /* For compatibility, we'll also look at the old Clutter
- environment variable */
- (rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
- {
- if (g_ascii_strcasecmp (rect_env, "force") == 0)
- context->rectangle_state =
- COGL_WINSYS_RECTANGLE_STATE_ENABLE;
- else if (g_ascii_strcasecmp (rect_env, "disable") == 0)
- context->rectangle_state =
- COGL_WINSYS_RECTANGLE_STATE_DISABLE;
- else if (g_ascii_strcasecmp (rect_env, "allow"))
- g_warning ("Unknown value for COGL_PIXMAP_TEXTURE_RECTANGLE, "
- "should be 'force' or 'disable'");
- }
- }
- else
- context->rectangle_state = COGL_WINSYS_RECTANGLE_STATE_DISABLE;
- }
-
- return context->rectangle_state == COGL_WINSYS_RECTANGLE_STATE_ENABLE;
-}
-
-static gboolean
try_create_glx_pixmap (CoglContext *context,
CoglTexturePixmapX11 *tex_pixmap,
gboolean mipmap)
@@ -2586,7 +2541,6 @@ try_create_glx_pixmap (CoglContext *context,
GLXFBConfig fb_config = (GLXFBConfig)0;
int attribs[7];
int i = 0;
- GLenum target;
CoglXlibTrapState trap_state;
unsigned int depth = tex_pixmap->depth;
@@ -2607,14 +2561,6 @@ try_create_glx_pixmap (CoglContext *context,
return FALSE;
}
- if (should_use_rectangle (context))
- {
- target = GLX_TEXTURE_RECTANGLE_EXT;
- glx_tex_pixmap->can_mipmap = FALSE;
- }
- else
- target = GLX_TEXTURE_2D_EXT;
-
if (!glx_tex_pixmap->can_mipmap)
mipmap = FALSE;
@@ -2635,7 +2581,7 @@ try_create_glx_pixmap (CoglContext *context,
attribs[i++] = mipmap;
attribs[i++] = GLX_TEXTURE_TARGET_EXT;
- attribs[i++] = target;
+ attribs[i++] = GLX_TEXTURE_2D_EXT;
attribs[i++] = None;
@@ -2818,49 +2764,21 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
COGL_PIXEL_FORMAT_RGBA_8888_PRE :
COGL_PIXEL_FORMAT_RGB_888);
- if (should_use_rectangle (ctx))
- {
- texture_info->glx_tex = COGL_TEXTURE (
- cogl_texture_rectangle_new_with_size (ctx,
- tex->width,
- tex->height));
+ texture_info->glx_tex = COGL_TEXTURE (
+ cogl_texture_2d_new_with_size (ctx, tex->width, tex->height));
- _cogl_texture_set_internal_format (tex, texture_format);
+ _cogl_texture_set_internal_format (tex, texture_format);
- if (cogl_texture_allocate (texture_info->glx_tex, &error))
- COGL_NOTE (TEXTURE_PIXMAP, "Created a texture rectangle for %p",
- tex_pixmap);
- else
- {
- COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a "
- "texture rectangle could not be created: %s",
- tex_pixmap, error->message);
- cogl_error_free (error);
- free_glx_pixmap (ctx, glx_tex_pixmap);
- return FALSE;
- }
- }
+ if (cogl_texture_allocate (texture_info->glx_tex, &error))
+ COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p", tex_pixmap);
else
{
- texture_info->glx_tex = COGL_TEXTURE (
- cogl_texture_2d_new_with_size (ctx,
- tex->width,
- tex->height));
-
- _cogl_texture_set_internal_format (tex, texture_format);
-
- if (cogl_texture_allocate (texture_info->glx_tex, &error))
- COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p",
- tex_pixmap);
- else
- {
- COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a "
- "texture 2d could not be created: %s",
- tex_pixmap, error->message);
- cogl_error_free (error);
- free_glx_pixmap (ctx, glx_tex_pixmap);
- return FALSE;
- }
+ COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a "
+ "texture 2d could not be created: %s",
+ tex_pixmap, error->message);
+ cogl_error_free (error);
+ free_glx_pixmap (ctx, glx_tex_pixmap);
+ return FALSE;
}
}
diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h
index c6b2f3579..759d8615c 100644
--- a/cogl/cogl/winsys/cogl-winsys-private.h
+++ b/cogl/cogl/winsys/cogl-winsys-private.h
@@ -64,13 +64,6 @@ typedef enum /*< prefix=COGL_WINSYS_ERROR >*/
COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT,
} CoglWinsysError;
-typedef enum
-{
- COGL_WINSYS_RECTANGLE_STATE_UNKNOWN,
- COGL_WINSYS_RECTANGLE_STATE_DISABLE,
- COGL_WINSYS_RECTANGLE_STATE_ENABLE
-} CoglWinsysRectangleState;
-
typedef struct _CoglWinsysVtable
{
CoglWinsysID id;