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