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"
36 #include "glapi/dispatch.h"
41 * Just update the ctx->Current vertex attributes.
42 * These functions are used when outside glBegin/glEnd or outside display
47 static void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
49 GET_CURRENT_CONTEXT(ctx
);
50 ctx
->Current
.Attrib
[VERT_ATTRIB_EDGEFLAG
][0] = (GLfloat
)b
;
53 static void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
55 GET_CURRENT_CONTEXT(ctx
);
56 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = f
;
59 static void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
61 GET_CURRENT_CONTEXT(ctx
);
62 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = *v
;
65 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
67 GET_CURRENT_CONTEXT(ctx
);
68 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
75 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
77 GET_CURRENT_CONTEXT(ctx
);
78 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
85 static void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
87 GET_CURRENT_CONTEXT(ctx
);
88 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
95 static void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
97 GET_CURRENT_CONTEXT(ctx
);
98 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
105 static void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
107 GET_CURRENT_CONTEXT(ctx
);
108 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
115 static void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
117 GET_CURRENT_CONTEXT(ctx
);
118 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
125 static void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
127 GET_CURRENT_CONTEXT(ctx
);
128 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
135 static void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
137 GET_CURRENT_CONTEXT(ctx
);
138 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
145 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
147 GET_CURRENT_CONTEXT(ctx
);
148 GLuint unit
= target
- GL_TEXTURE0_ARB
;
150 /* unit is unsigned -- cannot be less than zero.
152 if (unit
< MAX_TEXTURE_COORD_UNITS
)
154 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
162 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
164 GET_CURRENT_CONTEXT(ctx
);
165 GLuint unit
= target
- GL_TEXTURE0_ARB
;
167 /* unit is unsigned -- cannot be less than zero.
169 if (unit
< MAX_TEXTURE_COORD_UNITS
)
171 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
179 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
181 GET_CURRENT_CONTEXT(ctx
);
182 GLuint unit
= target
- GL_TEXTURE0_ARB
;
184 /* unit is unsigned -- cannot be less than zero.
186 if (unit
< MAX_TEXTURE_COORD_UNITS
)
188 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
196 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
198 GET_CURRENT_CONTEXT(ctx
);
199 GLuint unit
= target
- GL_TEXTURE0_ARB
;
201 /* unit is unsigned -- cannot be less than zero.
203 if (unit
< MAX_TEXTURE_COORD_UNITS
)
205 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
213 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
215 GET_CURRENT_CONTEXT(ctx
);
216 GLuint unit
= target
- GL_TEXTURE0_ARB
;
218 /* unit is unsigned -- cannot be less than zero.
220 if (unit
< MAX_TEXTURE_COORD_UNITS
)
222 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
230 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
232 GET_CURRENT_CONTEXT(ctx
);
233 GLuint unit
= target
- GL_TEXTURE0_ARB
;
235 /* unit is unsigned -- cannot be less than zero.
237 if (unit
< MAX_TEXTURE_COORD_UNITS
)
239 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
247 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
248 GLfloat c
, GLfloat d
)
250 GET_CURRENT_CONTEXT(ctx
);
251 GLuint unit
= target
- GL_TEXTURE0_ARB
;
253 /* unit is unsigned -- cannot be less than zero.
255 if (unit
< MAX_TEXTURE_COORD_UNITS
)
257 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
265 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
267 GET_CURRENT_CONTEXT(ctx
);
268 GLuint unit
= target
- GL_TEXTURE0_ARB
;
270 /* unit is unsigned -- cannot be less than zero.
272 if (unit
< MAX_TEXTURE_COORD_UNITS
)
274 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
282 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
284 GET_CURRENT_CONTEXT(ctx
);
285 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
292 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
294 GET_CURRENT_CONTEXT(ctx
);
295 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
302 static void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
304 GET_CURRENT_CONTEXT(ctx
);
305 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
312 static void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
314 GET_CURRENT_CONTEXT(ctx
);
315 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
322 static void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
324 GET_CURRENT_CONTEXT(ctx
);
325 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
332 static void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
334 GET_CURRENT_CONTEXT(ctx
);
335 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
342 static void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
344 GET_CURRENT_CONTEXT(ctx
);
345 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
352 static void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
354 GET_CURRENT_CONTEXT(ctx
);
355 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
362 static void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
364 GET_CURRENT_CONTEXT(ctx
);
365 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
372 static void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
374 GET_CURRENT_CONTEXT(ctx
);
375 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
384 * GL_NV_vertex_program attributes.
385 * Note that these attributes alias the conventional vertex attributes.
388 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
390 GET_CURRENT_CONTEXT(ctx
);
391 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
392 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
395 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fNV(index)" );
398 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
400 GET_CURRENT_CONTEXT(ctx
);
401 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
402 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
405 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvNV(index)" );
408 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
410 GET_CURRENT_CONTEXT(ctx
);
411 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
412 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
415 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fNV(index)" );
418 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
420 GET_CURRENT_CONTEXT(ctx
);
421 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
422 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
425 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvNV(index)" );
428 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
429 GLfloat y
, GLfloat z
)
431 GET_CURRENT_CONTEXT(ctx
);
432 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
433 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
436 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fNV(index)" );
439 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
441 GET_CURRENT_CONTEXT(ctx
);
442 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
443 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
446 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvNV(index)" );
449 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
450 GLfloat y
, GLfloat z
, GLfloat w
)
452 GET_CURRENT_CONTEXT(ctx
);
453 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
454 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
457 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fNV(index)" );
460 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
462 GET_CURRENT_CONTEXT(ctx
);
463 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
464 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
467 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvNV(index)" );
473 * GL_ARB_vertex_program attributes.
474 * Note that these attributes DO NOT alias the conventional vertex attributes.
477 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
479 GET_CURRENT_CONTEXT(ctx
);
480 if (index
< MAX_VERTEX_ATTRIBS
) {
481 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, 0, 0, 1);
484 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fARB(index)" );
487 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
489 GET_CURRENT_CONTEXT(ctx
);
490 if (index
< MAX_VERTEX_ATTRIBS
) {
491 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], 0, 0, 1);
494 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvARB(index)" );
497 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
499 GET_CURRENT_CONTEXT(ctx
);
500 if (index
< MAX_VERTEX_ATTRIBS
) {
501 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, 0, 1);
504 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fARB(index)" );
507 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
509 GET_CURRENT_CONTEXT(ctx
);
510 if (index
< MAX_VERTEX_ATTRIBS
) {
511 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], 0, 1);
514 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvARB(index)" );
517 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
518 GLfloat y
, GLfloat z
)
520 GET_CURRENT_CONTEXT(ctx
);
521 if (index
< MAX_VERTEX_ATTRIBS
) {
522 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, 1);
525 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fARB(index)" );
528 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
530 GET_CURRENT_CONTEXT(ctx
);
531 if (index
< MAX_VERTEX_ATTRIBS
) {
532 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], 1);
535 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvARB(index)" );
538 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
539 GLfloat y
, GLfloat z
, GLfloat w
)
541 GET_CURRENT_CONTEXT(ctx
);
542 if (index
< MAX_VERTEX_ATTRIBS
) {
543 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, w
);
546 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fARB(index)" );
549 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
551 GET_CURRENT_CONTEXT(ctx
);
552 if (index
< MAX_VERTEX_ATTRIBS
) {
553 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], v
[3]);
556 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvARB(index)" );
562 * Called by glMaterial*()
565 _mesa_noop_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*params
)
567 GET_CURRENT_CONTEXT(ctx
);
569 struct gl_material
*mat
= &ctx
->Light
.Material
;
570 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0,
571 "_mesa_noop_Materialfv" );
573 if (ctx
->Light
.ColorMaterialEnabled
)
574 bitmask
&= ~ctx
->Light
.ColorMaterialBitmask
;
580 case GL_SHININESS
: nr
= 1; break;
581 case GL_COLOR_INDEXES
: nr
= 3; break;
582 default: nr
= 4 ; break;
585 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
586 if (bitmask
& (1<<i
))
587 COPY_SZ_4V( mat
->Attrib
[i
], nr
, params
);
589 _mesa_update_material( ctx
, bitmask
);
594 * These really are noops outside begin/end:
596 static void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
601 static void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
606 static void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
611 static void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
616 static void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
618 (void) a
; (void) b
; (void) c
;
621 static void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
623 (void) a
; (void) b
; (void) c
; (void) d
;
627 #if FEATURE_evaluators
628 /* Similarly, these have no effect outside begin/end:
630 static void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
635 static void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
640 static void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
645 static void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
650 static void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
655 static void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
659 #endif /* FEATURE_evaluators */
662 /* Begin -- call into driver, should result in the vtxfmt being
665 static void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
671 /* End -- just raise an error
673 static void GLAPIENTRY
_mesa_noop_End( void )
675 GET_CURRENT_CONTEXT(ctx
);
676 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd(no glBegin)" );
681 * Execute a glRectf() function. This is not suitable for GL_COMPILE
682 * modes (as the test for outside begin/end is not compiled),
683 * but may be useful for drivers in circumstances which exclude
684 * display list interactions.
686 * (None of the functions in this file are suitable for GL_COMPILE
690 _mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
693 GET_CURRENT_CONTEXT(ctx
);
694 ASSERT_OUTSIDE_BEGIN_END(ctx
);
697 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
698 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
699 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
700 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
701 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
702 CALL_End(GET_DISPATCH(), ());
707 * Some very basic support for arrays. Drivers without explicit array
708 * support can hook these in, but still need to supply an array-elt
711 static void GLAPIENTRY
712 _mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
714 GET_CURRENT_CONTEXT(ctx
);
717 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
720 CALL_Begin(GET_DISPATCH(), (mode
));
721 for (i
= 0; i
< count
; i
++)
722 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
723 CALL_End(GET_DISPATCH(), ());
727 static void GLAPIENTRY
728 _mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
729 const GLvoid
*indices
)
731 GET_CURRENT_CONTEXT(ctx
);
734 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
))
737 CALL_Begin(GET_DISPATCH(), (mode
));
740 case GL_UNSIGNED_BYTE
:
741 for (i
= 0 ; i
< count
; i
++)
742 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
744 case GL_UNSIGNED_SHORT
:
745 for (i
= 0 ; i
< count
; i
++)
746 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
748 case GL_UNSIGNED_INT
:
749 for (i
= 0 ; i
< count
; i
++)
750 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
753 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
757 CALL_End(GET_DISPATCH(), ());
761 static void GLAPIENTRY
762 _mesa_noop_DrawRangeElements(GLenum mode
,
763 GLuint start
, GLuint end
,
764 GLsizei count
, GLenum type
,
765 const GLvoid
*indices
)
767 GET_CURRENT_CONTEXT(ctx
);
769 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
771 count
, type
, indices
))
772 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
781 * If are compiling, we don't know whether eval will produce a
782 * vertex when it is run in the future. If this is pure immediate
783 * mode, eval is a noop if neither vertex map is enabled.
785 * Thus we need to have a check in the display list code or elsewhere
786 * for eval(1,2) vertices in the case where map(1,2)_vertex is
787 * disabled, and to purge those vertices from the vb.
790 _mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
792 GET_CURRENT_CONTEXT(ctx
);
802 prim
= GL_LINE_STRIP
;
805 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
809 /* No effect if vertex maps disabled.
811 if (!ctx
->Eval
.Map1Vertex4
&&
812 !ctx
->Eval
.Map1Vertex3
&&
813 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
816 du
= ctx
->Eval
.MapGrid1du
;
817 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
819 CALL_Begin(GET_DISPATCH(), (prim
));
820 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
821 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
823 CALL_End(GET_DISPATCH(), ());
829 _mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
831 GET_CURRENT_CONTEXT(ctx
);
832 GLfloat u
, du
, v
, dv
, v1
, u1
;
841 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
845 /* No effect if vertex maps disabled.
847 if (!ctx
->Eval
.Map2Vertex4
&&
848 !ctx
->Eval
.Map2Vertex3
&&
849 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
852 du
= ctx
->Eval
.MapGrid2du
;
853 dv
= ctx
->Eval
.MapGrid2dv
;
854 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
855 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
859 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
860 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
861 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
862 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
865 CALL_End(GET_DISPATCH(), ());
868 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
869 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
870 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
871 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
873 CALL_End(GET_DISPATCH(), ());
875 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
876 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
877 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
878 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
880 CALL_End(GET_DISPATCH(), ());
884 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
885 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
886 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
887 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
888 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
890 CALL_End(GET_DISPATCH(), ());
894 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
902 * Build a vertexformat of functions to use outside begin/end pairs.
904 * TODO -- build a whole dispatch table for this purpose, and likewise
905 * for inside begin/end.
908 _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
910 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
911 vfmt
->Begin
= _mesa_noop_Begin
;
913 vfmt
->CallList
= _mesa_CallList
;
914 vfmt
->CallLists
= _mesa_CallLists
;
916 vfmt
->Color3f
= _mesa_noop_Color3f
;
917 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
918 vfmt
->Color4f
= _mesa_noop_Color4f
;
919 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
920 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
921 vfmt
->End
= _mesa_noop_End
;
922 #if FEATURE_evaluators
923 vfmt
->EvalCoord1f
= _mesa_noop_EvalCoord1f
;
924 vfmt
->EvalCoord1fv
= _mesa_noop_EvalCoord1fv
;
925 vfmt
->EvalCoord2f
= _mesa_noop_EvalCoord2f
;
926 vfmt
->EvalCoord2fv
= _mesa_noop_EvalCoord2fv
;
927 vfmt
->EvalPoint1
= _mesa_noop_EvalPoint1
;
928 vfmt
->EvalPoint2
= _mesa_noop_EvalPoint2
;
930 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
931 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
932 vfmt
->Indexf
= _mesa_noop_Indexf
;
933 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
934 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
935 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
936 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
937 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
938 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
939 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
940 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
941 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
942 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
943 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
944 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
945 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
946 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
947 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
948 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
949 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
950 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
951 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
952 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
953 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
954 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
955 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
956 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
957 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
958 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
959 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
960 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
961 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
962 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
963 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
964 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
965 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
966 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
967 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
968 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
969 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
970 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
971 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
972 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
973 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
974 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
975 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
976 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
978 vfmt
->Rectf
= _mesa_noop_Rectf
;
980 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
981 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
982 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
983 vfmt
->EvalMesh1
= _mesa_noop_EvalMesh1
;
984 vfmt
->EvalMesh2
= _mesa_noop_EvalMesh2
;