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