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
46 static void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
48 GET_CURRENT_CONTEXT(ctx
);
49 ctx
->Current
.Attrib
[VERT_ATTRIB_EDGEFLAG
][0] = (GLfloat
)b
;
52 static void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
54 GET_CURRENT_CONTEXT(ctx
);
55 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = f
;
58 static void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
60 GET_CURRENT_CONTEXT(ctx
);
61 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = *v
;
64 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
66 GET_CURRENT_CONTEXT(ctx
);
67 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
74 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
76 GET_CURRENT_CONTEXT(ctx
);
77 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
84 static void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
86 GET_CURRENT_CONTEXT(ctx
);
87 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
94 static void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
96 GET_CURRENT_CONTEXT(ctx
);
97 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
104 static void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
106 GET_CURRENT_CONTEXT(ctx
);
107 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
114 static void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
116 GET_CURRENT_CONTEXT(ctx
);
117 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
124 static void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
126 GET_CURRENT_CONTEXT(ctx
);
127 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
134 static void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
136 GET_CURRENT_CONTEXT(ctx
);
137 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
144 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
146 GET_CURRENT_CONTEXT(ctx
);
147 GLuint unit
= target
- GL_TEXTURE0_ARB
;
149 /* unit is unsigned -- cannot be less than zero.
151 if (unit
< MAX_TEXTURE_COORD_UNITS
)
153 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
161 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
163 GET_CURRENT_CONTEXT(ctx
);
164 GLuint unit
= target
- GL_TEXTURE0_ARB
;
166 /* unit is unsigned -- cannot be less than zero.
168 if (unit
< MAX_TEXTURE_COORD_UNITS
)
170 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
178 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
180 GET_CURRENT_CONTEXT(ctx
);
181 GLuint unit
= target
- GL_TEXTURE0_ARB
;
183 /* unit is unsigned -- cannot be less than zero.
185 if (unit
< MAX_TEXTURE_COORD_UNITS
)
187 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
195 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
197 GET_CURRENT_CONTEXT(ctx
);
198 GLuint unit
= target
- GL_TEXTURE0_ARB
;
200 /* unit is unsigned -- cannot be less than zero.
202 if (unit
< MAX_TEXTURE_COORD_UNITS
)
204 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
212 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
214 GET_CURRENT_CONTEXT(ctx
);
215 GLuint unit
= target
- GL_TEXTURE0_ARB
;
217 /* unit is unsigned -- cannot be less than zero.
219 if (unit
< MAX_TEXTURE_COORD_UNITS
)
221 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
229 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
231 GET_CURRENT_CONTEXT(ctx
);
232 GLuint unit
= target
- GL_TEXTURE0_ARB
;
234 /* unit is unsigned -- cannot be less than zero.
236 if (unit
< MAX_TEXTURE_COORD_UNITS
)
238 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
246 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
247 GLfloat c
, GLfloat d
)
249 GET_CURRENT_CONTEXT(ctx
);
250 GLuint unit
= target
- GL_TEXTURE0_ARB
;
252 /* unit is unsigned -- cannot be less than zero.
254 if (unit
< MAX_TEXTURE_COORD_UNITS
)
256 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
264 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
266 GET_CURRENT_CONTEXT(ctx
);
267 GLuint unit
= target
- GL_TEXTURE0_ARB
;
269 /* unit is unsigned -- cannot be less than zero.
271 if (unit
< MAX_TEXTURE_COORD_UNITS
)
273 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
281 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
283 GET_CURRENT_CONTEXT(ctx
);
284 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
291 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
293 GET_CURRENT_CONTEXT(ctx
);
294 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
301 static void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
303 GET_CURRENT_CONTEXT(ctx
);
304 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
311 static void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
313 GET_CURRENT_CONTEXT(ctx
);
314 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
321 static void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
323 GET_CURRENT_CONTEXT(ctx
);
324 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
331 static void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
333 GET_CURRENT_CONTEXT(ctx
);
334 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
341 static void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
343 GET_CURRENT_CONTEXT(ctx
);
344 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
351 static void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
353 GET_CURRENT_CONTEXT(ctx
);
354 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
361 static void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
363 GET_CURRENT_CONTEXT(ctx
);
364 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
371 static void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
373 GET_CURRENT_CONTEXT(ctx
);
374 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
383 * GL_NV_vertex_program attributes.
384 * Note that these attributes alias the conventional vertex attributes.
387 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
389 GET_CURRENT_CONTEXT(ctx
);
390 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
391 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
394 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fNV(index)" );
397 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
399 GET_CURRENT_CONTEXT(ctx
);
400 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
401 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
404 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvNV(index)" );
407 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
409 GET_CURRENT_CONTEXT(ctx
);
410 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
411 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
414 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fNV(index)" );
417 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
419 GET_CURRENT_CONTEXT(ctx
);
420 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
421 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
424 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvNV(index)" );
427 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
428 GLfloat y
, GLfloat z
)
430 GET_CURRENT_CONTEXT(ctx
);
431 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
432 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
435 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fNV(index)" );
438 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
440 GET_CURRENT_CONTEXT(ctx
);
441 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
442 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
445 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvNV(index)" );
448 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
449 GLfloat y
, GLfloat z
, GLfloat w
)
451 GET_CURRENT_CONTEXT(ctx
);
452 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
453 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
456 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fNV(index)" );
459 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
461 GET_CURRENT_CONTEXT(ctx
);
462 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
463 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
466 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvNV(index)" );
472 * GL_ARB_vertex_program attributes.
473 * Note that these attributes DO NOT alias the conventional vertex attributes.
476 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
478 GET_CURRENT_CONTEXT(ctx
);
479 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
480 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, 0, 0, 1);
483 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fARB(index)" );
486 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
488 GET_CURRENT_CONTEXT(ctx
);
489 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
490 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], 0, 0, 1);
493 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvARB(index)" );
496 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
498 GET_CURRENT_CONTEXT(ctx
);
499 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
500 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, 0, 1);
503 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fARB(index)" );
506 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
508 GET_CURRENT_CONTEXT(ctx
);
509 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
510 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], 0, 1);
513 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvARB(index)" );
516 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
517 GLfloat y
, GLfloat z
)
519 GET_CURRENT_CONTEXT(ctx
);
520 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
521 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, 1);
524 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fARB(index)" );
527 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
529 GET_CURRENT_CONTEXT(ctx
);
530 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
531 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], 1);
534 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvARB(index)" );
537 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
538 GLfloat y
, GLfloat z
, GLfloat w
)
540 GET_CURRENT_CONTEXT(ctx
);
541 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
542 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, w
);
545 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fARB(index)" );
548 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
550 GET_CURRENT_CONTEXT(ctx
);
551 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
) {
552 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], v
[3]);
555 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvARB(index)" );
561 * Called by glMaterial*()
564 _mesa_noop_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*params
)
566 GET_CURRENT_CONTEXT(ctx
);
568 struct gl_material
*mat
= &ctx
->Light
.Material
;
569 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0,
570 "_mesa_noop_Materialfv" );
572 if (ctx
->Light
.ColorMaterialEnabled
)
573 bitmask
&= ~ctx
->Light
.ColorMaterialBitmask
;
579 case GL_SHININESS
: nr
= 1; break;
580 case GL_COLOR_INDEXES
: nr
= 3; break;
581 default: nr
= 4 ; break;
584 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
585 if (bitmask
& (1<<i
))
586 COPY_SZ_4V( mat
->Attrib
[i
], nr
, params
);
588 _mesa_update_material( ctx
, bitmask
);
593 * These really are noops outside begin/end:
595 static void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
600 static void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
605 static void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
610 static void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
615 static void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
617 (void) a
; (void) b
; (void) c
;
620 static void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
622 (void) a
; (void) b
; (void) c
; (void) d
;
626 #if FEATURE_evaluators
627 /* Similarly, these have no effect outside begin/end:
629 static void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
634 static void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
639 static void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
644 static void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
649 static void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
654 static void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
658 #endif /* FEATURE_evaluators */
661 /* Begin -- call into driver, should result in the vtxfmt being
664 static void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
670 /* End -- just raise an error
672 static void GLAPIENTRY
_mesa_noop_End( void )
674 GET_CURRENT_CONTEXT(ctx
);
675 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd(no glBegin)" );
680 * Execute a glRectf() function. This is not suitable for GL_COMPILE
681 * modes (as the test for outside begin/end is not compiled),
682 * but may be useful for drivers in circumstances which exclude
683 * display list interactions.
685 * (None of the functions in this file are suitable for GL_COMPILE
689 _mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
692 GET_CURRENT_CONTEXT(ctx
);
693 ASSERT_OUTSIDE_BEGIN_END(ctx
);
696 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
697 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
698 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
699 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
700 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
701 CALL_End(GET_DISPATCH(), ());
706 * Some very basic support for arrays. Drivers without explicit array
707 * support can hook these in, but still need to supply an array-elt
710 static void GLAPIENTRY
711 _mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
713 GET_CURRENT_CONTEXT(ctx
);
716 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
719 CALL_Begin(GET_DISPATCH(), (mode
));
720 for (i
= 0; i
< count
; i
++)
721 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
722 CALL_End(GET_DISPATCH(), ());
726 static void GLAPIENTRY
727 _mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
728 const GLvoid
*indices
)
730 GET_CURRENT_CONTEXT(ctx
);
733 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
, 0 ))
736 CALL_Begin(GET_DISPATCH(), (mode
));
739 case GL_UNSIGNED_BYTE
:
740 for (i
= 0 ; i
< count
; i
++)
741 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
743 case GL_UNSIGNED_SHORT
:
744 for (i
= 0 ; i
< count
; i
++)
745 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
747 case GL_UNSIGNED_INT
:
748 for (i
= 0 ; i
< count
; i
++)
749 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
752 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
756 CALL_End(GET_DISPATCH(), ());
759 static void GLAPIENTRY
760 _mesa_noop_DrawElementsBaseVertex(GLenum mode
, GLsizei count
, GLenum type
,
761 const GLvoid
*indices
, GLint basevertex
)
763 GET_CURRENT_CONTEXT(ctx
);
766 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
,
770 CALL_Begin(GET_DISPATCH(), (mode
));
773 case GL_UNSIGNED_BYTE
:
774 for (i
= 0 ; i
< count
; i
++)
775 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] +
778 case GL_UNSIGNED_SHORT
:
779 for (i
= 0 ; i
< count
; i
++)
780 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] +
783 case GL_UNSIGNED_INT
:
784 for (i
= 0 ; i
< count
; i
++)
785 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] +
789 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElementsBaseVertex(type)" );
793 CALL_End(GET_DISPATCH(), ());
797 static void GLAPIENTRY
798 _mesa_noop_DrawRangeElements(GLenum mode
,
799 GLuint start
, GLuint end
,
800 GLsizei count
, GLenum type
,
801 const GLvoid
*indices
)
803 GET_CURRENT_CONTEXT(ctx
);
805 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
807 count
, type
, indices
, 0 ))
808 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
811 /* GL_EXT_multi_draw_arrays */
813 _mesa_noop_MultiDrawElements(GLenum mode
, const GLsizei
*count
, GLenum type
,
814 const GLvoid
**indices
, GLsizei primcount
)
818 for (i
= 0; i
< primcount
; i
++) {
820 CALL_DrawElements(GET_DISPATCH(), (mode
, count
[i
], type
, indices
[i
]));
825 static void GLAPIENTRY
826 _mesa_noop_DrawRangeElementsBaseVertex(GLenum mode
,
827 GLuint start
, GLuint end
,
828 GLsizei count
, GLenum type
,
829 const GLvoid
*indices
, GLint basevertex
)
831 GET_CURRENT_CONTEXT(ctx
);
833 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
835 count
, type
, indices
, basevertex
))
836 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode
, count
, type
, indices
,
840 /* GL_EXT_multi_draw_arrays */
842 _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode
, const GLsizei
*count
,
844 const GLvoid
**indices
,
846 const GLint
*basevertex
)
850 for (i
= 0; i
< primcount
; i
++) {
852 CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode
, count
[i
], type
,
865 * If are compiling, we don't know whether eval will produce a
866 * vertex when it is run in the future. If this is pure immediate
867 * mode, eval is a noop if neither vertex map is enabled.
869 * Thus we need to have a check in the display list code or elsewhere
870 * for eval(1,2) vertices in the case where map(1,2)_vertex is
871 * disabled, and to purge those vertices from the vb.
874 _mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
876 GET_CURRENT_CONTEXT(ctx
);
886 prim
= GL_LINE_STRIP
;
889 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
893 /* No effect if vertex maps disabled.
895 if (!ctx
->Eval
.Map1Vertex4
&&
896 !ctx
->Eval
.Map1Vertex3
&&
897 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
900 du
= ctx
->Eval
.MapGrid1du
;
901 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
903 CALL_Begin(GET_DISPATCH(), (prim
));
904 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
905 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
907 CALL_End(GET_DISPATCH(), ());
913 _mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
915 GET_CURRENT_CONTEXT(ctx
);
916 GLfloat u
, du
, v
, dv
, v1
, u1
;
925 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
929 /* No effect if vertex maps disabled.
931 if (!ctx
->Eval
.Map2Vertex4
&&
932 !ctx
->Eval
.Map2Vertex3
&&
933 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
936 du
= ctx
->Eval
.MapGrid2du
;
937 dv
= ctx
->Eval
.MapGrid2dv
;
938 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
939 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
943 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
944 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
945 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
946 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
949 CALL_End(GET_DISPATCH(), ());
952 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
953 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
954 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
955 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
957 CALL_End(GET_DISPATCH(), ());
959 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
960 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
961 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
962 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
964 CALL_End(GET_DISPATCH(), ());
968 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
969 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
970 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
971 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
972 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
974 CALL_End(GET_DISPATCH(), ());
978 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
986 * Build a vertexformat of functions to use outside begin/end pairs.
988 * TODO -- build a whole dispatch table for this purpose, and likewise
989 * for inside begin/end.
992 _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
994 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
996 vfmt
->Begin
= _mesa_noop_Begin
;
998 _MESA_INIT_DLIST_VTXFMT(vfmt
, _mesa_
);
1000 vfmt
->Color3f
= _mesa_noop_Color3f
;
1001 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
1002 vfmt
->Color4f
= _mesa_noop_Color4f
;
1003 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
1004 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
1005 vfmt
->End
= _mesa_noop_End
;
1007 _MESA_INIT_EVAL_VTXFMT(vfmt
, _mesa_noop_
);
1009 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
1010 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
1011 vfmt
->Indexf
= _mesa_noop_Indexf
;
1012 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
1013 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
1014 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
1015 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
1016 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
1017 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
1018 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
1019 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
1020 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
1021 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
1022 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
1023 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
1024 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
1025 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
1026 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
1027 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
1028 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
1029 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
1030 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
1031 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
1032 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
1033 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
1034 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
1035 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
1036 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
1037 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
1038 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
1039 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
1040 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
1041 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
1042 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
1043 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
1044 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
1045 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
1046 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
1047 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
1048 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
1049 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
1050 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
1051 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
1052 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
1053 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
1054 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
1055 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
1057 vfmt
->Rectf
= _mesa_noop_Rectf
;
1059 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
1060 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
1061 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
1062 vfmt
->MultiDrawElementsEXT
= _mesa_noop_MultiDrawElements
;
1063 vfmt
->DrawElementsBaseVertex
= _mesa_noop_DrawElementsBaseVertex
;
1064 vfmt
->DrawRangeElementsBaseVertex
= _mesa_noop_DrawRangeElementsBaseVertex
;
1065 vfmt
->MultiDrawElementsBaseVertex
= _mesa_noop_MultiDrawElementsBaseVertex
;