summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-02-11 07:54:42 -0700
committerBrian Paul <brianp@vmware.com>2016-02-12 15:11:24 -0700
commit82db969ac014531dcaba4e4637d6c691f5825e4b (patch)
treef4b5106f8c08155ce6c7d231ef4d886c828bce83 /src/mesa/main/teximage.h
parentd73f5a3133688bbae955feb517ea6bd1cd8782a3 (diff)
downloadexternal_mesa3d-82db969ac014531dcaba4e4637d6c691f5825e4b.zip
external_mesa3d-82db969ac014531dcaba4e4637d6c691f5825e4b.tar.gz
external_mesa3d-82db969ac014531dcaba4e4637d6c691f5825e4b.tar.bz2
mesa: add _mesa_cube_face_target() helper
Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Diffstat (limited to 'src/mesa/main/teximage.h')
-rw-r--r--src/mesa/main/teximage.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index da02214..7754a97 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -49,6 +49,23 @@ _mesa_is_cube_face(GLenum target)
/**
+ * If the target is GL_TEXTURE_CUBE_MAP, return one of the
+ * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z targets corresponding to
+ * the face parameter.
+ * Else, return target as-is.
+ */
+static inline GLenum
+_mesa_cube_face_target(GLenum target, unsigned face)
+{
+ assert(face < 6);
+ if (target == GL_TEXTURE_CUBE_MAP)
+ return GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+ else
+ return target;
+}
+
+
+/**
* For cube map faces, return a face index in [0,5].
* For other targets return 0;
*/