Fix typo.
[mesa.git] / src / mesa / main / api_noop.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 1999-2005 Brian Paul 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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #include "glheader.h"
27 #include "api_noop.h"
28 #include "api_validate.h"
29 #include "api_arrayelt.h"
30 #include "context.h"
31 #include "colormac.h"
32 #include "light.h"
33 #include "macros.h"
34 #include "mtypes.h"
35 #include "dlist.h"
36 #include "dispatch.h"
37
38
39 /* In states where certain vertex components are required for t&l or
40 * rasterization, we still need to keep track of the current values.
41 * These functions provide this service by keeping uptodate the
42 * 'ctx->Current' struct for all data elements not included in the
43 * currently enabled hardware vertex.
44 * I.e. these functions would typically be used when outside of glBegin/End.
45 */
46
47
48 void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
49 {
50 GET_CURRENT_CONTEXT(ctx);
51 ctx->Current.EdgeFlag = b;
52 }
53
54 void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b )
55 {
56 GET_CURRENT_CONTEXT(ctx);
57 ctx->Current.EdgeFlag = *b;
58 }
59
60 void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
61 {
62 GET_CURRENT_CONTEXT(ctx);
63 ctx->Current.Index = f;
64 }
65
66 void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
67 {
68 GET_CURRENT_CONTEXT(ctx);
69 ctx->Current.Index = *v;
70 }
71
72 void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
73 {
74 GET_CURRENT_CONTEXT(ctx);
75 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
76 dest[0] = a;
77 dest[1] = 0.0;
78 dest[2] = 0.0;
79 dest[3] = 1.0;
80 }
81
82 void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
83 {
84 GET_CURRENT_CONTEXT(ctx);
85 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
86 dest[0] = v[0];
87 dest[1] = 0.0;
88 dest[2] = 0.0;
89 dest[3] = 1.0;
90 }
91
92 void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
93 {
94 GET_CURRENT_CONTEXT(ctx);
95 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
96 dest[0] = a;
97 dest[1] = b;
98 dest[2] = c;
99 dest[3] = 1.0;
100 }
101
102 void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
103 {
104 GET_CURRENT_CONTEXT(ctx);
105 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
106 dest[0] = v[0];
107 dest[1] = v[1];
108 dest[2] = v[2];
109 dest[3] = 1.0;
110 }
111
112 void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
113 {
114 GET_CURRENT_CONTEXT(ctx);
115 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
116 color[0] = a;
117 color[1] = b;
118 color[2] = c;
119 color[3] = d;
120 }
121
122 void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
123 {
124 GET_CURRENT_CONTEXT(ctx);
125 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
126 color[0] = v[0];
127 color[1] = v[1];
128 color[2] = v[2];
129 color[3] = v[3];
130 }
131
132 void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
133 {
134 GET_CURRENT_CONTEXT(ctx);
135 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
136 color[0] = a;
137 color[1] = b;
138 color[2] = c;
139 color[3] = 1.0;
140 }
141
142 void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
143 {
144 GET_CURRENT_CONTEXT(ctx);
145 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
146 color[0] = v[0];
147 color[1] = v[1];
148 color[2] = v[2];
149 color[3] = 1.0;
150 }
151
152 void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
153 {
154 GET_CURRENT_CONTEXT(ctx);
155 GLuint unit = target - GL_TEXTURE0_ARB;
156
157 /* unit is unsigned -- cannot be less than zero.
158 */
159 if (unit < MAX_TEXTURE_COORD_UNITS)
160 {
161 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
162 dest[0] = a;
163 dest[1] = 0;
164 dest[2] = 0;
165 dest[3] = 1;
166 }
167 }
168
169 void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
170 {
171 GET_CURRENT_CONTEXT(ctx);
172 GLuint unit = target - GL_TEXTURE0_ARB;
173
174 /* unit is unsigned -- cannot be less than zero.
175 */
176 if (unit < MAX_TEXTURE_COORD_UNITS)
177 {
178 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
179 dest[0] = v[0];
180 dest[1] = 0;
181 dest[2] = 0;
182 dest[3] = 1;
183 }
184 }
185
186 void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
187 {
188 GET_CURRENT_CONTEXT(ctx);
189 GLuint unit = target - GL_TEXTURE0_ARB;
190
191 /* unit is unsigned -- cannot be less than zero.
192 */
193 if (unit < MAX_TEXTURE_COORD_UNITS)
194 {
195 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
196 dest[0] = a;
197 dest[1] = b;
198 dest[2] = 0;
199 dest[3] = 1;
200 }
201 }
202
203 void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
204 {
205 GET_CURRENT_CONTEXT(ctx);
206 GLuint unit = target - GL_TEXTURE0_ARB;
207
208 /* unit is unsigned -- cannot be less than zero.
209 */
210 if (unit < MAX_TEXTURE_COORD_UNITS)
211 {
212 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
213 dest[0] = v[0];
214 dest[1] = v[1];
215 dest[2] = 0;
216 dest[3] = 1;
217 }
218 }
219
220 void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
221 {
222 GET_CURRENT_CONTEXT(ctx);
223 GLuint unit = target - GL_TEXTURE0_ARB;
224
225 /* unit is unsigned -- cannot be less than zero.
226 */
227 if (unit < MAX_TEXTURE_COORD_UNITS)
228 {
229 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
230 dest[0] = a;
231 dest[1] = b;
232 dest[2] = c;
233 dest[3] = 1;
234 }
235 }
236
237 void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
238 {
239 GET_CURRENT_CONTEXT(ctx);
240 GLuint unit = target - GL_TEXTURE0_ARB;
241
242 /* unit is unsigned -- cannot be less than zero.
243 */
244 if (unit < MAX_TEXTURE_COORD_UNITS)
245 {
246 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
247 dest[0] = v[0];
248 dest[1] = v[1];
249 dest[2] = v[2];
250 dest[3] = 1;
251 }
252 }
253
254 void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
255 GLfloat c, GLfloat d )
256 {
257 GET_CURRENT_CONTEXT(ctx);
258 GLuint unit = target - GL_TEXTURE0_ARB;
259
260 /* unit is unsigned -- cannot be less than zero.
261 */
262 if (unit < MAX_TEXTURE_COORD_UNITS)
263 {
264 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
265 dest[0] = a;
266 dest[1] = b;
267 dest[2] = c;
268 dest[3] = d;
269 }
270 }
271
272 void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
273 {
274 GET_CURRENT_CONTEXT(ctx);
275 GLuint unit = target - GL_TEXTURE0_ARB;
276
277 /* unit is unsigned -- cannot be less than zero.
278 */
279 if (unit < MAX_TEXTURE_COORD_UNITS)
280 {
281 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
282 dest[0] = v[0];
283 dest[1] = v[1];
284 dest[2] = v[2];
285 dest[3] = v[3];
286 }
287 }
288
289 void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
290 {
291 GET_CURRENT_CONTEXT(ctx);
292 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
293 color[0] = a;
294 color[1] = b;
295 color[2] = c;
296 color[3] = 1.0;
297 }
298
299 void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
300 {
301 GET_CURRENT_CONTEXT(ctx);
302 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
303 color[0] = v[0];
304 color[1] = v[1];
305 color[2] = v[2];
306 color[3] = 1.0;
307 }
308
309 void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
310 {
311 GET_CURRENT_CONTEXT(ctx);
312 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
313 dest[0] = a;
314 dest[1] = 0;
315 dest[2] = 0;
316 dest[3] = 1;
317 }
318
319 void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
320 {
321 GET_CURRENT_CONTEXT(ctx);
322 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
323 dest[0] = v[0];
324 dest[1] = 0;
325 dest[2] = 0;
326 dest[3] = 1;
327 }
328
329 void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
330 {
331 GET_CURRENT_CONTEXT(ctx);
332 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
333 dest[0] = a;
334 dest[1] = b;
335 dest[2] = 0;
336 dest[3] = 1;
337 }
338
339 void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
340 {
341 GET_CURRENT_CONTEXT(ctx);
342 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
343 dest[0] = v[0];
344 dest[1] = v[1];
345 dest[2] = 0;
346 dest[3] = 1;
347 }
348
349 void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
350 {
351 GET_CURRENT_CONTEXT(ctx);
352 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
353 dest[0] = a;
354 dest[1] = b;
355 dest[2] = c;
356 dest[3] = 1;
357 }
358
359 void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
360 {
361 GET_CURRENT_CONTEXT(ctx);
362 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
363 dest[0] = v[0];
364 dest[1] = v[1];
365 dest[2] = v[2];
366 dest[3] = 1;
367 }
368
369 void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
370 {
371 GET_CURRENT_CONTEXT(ctx);
372 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
373 dest[0] = a;
374 dest[1] = b;
375 dest[2] = c;
376 dest[3] = d;
377 }
378
379 void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
380 {
381 GET_CURRENT_CONTEXT(ctx);
382 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
383 dest[0] = v[0];
384 dest[1] = v[1];
385 dest[2] = v[2];
386 dest[3] = v[3];
387 }
388
389
390
391 void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
392 {
393 GET_CURRENT_CONTEXT(ctx);
394 if (index < VERT_ATTRIB_MAX) {
395 ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
396 }
397 else
398 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fNV" );
399 }
400
401 void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
402 {
403 GET_CURRENT_CONTEXT(ctx);
404 if (index < VERT_ATTRIB_MAX) {
405 ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
406 }
407 else
408 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvNV" );
409 }
410
411 void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
412 {
413 GET_CURRENT_CONTEXT(ctx);
414 if (index < VERT_ATTRIB_MAX) {
415 ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
416 }
417 else
418 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fNV" );
419 }
420
421 void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
422 {
423 GET_CURRENT_CONTEXT(ctx);
424 if (index < VERT_ATTRIB_MAX) {
425 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
426 }
427 else
428 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvNV" );
429 }
430
431 void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
432 GLfloat y, GLfloat z )
433 {
434 GET_CURRENT_CONTEXT(ctx);
435 if (index < VERT_ATTRIB_MAX) {
436 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
437 }
438 else
439 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fNV" );
440 }
441
442 void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
443 {
444 GET_CURRENT_CONTEXT(ctx);
445 if (index < VERT_ATTRIB_MAX) {
446 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
447 }
448 else
449 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvNV" );
450 }
451
452 void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
453 GLfloat y, GLfloat z, GLfloat w )
454 {
455 GET_CURRENT_CONTEXT(ctx);
456 if (index < VERT_ATTRIB_MAX) {
457 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
458 }
459 else
460 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fNV" );
461 }
462
463 void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
464 {
465 GET_CURRENT_CONTEXT(ctx);
466 if (index < VERT_ATTRIB_MAX) {
467 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
468 }
469 else
470 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvNV" );
471 }
472
473
474 /*
475 * XXX Un-alias attribs here
476 */
477
478 void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x )
479 {
480 GET_CURRENT_CONTEXT(ctx);
481 if (index < VERT_ATTRIB_MAX) {
482 ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
483 }
484 else
485 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fARB" );
486 }
487
488 void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
489 {
490 GET_CURRENT_CONTEXT(ctx);
491 if (index < VERT_ATTRIB_MAX) {
492 ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
493 }
494 else
495 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fvARB" );
496 }
497
498 void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
499 {
500 GET_CURRENT_CONTEXT(ctx);
501 if (index < VERT_ATTRIB_MAX) {
502 ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
503 }
504 else
505 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fARB" );
506 }
507
508 void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
509 {
510 GET_CURRENT_CONTEXT(ctx);
511 if (index < VERT_ATTRIB_MAX) {
512 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
513 }
514 else
515 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fvARB" );
516 }
517
518 void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x,
519 GLfloat y, GLfloat z )
520 {
521 GET_CURRENT_CONTEXT(ctx);
522 if (index < VERT_ATTRIB_MAX) {
523 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
524 }
525 else
526 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fARB" );
527 }
528
529 void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
530 {
531 GET_CURRENT_CONTEXT(ctx);
532 if (index < VERT_ATTRIB_MAX) {
533 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
534 }
535 else
536 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fvARB" );
537 }
538
539 void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x,
540 GLfloat y, GLfloat z, GLfloat w )
541 {
542 GET_CURRENT_CONTEXT(ctx);
543 if (index < VERT_ATTRIB_MAX) {
544 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
545 }
546 else
547 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fARB" );
548 }
549
550 void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
551 {
552 GET_CURRENT_CONTEXT(ctx);
553 if (index < VERT_ATTRIB_MAX) {
554 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
555 }
556 else
557 _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fvARB" );
558 }
559
560
561
562 /* Material
563 */
564 void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
565 {
566 GET_CURRENT_CONTEXT(ctx);
567 GLint i, nr;
568 struct gl_material *mat = &ctx->Light.Material;
569 GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
570 "_mesa_noop_Materialfv" );
571
572 if (ctx->Light.ColorMaterialEnabled)
573 bitmask &= ~ctx->Light.ColorMaterialBitmask;
574
575 if (bitmask == 0)
576 return;
577
578 switch (pname) {
579 case GL_SHININESS: nr = 1; break;
580 case GL_COLOR_INDEXES: nr = 3; break;
581 default: nr = 4 ; break;
582 }
583
584 for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
585 if (bitmask & (1<<i))
586 COPY_SZ_4V( mat->Attrib[i], nr, params );
587
588 _mesa_update_material( ctx, bitmask );
589 }
590
591 /* These really are noops outside begin/end:
592 */
593 void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v )
594 {
595 (void) v;
596 }
597
598 void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v )
599 {
600 (void) v;
601 }
602
603 void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v )
604 {
605 (void) v;
606 }
607
608 void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
609 {
610 (void) a; (void) b;
611 }
612
613 void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
614 {
615 (void) a; (void) b; (void) c;
616 }
617
618 void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
619 {
620 (void) a; (void) b; (void) c; (void) d;
621 }
622
623 /* Similarly, these have no effect outside begin/end:
624 */
625 void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
626 {
627 (void) a;
628 }
629
630 void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v )
631 {
632 (void) v;
633 }
634
635 void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
636 {
637 (void) a; (void) b;
638 }
639
640 void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v )
641 {
642 (void) v;
643 }
644
645 void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a )
646 {
647 (void) a;
648 }
649
650 void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
651 {
652 (void) a; (void) b;
653 }
654
655
656 /* Begin -- call into driver, should result in the vtxfmt being
657 * swapped out:
658 */
659 void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
660 {
661 (void) mode;
662 }
663
664
665 /* End -- just raise an error
666 */
667 void GLAPIENTRY _mesa_noop_End( void )
668 {
669 GET_CURRENT_CONTEXT(ctx);
670 _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" );
671 }
672
673
674 /* Execute a glRectf() function. This is not suitable for GL_COMPILE
675 * modes (as the test for outside begin/end is not compiled),
676 * but may be useful for drivers in circumstances which exclude
677 * display list interactions.
678 *
679 * (None of the functions in this file are suitable for GL_COMPILE
680 * modes).
681 */
682 void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
683 {
684 {
685 GET_CURRENT_CONTEXT(ctx);
686 ASSERT_OUTSIDE_BEGIN_END(ctx);
687 }
688
689 CALL_Begin(GET_DISPATCH(), (GL_QUADS));
690 CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
691 CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
692 CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
693 CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
694 CALL_End(GET_DISPATCH(), ());
695 }
696
697
698 /* Some very basic support for arrays. Drivers without explicit array
699 * support can hook these in, but still need to supply an array-elt
700 * implementation.
701 */
702 void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
703 {
704 GET_CURRENT_CONTEXT(ctx);
705 GLint i;
706
707 if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
708 return;
709
710 CALL_Begin(GET_DISPATCH(), (mode));
711 for (i = 0; i < count; i++)
712 CALL_ArrayElement(GET_DISPATCH(), (start + i));
713 CALL_End(GET_DISPATCH(), ());
714 }
715
716
717 void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
718 const GLvoid *indices)
719 {
720 GET_CURRENT_CONTEXT(ctx);
721 GLint i;
722
723 if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices ))
724 return;
725
726 CALL_Begin(GET_DISPATCH(), (mode));
727
728 switch (type) {
729 case GL_UNSIGNED_BYTE:
730 for (i = 0 ; i < count ; i++)
731 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] ));
732 break;
733 case GL_UNSIGNED_SHORT:
734 for (i = 0 ; i < count ; i++)
735 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] ));
736 break;
737 case GL_UNSIGNED_INT:
738 for (i = 0 ; i < count ; i++)
739 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] ));
740 break;
741 default:
742 _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
743 break;
744 }
745
746 CALL_End(GET_DISPATCH(), ());
747 }
748
749 void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
750 GLuint start, GLuint end,
751 GLsizei count, GLenum type,
752 const GLvoid *indices)
753 {
754 GET_CURRENT_CONTEXT(ctx);
755
756 if (_mesa_validate_DrawRangeElements( ctx, mode,
757 start, end,
758 count, type, indices ))
759 CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices));
760 }
761
762 /*
763 * Eval Mesh
764 */
765
766 /* KW: If are compiling, we don't know whether eval will produce a
767 * vertex when it is run in the future. If this is pure immediate
768 * mode, eval is a noop if neither vertex map is enabled.
769 *
770 * Thus we need to have a check in the display list code or
771 * elsewhere for eval(1,2) vertices in the case where
772 * map(1,2)_vertex is disabled, and to purge those vertices from
773 * the vb.
774 */
775 void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
776 {
777 GET_CURRENT_CONTEXT(ctx);
778 GLint i;
779 GLfloat u, du;
780 GLenum prim;
781
782 switch (mode) {
783 case GL_POINT:
784 prim = GL_POINTS;
785 break;
786 case GL_LINE:
787 prim = GL_LINE_STRIP;
788 break;
789 default:
790 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" );
791 return;
792 }
793
794 /* No effect if vertex maps disabled.
795 */
796 if (!ctx->Eval.Map1Vertex4 &&
797 !ctx->Eval.Map1Vertex3 &&
798 !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
799 return;
800
801 du = ctx->Eval.MapGrid1du;
802 u = ctx->Eval.MapGrid1u1 + i1 * du;
803
804 CALL_Begin(GET_DISPATCH(), (prim));
805 for (i=i1;i<=i2;i++,u+=du) {
806 CALL_EvalCoord1f(GET_DISPATCH(), (u));
807 }
808 CALL_End(GET_DISPATCH(), ());
809 }
810
811
812
813 void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
814 {
815 GET_CURRENT_CONTEXT(ctx);
816 GLfloat u, du, v, dv, v1, u1;
817 GLint i, j;
818
819 switch (mode) {
820 case GL_POINT:
821 case GL_LINE:
822 case GL_FILL:
823 break;
824 default:
825 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
826 return;
827 }
828
829 /* No effect if vertex maps disabled.
830 */
831 if (!ctx->Eval.Map2Vertex4 &&
832 !ctx->Eval.Map2Vertex3 &&
833 !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
834 return;
835
836 du = ctx->Eval.MapGrid2du;
837 dv = ctx->Eval.MapGrid2dv;
838 v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
839 u1 = ctx->Eval.MapGrid2u1 + i1 * du;
840
841 switch (mode) {
842 case GL_POINT:
843 CALL_Begin(GET_DISPATCH(), (GL_POINTS));
844 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
845 for (u=u1,i=i1;i<=i2;i++,u+=du) {
846 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
847 }
848 }
849 CALL_End(GET_DISPATCH(), ());
850 break;
851 case GL_LINE:
852 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
853 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
854 for (u=u1,i=i1;i<=i2;i++,u+=du) {
855 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
856 }
857 CALL_End(GET_DISPATCH(), ());
858 }
859 for (u=u1,i=i1;i<=i2;i++,u+=du) {
860 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
861 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
862 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
863 }
864 CALL_End(GET_DISPATCH(), ());
865 }
866 break;
867 case GL_FILL:
868 for (v=v1,j=j1;j<j2;j++,v+=dv) {
869 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP));
870 for (u=u1,i=i1;i<=i2;i++,u+=du) {
871 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
872 CALL_EvalCoord2f(GET_DISPATCH(), (u, v+dv));
873 }
874 CALL_End(GET_DISPATCH(), ());
875 }
876 break;
877 default:
878 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
879 return;
880 }
881 }
882
883
884
885 /* Build a vertexformat full of things to use outside begin/end pairs.
886 *
887 * TODO -- build a whole dispatch table for this purpose, and likewise
888 * for inside begin/end.
889 */
890 void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
891 {
892 vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */
893 vfmt->Begin = _mesa_noop_Begin;
894 vfmt->CallList = _mesa_CallList;
895 vfmt->CallLists = _mesa_CallLists;
896 vfmt->Color3f = _mesa_noop_Color3f;
897 vfmt->Color3fv = _mesa_noop_Color3fv;
898 vfmt->Color4f = _mesa_noop_Color4f;
899 vfmt->Color4fv = _mesa_noop_Color4fv;
900 vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
901 vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
902 vfmt->End = _mesa_noop_End;
903 vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
904 vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
905 vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
906 vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
907 vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
908 vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
909 vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
910 vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
911 vfmt->Indexf = _mesa_noop_Indexf;
912 vfmt->Indexfv = _mesa_noop_Indexfv;
913 vfmt->Materialfv = _mesa_noop_Materialfv;
914 vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
915 vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
916 vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
917 vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
918 vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
919 vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
920 vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
921 vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
922 vfmt->Normal3f = _mesa_noop_Normal3f;
923 vfmt->Normal3fv = _mesa_noop_Normal3fv;
924 vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
925 vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
926 vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
927 vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
928 vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
929 vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
930 vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
931 vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
932 vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
933 vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
934 vfmt->Vertex2f = _mesa_noop_Vertex2f;
935 vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
936 vfmt->Vertex3f = _mesa_noop_Vertex3f;
937 vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
938 vfmt->Vertex4f = _mesa_noop_Vertex4f;
939 vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
940 vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
941 vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
942 vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
943 vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
944 vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
945 vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
946 vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
947 vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
948 vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
949 vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
950 vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
951 vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
952 vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
953 vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
954 vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
955 vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
956
957 vfmt->Rectf = _mesa_noop_Rectf;
958
959 vfmt->DrawArrays = _mesa_noop_DrawArrays;
960 vfmt->DrawElements = _mesa_noop_DrawElements;
961 vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
962 vfmt->EvalMesh1 = _mesa_noop_EvalMesh1;
963 vfmt->EvalMesh2 = _mesa_noop_EvalMesh2;
964 }