summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_loopback.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-10-28 21:17:41 -0600
committerBrian Paul <[email protected]>2010-10-28 21:17:41 -0600
commitca2618f4b632bf4b357a539a8fb7dafc99b35976 (patch)
tree70b05392c3ca65db9a2690689b9550eca196b639 /src/mesa/main/api_loopback.c
parente2b8c657238d37b76720ea5d2e8b30d748718c29 (diff)
mesa: implement integer-valued vertex attribute functions
The integers still get converted to floats. That'll have to change someday.
Diffstat (limited to 'src/mesa/main/api_loopback.c')
-rw-r--r--src/mesa/main/api_loopback.c144
1 files changed, 36 insertions, 108 deletions
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index d1789069cc1..8740a1830c2 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -66,16 +66,24 @@
#define MATERIALFV(a,b,c) CALL_Materialfv(GET_DISPATCH(), (a,b,c))
#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d))
+#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x))
+#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
+
#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x))
#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y))
#define ATTRIB3NV(index,x,y,z) CALL_VertexAttrib3fNV(GET_DISPATCH(), (index,x,y,z))
#define ATTRIB4NV(index,x,y,z,w) CALL_VertexAttrib4fNV(GET_DISPATCH(), (index,x,y,z,w))
+
#define ATTRIB1ARB(index,x) CALL_VertexAttrib1fARB(GET_DISPATCH(), (index,x))
#define ATTRIB2ARB(index,x,y) CALL_VertexAttrib2fARB(GET_DISPATCH(), (index,x,y))
#define ATTRIB3ARB(index,x,y,z) CALL_VertexAttrib3fARB(GET_DISPATCH(), (index,x,y,z))
#define ATTRIB4ARB(index,x,y,z,w) CALL_VertexAttrib4fARB(GET_DISPATCH(), (index,x,y,z,w))
-#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x))
-#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
+
+#define ATTRIBI_1I(index,x) CALL_VertexAttribI1iEXT(GET_DISPATCH(), (index,x))
+#define ATTRIBI_1UI(index,x) CALL_VertexAttribI1uiEXT(GET_DISPATCH(), (index,x))
+#define ATTRIBI_4I(index,x,y,z,w) CALL_VertexAttribI4iEXT(GET_DISPATCH(), (index,x,y,z,w))
+
+#define ATTRIBI_4UI(index,x,y,z,w) CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w))
#if FEATURE_beginend
@@ -1041,6 +1049,7 @@ loopback_SecondaryColor3ubvEXT_f( const GLubyte *v )
/*
* GL_NV_vertex_program:
* Always loop-back to one of the VertexAttrib[1234]f[v]NV functions.
+ * Note that attribute indexes DO alias conventional vertex attributes.
*/
static void GLAPIENTRY
@@ -1263,6 +1272,7 @@ loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
/*
* GL_ARB_vertex_program
* Always loop-back to one of the VertexAttrib[1234]f[v]ARB functions.
+ * Note that attribute indexes do NOT alias conventional attributes.
*/
static void GLAPIENTRY
@@ -1443,133 +1453,47 @@ loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v)
-/** GL 3.0 Integer-valued attributes **/
-
-static void GLAPIENTRY
-loopback_VertexAttribI1i(GLuint index, GLint x)
-{
- ATTRIB1ARB(index, (GLfloat) x);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI2i(GLuint index, GLint x, GLint y)
-{
- ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
-{
- ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI1ui(GLuint index, GLuint x)
-{
- ATTRIB1ARB(index, (GLfloat) x);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI2ui(GLuint index, GLuint x, GLuint y)
-{
- ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
-{
- ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
-}
+/**
+ * GL_EXT_gpu_shader / GL 3.0 signed/unsigned integer-valued attributes.
+ * Note that attribute indexes do NOT alias conventional attributes.
+ */
static void GLAPIENTRY
loopback_VertexAttribI1iv(GLuint index, const GLint *v)
{
- ATTRIB1ARB(index, (GLfloat) v[0]);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI2iv (GLuint index, const GLint *v)
-{
- ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI3iv(GLuint index, const GLint *v)
-{
- ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI4iv(GLuint index, const GLint *v)
-{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIBI_1I(index, v[0]);
}
static void GLAPIENTRY
loopback_VertexAttribI1uiv(GLuint index, const GLuint *v)
{
- ATTRIB1ARB(index, (GLfloat) v[0]);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI2uiv(GLuint index, const GLuint *v)
-{
- ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]);
-}
-
-static void GLAPIENTRY
-loopback_VertexAttribI3uiv(GLuint index, const GLuint *v)
-{
- ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]);
+ ATTRIBI_1UI(index, v[0]);
}
static void GLAPIENTRY
-loopback_VertexAttribI4uiv(GLuint index, const GLuint *v)
+loopback_VertexAttribI4bv(uint index, const GLbyte *v)
{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIBI_4I(index, v[0], v[1], v[2], v[3]);
}
static void GLAPIENTRY
-loopback_VertexAttribI4bv(GLuint index, const GLbyte *v)
+loopback_VertexAttribI4sv(uint index, const GLshort *v)
{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIBI_4I(index, v[0], v[1], v[2], v[3]);
}
static void GLAPIENTRY
-loopback_VertexAttribI4sv(GLuint index, const GLshort *v)
+loopback_VertexAttribI4ubv(uint index, const GLubyte *v)
{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]);
}
static void GLAPIENTRY
-loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v)
+loopback_VertexAttribI4usv(uint index, const GLushort *v)
{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
+ ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]);
}
-static void GLAPIENTRY
-loopback_VertexAttribI4usv(GLuint index, const GLushort *v)
-{
- ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1],
- (GLfloat) v[2], (GLfloat) v[3]);
-}
@@ -1788,7 +1712,14 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB);
SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB);
- /* GL 3.0 */
+ /* GL_EXT_gpu_shader4, GL 3.0 */
+ SET_VertexAttribI1ivEXT(dest, loopback_VertexAttribI1iv);
+ SET_VertexAttribI1uivEXT(dest, loopback_VertexAttribI1uiv);
+ SET_VertexAttribI4bvEXT(dest, loopback_VertexAttribI4bv);
+ SET_VertexAttribI4svEXT(dest, loopback_VertexAttribI4sv);
+ SET_VertexAttribI4ubvEXT(dest, loopback_VertexAttribI4ubv);
+ SET_VertexAttribI4usvEXT(dest, loopback_VertexAttribI4usv);
+
#if 0
SET_VertexAttribI1i(dest, loopback_VertexAttribI1i);
SET_VertexAttribI2i(dest, loopback_VertexAttribI2i);
@@ -1806,11 +1737,8 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
SET_VertexAttribI2uiv(dest, loopback_VertexAttribI2uiv);
SET_VertexAttribI3uiv(dest, loopback_VertexAttribI3uiv);
SET_VertexAttribI4uiv(dest, loopback_VertexAttribI4uiv);
- SET_VertexAttribI4bv(dest, loopback_VertexAttribI4bv);
- SET_VertexAttribI4sv(dest, loopback_VertexAttribI4sv);
- SET_VertexAttribI4ubv(dest, loopback_VertexAttribI4ubv);
- SET_VertexAttribI4usv(dest, loopback_VertexAttribI4usv);
-#else
+#endif
+#if 0
(void) loopback_VertexAttribI1i;
(void) loopback_VertexAttribI2i;
(void) loopback_VertexAttribI3i;