summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-11-27 20:07:08 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-11-27 20:07:08 +0000
commitb5b8d22c4ee921dff99b898a5907023b20670a27 (patch)
treef86cfa06e3fbe8c3d73fc665e79294c0257d53ff /src/mesa/tnl
parent0699b0bb171ffba453222154c4b2c047a30a2a8b (diff)
Change the dispatch offsets for the VertexAttrib*NV functions so they don't
alias with the corresponding ARB functions. GL_ARB_vertex_shader (and OpenGL 2.0's) VertexAttrib functions don't alias with conventional vertex attributes, as GL_NV_vertex_program does. So, the ARB and NV version of VertexAttrib need to be distinct.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_save_api.c81
-rw-r--r--src/mesa/tnl/t_save_loopback.c40
-rw-r--r--src/mesa/tnl/t_vtx_generic.c70
3 files changed, 188 insertions, 3 deletions
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index 5a7e6b5666..81b68f77be 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -991,6 +991,79 @@ static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
}
+static void GLAPIENTRY
+_save_VertexAttrib1fARB( GLuint index, GLfloat x )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR1F( index, x );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR1FV( index, v );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR2F( index, x, y );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR2FV( index, v );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR3F( index, x, y, z );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR3FV( index, v );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR4F( index, x, y, z, w );
+ else
+ enum_error();
+}
+
+static void GLAPIENTRY
+_save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
+{
+ if (index < VERT_ATTRIB_MAX)
+ DISPATCH_ATTR4FV( index, v );
+ else
+ enum_error();
+}
+
+
/* Materials:
*
* These are treated as per-vertex attributes, at indices above where
@@ -1427,6 +1500,14 @@ static void _save_vtxfmt_init( GLcontext *ctx )
vfmt->VertexAttrib3fvNV = _save_VertexAttrib3fvNV;
vfmt->VertexAttrib4fNV = _save_VertexAttrib4fNV;
vfmt->VertexAttrib4fvNV = _save_VertexAttrib4fvNV;
+ vfmt->VertexAttrib1fARB = _save_VertexAttrib1fARB;
+ vfmt->VertexAttrib1fvARB = _save_VertexAttrib1fvARB;
+ vfmt->VertexAttrib2fARB = _save_VertexAttrib2fARB;
+ vfmt->VertexAttrib2fvARB = _save_VertexAttrib2fvARB;
+ vfmt->VertexAttrib3fARB = _save_VertexAttrib3fARB;
+ vfmt->VertexAttrib3fvARB = _save_VertexAttrib3fvARB;
+ vfmt->VertexAttrib4fARB = _save_VertexAttrib4fARB;
+ vfmt->VertexAttrib4fvARB = _save_VertexAttrib4fvARB;
/* This will all require us to fallback to saving the list as opcodes:
*/
diff --git a/src/mesa/tnl/t_save_loopback.c b/src/mesa/tnl/t_save_loopback.c
index 2e752c809a..66def96121 100644
--- a/src/mesa/tnl/t_save_loopback.c
+++ b/src/mesa/tnl/t_save_loopback.c
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.3
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -97,6 +96,39 @@ static attr_func vert_attrfunc[4] = {
};
+static void VertexAttrib1fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
+{
+ ctx->Exec->VertexAttrib1fvARB(target, v);
+}
+
+static void VertexAttrib2fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
+{
+ ctx->Exec->VertexAttrib2fvARB(target, v);
+}
+
+static void VertexAttrib3fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
+{
+ ctx->Exec->VertexAttrib3fvARB(target, v);
+}
+
+static void VertexAttrib4fvARB(GLcontext *ctx, GLint target, const GLfloat *v)
+{
+ ctx->Exec->VertexAttrib4fvARB(target, v);
+}
+
+static attr_func vert_attrfunc_arb[4] = {
+ VertexAttrib1fvARB,
+ VertexAttrib2fvARB,
+ VertexAttrib3fvARB,
+ VertexAttrib4fvARB
+};
+
+
+
+
+
+
+
static void mat_attr1fv( GLcontext *ctx, GLint target, const GLfloat *v )
{
switch (target) {
@@ -298,6 +330,8 @@ void _tnl_loopback_vertex_list( GLcontext *ctx,
nr++;
}
+ /* XXX ARB vertex attribs */
+
for (i = 0 ; i < list->prim_count ; i++) {
if (list->prim[i].mode & PRIM_WEAK)
loopback_weak_prim( ctx, list, i, la, nr );
diff --git a/src/mesa/tnl/t_vtx_generic.c b/src/mesa/tnl/t_vtx_generic.c
index daa7deace3..0422fcd45d 100644
--- a/src/mesa/tnl/t_vtx_generic.c
+++ b/src/mesa/tnl/t_vtx_generic.c
@@ -361,6 +361,7 @@ static void GLAPIENTRY _tnl_MultiTexCoord4fv( GLenum target,
DISPATCH_ATTR4FV( attr, v );
}
+
static void GLAPIENTRY _tnl_VertexAttrib1fNV( GLuint index, GLfloat x )
{
if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
@@ -418,6 +419,67 @@ static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index,
}
+/*
+ * XXX adjust index
+ */
+
+static void GLAPIENTRY _tnl_VertexAttrib1fARB( GLuint index, GLfloat x )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR1F( index, x );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib1fvARB( GLuint index,
+ const GLfloat *v )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR1FV( index, v );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib2fARB( GLuint index, GLfloat x,
+ GLfloat y )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR2F( index, x, y );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib2fvARB( GLuint index,
+ const GLfloat *v )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR2FV( index, v );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib3fARB( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR3F( index, x, y, z );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib3fvARB( GLuint index,
+ const GLfloat *v )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR3FV( index, v );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib4fARB( GLuint index, GLfloat x,
+ GLfloat y, GLfloat z,
+ GLfloat w )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR4F( index, x, y, z, w );
+}
+
+static void GLAPIENTRY _tnl_VertexAttrib4fvARB( GLuint index,
+ const GLfloat *v )
+{
+ if (index >= VERT_ATTRIB_MAX) index = ERROR_ATTRIB;
+ DISPATCH_ATTR4FV( index, v );
+}
+
+
/* Install the generic versions of the 2nd level dispatch
* functions. Some of these have a codegen alternative.
*/
@@ -465,4 +527,12 @@ void _tnl_generic_exec_vtxfmt_init( GLcontext *ctx )
vfmt->VertexAttrib3fvNV = _tnl_VertexAttrib3fvNV;
vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV;
vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV;
+ vfmt->VertexAttrib1fARB = _tnl_VertexAttrib1fARB;
+ vfmt->VertexAttrib1fvARB = _tnl_VertexAttrib1fvARB;
+ vfmt->VertexAttrib2fARB = _tnl_VertexAttrib2fARB;
+ vfmt->VertexAttrib2fvARB = _tnl_VertexAttrib2fvARB;
+ vfmt->VertexAttrib3fARB = _tnl_VertexAttrib3fARB;
+ vfmt->VertexAttrib3fvARB = _tnl_VertexAttrib3fvARB;
+ vfmt->VertexAttrib4fARB = _tnl_VertexAttrib4fARB;
+ vfmt->VertexAttrib4fvARB = _tnl_VertexAttrib4fvARB;
}