summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-01-02 16:56:12 -0700
committerBrian Paul <[email protected]>2015-01-05 13:50:55 -0700
commit934e41c0b31cffa4efc08f61cff2389e3149b3f3 (patch)
tree47f638f83ab5520de8fd1a94d1a413cde320ae7c /src/mesa/main/texobj.c
parentf262ed6e3dd9d447355ea2490e84c0a6b0fd1ddb (diff)
mesa: create, use new _mesa_texture_base_format() function
Reviewed-by: Eric Anholt <[email protected]>
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 f0ff605fc50..d199bd7fdb5 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)