mesa: Add missing include guards
[mesa.git] / src / mesa / main / vtxfmt.c
index 5891a5231616f585ab6a8617dd7a4186f601d0b6..3e96c7d2fbac5c79c35ad257f3d62070dd8c1f27 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * 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.
  *
  * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
- *    Gareth Hughes
+ *    Keith Whitwell <keithw@vmware.com> Gareth Hughes
  */
 
 #include "glheader.h"
 #include "api_arrayelt.h"
 #include "context.h"
 #include "imports.h"
-#include "mfeatures.h"
 #include "mtypes.h"
 #include "vtxfmt.h"
 #include "eval.h"
 #include "dlist.h"
 #include "main/dispatch.h"
+#include "vbo/vbo.h"
 
 
 /**
- * Use the per-vertex functions found in <vfmt> to initialize the given
- * API dispatch table.
+ * Copy the functions found in the GLvertexformat object into the
+ * dispatch table.
  */
 static void
 install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
                const GLvertexformat *vfmt)
 {
+   assert(ctx->Version > 0);
+
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_Color4f(tab, vfmt->Color4f);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       _mesa_install_arrayelt_vtxfmt(tab, vfmt);
       SET_Color3f(tab, vfmt->Color3f);
       SET_Color3fv(tab, vfmt->Color3fv);
@@ -58,7 +59,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_EdgeFlag(tab, vfmt->EdgeFlag);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       _mesa_install_eval_vtxfmt(tab, vfmt);
    }
 
@@ -68,7 +69,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_Normal3f(tab, vfmt->Normal3f);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
       SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
       SET_Indexf(tab, vfmt->Indexf);
@@ -83,7 +84,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_Normal3fv(tab, vfmt->Normal3fv);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
       SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
       SET_TexCoord1f(tab, vfmt->TexCoord1f);
@@ -102,50 +103,16 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_Vertex4fv(tab, vfmt->Vertex4fv);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       _mesa_install_dlist_vtxfmt(tab, vfmt);   /* glCallList / glCallLists */
 
       SET_Begin(tab, vfmt->Begin);
       SET_End(tab, vfmt->End);
       SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
-
-      SET_Rectf(tab, vfmt->Rectf);
-   }
-
-   SET_DrawArrays(tab, vfmt->DrawArrays);
-   SET_DrawElements(tab, vfmt->DrawElements);
-   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
-      SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
-   }
-
-   SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
-
-   if (_mesa_is_desktop_gl(ctx)) {
-      SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
-      SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
-      SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
-      SET_DrawArraysInstancedBaseInstance(tab, vfmt->DrawArraysInstancedBaseInstance);
-      SET_DrawElementsInstancedBaseInstance(tab, vfmt->DrawElementsInstancedBaseInstance);
-      SET_DrawElementsInstancedBaseVertex(tab, vfmt->DrawElementsInstancedBaseVertex);
-      SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance);
-   }
-
-   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
-      SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
-      SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
-   }
-
-   if (_mesa_is_desktop_gl(ctx)) {
-      SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback);
-      SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream);
-      SET_DrawTransformFeedbackInstanced(tab,
-                                         vfmt->DrawTransformFeedbackInstanced);
-      SET_DrawTransformFeedbackStreamInstanced(tab,
-                                               vfmt->DrawTransformFeedbackStreamInstanced);
    }
 
    /* Originally for GL_NV_vertex_program, this is also used by dlist.c */
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
       SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
       SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
@@ -189,7 +156,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
    }
 
-   if (ctx->API == API_OPENGL) {
+   if (ctx->API == API_OPENGL_COMPAT) {
       /* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
       SET_VertexP2ui(tab, vfmt->VertexP2ui);
       SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
@@ -238,6 +205,23 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_VertexAttribP2uiv(tab, vfmt->VertexAttribP2uiv);
       SET_VertexAttribP3uiv(tab, vfmt->VertexAttribP3uiv);
       SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
+
+      /* GL_ARB_bindless_texture */
+      SET_VertexAttribL1ui64ARB(tab, vfmt->VertexAttribL1ui64ARB);
+      SET_VertexAttribL1ui64vARB(tab, vfmt->VertexAttribL1ui64vARB);
+   }
+
+   if (_mesa_is_desktop_gl(ctx)) {
+      /* GL_ARB_vertex_attrib_64bit */
+      SET_VertexAttribL1d(tab, vfmt->VertexAttribL1d);
+      SET_VertexAttribL2d(tab, vfmt->VertexAttribL2d);
+      SET_VertexAttribL3d(tab, vfmt->VertexAttribL3d);
+      SET_VertexAttribL4d(tab, vfmt->VertexAttribL4d);
+
+      SET_VertexAttribL1dv(tab, vfmt->VertexAttribL1dv);
+      SET_VertexAttribL2dv(tab, vfmt->VertexAttribL2dv);
+      SET_VertexAttribL3dv(tab, vfmt->VertexAttribL3dv);
+      SET_VertexAttribL4dv(tab, vfmt->VertexAttribL4dv);
    }
 }
 
@@ -248,7 +232,9 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
 void
 _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
 {
-   install_vtxfmt( ctx, ctx->Exec, vfmt );
+   install_vtxfmt(ctx, ctx->Exec, vfmt);
+   if (ctx->BeginEnd)
+      install_vtxfmt(ctx, ctx->BeginEnd, vfmt);
 }
 
 
@@ -260,5 +246,21 @@ void
 _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
 {
    if (_mesa_is_desktop_gl(ctx))
-      install_vtxfmt( ctx, ctx->Save, vfmt );
+      install_vtxfmt(ctx, ctx->Save, vfmt);
+}
+
+
+/**
+ * Install VBO vtxfmt functions.
+ *
+ * This function depends on ctx->Version.
+ */
+void
+_mesa_initialize_vbo_vtxfmt(struct gl_context *ctx)
+{
+   _vbo_install_exec_vtxfmt(ctx);
+   if (ctx->API == API_OPENGL_COMPAT) {
+      _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt);
+   }
 }
+