[cogl/wip/rig: 30/33] Remove support for CoglTextureRectangle



commit f9df324afb7f88627931066212340d464debe156
Author: Robert Bragg <robert sixbynine org>
Date:   Thu Jun 12 01:25:56 2014 +0100

    Remove support for CoglTextureRectangle
    
    TextureRectangle used to be useful for supporting X11 texture from
    pixmap on older ATI cards without full NPOT texture support and
    theoretically it was there to help at times when it's preferable
    to access a texture with non-normalized coordinates.
    
    More recent versions of glsl now offer a way to sample texture with
    non-normalized coordinates and so in practice this feature represents
    quite a lot of code and special cases for non-normalized coordinates for
    basically zero benefit.

 cogl/Makefile.sources                          |    3 -
 cogl/cogl-context-private.h                    |    2 -
 cogl/cogl-context.c                            |   26 -
 cogl/cogl-context.h                            |    3 -
 cogl/cogl-framebuffer.h                        |   21 +-
 cogl/cogl-meta-texture.c                       |   92 +---
 cogl/cogl-offscreen.h                          |    4 +-
 cogl/cogl-pipeline-layer-state.c               |    9 -
 cogl/cogl-pipeline.c                           |    4 -
 cogl/cogl-primitive-texture.h                  |   10 +-
 cogl/cogl-primitive.h                          |   44 +-
 cogl/cogl-primitives.c                         |   38 +-
 cogl/cogl-sub-texture.c                        |   63 +--
 cogl/cogl-texture-driver.h                     |    9 -
 cogl/cogl-texture-rectangle-private.h          |   66 --
 cogl/cogl-texture-rectangle.c                  |  771 ------------------------
 cogl/cogl-texture-rectangle.h                  |  208 -------
 cogl/cogl-texture.c                            |    5 +-
 cogl/cogl-texture.h                            |   16 +-
 cogl/cogl.h                                    |    1 -
 cogl/cogl.symbols                              |    3 -
 cogl/driver/gl/cogl-framebuffer-gl.c           |    6 +-
 cogl/driver/gl/cogl-pipeline-opengl.c          |    3 -
 cogl/driver/gl/cogl-texture-2d-gl.c            |   10 -
 cogl/driver/gl/cogl-util-gl.c                  |   12 -
 cogl/driver/gl/gl/cogl-driver-gl.c             |    4 -
 cogl/driver/gl/gl/cogl-texture-driver-gl.c     |   27 -
 cogl/driver/gl/gles/cogl-texture-driver-gles.c |   11 -
 cogl/winsys/cogl-texture-pixmap-x11.c          |   92 +---
 cogl/winsys/cogl-winsys-glx.c                  |  110 +---
 doc/reference/cogl2/cogl2-docs.xml.in          |    1 -
 doc/reference/cogl2/cogl2-sections.txt         |    9 -
 examples/cogl-info.c                           |    6 -
 test-fixtures/test-utils.c                     |    6 -
 test-fixtures/test-utils.h                     |    1 -
 tests/conform/Makefile.am                      |    2 -
 tests/conform/test-conform-main.c              |    4 -
 tests/conform/test-texture-no-allocate.c       |    9 -
 tests/conform/test-wrap-rectangle-textures.c   |  175 ------
 39 files changed, 114 insertions(+), 1772 deletions(-)
---
diff --git a/cogl/Makefile.sources b/cogl/Makefile.sources
index 5bdfd8f..aaead0b 100644
--- a/cogl/Makefile.sources
+++ b/cogl/Makefile.sources
@@ -42,7 +42,6 @@ cogl_public_h = \
        cogl-texture-2d-sliced.h      \
        cogl-texture-2d.h             \
        cogl-texture-3d.h             \
-       cogl-texture-rectangle.h      \
        cogl-texture.h          \
        cogl-types.h                    \
        cogl-vector.h           \
@@ -214,8 +213,6 @@ cogl_sources_c = \
        cogl-texture-2d.c                     \
        cogl-texture-2d-sliced.c                \
        cogl-texture-3d.c                     \
-       cogl-texture-rectangle-private.h      \
-       cogl-texture-rectangle.c              \
        cogl-rectangle-map.h                  \
        cogl-rectangle-map.c                  \
        cogl-atlas-set-private.h                \
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index 261d6e6..92eb7c1 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -51,7 +51,6 @@
 #include "cogl-pipeline-cache.h"
 #include "cogl-texture-2d.h"
 #include "cogl-texture-3d.h"
-#include "cogl-texture-rectangle.h"
 #include "cogl-sampler-cache-private.h"
 #include "cogl-gpu-info-private.h"
 #include "cogl-gl-header.h"
@@ -148,7 +147,6 @@ struct _CoglContext
   /* Textures */
   CoglTexture2D *default_gl_texture_2d_tex;
   CoglTexture3D *default_gl_texture_3d_tex;
-  CoglTextureRectangle *default_gl_texture_rect_tex;
 
   /* Central list of all framebuffers so all journals can be flushed
    * at any time. */
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 9b5c52f..e3ec5c7 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -44,7 +44,6 @@
 #include "cogl-texture-private.h"
 #include "cogl-texture-2d-private.h"
 #include "cogl-texture-3d-private.h"
-#include "cogl-texture-rectangle-private.h"
 #include "cogl-atlas-set.h"
 #include "cogl-atlas-texture-private.h"
 #include "cogl-pipeline-private.h"
