[Mesa-dev] [PATCH 2/7] mesa: add an index_to_target_enum() function
Maxence Le Doré
maxence.ledore at gmail.com
Thu Jan 2 16:27:32 PST 2014
From: Maxence Le Doré <Maxence Le Doré>
---
src/mesa/main/texobj.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index d6510fe..bddbc50 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1218,6 +1218,46 @@ target_enum_to_index(const struct gl_context *ctx, GLenum target)
/**
+ * Convert a Mesa texture target index into the corresponding
+ * GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D.
+ * Note that proxy targets are not valid here.
+ * \return GL_TEXTURE_x or 0x0 if index is invalid
+ */
+static GLenum
+index_to_target_enum(struct gl_context *ctx, GLint index)
+{
+ switch (index) {
+ case TEXTURE_2D_MULTISAMPLE_INDEX:
+ return GL_TEXTURE_2D_MULTISAMPLE;
+ case TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX:
+ return GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
+ case TEXTURE_CUBE_ARRAY_INDEX:
+ return GL_TEXTURE_CUBE_MAP_ARRAY;
+ case TEXTURE_BUFFER_INDEX:
+ return GL_TEXTURE_BUFFER_ARB;
+ case TEXTURE_2D_ARRAY_INDEX:
+ return GL_TEXTURE_2D_ARRAY_EXT;
+ case TEXTURE_1D_ARRAY_INDEX:
+ return GL_TEXTURE_1D_ARRAY_EXT;
+ case TEXTURE_EXTERNAL_INDEX:
+ return GL_TEXTURE_EXTERNAL_OES;
+ case TEXTURE_CUBE_INDEX:
+ return GL_TEXTURE_CUBE_MAP_ARB;
+ case TEXTURE_3D_INDEX:
+ return GL_TEXTURE_3D;
+ case TEXTURE_RECT_INDEX:
+ return GL_TEXTURE_RECTANGLE_NV;
+ case TEXTURE_2D_INDEX:
+ return GL_TEXTURE_2D;
+ case TEXTURE_1D_INDEX:
+ return GL_TEXTURE_1D;
+ default:
+ return 0x0;
+ }
+}
+
+
+/**
* Bind a named texture to a texturing target.
*
* \param target texture target.
--
1.8.5.2
More information about the mesa-dev
mailing list