2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
28 #include "api_validate.h"
29 #include "api_arrayelt.h"
33 #include "mfeatures.h"
36 #include "main/dispatch.h"
41 * Just update the ctx->Current vertex attributes.
42 * These functions are used when outside glBegin/glEnd or outside display
50 static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b )
52 GET_CURRENT_CONTEXT(ctx);
53 ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] = (GLfloat)b;
56 static void GLAPIENTRY _mesa_noop_Indexf( GLfloat f )
58 GET_CURRENT_CONTEXT(ctx);
59 ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = f;
62 static void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v )
64 GET_CURRENT_CONTEXT(ctx);
65 ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0] = *v;
68 static void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a )
70 GET_CURRENT_CONTEXT(ctx);
71 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
78 static void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v )
80 GET_CURRENT_CONTEXT(ctx);
81 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_FOG];
88 static void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
90 GET_CURRENT_CONTEXT(ctx);
91 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
98 static void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v )
100 GET_CURRENT_CONTEXT(ctx);
101 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
108 static void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
110 GET_CURRENT_CONTEXT(ctx);
111 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
118 static void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v )
120 GET_CURRENT_CONTEXT(ctx);
121 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
128 static void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
130 GET_CURRENT_CONTEXT(ctx);
131 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
138 static void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v )
140 GET_CURRENT_CONTEXT(ctx);
141 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
148 static void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
150 GET_CURRENT_CONTEXT(ctx);
151 GLuint unit = target - GL_TEXTURE0_ARB;
153 /* unit is unsigned -- cannot be less than zero.
155 if (unit < MAX_TEXTURE_COORD_UNITS)
157 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
165 static void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v )
167 GET_CURRENT_CONTEXT(ctx);
168 GLuint unit = target - GL_TEXTURE0_ARB;
170 /* unit is unsigned -- cannot be less than zero.
172 if (unit < MAX_TEXTURE_COORD_UNITS)
174 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
182 static void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
184 GET_CURRENT_CONTEXT(ctx);
185 GLuint unit = target - GL_TEXTURE0_ARB;
187 /* unit is unsigned -- cannot be less than zero.
189 if (unit < MAX_TEXTURE_COORD_UNITS)
191 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
199 static void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v )
201 GET_CURRENT_CONTEXT(ctx);
202 GLuint unit = target - GL_TEXTURE0_ARB;
204 /* unit is unsigned -- cannot be less than zero.
206 if (unit < MAX_TEXTURE_COORD_UNITS)
208 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
216 static void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
218 GET_CURRENT_CONTEXT(ctx);
219 GLuint unit = target - GL_TEXTURE0_ARB;
221 /* unit is unsigned -- cannot be less than zero.
223 if (unit < MAX_TEXTURE_COORD_UNITS)
225 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
233 static void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v )
235 GET_CURRENT_CONTEXT(ctx);
236 GLuint unit = target - GL_TEXTURE0_ARB;
238 /* unit is unsigned -- cannot be less than zero.
240 if (unit < MAX_TEXTURE_COORD_UNITS)
242 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
250 static void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
251 GLfloat c, GLfloat d )
253 GET_CURRENT_CONTEXT(ctx);
254 GLuint unit = target - GL_TEXTURE0_ARB;
256 /* unit is unsigned -- cannot be less than zero.
258 if (unit < MAX_TEXTURE_COORD_UNITS)
260 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
268 static void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v )
270 GET_CURRENT_CONTEXT(ctx);
271 GLuint unit = target - GL_TEXTURE0_ARB;
273 /* unit is unsigned -- cannot be less than zero.
275 if (unit < MAX_TEXTURE_COORD_UNITS)
277 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit];
285 static void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
287 GET_CURRENT_CONTEXT(ctx);
288 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
295 static void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
297 GET_CURRENT_CONTEXT(ctx);
298 GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
305 static void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a )
307 GET_CURRENT_CONTEXT(ctx);
308 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
315 static void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v )
317 GET_CURRENT_CONTEXT(ctx);
318 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
325 static void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
327 GET_CURRENT_CONTEXT(ctx);
328 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
335 static void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v )
337 GET_CURRENT_CONTEXT(ctx);
338 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
345 static void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
347 GET_CURRENT_CONTEXT(ctx);
348 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
355 static void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v )
357 GET_CURRENT_CONTEXT(ctx);
358 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
365 static void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
367 GET_CURRENT_CONTEXT(ctx);
368 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
375 static void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v )
377 GET_CURRENT_CONTEXT(ctx);
378 GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
387 * GL_NV_vertex_program attributes.
388 * Note that these attributes alias the conventional vertex attributes.
391 static void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x )
393 GET_CURRENT_CONTEXT(ctx);
394 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
395 ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1);
398 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fNV(index)" );
401 static void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
403 GET_CURRENT_CONTEXT(ctx);
404 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
405 ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1);
408 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvNV(index)" );
411 static void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
413 GET_CURRENT_CONTEXT(ctx);
414 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
415 ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1);
418 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fNV(index)" );
421 static void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
423 GET_CURRENT_CONTEXT(ctx);
424 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
425 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1);
428 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvNV(index)" );
431 static void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x,
432 GLfloat y, GLfloat z )
434 GET_CURRENT_CONTEXT(ctx);
435 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
436 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1);
439 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fNV(index)" );
442 static void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
444 GET_CURRENT_CONTEXT(ctx);
445 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
446 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1);
449 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvNV(index)" );
452 static void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x,
453 GLfloat y, GLfloat z, GLfloat w )
455 GET_CURRENT_CONTEXT(ctx);
456 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
457 ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w);
460 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fNV(index)" );
463 static void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
465 GET_CURRENT_CONTEXT(ctx);
466 if (index < MAX_NV_VERTEX_PROGRAM_INPUTS) {
467 ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]);
470 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvNV(index)" );
476 * GL_ARB_vertex_program attributes.
477 * Note that these attributes DO NOT alias the conventional vertex attributes.
480 static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x )
482 GET_CURRENT_CONTEXT(ctx);
483 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
484 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1);
487 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fARB(index)" );
490 static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
492 GET_CURRENT_CONTEXT(ctx);
493 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
494 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1);
497 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib1fvARB(index)" );
500 static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
502 GET_CURRENT_CONTEXT(ctx);
503 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
504 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1);
507 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fARB(index)" );
510 static void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
512 GET_CURRENT_CONTEXT(ctx);
513 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
514 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1);
517 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib2fvARB(index)" );
520 static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x,
521 GLfloat y, GLfloat z )
523 GET_CURRENT_CONTEXT(ctx);
524 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
525 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1);
528 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fARB(index)" );
531 static void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
533 GET_CURRENT_CONTEXT(ctx);
534 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
535 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1);
538 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib3fvARB(index)" );
541 static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x,
542 GLfloat y, GLfloat z, GLfloat w )
544 GET_CURRENT_CONTEXT(ctx);
545 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
546 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w);
549 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fARB(index)" );
552 static void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
554 GET_CURRENT_CONTEXT(ctx);
555 if (index < MAX_VERTEX_GENERIC_ATTRIBS) {
556 ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]);
559 _mesa_error( ctx, GL_INVALID_VALUE, "glVertexAttrib4fvARB(index)" );
565 * Called by glMaterial*()
568 _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
570 GET_CURRENT_CONTEXT(ctx);
572 struct gl_material *mat = &ctx->Light.Material;
573 GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0,
574 "_mesa_noop_Materialfv" );
576 if (ctx->Light.ColorMaterialEnabled)
577 bitmask &= ~ctx->Light.ColorMaterialBitmask;
583 case GL_SHININESS: nr = 1; break;
584 case GL_COLOR_INDEXES: nr = 3; break;
585 default: nr = 4 ; break;
588 for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
589 if (bitmask & (1<<i))
590 COPY_SZ_4V( mat->Attrib[i], nr, params );
592 _mesa_update_material( ctx, bitmask );
597 * These really are noops outside begin/end:
599 static void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v )
604 static void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v )
609 static void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v )
614 static void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b )
619 static void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c )
621 (void) a; (void) b; (void) c;
624 static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
626 (void) a; (void) b; (void) c; (void) d;
630 #if FEATURE_evaluators
631 /* Similarly, these have no effect outside begin/end:
633 static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a )
638 static void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v )
643 static void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b )
648 static void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v )
653 static void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a )
658 static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b )
662 #endif /* FEATURE_evaluators */
665 /* Begin -- call into driver, should result in the vtxfmt being
668 static void GLAPIENTRY _mesa_noop_Begin( GLenum mode )
674 /* End -- just raise an error
676 static void GLAPIENTRY _mesa_noop_End( void )
678 GET_CURRENT_CONTEXT(ctx);
679 _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd(no glBegin)" );
684 * PrimitiveRestart called outside glBegin()/End(): raise an error
686 static void GLAPIENTRY _mesa_noop_PrimitiveRestartNV( void )
688 GET_CURRENT_CONTEXT(ctx);
689 _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartNV(no glBegin)");
694 * Execute a glRectf() function. This is not suitable for GL_COMPILE
695 * modes (as the test for outside begin/end is not compiled),
696 * but may be useful for drivers in circumstances which exclude
697 * display list interactions.
699 * (None of the functions in this file are suitable for GL_COMPILE
703 _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
706 GET_CURRENT_CONTEXT(ctx);
707 ASSERT_OUTSIDE_BEGIN_END(ctx);
710 CALL_Begin(GET_DISPATCH(), (GL_QUADS));
711 CALL_Vertex2f(GET_DISPATCH(), (x1, y1));
712 CALL_Vertex2f(GET_DISPATCH(), (x2, y1));
713 CALL_Vertex2f(GET_DISPATCH(), (x2, y2));
714 CALL_Vertex2f(GET_DISPATCH(), (x1, y2));
715 CALL_End(GET_DISPATCH(), ());
720 * Some very basic support for arrays. Drivers without explicit array
721 * support can hook these in, but still need to supply an array-elt
724 static void GLAPIENTRY
725 _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
727 GET_CURRENT_CONTEXT(ctx);
730 if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
733 CALL_Begin(GET_DISPATCH(), (mode));
734 for (i = 0; i < count; i++)
735 CALL_ArrayElement(GET_DISPATCH(), (start + i));
736 CALL_End(GET_DISPATCH(), ());
740 static void GLAPIENTRY
741 _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
742 const GLvoid *indices)
744 GET_CURRENT_CONTEXT(ctx);
747 if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
750 CALL_Begin(GET_DISPATCH(), (mode));
753 case GL_UNSIGNED_BYTE:
754 for (i = 0 ; i < count ; i++)
755 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] ));
757 case GL_UNSIGNED_SHORT:
758 for (i = 0 ; i < count ; i++)
759 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] ));
761 case GL_UNSIGNED_INT:
762 for (i = 0 ; i < count ; i++)
763 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] ));
766 _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
770 CALL_End(GET_DISPATCH(), ());
773 static void GLAPIENTRY
774 _mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
775 const GLvoid *indices, GLint basevertex)
777 GET_CURRENT_CONTEXT(ctx);
780 if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
784 CALL_Begin(GET_DISPATCH(), (mode));
787 case GL_UNSIGNED_BYTE:
788 for (i = 0 ; i < count ; i++)
789 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] +
792 case GL_UNSIGNED_SHORT:
793 for (i = 0 ; i < count ; i++)
794 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] +
797 case GL_UNSIGNED_INT:
798 for (i = 0 ; i < count ; i++)
799 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] +
803 _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElementsBaseVertex(type)" );
807 CALL_End(GET_DISPATCH(), ());
811 static void GLAPIENTRY
812 _mesa_noop_DrawRangeElements(GLenum mode,
813 GLuint start, GLuint end,
814 GLsizei count, GLenum type,
815 const GLvoid *indices)
817 GET_CURRENT_CONTEXT(ctx);
819 if (_mesa_validate_DrawRangeElements( ctx, mode,
821 count, type, indices, 0 ))
822 CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices));
825 /* GL_EXT_multi_draw_arrays */
827 _mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
828 const GLvoid **indices, GLsizei primcount)
832 for (i = 0; i < primcount; i++) {
834 CALL_DrawElements(GET_DISPATCH(), (mode, count[i], type, indices[i]));
839 static void GLAPIENTRY
840 _mesa_noop_DrawRangeElementsBaseVertex(GLenum mode,
841 GLuint start, GLuint end,
842 GLsizei count, GLenum type,
843 const GLvoid *indices, GLint basevertex)
845 GET_CURRENT_CONTEXT(ctx);
847 if (_mesa_validate_DrawRangeElements( ctx, mode,
849 count, type, indices, basevertex ))
850 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count, type, indices,
854 /* GL_EXT_multi_draw_arrays */
856 _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
858 const GLvoid **indices,
860 const GLint *basevertex)
864 for (i = 0; i < primcount; i++) {
866 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count[i], type,
879 * If are compiling, we don't know whether eval will produce a
880 * vertex when it is run in the future. If this is pure immediate
881 * mode, eval is a noop if neither vertex map is enabled.
883 * Thus we need to have a check in the display list code or elsewhere
884 * for eval(1,2) vertices in the case where map(1,2)_vertex is
885 * disabled, and to purge those vertices from the vb.
888 _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
890 GET_CURRENT_CONTEXT(ctx);
895 ASSERT_OUTSIDE_BEGIN_END(ctx);
902 prim = GL_LINE_STRIP;
905 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" );
909 /* No effect if vertex maps disabled.
911 if (!ctx->Eval.Map1Vertex4 &&
912 !ctx->Eval.Map1Vertex3 &&
913 !(ctx->VertexProgram._Enabled && ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]))
916 du = ctx->Eval.MapGrid1du;
917 u = ctx->Eval.MapGrid1u1 + i1 * du;
919 CALL_Begin(GET_DISPATCH(), (prim));
920 for (i=i1;i<=i2;i++,u+=du) {
921 CALL_EvalCoord1f(GET_DISPATCH(), (u));
923 CALL_End(GET_DISPATCH(), ());
929 _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
931 GET_CURRENT_CONTEXT(ctx);
932 GLfloat u, du, v, dv, v1, u1;
935 ASSERT_OUTSIDE_BEGIN_END(ctx);
943 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
947 /* No effect if vertex maps disabled.
949 if (!ctx->Eval.Map2Vertex4 &&
950 !ctx->Eval.Map2Vertex3 &&
951 !(ctx->VertexProgram._Enabled && ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]))
954 du = ctx->Eval.MapGrid2du;
955 dv = ctx->Eval.MapGrid2dv;
956 v1 = ctx->Eval.MapGrid2v1 + j1 * dv;
957 u1 = ctx->Eval.MapGrid2u1 + i1 * du;
961 CALL_Begin(GET_DISPATCH(), (GL_POINTS));
962 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
963 for (u=u1,i=i1;i<=i2;i++,u+=du) {
964 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
967 CALL_End(GET_DISPATCH(), ());
970 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
971 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
972 for (u=u1,i=i1;i<=i2;i++,u+=du) {
973 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
975 CALL_End(GET_DISPATCH(), ());
977 for (u=u1,i=i1;i<=i2;i++,u+=du) {
978 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP));
979 for (v=v1,j=j1;j<=j2;j++,v+=dv) {
980 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
982 CALL_End(GET_DISPATCH(), ());
986 for (v=v1,j=j1;j<j2;j++,v+=dv) {
987 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP));
988 for (u=u1,i=i1;i<=i2;i++,u+=du) {
989 CALL_EvalCoord2f(GET_DISPATCH(), (u, v));
990 CALL_EvalCoord2f(GET_DISPATCH(), (u, v+dv));
992 CALL_End(GET_DISPATCH(), ());
996 _mesa_error( ctx, GL_INVALID_ENUM, "glEvalMesh2(mode)" );
1004 * Build a vertexformat of functions to use outside begin/end pairs.
1006 * TODO -- build a whole dispatch table for this purpose, and likewise
1007 * for inside begin/end.
1010 _mesa_noop_vtxfmt_init( GLvertexformat *vfmt )
1012 _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
1014 vfmt->Begin = _mesa_noop_Begin;
1016 _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_);
1018 vfmt->Color3f = _mesa_noop_Color3f;
1019 vfmt->Color3fv = _mesa_noop_Color3fv;
1020 vfmt->Color4f = _mesa_noop_Color4f;
1021 vfmt->Color4fv = _mesa_noop_Color4fv;
1022 vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
1023 vfmt->End = _mesa_noop_End;
1025 vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV;
1027 _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_);
1029 vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
1030 vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
1031 vfmt->Indexf = _mesa_noop_Indexf;
1032 vfmt->Indexfv = _mesa_noop_Indexfv;
1033 vfmt->Materialfv = _mesa_noop_Materialfv;
1034 vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
1035 vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
1036 vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
1037 vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
1038 vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
1039 vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
1040 vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
1041 vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
1042 vfmt->Normal3f = _mesa_noop_Normal3f;
1043 vfmt->Normal3fv = _mesa_noop_Normal3fv;
1044 vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
1045 vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
1046 vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
1047 vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
1048 vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
1049 vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
1050 vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
1051 vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
1052 vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
1053 vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
1054 vfmt->Vertex2f = _mesa_noop_Vertex2f;
1055 vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
1056 vfmt->Vertex3f = _mesa_noop_Vertex3f;
1057 vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
1058 vfmt->Vertex4f = _mesa_noop_Vertex4f;
1059 vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
1060 vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
1061 vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
1062 vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
1063 vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
1064 vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
1065 vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
1066 vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
1067 vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
1068 vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
1069 vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
1070 vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
1071 vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
1072 vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
1073 vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
1074 vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
1075 vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
1077 vfmt->Rectf = _mesa_noop_Rectf;
1079 vfmt->DrawArrays = _mesa_noop_DrawArrays;
1080 vfmt->DrawElements = _mesa_noop_DrawElements;
1081 vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
1082 vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements;
1083 vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex;
1084 vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
1085 vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
1089 #endif /* FEATURE_beginend */