@@ -127,7 +126,6 @@ cogl_context_new (CoglDisplay *display,
 {
   CoglContext *context;
   uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff };
-  CoglBitmap *white_pixel_bitmap;
   const CoglWinsysVtable *winsys;
   int i;
   CoglError *internal_error = NULL;
@@ -285,7 +283,6 @@ cogl_context_new (CoglDisplay *display,
 
   context->default_gl_texture_2d_tex = NULL;
   context->default_gl_texture_3d_tex = NULL;
-  context->default_gl_texture_rect_tex = NULL;
 
   context->framebuffers = NULL;
   context->current_draw_buffer = NULL;
@@ -385,27 +382,6 @@ cogl_context_new (CoglDisplay *display,
   if (internal_error)
     cogl_error_free (internal_error);
 
-  /* TODO: add cogl_texture_rectangle_new_from_data() */
-  white_pixel_bitmap =
-    cogl_bitmap_new_for_data (context,
-                              1, 1, /* width/height */
-                              COGL_PIXEL_FORMAT_RGBA_8888_PRE,
-                              4, /* rowstride */
-                              white_pixel);
-
-  internal_error = NULL;
-  context->default_gl_texture_rect_tex =
-    cogl_texture_rectangle_new_from_bitmap (white_pixel_bitmap);
-
-  /* XXX: we need to allocate the texture now because the white_pixel
-   * data is on the stack */
-  cogl_texture_allocate (COGL_TEXTURE (context->default_gl_texture_rect_tex),
-                         &internal_error);
-  if (internal_error)
-    cogl_error_free (internal_error);
-
-  cogl_object_unref (white_pixel_bitmap);
-
   context->buffer_map_fallback_array = c_byte_array_new ();
   context->buffer_map_fallback_in_use = FALSE;
 
@@ -436,8 +412,6 @@ _cogl_context_free (CoglContext *context)
     cogl_object_unref (context->default_gl_texture_2d_tex);
   if (context->default_gl_texture_3d_tex)
     cogl_object_unref (context->default_gl_texture_3d_tex);
-  if (context->default_gl_texture_rect_tex)
-    cogl_object_unref (context->default_gl_texture_rect_tex);
 
   if (context->opaque_color_pipeline)
     cogl_object_unref (context->opaque_color_pipeline);
diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h
index 8e1775c..ef24d0a 100644
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -200,8 +200,6 @@ cogl_is_context (void *object);
  *    by the hardware. This is a equivalent to the
  *    %COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, %COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP
  *    and %COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined.
- * @COGL_FEATURE_ID_TEXTURE_RECTANGLE: Support for rectangular
- *    textures with non-normalized texture coordinates.
  * @COGL_FEATURE_ID_TEXTURE_RG: Support for
  *    %COGL_TEXTURE_COMPONENTS_RG as the internal components of a
  *    texture.
@@ -245,7 +243,6 @@ typedef enum _CoglFeatureID
   COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP,
   COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT,
   COGL_FEATURE_ID_TEXTURE_NPOT,
-  COGL_FEATURE_ID_TEXTURE_RECTANGLE,
   COGL_FEATURE_ID_TEXTURE_3D,
   COGL_FEATURE_ID_GLSL,
   COGL_FEATURE_ID_OFFSCREEN,
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index 5972277..0c9be7f 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -1185,11 +1185,6 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
  * bottom right. To map an entire texture across the rectangle pass
  * in @s_1=0, @t_1=0, @s_2=1, @t_2=1.
  *
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * with one of your @pipeline layers which normally implies working
- * with non-normalized texture coordinates this api should still be
- * passed normalized texture coordinates.</note>
- *
  * Since: 1.10
  * Stability: unstable
  */
@@ -1241,10 +1236,8 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
  *
  * <note>This api can not currently handle multiple high-level meta
  * texture layers. The first layer may be a high level meta texture
- * such as #CoglTexture2DSliced but all other layers much be low
- * level textures such as #CoglTexture2D and additionally they
- * should be textures that can be sampled using normalized coordinates
- * (so not #CoglTextureRectangle textures).</note>
+ * such as #CoglTexture2DSliced but all other layers must be low
+ * level textures such as #CoglTexture2D.</note>
  *
  * The top left texture coordinate for layer 0 of any pipeline will be
  * (tex_coords[0], tex_coords[1]) and the bottom right coordinate will
@@ -1258,11 +1251,6 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
  * in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1,
  * tex_coords[3]=1.
  *
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * which normally implies working with non-normalized texture
- * coordinates this api should still be passed normalized texture
- * coordinates.</note>
- *
  * The first pair of coordinates are for the first layer (with the
  * smallest layer index) and if you supply less texture coordinates
  * than there are layers in the current source material then default
@@ -1366,11 +1354,6 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
  * in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1,
  * tex_coords[3]=1.
  *
- * <note>Even if you have associated a #CoglTextureRectangle texture
- * which normally implies working with non-normalized texture
- * coordinates this api should still be passed normalized texture
- * coordinates.</note>
- *
  * Since: 1.10
  * Stability: unstable
  */
diff --git a/cogl/cogl-meta-texture.c b/cogl/cogl-meta-texture.c
index 0d1f4d5..55d9a37 100644
--- a/cogl/cogl-meta-texture.c
+++ b/cogl/cogl-meta-texture.c
@@ -30,15 +30,13 @@
  *  Robert Bragg   <robert linux intel com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "cogl-texture.h"
 #include "cogl-matrix.h"
 #include "cogl-spans.h"
 #include "cogl-meta-texture.h"
-#include "cogl-texture-rectangle-private.h"
+#include "cogl-texture-private.h"
 
 #include <string.h>
 #include <math.h>
@@ -172,8 +170,7 @@ create_grid_and_repeat_cb (CoglTexture *slice_texture,
    * the user's original region, calling their callback whenever
    * we see our current slice - ignoring padding.
    *
-   * NB: we can assume meta_coords[] are normalized at this point
-   * since TextureRectangles aren't iterated with this code-path.
+   * NB: we can assume meta_coords[] are normalized at this point.
    *
    * NB: spans are always defined using non-normalized coordinates
    */
@@ -318,16 +315,9 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
 
   if (wrap_s == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE)
     {
-      float max_s_coord;
+      float max_s_coord = 1.0;
       float half_texel_width;
 
-      /* Consider that rectangle textures have non-normalized
-       * coordinates... */
-      if (cogl_is_texture_rectangle (meta_texture))
-        max_s_coord = width;
-      else
-        max_s_coord = 1.0;
-
       half_texel_width = max_s_coord / (width * 2);
 
       /* Handle any left clamped region */
@@ -377,16 +367,9 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
   if (wrap_t == COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE)
     {
       float height = cogl_texture_get_height (COGL_TEXTURE (meta_texture));
-      float max_t_coord;
+      float max_t_coord = 1.0;
       float half_texel_height;
 
-      /* Consider that rectangle textures have non-normalized
-       * coordinates... */
-      if (cogl_is_texture_rectangle (meta_texture))
-        max_t_coord = height;
-      else
-        max_t_coord = 1.0;
-
       half_texel_height = max_t_coord / (height * 2);
 
       /* Handle any top clamped region */
@@ -468,33 +451,6 @@ normalize_meta_coords_cb (CoglTexture *slice_texture,
                   data->user_data);
 }
 
-typedef struct _UnNormalizeData
-{
-  CoglMetaTextureCallback callback;
-  void *user_data;
-  float width;
-  float height;
-} UnNormalizeData;
-
-static void
-un_normalize_slice_coords_cb (CoglTexture *slice_texture,
-                              const float *slice_coords,
-                              const float *meta_coords,
-                              void *user_data)
-{
-  UnNormalizeData *data = user_data;
-  float un_normalized_slice_coords[4] = {
-    slice_coords[0] * data->width,
-    slice_coords[1] * data->height,
-    slice_coords[2] * data->width,
-    slice_coords[3] * data->height
-  };
-
-  data->callback (slice_texture,
-                  un_normalized_slice_coords, meta_coords,
-                  data->user_data);
-}
-
 void
 cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
                                      float tx_1,
@@ -541,19 +497,16 @@ cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
    * coordinates beyond this point and only re-normalize just before
    * calling the user's callback... */
 
-  if (!cogl_is_texture_rectangle (COGL_TEXTURE (meta_texture)))
-    {
-      normalize_data.callback = callback;
-      normalize_data.user_data = user_data;
-      normalize_data.s_normalize_factor = 1.0f / width;
-      normalize_data.t_normalize_factor = 1.0f / height;
-      callback = normalize_meta_coords_cb;
-      user_data = &normalize_data;
-      tx_1 *= width;
-      ty_1 *= height;
-      tx_2 *= width;
-      ty_2 *= height;
-    }
+  normalize_data.callback = callback;
+  normalize_data.user_data = user_data;
+  normalize_data.s_normalize_factor = 1.0f / width;
+  normalize_data.t_normalize_factor = 1.0f / height;
+  callback = normalize_meta_coords_cb;
+  user_data = &normalize_data;
+  tx_1 *= width;
+  ty_1 *= height;
+  tx_2 *= width;
+  ty_2 *= height;
 
   /* XXX: at some point this wont be routed through the CoglTexture
    * vtable, instead there will be a separate CoglMetaTexture
@@ -611,21 +564,6 @@ cogl_meta_texture_foreach_in_region (CoglMetaTexture *meta_texture,
       CoglSpan x_span = { 0, width, 0 };
       CoglSpan y_span = { 0, height, 0 };
       float meta_region_coords[4] = { tx_1, ty_1, tx_2, ty_2 };
-      UnNormalizeData un_normalize_data;
-
-      /* If we are dealing with a CoglTextureRectangle then we need a shim
-       * callback that un_normalizes the slice coordinates we get from
-       * _cogl_texture_spans_foreach_in_region before passing them to
-       * the user's callback. */
-      if (cogl_is_texture_rectangle (meta_texture))
-        {
-          un_normalize_data.callback = callback;
-          un_normalize_data.user_data = user_data;
-          un_normalize_data.width = width;
-          un_normalize_data.height = height;
-          callback = un_normalize_slice_coords_cb;
-          user_data = &un_normalize_data;
-        }
 
       _cogl_texture_spans_foreach_in_region (&x_span, 1,
                                              &y_span, 1,
diff --git a/cogl/cogl-offscreen.h b/cogl/cogl-offscreen.h
index b971b1f..182fe7b 100644
--- a/cogl/cogl-offscreen.h
+++ b/cogl/cogl-offscreen.h
@@ -66,8 +66,8 @@ typedef struct _CoglOffscreen CoglOffscreen;
  * destroy the offscreen buffer before you can use the @texture again.
  *
  * <note>This api only works with low-level #CoglTexture types such as
- * #CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not
- * with meta-texture types such as #CoglTexture2DSliced.</note>
+ * #CoglTexture2D, #CoglTexture3D and not with meta-texture types such
+ * as #CoglTexture2DSliced.</note>
  *
  * The storage for the framebuffer is actually allocated lazily
  * so this function will never return %NULL to indicate a runtime
diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c
index bed8313..9344851 100644
--- a/cogl/cogl-pipeline-layer-state.c
+++ b/cogl/cogl-pipeline-layer-state.c
@@ -354,15 +354,6 @@ cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline,
           return;
         }
       break;
-
-    case COGL_TEXTURE_TYPE_RECTANGLE:
-      if (ctx->default_gl_texture_rect_tex == NULL)
-        {
-          c_warning ("The default rectangle texture was set on a pipeline but "
-                     "rectangle textures are not supported");
-          texture_type = COGL_TEXTURE_TYPE_2D;
-        }
-      break;
     }
 
   _cogl_pipeline_set_layer_texture_type (pipeline, layer_index, texture_type);
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 112709d..7bff2fb 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -1820,10 +1820,6 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
     case COGL_TEXTURE_TYPE_3D:
       texture = COGL_TEXTURE (ctx->default_gl_texture_3d_tex);
       break;
-
-    case COGL_TEXTURE_TYPE_RECTANGLE:
-      texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex);
-      break;
     }
 
   if (texture == NULL)
diff --git a/cogl/cogl-primitive-texture.h b/cogl/cogl-primitive-texture.h
index 393d9ba..5f8bac0 100644
--- a/cogl/cogl-primitive-texture.h
+++ b/cogl/cogl-primitive-texture.h
@@ -45,11 +45,11 @@ COGL_BEGIN_DECLS
  *                     #CoglTexture2D and #CoglTexture3D.
  *
  * A #CoglPrimitiveTexture is a texture that is directly represented
- * by a single texture on the GPU. For example these could be a
- * #CoglTexture2D, #CoglTexture3D or #CoglTextureRectangle. This is
- * opposed to high level meta textures which may be composed of
- * multiple primitive textures or a sub-region of another texture such
- * as #CoglAtlasTexture and #CoglTexture2DSliced.
+ * by a single texture on the GPU, such as #CoglTexture2D and
+ * #CoglTexture3D. This is in contrast to high level meta textures
+ * which may be composed of multiple primitive textures or a
+ * sub-region of another texture such as #CoglAtlasTexture and
+ * #CoglTexture2DSliced.
  *
  * A texture that implements this interface can be directly used with
  * the low level cogl_primitive_draw() API. Other types of textures
diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h
index 21ffcfc..c826d4a 100644
--- a/cogl/cogl-primitive.h
+++ b/cogl/cogl-primitive.h
@@ -304,9 +304,8 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -357,9 +356,8 @@ cogl_primitive_new_p2 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -412,9 +410,8 @@ cogl_primitive_new_p3 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -467,9 +464,8 @@ cogl_primitive_new_p2c4 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -522,9 +518,8 @@ cogl_primitive_new_p3c4 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -577,9 +572,8 @@ cogl_primitive_new_p2t2 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -632,9 +626,8 @@ cogl_primitive_new_p3t2 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -687,9 +680,8 @@ cogl_primitive_new_p2t2c4 (CoglContext *context,
  * meta texture types such as #CoglTexture2DSliced or
  * #CoglAtlasTexture so you need to ensure that only low-level
  * textures that can be directly sampled by a GPU such as
- * #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D are
- * associated with the layers of any pipeline used while drawing a
- * primitive.</note>
+ * #CoglTexture2D or #CoglTexture3D are associated with the layers of
+ * any pipeline used while drawing a primitive.</note>
  *
  * Return value: (transfer full): A newly allocated #CoglPrimitive
  * with a reference of 1. This can be freed using cogl_object_unref().
@@ -904,8 +896,8 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
  * This drawing api doesn't support high-level meta texture types such
  * as #CoglTexture2DSliced so it is the user's responsibility to
  * ensure that only low-level textures that can be directly sampled by
- * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
- * are associated with layers of the given @pipeline.
+ * a GPU such as #CoglTexture2D or #CoglTexture3D are associated with
+ * layers of the given @pipeline.
  *
  * Stability: unstable
  * Since: 1.16
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
index 98b6656..e3073ac 100644
--- a/cogl/cogl-primitives.c
+++ b/cogl/cogl-primitives.c
@@ -179,8 +179,6 @@ validate_first_layer_cb (CoglPipeline *pipeline,
  *   texture coordinates require repeating,
  * - CoglTexture2DAtlas: if the users given texture coordinates require
  *   repeating,
- * - CoglTextureRectangle: if the users given texture coordinates require
- *   repeating,
  * - CoglTexturePixmap: if the users given texture coordinates require
  *   repeating
  */
@@ -334,9 +332,10 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
   transform_result =
     _cogl_texture_transform_quad_coords_to_gl (texture,
                                                out_tex_coords);
-  /* If the texture has waste or we are using GL_TEXTURE_RECT we
-   * can't handle texture repeating so we can't use the layer if
-   * repeating is required.
+
+  /* If the texture has waste or the gpu only has limited support for
+   * non-power-of-two textures we we can't use the layer if repeating
+   * is required.
    *
    * NB: We already know that no texture matrix is being used if the
    * texture doesn't support hardware repeat.
@@ -349,13 +348,15 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
             {
               static CoglBool warning_seen = FALSE;
               if (!warning_seen)
-                c_warning ("Skipping layers 1..n of your material since "
-                           "the first layer doesn't support hardware "
-                           "repeat (e.g. because of waste or use of "
-                           "GL_TEXTURE_RECTANGLE_ARB) and you supplied "
-                           "texture coordinates outside the range [0,1]."
-                           "Falling back to software repeat assuming "
-                           "layer 0 is the most important one keep");
+                c_warning ("Skipping layers 1..n of your material "
+                           "since the first layer doesn't support "
+                           "hardware repeat (e.g. because of waste "
+                           "or gpu has limited support for "
+                           "non-power-of-two "" textures) and you "
+                           "supplied texture coordinates outside the "
+                           "range [0,1]. Falling back to software "
+                           "repeat assuming layer 0 is the most "
+                           "important one keep");
               warning_seen = TRUE;
             }
 
@@ -372,9 +373,10 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
                        "since you have supplied texture coords "
                        "outside the range [0,1] but the texture "
                        "doesn't support hardware repeat (e.g. "
-                       "because of waste or use of "
-                       "GL_TEXTURE_RECTANGLE_ARB). This isn't "
-                       "supported with multi-texturing.", state->i);
+                       "because of waste or gpu has limited "
+                       "support for non-power-of-two textures). "
+                       "This isn't supported with multi-texturing.",
+                       state->i);
           warning_seen = TRUE;
 
           cogl_pipeline_set_layer_texture (pipeline, layer_index, NULL);
@@ -422,8 +424,6 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
  * - CoglTexture{1D,2D,3D}: always.
  * - CoglTexture2DAtlas: assuming the users given texture coordinates don't
  *   require repeating.
- * - CoglTextureRectangle: assuming the users given texture coordinates don't
- *   require repeating.
  * - CoglTexturePixmap: assuming the users given texture coordinates don't
  *   require repeating.
  */
@@ -647,8 +647,8 @@ _cogl_framebuffer_draw_multitextured_rectangles (
 
           /* NB: If _cogl_multitexture_quad_single_primitive fails then it
            * means the user tried to use texture repeat with a texture that
-           * can't be repeated by the GPU (e.g. due to waste or use of
-           * GL_TEXTURE_RECTANGLE_ARB) */
+           * can't be repeated by the GPU (e.g. due to waste or gpu has
+           * limited support for non-power-of-two textures) */
           if (success)
             continue;
         }
diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c
index ba96e42..ef9980a 100644
--- a/cogl/cogl-sub-texture.c
+++ b/cogl/cogl-sub-texture.c
@@ -42,7 +42,6 @@
 #include "cogl-context-private.h"
 #include "cogl-object.h"
 #include "cogl-texture-driver.h"
-#include "cogl-texture-rectangle-private.h"
 #include "cogl-texture-2d.h"
 #include "cogl-texture-gl-private.h"
 
@@ -60,30 +59,13 @@ _cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex,
                               float *coords)
 {
   CoglTexture *tex = COGL_TEXTURE (sub_tex);
+  float width = cogl_texture_get_width (sub_tex->full_texture);
+  float height = cogl_texture_get_height (sub_tex->full_texture);
 
-  /* NB: coords[] come in as non-normalized if sub_tex->full_texture
-   * is a CoglTextureRectangle otherwhise they are normalized. The
-   * coordinates we write out though must always be normalized.
-   *
-   * NB: sub_tex->sub_x/y/width/height are in non-normalized
-   * coordinates.
-   */
-  if (cogl_is_texture_rectangle (sub_tex->full_texture))
-    {
-      coords[0] = (coords[0] - sub_tex->sub_x) / tex->width;
-      coords[1] = (coords[1] - sub_tex->sub_y) / tex->height;
-      coords[2] = (coords[2] - sub_tex->sub_x) / tex->width;
-      coords[3] = (coords[3] - sub_tex->sub_y) / tex->height;
-    }
-  else
-    {
-      float width = cogl_texture_get_width (sub_tex->full_texture);
-      float height = cogl_texture_get_height (sub_tex->full_texture);
-      coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;
-      coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;
-      coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;
-      coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;
-    }
+  coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;
+  coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;
+  coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;
+  coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;
 }
 
 static void
@@ -91,31 +73,13 @@ _cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
                             float *coords)
 {
   CoglTexture *tex = COGL_TEXTURE (sub_tex);
+  float width = cogl_texture_get_width (sub_tex->full_texture);
+  float height = cogl_texture_get_height (sub_tex->full_texture);
 
-  /* NB: coords[] always come in as normalized coordinates but may go
-   * out as non-normalized if sub_tex->full_texture is a
-   * CoglTextureRectangle.
-   *
-   * NB: sub_tex->sub_x/y/width/height are in non-normalized
-   * coordinates.
-   */
-
-  if (cogl_is_texture_rectangle (sub_tex->full_texture))
-    {
-      coords[0] = coords[0] * tex->width + sub_tex->sub_x;
-      coords[1] = coords[1] * tex->height + sub_tex->sub_y;
-      coords[2] = coords[2] * tex->width + sub_tex->sub_x;
-      coords[3] = coords[3] * tex->height + sub_tex->sub_y;
-    }
-  else
-    {
-      float width = cogl_texture_get_width (sub_tex->full_texture);
-      float height = cogl_texture_get_height (sub_tex->full_texture);
-      coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;
-      coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;
-      coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;
-      coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;
-    }
+  coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;
+  coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;
+  coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;
+  coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;
 }
 
 typedef struct _CoglSubTextureForeachData
@@ -165,8 +129,7 @@ _cogl_sub_texture_foreach_sub_texture_in_region (
   _cogl_sub_texture_map_quad (sub_tex, mapped_coords);
 
   /* TODO: Add something like cogl_is_low_level_texture() */
-  if (cogl_is_texture_2d (full_texture) ||
-      cogl_is_texture_rectangle (full_texture))
+  if (cogl_is_texture_2d (full_texture))
     {
       callback (sub_tex->full_texture,
                 mapped_coords,
diff --git a/cogl/cogl-texture-driver.h b/cogl/cogl-texture-driver.h
index 8794dd5..28c9262 100644
--- a/cogl/cogl-texture-driver.h
+++ b/cogl/cogl-texture-driver.h
@@ -181,15 +181,6 @@ struct _CoglTextureDriver
                                    const GLfloat *transparent_color);
 
   /*
-   * It may depend on the driver as to what texture targets may be used when
-   * creating a foreign texture. E.g. OpenGL supports ARB_texture_rectangle
-   * but GLES doesn't
-   */
-  CoglBool
-  (* allows_foreign_gl_target) (CoglContext *ctx,
-                                GLenum gl_target);
-
-  /*
    * The driver may impose constraints on what formats can be used to store
    * texture data read from textures. For example GLES currently only supports
    * RGBA_8888, and so we need to manually convert the data if the final
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 8abdb98..70f5644 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -34,9 +34,7 @@
  *  Robert Bragg   <robert linux intel com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "cogl-util.h"
 #include "cogl-bitmap.h"
@@ -50,7 +48,6 @@
 #include "cogl-texture-2d-private.h"
 #include "cogl-texture-2d-gl.h"
 #include "cogl-texture-3d-private.h"
-#include "cogl-texture-rectangle-private.h"
 #include "cogl-sub-texture-private.h"
 #include "cogl-atlas-texture-private.h"
 #include "cogl-pipeline.h"
diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h
index b07da9b..d9a793c 100644
--- a/cogl/cogl-texture.h
+++ b/cogl/cogl-texture.h
@@ -61,12 +61,12 @@ COGL_BEGIN_DECLS
  * @short_description: Common interface for manipulating textures
  *
  * Cogl provides several different types of textures such as
- * #CoglTexture2D, #CoglTexture3D, #CoglTextureRectangle,
- * #CoglTexture2DSliced, #CoglAtlasTexture, #CoglSubTexture and
- * #CoglTexturePixmapX11 that each have specific apis for creating
- * and manipulating them, but there are a number of common operations
- * that can be applied to any of these texture types which are handled
- * via this #CoglTexture interface.
+ * #CoglTexture2D, #CoglTexture3D, #CoglTexture2DSliced,
+ * #CoglAtlasTexture, #CoglSubTexture and #CoglTexturePixmapX11 that
+ * each have specific apis for creating and manipulating them, but
+ * there are a number of common operations that can be applied to any
+ * of these texture types which are handled via this #CoglTexture
+ * interface.
  */
 
 #define COGL_TEXTURE_MAX_WASTE  127
@@ -105,7 +105,6 @@ typedef enum {
  * CoglTextureType:
  * @COGL_TEXTURE_TYPE_2D: A #CoglTexture2D
  * @COGL_TEXTURE_TYPE_3D: A #CoglTexture3D
- * @COGL_TEXTURE_TYPE_RECTANGLE: A #CoglTextureRectangle
  *
  * Constants representing the underlying hardware texture type of a
  * #CoglTexture.
@@ -115,8 +114,7 @@ typedef enum {
  */
 typedef enum {
   COGL_TEXTURE_TYPE_2D,
-  COGL_TEXTURE_TYPE_3D,
-  COGL_TEXTURE_TYPE_RECTANGLE
+  COGL_TEXTURE_TYPE_3D
 } CoglTextureType;
 
 uint32_t cogl_texture_error_domain (void);
diff --git a/cogl/cogl.h b/cogl/cogl.h
index edcf6ba..550205a 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -71,7 +71,6 @@
 #include <cogl/cogl-quaternion.h>
 #include <cogl/cogl-texture-2d.h>
 #include <cogl/cogl-texture-2d-gl.h>
-#include <cogl/cogl-texture-rectangle.h>
 #include <cogl/cogl-texture-3d.h>
 #include <cogl/cogl-texture-2d-sliced.h>
 #include <cogl/cogl-sub-texture.h>
diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
index 73dd0a4..208db01 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -289,7 +289,6 @@ cogl_is_texture
 #ifdef COGL_HAS_X11
 cogl_is_texture_pixmap_x11
 #endif
-cogl_is_texture_rectangle
 cogl_is_texture_2d
 cogl_is_texture_3d
 
@@ -543,8 +542,6 @@ cogl_texture_pixmap_x11_new
 cogl_texture_pixmap_x11_set_damage_object
 cogl_texture_pixmap_x11_update_area
 #endif
-cogl_texture_rectangle_new_from_bitmap
-cogl_texture_rectangle_new_with_size
 cogl_texture_set_region
 cogl_texture_set_region_from_bitmap
 cogl_texture_2d_new_from_bitmap
diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
index 779e03b..9d16125 100644
--- a/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -635,11 +635,7 @@ try_creating_fbo (CoglContext *ctx,
   if (!cogl_texture_get_gl_texture (texture, &tex_gl_handle, &tex_gl_target))
     return FALSE;
 
-  if (tex_gl_target != GL_TEXTURE_2D
-#ifdef HAVE_COGL_GL
-      && tex_gl_target != GL_TEXTURE_RECTANGLE_ARB
-#endif
-      )
+  if (tex_gl_target != GL_TEXTURE_2D)
     return FALSE;
 
   if (config->samples_per_pixel)
diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c
index 14b41ba..9aa34ab 100644
--- a/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -463,9 +463,6 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
           case COGL_TEXTURE_TYPE_3D:
             texture = COGL_TEXTURE (ctx->default_gl_texture_3d_tex);
             break;
-          case COGL_TEXTURE_TYPE_RECTANGLE:
-            texture = COGL_TEXTURE (ctx->default_gl_texture_rect_tex);
-            break;
           }
 
       cogl_texture_get_gl_texture (texture,
diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c
index c9240a3..4466563 100644
--- a/cogl/driver/gl/cogl-texture-2d-gl.c
+++ b/cogl/driver/gl/cogl-texture-2d-gl.c
@@ -331,16 +331,6 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d,
   GLint gl_compressed = GL_FALSE;
   GLenum gl_int_format = 0;
 
-  if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D))
-    {
-      _cogl_set_error (error,
-                       COGL_SYSTEM_ERROR,
-                       COGL_SYSTEM_ERROR_UNSUPPORTED,
-                       "Foreign GL_TEXTURE_2D textures are not "
-                       "supported by your system");
-      return FALSE;
-    }
-
   /* Make sure binding succeeds */
   while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR)
     ;
diff --git a/cogl/driver/gl/cogl-util-gl.c b/cogl/driver/gl/cogl-util-gl.c
index 84cd74c..12edf72 100644
--- a/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/driver/gl/cogl-util-gl.c
@@ -118,13 +118,6 @@ _cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
 
   switch (texture_type)
     {
-#if 0 /* TODO */
-    case COGL_TEXTURE_TYPE_1D:
-      target_string = "1D";
-      tex_coord_swizzle = "s";
-      break;
-#endif
-
     case COGL_TEXTURE_TYPE_2D:
       target_string = "2D";
       tex_coord_swizzle = "st";
@@ -134,11 +127,6 @@ _cogl_gl_util_get_texture_target_string (CoglTextureType texture_type,
       target_string = "3D";
       tex_coord_swizzle = "stp";
       break;
-
-    case COGL_TEXTURE_TYPE_RECTANGLE:
-      target_string = "2DRect";
-      tex_coord_swizzle = "st";
-      break;
     }
 
   if (target_string_out)
diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index 9083ecc..89d22cd 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -538,10 +538,6 @@ _cogl_driver_update_features (CoglContext *ctx,
                       COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE);
     }
 
-  if (_cogl_check_extension ("GL_ARB_texture_rectangle", gl_extensions))
-    COGL_FLAGS_SET (ctx->features,
-                    COGL_FEATURE_ID_TEXTURE_RECTANGLE, TRUE);
-
   if (ctx->glTexImage3D)
     COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_3D, TRUE);
 
diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c
index 39b3121..40cb1d0 100644
--- a/cogl/driver/gl/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c
@@ -91,11 +91,6 @@ _cogl_texture_driver_gen (CoglContext *ctx,
                                 GL_LINEAR) );
       break;
 
-    case GL_TEXTURE_RECTANGLE_ARB:
-      /* Texture rectangles already default to GL_LINEAR so nothing
-         needs to be done */
-      break;
-
     default:
       c_assert_not_reached();
     }
@@ -473,10 +468,6 @@ _cogl_texture_driver_size_supported (CoglContext *ctx,
 
   if (gl_target == GL_TEXTURE_2D)
     proxy_target = GL_PROXY_TEXTURE_2D;
-#if HAVE_COGL_GL
-  else if (gl_target == GL_TEXTURE_RECTANGLE_ARB)
-    proxy_target = GL_PROXY_TEXTURE_RECTANGLE_ARB;
-#endif
   else
     /* Unknown target, assume it's not supported */
     return FALSE;
@@ -505,23 +496,6 @@ _cogl_texture_driver_try_setting_gl_border_color
                              transparent_color) );
 }
 
-static CoglBool
-_cogl_texture_driver_allows_foreign_gl_target (CoglContext *ctx,
-                                               GLenum gl_target)
-{
-  /* GL_ARB_texture_rectangle textures are supported if they are
-     created from foreign because some chipsets have trouble with
-     GL_ARB_texture_non_power_of_two. There is no Cogl call to create
-     them directly to emphasize the fact that they don't work fully
-     (for example, no mipmapping and complicated shader support) */
-
-  /* Allow 2-dimensional or rectangle textures only */
-  if (gl_target != GL_TEXTURE_2D && gl_target != GL_TEXTURE_RECTANGLE_ARB)
-    return FALSE;
-
-  return TRUE;
-}
-
 static CoglPixelFormat
 _cogl_texture_driver_find_best_gl_get_data_format
                                             (CoglContext *context,
@@ -549,6 +523,5 @@ _cogl_texture_driver_gl =
     _cogl_texture_driver_size_supported,
     _cogl_texture_driver_size_supported_3d,
     _cogl_texture_driver_try_setting_gl_border_color,
-    _cogl_texture_driver_allows_foreign_gl_target,
     _cogl_texture_driver_find_best_gl_get_data_format
   };
diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c
index 5d89524..3958e16 100644
--- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -607,16 +607,6 @@ _cogl_texture_driver_try_setting_gl_border_color
   /* FAIL! */
 }
 
