From e3e74a4a9760649ee571df0a140d419f8757d906 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Thu, 16 Feb 2006 02:57:51 +0000 Subject: GL_ARB_texture_rectangle and GL_ARB_texture_border_clamp are no longer required for texture objects --- ChangeLog | 4 ++++ src/glitz_texture.c | 40 +++++++++++++--------------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86b21e8..e9a1859 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-02-16 David Reveman + * src/glitz_texture.c: Fix so that GL_ARB_texture_rectangle + and GL_ARB_texture_border_clamp are not required for texture + object creation. + * TODO: Add note about removing some complexity. * src/glitz_pixel.c (glitz_get_pixels): Patch together clipped diff --git a/src/glitz_texture.c b/src/glitz_texture.c index b372d83..ddb5cbf 100644 --- a/src/glitz_texture.c +++ b/src/glitz_texture.c @@ -69,24 +69,15 @@ glitz_texture_init (glitz_texture_t *texture, GLITZ_TEXTURE_FLAG_PADABLE_MASK; break; default: + texture->box.x1 = texture->box.y1 = 0; + texture->box.x2 = texture->width = width; + texture->box.y2 = texture->height = height; + + texture->flags = GLITZ_TEXTURE_FLAG_PADABLE_MASK | + GLITZ_TEXTURE_FLAG_REPEATABLE_MASK; + if (feature_mask & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) - { - texture->box.x1 = texture->box.y1 = 0; - texture->box.x2 = texture->width = width; - texture->box.y2 = texture->height = height; - texture->flags = GLITZ_TEXTURE_FLAG_CLAMPABLE_MASK | - GLITZ_TEXTURE_FLAG_REPEATABLE_MASK | - GLITZ_TEXTURE_FLAG_PADABLE_MASK; - } - else - { - texture->box.x1 = texture->box.y1 = 1; - texture->box.x2 = width + 1; - texture->box.y2 = height + 1; - texture->width = width + 2; - texture->height = height + 2; - texture->flags = GLITZ_TEXTURE_FLAG_CLAMPABLE_MASK; - } + texture->flags |= GLITZ_TEXTURE_FLAG_CLAMPABLE_MASK; } if (!unnormalized && @@ -180,8 +171,8 @@ glitz_texture_allocate (glitz_gl_proc_address_list_t *gl, glitz_texture_bind (gl, texture); if (TEXTURE_CLAMPABLE (texture) && - (texture->box.x2 != texture->width || - texture->box.y2 != texture->height)) + (texture->box.x2 > texture->width || + texture->box.y2 > texture->height)) { data = malloc (texture->width * texture->height); if (data) @@ -353,14 +344,9 @@ glitz_texture_object_create (glitz_surface_t *surface) GLITZ_GL_SURFACE (surface); - /* GL_ARB_texture_rectangle is required for sane texture coordinates. - GL_ARB_texture_border_clamp is required right now as glitz will - emulate it when missing, which means a 1 pixel translucent black - border inside textures and that cannot be exposed to clients. */ - if ((!(surface->drawable->backend->feature_mask & - GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)) || - (!(surface->drawable->backend->feature_mask & - GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK))) + /* texture dimensions must match surface dimensions */ + if (surface->texture.width != surface->box.x2 && + surface->texture.height != surface->box.y2) return 0; texture = malloc (sizeof (glitz_texture_object_t)); -- cgit v1.2.3