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
This commit is contained in:
Adam Jackson 2019-03-08 11:57:35 -05:00
parent ce6acf9dca
commit d79f176142
4 changed files with 12 additions and 106 deletions

View File

@ -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

View File

@ -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)

View File

@ -2525,51 +2525,6 @@ get_fbconfig_for_depth (CoglContext *context,
return found;
}
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,
@ -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;
}
}

View File

@ -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;