-static CoglBool
-_cogl_texture_driver_allows_foreign_gl_target (CoglContext *ctx,
-                                               GLenum gl_target)
-{
-  /* Allow 2-dimensional textures only */
-  if (gl_target != GL_TEXTURE_2D)
-    return FALSE;
-  return TRUE;
-}
-
 static CoglPixelFormat
 _cogl_texture_driver_find_best_gl_get_data_format
                                             (CoglContext *context,
@@ -645,6 +635,5 @@ _cogl_texture_driver_gles =
     _cogl_texture_driver_size_supported,
     _cogl_texture_driver_size_supported_3d,
     _cogl_texture_driver_try_setting_gl_border_color,
-    _cogl_texture_driver_allows_foreign_gl_target,
     _cogl_texture_driver_find_best_gl_get_data_format
   };
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 37a2b8b..cd15638 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -46,7 +46,6 @@
 #include "cogl-texture-driver.h"
 #include "cogl-texture-2d-private.h"
 #include "cogl-texture-2d-sliced.h"
-#include "cogl-texture-rectangle-private.h"
 #include "cogl-context-private.h"
 #include "cogl-display-private.h"
 #include "cogl-renderer-private.h"
@@ -802,88 +801,29 @@ _cogl_texture_pixmap_x11_get_data (CoglTexture *tex,
   return cogl_texture_get_data (child_tex, format, rowstride, data);
 }
 
