summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2015-01-02 16:56:12 -0700
committerBrian Paul <brianp@vmware.com>2015-01-05 13:50:55 -0700
commit934e41c0b31cffa4efc08f61cff2389e3149b3f3 (patch)
tree47f638f83ab5520de8fd1a94d1a413cde320ae7c /src/mesa/main/texobj.c
parentf262ed6e3dd9d447355ea2490e84c0a6b0fd1ddb (diff)
downloadexternal_mesa3d-934e41c0b31cffa4efc08f61cff2389e3149b3f3.zip
external_mesa3d-934e41c0b31cffa4efc08f61cff2389e3149b3f3.tar.gz
external_mesa3d-934e41c0b31cffa4efc08f61cff2389e3149b3f3.tar.bz2
mesa: create, use new _mesa_texture_base_format() function
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index f0ff605..d199bd7 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -954,6 +954,20 @@ _mesa_total_texture_memory(struct gl_context *ctx)
}
+/**
+ * Return the base format for the given texture object by looking
+ * at the base texture image.
+ * \return base format (such as GL_RGBA) or GL_NONE if it can't be determined
+ */
+GLenum
+_mesa_texture_base_format(const struct gl_texture_object *texObj)
+{
+ const struct gl_texture_image *texImage = _mesa_base_tex_image(texObj);
+
+ return texImage ? texImage->_BaseFormat : GL_NONE;
+}
+
+
static struct gl_texture_object *
invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture,
GLint level, const char *name)