mesa/main: Fix missing return in non void function
[mesa.git] / src / mesa / main / api_loopback.c
index 6b66319a9e425f5759af944168b41528a1039a6b..8b63d9c0e95e83ff0d0a9a8b0e304a275cd95403 100644 (file)
@@ -1,12 +1,11 @@
 /**
  * \file api_loopback.c
  *
- * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Keith Whitwell <keithw@vmware.com>
  */
 
 /*
  * Mesa 3-D graphics library
- * Version:  6.3
  *
  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
@@ -34,9 +34,7 @@
 #include "api_loopback.h"
 #include "mtypes.h"
 #include "glapi/glapi.h"
-#include "glapi/glthread.h"
 #include "main/dispatch.h"
-#include "mfeatures.h"
 #include "main/context.h"
 
 /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
 
 #define ATTRIBI_4UI(index,x,y,z,w)   CALL_VertexAttribI4uiEXT(GET_DISPATCH(), (index,x,y,z,w))
 
+#define ATTRIB1_D(index,x)         CALL_VertexAttribL1d(GET_DISPATCH(), (index,x))
+#define ATTRIB2_D(index,x,y)       CALL_VertexAttribL2d(GET_DISPATCH(), (index,x,y))
+#define ATTRIB3_D(index,x,y,z)     CALL_VertexAttribL3d(GET_DISPATCH(), (index,x,y,z))
+#define ATTRIB4_D(index,x,y,z,w)    CALL_VertexAttribL4d(GET_DISPATCH(), (index,x,y,z,w))
 
 void GLAPIENTRY
 _mesa_Color3b( GLbyte red, GLbyte green, GLbyte blue )
@@ -627,7 +629,10 @@ _mesa_Vertex2sv( const GLshort *v )
 void GLAPIENTRY
 _mesa_Vertex3dv( const GLdouble *v )
 {
-   VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+   if (v[2] == 0.0)
+      VERTEX2( (GLfloat) v[0], (GLfloat) v[1] );
+   else
+      VERTEX3( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
 }
 
 void GLAPIENTRY
@@ -1492,8 +1497,53 @@ _mesa_VertexAttribI4usv(GLuint index, const GLushort *v)
    ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]);
 }
 
+void GLAPIENTRY
+_mesa_VertexAttribL1d(GLuint index, GLdouble x)
+{
+   ATTRIB1_D(index, x);
+}
+
+void GLAPIENTRY
+_mesa_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
+{
+   ATTRIB2_D(index, x, y);
+}
+
+void GLAPIENTRY
+_mesa_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+   ATTRIB3_D(index, x, y, z);
+}
+
+void GLAPIENTRY
+_mesa_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+   ATTRIB4_D(index, x, y, z, w);
+}
+
+void GLAPIENTRY
+_mesa_VertexAttribL1dv(GLuint index, const GLdouble *v)
+{
+   ATTRIB1_D(index, v[0]);
+}
+
+void GLAPIENTRY
+_mesa_VertexAttribL2dv(GLuint index, const GLdouble *v)
+{
+   ATTRIB2_D(index, v[0], v[1]);
+}
 
+void GLAPIENTRY
+_mesa_VertexAttribL3dv(GLuint index, const GLdouble *v)
+{
+   ATTRIB3_D(index, v[0], v[1], v[2]);
+}
 
+void GLAPIENTRY
+_mesa_VertexAttribL4dv(GLuint index, const GLdouble *v)
+{
+   ATTRIB4_D(index, v[0], v[1], v[2], v[3]);
+}
 
 /*
  * This code never registers handlers for any of the entry points
@@ -1507,7 +1557,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_Color4ub(dest, _mesa_Color4ub);
       SET_Materialf(dest, _mesa_Materialf);
    }
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       SET_Color3b(dest, _mesa_Color3b);
       SET_Color3d(dest, _mesa_Color3d);
       SET_Color3i(dest, _mesa_Color3i);
@@ -1654,7 +1704,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_FogCoorddv(dest, _mesa_FogCoorddv);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       SET_VertexAttrib1sNV(dest, _mesa_VertexAttrib1sNV);
       SET_VertexAttrib1dNV(dest, _mesa_VertexAttrib1dNV);
       SET_VertexAttrib2sNV(dest, _mesa_VertexAttrib2sNV);
@@ -1726,4 +1776,17 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_VertexAttribI4ubv(dest, _mesa_VertexAttribI4ubv);
       SET_VertexAttribI4usv(dest, _mesa_VertexAttribI4usv);
    }
+
+   if (ctx->API == API_OPENGL_CORE) {
+      /* GL 4.1 / GL_ARB_vertex_attrib_64bit */
+      SET_VertexAttribL1d(dest, _mesa_VertexAttribL1d);
+      SET_VertexAttribL2d(dest, _mesa_VertexAttribL2d);
+      SET_VertexAttribL3d(dest, _mesa_VertexAttribL3d);
+      SET_VertexAttribL4d(dest, _mesa_VertexAttribL4d);
+
+      SET_VertexAttribL1dv(dest, _mesa_VertexAttribL1dv);
+      SET_VertexAttribL2dv(dest, _mesa_VertexAttribL2dv);
+      SET_VertexAttribL3dv(dest, _mesa_VertexAttribL3dv);
+      SET_VertexAttribL4dv(dest, _mesa_VertexAttribL4dv);
+   }
 }