-typedef struct _NormalizeCoordsWrapperData
-{
-  int width;
-  int height;
-  CoglMetaTextureCallback callback;
-  void *user_data;
-} NormalizeCoordsWrapperData;
-
-static void
-normalize_coords_wrapper_cb (CoglTexture *child_texture,
-                             const float *child_texture_coords,
-                             const float *meta_coords,
-                             void *user_data)
-{
-  NormalizeCoordsWrapperData *data = user_data;
-  float normalized_coords[4];
-
-  normalized_coords[0] = meta_coords[0] / data->width;
-  normalized_coords[1] = meta_coords[1] / data->height;
-  normalized_coords[2] = meta_coords[2] / data->width;
-  normalized_coords[3] = meta_coords[3] / data->height;
-
-  data->callback (child_texture,
-                  child_texture_coords, normalized_coords,
-                  data->user_data);
-}
-
 static void
 _cogl_texture_pixmap_x11_foreach_sub_texture_in_region
-                                  (CoglTexture              *tex,
-                                   float                     virtual_tx_1,
-                                   float                     virtual_ty_1,
-                                   float                     virtual_tx_2,
-                                   float                     virtual_ty_2,
-                                   CoglMetaTextureCallback   callback,
-                                   void                     *user_data)
+                                  (CoglTexture *tex,
+                                   float virtual_tx_1,
+                                   float virtual_ty_1,
+                                   float virtual_tx_2,
+                                   float virtual_ty_2,
+                                   CoglMetaTextureCallback callback,
+                                   void *user_data)
 {
   CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
   CoglTexture *child_tex = _cogl_texture_pixmap_x11_get_texture (tex_pixmap);
 
   /* Forward on to the child texture */
-
-  /* tfp textures may be implemented in terms of a
-   * CoglTextureRectangle texture which uses un-normalized texture
-   * coordinates but we want to consistently deal with normalized
-   * texture coordinates with CoglTexturePixmapX11... */
-  if (cogl_is_texture_rectangle (child_tex))
-    {
-      NormalizeCoordsWrapperData data;
-      int width = tex->width;
-      int height = tex->height;
-
-      virtual_tx_1 *= width;
-      virtual_ty_1 *= height;
-      virtual_tx_2 *= width;
-      virtual_ty_2 *= height;
-
-      data.width = width;
-      data.height = height;
-      data.callback = callback;
-      data.user_data = user_data;
-
-      cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
-                                           virtual_tx_1,
-                                           virtual_ty_1,
-                                           virtual_tx_2,
-                                           virtual_ty_2,
-                                           COGL_PIPELINE_WRAP_MODE_REPEAT,
-                                           COGL_PIPELINE_WRAP_MODE_REPEAT,
-                                           normalize_coords_wrapper_cb,
-                                           &data);
-    }
-  else
-    cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
-                                         virtual_tx_1,
-                                         virtual_ty_1,
-                                         virtual_tx_2,
-                                         virtual_ty_2,
-                                         COGL_PIPELINE_WRAP_MODE_REPEAT,
-                                         COGL_PIPELINE_WRAP_MODE_REPEAT,
-                                         callback,
-                                         user_data);
+  cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (child_tex),
+                                       virtual_tx_1,
+                                       virtual_ty_1,
+                                       virtual_tx_2,
+                                       virtual_ty_2,
+                                       COGL_PIPELINE_WRAP_MODE_REPEAT,
+                                       COGL_PIPELINE_WRAP_MODE_REPEAT,
+                                       callback,
+                                       user_data);
 }
 
 static CoglBool
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index bd9818b..9fcc167 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -46,7 +46,6 @@
 #include "cogl-glx-display-private.h"
 #include "cogl-private.h"
 #include "cogl-texture-2d-private.h"
