mesa: Allow glGetTexParameter of GL_TEXTURE_SRGB_DECODE_EXT
[mesa.git] / src / mesa / main / teximage.h
index 252d80afc0f10b298a05059f761b78efd9eda8d4..c7c32d8acdde8ecdbce42f49f89525429e8e9f9c 100644 (file)
 #include "mtypes.h"
 #include "formats.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-extern void *
-_mesa_alloc_texmemory(GLsizei bytes);
-
-extern void
-_mesa_free_texmemory(void *m);
+/** Is the given value one of the 6 cube faces? */
+static inline GLboolean
+_mesa_is_cube_face(GLenum target)
+{
+   return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
+           target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
+}
 
+/** Is any of the dimensions of given texture equal to zero? */
+static inline GLboolean
+_mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
+{
+   return (texImage->Width == 0 ||
+           texImage->Height == 0 ||
+           texImage->Depth == 0);
+}
 
 /** \name Internal functions */
 /*@{*/
@@ -53,6 +66,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
 extern GLboolean
 _mesa_is_proxy_texture(GLenum target);
 
+extern GLenum
+_mesa_get_proxy_target(GLenum target);
 
 extern struct gl_texture_image *
 _mesa_new_texture_image( struct gl_context *ctx );
@@ -62,13 +77,9 @@ extern void
 _mesa_delete_texture_image( struct gl_context *ctx,
                             struct gl_texture_image *teximage );
 
-extern void
-_mesa_free_texture_image_data( struct gl_context *ctx, 
-                              struct gl_texture_image *texImage );
-
 
 extern void
-_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
+_mesa_init_teximage_fields(struct gl_context *ctx,
                            struct gl_texture_image *img,
                            GLsizei width, GLsizei height, GLsizei depth,
                            GLint border, GLenum internalFormat,
@@ -81,18 +92,16 @@ _mesa_choose_texture_format(struct gl_context *ctx,
                             GLenum target, GLint level,
                             GLenum internalFormat, GLenum format, GLenum type);
 
+extern void
+_mesa_update_fbo_texture(struct gl_context *ctx,
+                         struct gl_texture_object *texObj,
+                         GLuint face, GLuint level);
 
 extern void
 _mesa_clear_texture_image(struct gl_context *ctx,
                           struct gl_texture_image *texImage);
 
 
-extern void
-_mesa_set_tex_image(struct gl_texture_object *tObj,
-                    GLenum target, GLint level,
-                    struct gl_texture_image *texImage);
-
-
 extern struct gl_texture_object *
 _mesa_select_tex_object(struct gl_context *ctx,
                         const struct gl_texture_unit *texUnit,
@@ -113,18 +122,14 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
                     GLenum target, GLint level);
 
 
-extern struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
-
-
 extern GLint
 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
 
 
 extern GLboolean
 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-                         GLint internalFormat, GLenum format, GLenum type,
-                         GLint width, GLint height, GLint depth, GLint border);
+                          gl_format format,
+                          GLint width, GLint height, GLint depth, GLint border);
 
 
 extern GLuint
@@ -133,10 +138,19 @@ _mesa_tex_target_to_face(GLenum target);
 extern GLint
 _mesa_get_texture_dimensions(GLenum target);
 
+extern GLenum
+_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+                                     unsigned dimensions);
+
+extern GLboolean
+_mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target,
+                               GLint level, GLint width, GLint height,
+                               GLint depth, GLint border);
+
 /**
  * Lock a texture for updating.  See also _mesa_lock_context_textures().
  */
-static INLINE void
+static inline void
 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
    _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
@@ -144,9 +158,10 @@ _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
    (void) texObj;
 }
 
-static INLINE void
+static inline void
 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
+   (void) texObj;
    _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
 }
 
@@ -275,6 +290,15 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
                                  GLsizei height, GLsizei depth, GLenum format,
                                  GLsizei imageSize, const GLvoid *data);
 
+
+extern void GLAPIENTRY
+_mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
+
+
 /*@}*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif