mesa: add _mesa_cube_face_target() helper
authorBrian Paul <brianp@vmware.com>
Thu, 11 Feb 2016 14:54:42 +0000 (07:54 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 12 Feb 2016 22:11:24 +0000 (15:11 -0700)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/mesa/main/teximage.h

index da02214256ef4f56d69695fc9f21fe1783ab9ecd..7754a97e2de3aa016ef3ebb808ee361a3518fb10 100644 (file)
@@ -48,6 +48,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;