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"
35 #include "glapi/dispatch.h"
40 * Just update the ctx->Current vertex attributes.
41 * These functions are used when outside glBegin/glEnd or outside display
49 static void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
51 GET_CURRENT_CONTEXT(ctx
);
52 ctx
->Current
.Attrib
[VERT_ATTRIB_EDGEFLAG
][0] = (GLfloat
)b
;
55 static void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
57 GET_CURRENT_CONTEXT(ctx
);
58 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = f
;
61 static void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
63 GET_CURRENT_CONTEXT(ctx
);
64 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = *v
;
67 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
69 GET_CURRENT_CONTEXT(ctx
);
70 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
77 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
79 GET_CURRENT_CONTEXT(ctx
);
80 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
87 static void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
89 GET_CURRENT_CONTEXT(ctx
);
90 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
97 static void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
99 GET_CURRENT_CONTEXT(ctx
);
100 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
107 static void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
109 GET_CURRENT_CONTEXT(ctx
);
110 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
117 static void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
119 GET_CURRENT_CONTEXT(ctx
);
120 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
127 static void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
129 GET_CURRENT_CONTEXT(ctx
);
130 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
137 static void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
139 GET_CURRENT_CONTEXT(ctx
);
140 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
147 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
149 GET_CURRENT_CONTEXT(ctx
);
150 GLuint unit
= target
- GL_TEXTURE0_ARB
;
152 /* unit is unsigned -- cannot be less than zero.
154 if (unit
< MAX_TEXTURE_COORD_UNITS
)
156 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
164 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
166 GET_CURRENT_CONTEXT(ctx
);
167 GLuint unit
= target
- GL_TEXTURE0_ARB
;
169 /* unit is unsigned -- cannot be less than zero.
171 if (unit
< MAX_TEXTURE_COORD_UNITS
)
173 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
181 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
183 GET_CURRENT_CONTEXT(ctx
);
184 GLuint unit
= target
- GL_TEXTURE0_ARB
;
186 /* unit is unsigned -- cannot be less than zero.
188 if (unit
< MAX_TEXTURE_COORD_UNITS
)
190 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
198 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
200 GET_CURRENT_CONTEXT(ctx
);
201 GLuint unit
= target
- GL_TEXTURE0_ARB
;
203 /* unit is unsigned -- cannot be less than zero.
205 if (unit
< MAX_TEXTURE_COORD_UNITS
)
207 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
215 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
217 GET_CURRENT_CONTEXT(ctx
);
218 GLuint unit
= target
- GL_TEXTURE0_ARB
;
220 /* unit is unsigned -- cannot be less than zero.
222 if (unit
< MAX_TEXTURE_COORD_UNITS
)
224 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
232 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
234 GET_CURRENT_CONTEXT(ctx
);
235 GLuint unit
= target
- GL_TEXTURE0_ARB
;
237 /* unit is unsigned -- cannot be less than zero.
239 if (unit
< MAX_TEXTURE_COORD_UNITS
)
241 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
249 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
250 GLfloat c
, GLfloat d
)
252 GET_CURRENT_CONTEXT(ctx
);
253 GLuint unit
= target
- GL_TEXTURE0_ARB
;
255 /* unit is unsigned -- cannot be less than zero.
257 if (unit
< MAX_TEXTURE_COORD_UNITS
)
259 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
267 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
269 GET_CURRENT_CONTEXT(ctx
);
270 GLuint unit
= target
- GL_TEXTURE0_ARB
;
272 /* unit is unsigned -- cannot be less than zero.
274 if (unit
< MAX_TEXTURE_COORD_UNITS
)
276 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
284 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
286 GET_CURRENT_CONTEXT(ctx
);
287 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
294 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
296 GET_CURRENT_CONTEXT(ctx
);
297 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
304 static void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
306 GET_CURRENT_CONTEXT(ctx
);
307 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
314 static void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
316 GET_CURRENT_CONTEXT(ctx
);
317 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
324 static void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
326 GET_CURRENT_CONTEXT(ctx
);
327 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
334 static void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
336 GET_CURRENT_CONTEXT(ctx
);
337 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
344 static void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
346 GET_CURRENT_CONTEXT(ctx
);
347 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
354 static void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
356 GET_CURRENT_CONTEXT(ctx
);
357 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
364 static void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
366 GET_CURRENT_CONTEXT(ctx
);
367 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
374 static void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
376 GET_CURRENT_CONTEXT(ctx
);
377 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
386 * GL_NV_vertex_program attributes.
387 * Note that these attributes alias the conventional vertex attributes.
390 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
392 GET_CURRENT_CONTEXT(ctx
);
393 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
394 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
397 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fNV(index)" );
400 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
402 GET_CURRENT_CONTEXT(ctx
);
403 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
404 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
407 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvNV(index)" );
410 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
412 GET_CURRENT_CONTEXT(ctx
);
413 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
414 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
417 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fNV(index)" );
420 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
422 GET_CURRENT_CONTEXT(ctx
);
423 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
424 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
427 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvNV(index)" );
430 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
431 GLfloat y
, GLfloat z
)
433 GET_CURRENT_CONTEXT(ctx
);
434 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
435 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
438 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fNV(index)" );
441 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
443 GET_CURRENT_CONTEXT(ctx
);
444 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
445 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
448 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvNV(index)" );
451 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
452 GLfloat y
, GLfloat z
, GLfloat w
)
454 GET_CURRENT_CONTEXT(ctx
);
455 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
456 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
459 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fNV(index)" );
462 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
464 GET_CURRENT_CONTEXT(ctx
);
465 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
466 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
469 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvNV(index)" );
475 * GL_ARB_vertex_program attributes.
476 * Note that these attributes DO NOT alias the conventional vertex attributes.
479 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
481 GET_CURRENT_CONTEXT(ctx
);
482 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
483 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, 0, 0, 1);
486 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fARB(index)" );
489 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
491 GET_CURRENT_CONTEXT(ctx
);
492 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
493 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], 0, 0, 1);
496 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvARB(index)" );
499 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
501 GET_CURRENT_CONTEXT(ctx
);
502 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
503 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, 0, 1);
506 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fARB(index)" );
509 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
511 GET_CURRENT_CONTEXT(ctx
);
512 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
513 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], 0, 1);
516 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvARB(index)" );
519 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
520 GLfloat y
, GLfloat z
)
522 GET_CURRENT_CONTEXT(ctx
);
523 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
524 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, 1);
527 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fARB(index)" );
530 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
532 GET_CURRENT_CONTEXT(ctx
);
533 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
534 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], 1);
537 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvARB(index)" );
540 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
541 GLfloat y
, GLfloat z
, GLfloat w
)
543 GET_CURRENT_CONTEXT(ctx
);
544 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
545 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, w
);
548 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fARB(index)" );
551 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
553 GET_CURRENT_CONTEXT(ctx
);
554 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
555 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], v
[3]);
558 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvARB(index)" );
564 * Called by glMaterial*()
567 _mesa_noop_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*params
)
569 GET_CURRENT_CONTEXT(ctx
);
571 struct gl_material
*mat
= &ctx
->Light
.Material
;
572 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0,
573 "_mesa_noop_Materialfv" );
575 if (ctx
->Light
.ColorMaterialEnabled
)
576 bitmask
&= ~ctx
->Light
.ColorMaterialBitmask
;
582 case GL_SHININESS
: nr
= 1; break;
583 case GL_COLOR_INDEXES
: nr
= 3; break;
584 default: nr
= 4 ; break;
587 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
588 if (bitmask
& (1<<i
))
589 COPY_SZ_4V( mat
->Attrib
[i
], nr
, params
);
591 _mesa_update_material( ctx
, bitmask
);
596 * These really are noops outside begin/end:
598 static void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
603 static void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
608 static void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
613 static void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
618 static void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
620 (void) a
; (void) b
; (void) c
;
623 static void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
625 (void) a
; (void) b
; (void) c
; (void) d
;
629 #if FEATURE_evaluators
630 /* Similarly, these have no effect outside begin/end:
632 static void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
637 static void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
642 static void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
647 static void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
652 static void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
657 static void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
661 #endif /* FEATURE_evaluators */
664 /* Begin -- call into driver, should result in the vtxfmt being
667 static void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
673 /* End -- just raise an error
675 static void GLAPIENTRY
_mesa_noop_End( void )
677 GET_CURRENT_CONTEXT(ctx
);
678 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd(no glBegin)" );
683 * Execute a glRectf() function. This is not suitable for GL_COMPILE
684 * modes (as the test for outside begin/end is not compiled),
685 * but may be useful for drivers in circumstances which exclude
686 * display list interactions.
688 * (None of the functions in this file are suitable for GL_COMPILE
692 _mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
695 GET_CURRENT_CONTEXT(ctx
);
696 ASSERT_OUTSIDE_BEGIN_END(ctx
);
699 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
700 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
701 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
702 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
703 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
704 CALL_End(GET_DISPATCH(), ());
709 * Some very basic support for arrays. Drivers without explicit array
710 * support can hook these in, but still need to supply an array-elt
713 static void GLAPIENTRY
714 _mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
716 GET_CURRENT_CONTEXT(ctx
);
719 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
722 CALL_Begin(GET_DISPATCH(), (mode
));
723 for (i
= 0; i
< count
; i
++)
724 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
725 CALL_End(GET_DISPATCH(), ());
729 static void GLAPIENTRY
730 _mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
731 const GLvoid
*indices
)
733 GET_CURRENT_CONTEXT(ctx
);
736 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
, 0 ))
739 CALL_Begin(GET_DISPATCH(), (mode
));
742 case GL_UNSIGNED_BYTE
:
743 for (i
= 0 ; i
< count
; i
++)
744 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
746 case GL_UNSIGNED_SHORT
:
747 for (i
= 0 ; i
< count
; i
++)
748 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
750 case GL_UNSIGNED_INT
:
751 for (i
= 0 ; i
< count
; i
++)
752 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
755 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
759 CALL_End(GET_DISPATCH(), ());
762 static void GLAPIENTRY
763 _mesa_noop_DrawElementsBaseVertex(GLenum mode
, GLsizei count
, GLenum type
,
764 const GLvoid
*indices
, GLint basevertex
)
766 GET_CURRENT_CONTEXT(ctx
);
769 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
,
773 CALL_Begin(GET_DISPATCH(), (mode
));
776 case GL_UNSIGNED_BYTE
:
777 for (i
= 0 ; i
< count
; i
++)
778 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] +
781 case GL_UNSIGNED_SHORT
:
782 for (i
= 0 ; i
< count
; i
++)
783 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] +
786 case GL_UNSIGNED_INT
:
787 for (i
= 0 ; i
< count
; i
++)
788 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] +
792 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElementsBaseVertex(type)" );
796 CALL_End(GET_DISPATCH(), ());
800 static void GLAPIENTRY
801 _mesa_noop_DrawRangeElements(GLenum mode
,
802 GLuint start
, GLuint end
,
803 GLsizei count
, GLenum type
,
804 const GLvoid
*indices
)
806 GET_CURRENT_CONTEXT(ctx
);
808 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
810 count
, type
, indices
, 0 ))
811 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
814 /* GL_EXT_multi_draw_arrays */
816 _mesa_noop_MultiDrawElements(GLenum mode
, const GLsizei
*count
, GLenum type
,
817 const GLvoid
**indices
, GLsizei primcount
)
821 for (i
= 0; i
< primcount
; i
++) {
823 CALL_DrawElements(GET_DISPATCH(), (mode
, count
[i
], type
, indices
[i
]));
828 static void GLAPIENTRY
829 _mesa_noop_DrawRangeElementsBaseVertex(GLenum mode
,
830 GLuint start
, GLuint end
,
831 GLsizei count
, GLenum type
,
832 const GLvoid
*indices
, GLint basevertex
)
834 GET_CURRENT_CONTEXT(ctx
);
836 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
838 count
, type
, indices
, basevertex
))
839 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode
, count
, type
, indices
,
843 /* GL_EXT_multi_draw_arrays */
845 _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode
, const GLsizei
*count
,
847 const GLvoid
**indices
,
849 const GLint
*basevertex
)
853 for (i
= 0; i
< primcount
; i
++) {
855 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode
, count
[i
], type
,
868 * If are compiling, we don't know whether eval will produce a
869 * vertex when it is run in the future. If this is pure immediate
870 * mode, eval is a noop if neither vertex map is enabled.
872 * Thus we need to have a check in the display list code or elsewhere
873 * for eval(1,2) vertices in the case where map(1,2)_vertex is
874 * disabled, and to purge those vertices from the vb.
877 _mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
879 GET_CURRENT_CONTEXT(ctx
);
889 prim
= GL_LINE_STRIP
;
892 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
896 /* No effect if vertex maps disabled.
898 if (!ctx
->Eval
.Map1Vertex4
&&
899 !ctx
->Eval
.Map1Vertex3
&&
900 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
903 du
= ctx
->Eval
.MapGrid1du
;
904 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
906 CALL_Begin(GET_DISPATCH(), (prim
));
907 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
908 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
910 CALL_End(GET_DISPATCH(), ());
916 _mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
918 GET_CURRENT_CONTEXT(ctx
);
919 GLfloat u
, du
, v
, dv
, v1
, u1
;
928 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
932 /* No effect if vertex maps disabled.
934 if (!ctx
->Eval
.Map2Vertex4
&&
935 !ctx
->Eval
.Map2Vertex3
&&
936 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
939 du
= ctx
->Eval
.MapGrid2du
;
940 dv
= ctx
->Eval
.MapGrid2dv
;
941 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
942 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
946 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
947 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
948 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
949 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
952 CALL_End(GET_DISPATCH(), ());
955 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
956 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
957 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
958 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
960 CALL_End(GET_DISPATCH(), ());
962 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
963 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
964 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
965 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
967 CALL_End(GET_DISPATCH(), ());
971 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
972 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
973 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
974 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
975 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
977 CALL_End(GET_DISPATCH(), ());
981 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
989 * Build a vertexformat of functions to use outside begin/end pairs.
991 * TODO -- build a whole dispatch table for this purpose, and likewise
992 * for inside begin/end.
995 _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
997 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
999 vfmt
->Begin
= _mesa_noop_Begin
;
1001 _MESA_INIT_DLIST_VTXFMT(vfmt
, _mesa_
);
1003 vfmt
->Color3f
= _mesa_noop_Color3f
;
1004 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
1005 vfmt
->Color4f
= _mesa_noop_Color4f
;
1006 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
1007 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
1008 vfmt
->End
= _mesa_noop_End
;
1010 _MESA_INIT_EVAL_VTXFMT(vfmt
, _mesa_noop_
);
1012 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
1013 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
1014 vfmt
->Indexf
= _mesa_noop_Indexf
;
1015 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
1016 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
1017 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
1018 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
1019 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
1020 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
1021 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
1022 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
1023 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
1024 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
1025 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
1026 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
1027 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
1028 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
1029 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
1030 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
1031 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
1032 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
1033 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
1034 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
1035 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
1036 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
1037 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
1038 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
1039 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
1040 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
1041 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
1042 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
1043 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
1044 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
1045 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
1046 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
1047 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
1048 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
1049 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
1050 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
1051 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
1052 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
1053 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
1054 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
1055 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
1056 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
1057 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
1058 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
1060 vfmt
->Rectf
= _mesa_noop_Rectf
;
1062 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
1063 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
1064 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
1065 vfmt
->MultiDrawElementsEXT
= _mesa_noop_MultiDrawElements
;
1066 vfmt
->DrawElementsBaseVertex
= _mesa_noop_DrawElementsBaseVertex
;
1067 vfmt
->DrawRangeElementsBaseVertex
= _mesa_noop_DrawRangeElementsBaseVertex
;
1068 vfmt
->MultiDrawElementsBaseVertex
= _mesa_noop_MultiDrawElementsBaseVertex
;
1072 #endif /* FEATURE_beginend */