xref: /third_party/mesa3d/src/mesa/vbo/vbo_noop.c (revision bf215546)
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#ifdef _WIN32
32#define NOGDI
33#endif
34
35#include "main/glheader.h"
36#include "main/context.h"
37#include "main/dispatch.h"
38#include "main/dlist.h"
39#include "main/eval.h"
40#include "vbo_attrib.h"
41#include "api_exec_decl.h"
42
43static void GLAPIENTRY
44_mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params)
45{
46}
47
48static void GLAPIENTRY
49_mesa_noop_EvalCoord1f(GLfloat a)
50{
51}
52
53static void GLAPIENTRY
54_mesa_noop_EvalCoord1fv(const GLfloat * v)
55{
56}
57
58static void GLAPIENTRY
59_mesa_noop_EvalCoord2f(GLfloat a, GLfloat b)
60{
61}
62
63static void GLAPIENTRY
64_mesa_noop_EvalCoord2fv(const GLfloat * v)
65{
66}
67
68static void GLAPIENTRY
69_mesa_noop_EvalPoint1(GLint a)
70{
71}
72
73static void GLAPIENTRY
74_mesa_noop_EvalPoint2(GLint a, GLint b)
75{
76}
77
78static void GLAPIENTRY
79_mesa_noop_ArrayElement(GLint elem)
80{
81}
82
83
84static void GLAPIENTRY
85_mesa_noop_Begin(GLenum mode)
86{
87}
88
89static void GLAPIENTRY
90_mesa_noop_End(void)
91{
92}
93
94static void GLAPIENTRY
95_mesa_noop_PrimitiveRestartNV(void)
96{
97}
98
99/**
100 * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex?
101 * It depends on a few things, including whether we're inside or outside
102 * of glBegin/glEnd.
103 */
104static inline bool
105is_vertex_position(const struct gl_context *ctx, GLuint index)
106{
107   return false; /* it doesn't matter for noop */
108}
109
110#define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) do { (void)ctx; (void)(A); } while(0)
111#define ERROR(err) _mesa_error(ctx, err, __func__)
112#define TAG(x) _mesa_noop_##x
113
114#include "vbo_attrib_tmp.h"
115
116
117/**
118 * Build a vertexformat of functions that are no-ops.
119 * These are used in out-of-memory situations when we have no VBO
120 * to put the vertex data into.
121 */
122void
123vbo_install_exec_vtxfmt_noop(struct gl_context *ctx)
124{
125#define NAME_AE(x) _mesa_noop_##x
126#define NAME_CALLLIST(x) _mesa_##x
127#define NAME(x) _mesa_noop_##x
128#define NAME_ES(x) _mesa_noop_##x
129
130   struct _glapi_table *tab = ctx->Exec;
131   #include "api_vtxfmt_init.h"
132
133   if (ctx->BeginEnd) {
134      tab = ctx->BeginEnd;
135      #include "api_vtxfmt_init.h"
136   }
137
138   if (ctx->HWSelectModeBeginEnd) {
139      tab = ctx->HWSelectModeBeginEnd;
140      #include "api_vtxfmt_init.h"
141   }
142}
143
144
145void
146vbo_install_save_vtxfmt_noop(struct gl_context *ctx)
147{
148   struct _glapi_table *tab = ctx->Save;
149   #include "api_vtxfmt_init.h"
150}
151
152/**
153 * Is the given dispatch table using the no-op functions?
154 */
155GLboolean
156_mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch)
157{
158   return GET_Begin((struct _glapi_table *) dispatch) == _mesa_noop_Begin;
159}
160