From: Brian Paul Date: Thu, 11 Feb 2016 14:54:42 +0000 (-0700) Subject: mesa: add _mesa_cube_face_target() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82db969ac014531dcaba4e4637d6c691f5825e4b;p=mesa.git mesa: add _mesa_cube_face_target() helper Reviewed-by: Roland Scheidegger Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index da02214256e..7754a97e2de 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -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;