mesa: don't ever set NullBufferObj in gl_vertex_array_binding
[mesa.git] / src / mesa / vbo / vbo_noop.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
5 * Copyright (C) 2011 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * GLvertexformat no-op functions. Used in out-of-memory situations.
29 */
30
31
32 #include "main/glheader.h"
33 #include "main/context.h"
34 #include "main/dispatch.h"
35 #include "main/dlist.h"
36 #include "main/eval.h"
37 #include "vbo/vbo_noop.h"
38 #include "vbo_attrib.h"
39
40 static void GLAPIENTRY
41 _mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params)
42 {
43 }
44
45 static void GLAPIENTRY
46 _mesa_noop_EvalCoord1f(GLfloat a)
47 {
48 }
49
50 static void GLAPIENTRY
51 _mesa_noop_EvalCoord1fv(const GLfloat * v)
52 {
53 }
54
55 static void GLAPIENTRY
56 _mesa_noop_EvalCoord2f(GLfloat a, GLfloat b)
57 {
58 }
59
60 static void GLAPIENTRY
61 _mesa_noop_EvalCoord2fv(const GLfloat * v)
62 {
63 }
64
65 static void GLAPIENTRY
66 _mesa_noop_EvalPoint1(GLint a)
67 {
68 }
69
70 static void GLAPIENTRY
71 _mesa_noop_EvalPoint2(GLint a, GLint b)
72 {
73 }
74
75 static void GLAPIENTRY
76 _mesa_noop_ArrayElement(GLint elem)
77 {
78 }
79
80
81 static void GLAPIENTRY
82 _mesa_noop_Begin(GLenum mode)
83 {
84 }
85
86 static void GLAPIENTRY
87 _mesa_noop_End(void)
88 {
89 }
90
91 static void GLAPIENTRY
92 _mesa_noop_PrimitiveRestartNV(void)
93 {
94 }
95
96 /**
97 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
98 * It depends on a few things, including whether we're inside or outside
99 * of glBegin/glEnd.
100 */
101 static inline bool
102 is_vertex_position(const struct gl_context *ctx, GLuint index)
103 {
104 return false; /* it doesn't matter for noop */
105 }
106
107 #define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) do { (void)ctx; (void)(A); } while(0)
108 #define ERROR(err) _mesa_error(ctx, err, __func__)
109 #define TAG(x) _mesa_noop_##x
110
111 #include "vbo_attrib_tmp.h"
112
113
114 /**
115 * Build a vertexformat of functions that are no-ops.
116 * These are used in out-of-memory situations when we have no VBO
117 * to put the vertex data into.
118 */
119 void
120 _mesa_noop_vtxfmt_init(struct gl_context *ctx, GLvertexformat * vfmt)
121 {
122 #define NAME_AE(x) _mesa_noop_##x
123 #define NAME_CALLLIST(x) _mesa_##x
124 #define NAME(x) _mesa_noop_##x
125 #define NAME_ES(x) _mesa_noop_##x##ARB
126
127 #include "vbo_init_tmp.h"
128 }
129
130
131 /**
132 * Is the given dispatch table using the no-op functions?
133 */
134 GLboolean
135 _mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch)
136 {
137 return GET_Begin((struct _glapi_table *) dispatch) == _mesa_noop_Begin;
138 }