Use GL_MAX_TEXTURE_SIZE on GLES when checking supported tex size
authorNeil Roberts <neil@linux.intel.com>
Thu, 8 Jul 2010 17:37:01 +0000 (18:37 +0100)
committerNeil Roberts <neil@linux.intel.com>
Fri, 9 Jul 2010 10:14:15 +0000 (11:14 +0100)
Under big GL, _cogl_texture_driver_size_supported uses the proxy
texture to check whether the given texture size is supported. Proxy
textures aren't available under GLES so previously this would just
return TRUE to assume all texture sizes are supported. This patch
makes it use glGetIntegerv with GL_MAX_TEXTURE_SIZE to give a second
best guess.

This fixes the sliced texture backend so that it will use slices when
the texture is too big.

clutter/cogl/cogl/driver/gles/cogl-texture-driver.c

index 610411e..64a3d7e 100644 (file)
@@ -211,7 +211,13 @@ _cogl_texture_driver_size_supported (GLenum gl_target,
                                      int    width,
                                      int    height)
 {
-  return TRUE;
+  GLint max_size;
+
+  /* GLES doesn't support a proxy texture target so let's at least
+     check whether the size is greater than GL_MAX_TEXTURE_SIZE */
+  GE( glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size) );
+
+  return width <= max_size && height <= max_size;
 }
 
 void