-#include "cogl-texture-rectangle-private.h"
 #include "cogl-pipeline-opengl-private.h"
 #include "cogl-frame-info-private.h"
 #include "cogl-framebuffer-private.h"
@@ -2223,54 +2222,6 @@ get_fbconfig_for_depth (CoglContext *context,
 }
 
 static CoglBool
-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_has_feature (context, COGL_FEATURE_ID_TEXTURE_NPOT) ?
-            COGL_WINSYS_RECTANGLE_STATE_DISABLE :
-            COGL_WINSYS_RECTANGLE_STATE_ENABLE;
-
-          if ((rect_env = c_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
-              /* For compatibility, we'll also look at the old Clutter
-                 environment variable */
-              (rect_env = c_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
-            {
-              if (c_ascii_strcasecmp (rect_env, "force") == 0)
-                context->rectangle_state =
-                  COGL_WINSYS_RECTANGLE_STATE_ENABLE;
-              else if (c_ascii_strcasecmp (rect_env, "disable") == 0)
-                context->rectangle_state =
-                  COGL_WINSYS_RECTANGLE_STATE_DISABLE;
-              else if (c_ascii_strcasecmp (rect_env, "allow"))
-                c_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 CoglBool
 try_create_glx_pixmap (CoglContext *context,
                        CoglTexturePixmapX11 *tex_pixmap,
                        CoglBool mipmap)
@@ -2305,13 +2256,7 @@ 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;
+  target = GLX_TEXTURE_2D_EXT;
 
   if (!glx_tex_pixmap->can_mipmap)
     mipmap = FALSE;
@@ -2491,49 +2436,24 @@ _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))
-        {
-          glx_tex_pixmap->glx_tex = COGL_TEXTURE (
-            cogl_texture_rectangle_new_with_size (ctx,
-                                                  tex->width,
-                                                  tex->height));
+      glx_tex_pixmap->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 (glx_tex_pixmap->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 (glx_tex_pixmap->glx_tex, &error))
+        COGL_NOTE (TEXTURE_PIXMAP, "Created a texture 2d for %p",
+                   tex_pixmap);
       else
         {
-          glx_tex_pixmap->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 (glx_tex_pixmap->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/doc/reference/cogl2/cogl2-docs.xml.in b/doc/reference/cogl2/cogl2-docs.xml.in
index 6aee925..a647f9d 100644
--- a/doc/reference/cogl2/cogl2-docs.xml.in
+++ b/doc/reference/cogl2/cogl2-docs.xml.in
@@ -123,7 +123,6 @@
       <xi:include href="xml/cogl-primitive-texture.xml"/>
       <xi:include href="xml/cogl-texture-2d.xml"/>
       <xi:include href="xml/cogl-texture-3d.xml"/>
-      <xi:include href="xml/cogl-texture-rectangle.xml"/>
     </section>
 
     <section id="cogl-framebuffer-apis">
diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
index 7cd53d0..23c364d 100644
--- a/doc/reference/cogl2/cogl2-sections.txt
+++ b/doc/reference/cogl2/cogl2-sections.txt
@@ -375,15 +375,6 @@ cogl_texture_2d_gl_new_from_foreign
 </SECTION>
 
 <SECTION>
-<FILE>cogl-texture-rectangle</FILE>
-<TITLE>Rectangle textures (non-normalized coordinates)</TITLE>
-CoglTextureRectangle
-cogl_texture_rectangle_new_with_size
-cogl_texture_rectangle_new_from_bitmap
-cogl_is_texture_rectangle
-</SECTION>
-
-<SECTION>
 <FILE>cogl-texture-3d</FILE>
 <TITLE>3D textures</TITLE>
 CoglTexture3D
diff --git a/examples/cogl-info.c b/examples/cogl-info.c
index 18101a8..16a0e36 100644
--- a/examples/cogl-info.c
+++ b/examples/cogl-info.c
@@ -39,12 +39,6 @@ struct {
     "COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT features combined."
   },
   {
-    COGL_FEATURE_ID_TEXTURE_RECTANGLE,
-    "Unnormalized coordinate, rectangle textures",
-    "Support for rectangular textures with non-normalized texture "
-    "coordinates."
-  },
-  {
     COGL_FEATURE_ID_TEXTURE_3D,
     "3D texture support",
     "3D texture support"
diff --git a/test-fixtures/test-utils.c b/test-fixtures/test-utils.c
index 8a0a388..fff5b15 100644
--- a/test-fixtures/test-utils.c
+++ b/test-fixtures/test-utils.c
@@ -36,12 +36,6 @@ check_flags (TestFlags flags,
       return FALSE;
     }
 
-  if (flags & TEST_REQUIREMENT_TEXTURE_RECTANGLE &&
-      !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
-    {
-      return FALSE;
-    }
-
   if (flags & TEST_REQUIREMENT_TEXTURE_RG &&
       !cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RG))
     {
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 9a301ca..47a663c 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -34,7 +34,6 @@ typedef enum _TestFlags
   TEST_REQUIREMENT_GL = 1<<1,
   TEST_REQUIREMENT_NPOT = 1<<2,
   TEST_REQUIREMENT_TEXTURE_3D = 1<<3,
-  TEST_REQUIREMENT_TEXTURE_RECTANGLE = 1<<4,
   TEST_REQUIREMENT_TEXTURE_RG = 1<<5,
   TEST_REQUIREMENT_POINT_SPRITE = 1<<6,
   TEST_REQUIREMENT_GLES2_CONTEXT = 1<<7,
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index c0fc977..d451ac5 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -17,7 +17,6 @@ unported_test_sources = \
        test-readpixels.c \
        test-texture-mipmaps.c \
        test-texture-pixmap-x11.c \
-       test-texture-rectangle.c \
        test-vertex-buffer-contiguous.c \
        test-vertex-buffer-interleved.c \
        test-vertex-buffer-mutability.c \
@@ -57,7 +56,6 @@ test_sources = \
        test-map-buffer-range.c \
        test-npot-texture.c \
        test-alpha-textures.c \
-       test-wrap-rectangle-textures.c \
        test-texture-get-set-data.c \
        test-texture-mipmap-get-set.c \
        test-framebuffer-get-bits.c \
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 02ea4e2..37cf1a0 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -74,7 +74,6 @@ main (int argc, char **argv)
   ADD_TEST (test_pixel_buffer_map, 0, 0);
   ADD_TEST (test_pixel_buffer_set_data, 0, 0);
   ADD_TEST (test_pixel_buffer_sub_region, 0, 0);
-  UNPORTED_TEST (test_texture_rectangle);
   ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D, 0);
   ADD_TEST (test_wrap_modes, 0, 0);
   UNPORTED_TEST (test_texture_pixmap_x11);
@@ -86,9 +85,6 @@ main (int argc, char **argv)
   ADD_TEST (test_read_texture_formats, 0, 0);
   ADD_TEST (test_write_texture_formats, 0, 0);
   ADD_TEST (test_alpha_textures, 0, 0);
-  ADD_TEST (test_wrap_rectangle_textures,
-            TEST_REQUIREMENT_TEXTURE_RECTANGLE,
-            TEST_KNOWN_FAILURE);
 
   UNPORTED_TEST (test_vertex_buffer_contiguous);
   UNPORTED_TEST (test_vertex_buffer_interleved);
diff --git a/tests/conform/test-texture-no-allocate.c b/tests/conform/test-texture-no-allocate.c
index af1a54c..a033815 100644
--- a/tests/conform/test-texture-no-allocate.c
+++ b/tests/conform/test-texture-no-allocate.c
@@ -68,13 +68,4 @@ test_texture_no_allocate (void)
                                        64, 64, 64);
       cogl_object_unref (texture_3d);
     }
-
-  /* Rectangle texture */
-  if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_RECTANGLE))
-    {
-      CoglTextureRectangle *texture_rect =
-        cogl_texture_rectangle_new_with_size (test_ctx,
-                                              64, 64);
-      cogl_object_unref (texture_rect);
-    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]