2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2005 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"
39 /* In states where certain vertex components are required for t&l or
40 * rasterization, we still need to keep track of the current values.
41 * These functions provide this service by keeping uptodate the
42 * 'ctx->Current' struct for all data elements not included in the
43 * currently enabled hardware vertex.
44 * I.e. these functions would typically be used when outside of glBegin/End.
48 void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
50 GET_CURRENT_CONTEXT(ctx
);
51 ctx
->Current
.EdgeFlag
= b
;
54 void GLAPIENTRY
_mesa_noop_EdgeFlagv( const GLboolean
*b
)
56 GET_CURRENT_CONTEXT(ctx
);
57 ctx
->Current
.EdgeFlag
= *b
;
60 void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
62 GET_CURRENT_CONTEXT(ctx
);
63 ctx
->Current
.Index
= f
;
66 void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
68 GET_CURRENT_CONTEXT(ctx
);
69 ctx
->Current
.Index
= *v
;
72 void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
74 GET_CURRENT_CONTEXT(ctx
);
75 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
82 void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
84 GET_CURRENT_CONTEXT(ctx
);
85 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
92 void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
94 GET_CURRENT_CONTEXT(ctx
);
95 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
102 void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
104 GET_CURRENT_CONTEXT(ctx
);
105 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
112 void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
114 GET_CURRENT_CONTEXT(ctx
);
115 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
122 void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
124 GET_CURRENT_CONTEXT(ctx
);
125 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
132 void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
134 GET_CURRENT_CONTEXT(ctx
);
135 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
142 void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
144 GET_CURRENT_CONTEXT(ctx
);
145 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
152 void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
154 GET_CURRENT_CONTEXT(ctx
);
155 GLuint unit
= target
- GL_TEXTURE0_ARB
;
157 /* unit is unsigned -- cannot be less than zero.
159 if (unit
< MAX_TEXTURE_COORD_UNITS
)
161 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
169 void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
171 GET_CURRENT_CONTEXT(ctx
);
172 GLuint unit
= target
- GL_TEXTURE0_ARB
;
174 /* unit is unsigned -- cannot be less than zero.
176 if (unit
< MAX_TEXTURE_COORD_UNITS
)
178 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
186 void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
188 GET_CURRENT_CONTEXT(ctx
);
189 GLuint unit
= target
- GL_TEXTURE0_ARB
;
191 /* unit is unsigned -- cannot be less than zero.
193 if (unit
< MAX_TEXTURE_COORD_UNITS
)
195 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
203 void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
205 GET_CURRENT_CONTEXT(ctx
);
206 GLuint unit
= target
- GL_TEXTURE0_ARB
;
208 /* unit is unsigned -- cannot be less than zero.
210 if (unit
< MAX_TEXTURE_COORD_UNITS
)
212 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
220 void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
222 GET_CURRENT_CONTEXT(ctx
);
223 GLuint unit
= target
- GL_TEXTURE0_ARB
;
225 /* unit is unsigned -- cannot be less than zero.
227 if (unit
< MAX_TEXTURE_COORD_UNITS
)
229 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
237 void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
239 GET_CURRENT_CONTEXT(ctx
);
240 GLuint unit
= target
- GL_TEXTURE0_ARB
;
242 /* unit is unsigned -- cannot be less than zero.
244 if (unit
< MAX_TEXTURE_COORD_UNITS
)
246 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
254 void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
255 GLfloat c
, GLfloat d
)
257 GET_CURRENT_CONTEXT(ctx
);
258 GLuint unit
= target
- GL_TEXTURE0_ARB
;
260 /* unit is unsigned -- cannot be less than zero.
262 if (unit
< MAX_TEXTURE_COORD_UNITS
)
264 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
272 void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
274 GET_CURRENT_CONTEXT(ctx
);
275 GLuint unit
= target
- GL_TEXTURE0_ARB
;
277 /* unit is unsigned -- cannot be less than zero.
279 if (unit
< MAX_TEXTURE_COORD_UNITS
)
281 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
289 void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
291 GET_CURRENT_CONTEXT(ctx
);
292 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
299 void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
301 GET_CURRENT_CONTEXT(ctx
);
302 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
309 void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
311 GET_CURRENT_CONTEXT(ctx
);
312 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
319 void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
321 GET_CURRENT_CONTEXT(ctx
);
322 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
329 void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
331 GET_CURRENT_CONTEXT(ctx
);
332 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
339 void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
341 GET_CURRENT_CONTEXT(ctx
);
342 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
349 void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
351 GET_CURRENT_CONTEXT(ctx
);
352 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
359 void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
361 GET_CURRENT_CONTEXT(ctx
);
362 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
369 void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
371 GET_CURRENT_CONTEXT(ctx
);
372 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
379 void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
381 GET_CURRENT_CONTEXT(ctx
);
382 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
391 void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
393 GET_CURRENT_CONTEXT(ctx
);
394 if (index
< VERT_ATTRIB_MAX
) {
395 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
398 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fNV" );
401 void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
403 GET_CURRENT_CONTEXT(ctx
);
404 if (index
< VERT_ATTRIB_MAX
) {
405 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
408 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fvNV" );
411 void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
413 GET_CURRENT_CONTEXT(ctx
);
414 if (index
< VERT_ATTRIB_MAX
) {
415 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
418 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fNV" );
421 void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
423 GET_CURRENT_CONTEXT(ctx
);
424 if (index
< VERT_ATTRIB_MAX
) {
425 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
428 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fvNV" );
431 void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
432 GLfloat y
, GLfloat z
)
434 GET_CURRENT_CONTEXT(ctx
);
435 if (index
< VERT_ATTRIB_MAX
) {
436 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
439 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fNV" );
442 void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
444 GET_CURRENT_CONTEXT(ctx
);
445 if (index
< VERT_ATTRIB_MAX
) {
446 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
449 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fvNV" );
452 void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
453 GLfloat y
, GLfloat z
, GLfloat w
)
455 GET_CURRENT_CONTEXT(ctx
);
456 if (index
< VERT_ATTRIB_MAX
) {
457 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
460 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fNV" );
463 void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
465 GET_CURRENT_CONTEXT(ctx
);
466 if (index
< VERT_ATTRIB_MAX
) {
467 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
470 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fvNV" );
475 * XXX Un-alias attribs here
478 void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
480 GET_CURRENT_CONTEXT(ctx
);
481 if (index
< VERT_ATTRIB_MAX
) {
482 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
485 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fARB" );
488 void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
490 GET_CURRENT_CONTEXT(ctx
);
491 if (index
< VERT_ATTRIB_MAX
) {
492 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
495 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fvARB" );
498 void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
500 GET_CURRENT_CONTEXT(ctx
);
501 if (index
< VERT_ATTRIB_MAX
) {
502 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
505 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fARB" );
508 void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
510 GET_CURRENT_CONTEXT(ctx
);
511 if (index
< VERT_ATTRIB_MAX
) {
512 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
515 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fvARB" );
518 void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
519 GLfloat y
, GLfloat z
)
521 GET_CURRENT_CONTEXT(ctx
);
522 if (index
< VERT_ATTRIB_MAX
) {
523 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
526 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fARB" );
529 void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
531 GET_CURRENT_CONTEXT(ctx
);
532 if (index
< VERT_ATTRIB_MAX
) {
533 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
536 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fvARB" );
539 void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
540 GLfloat y
, GLfloat z
, GLfloat w
)
542 GET_CURRENT_CONTEXT(ctx
);
543 if (index
< VERT_ATTRIB_MAX
) {
544 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
547 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fARB" );
550 void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
552 GET_CURRENT_CONTEXT(ctx
);
553 if (index
< VERT_ATTRIB_MAX
) {
554 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
557 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fvARB" );
564 void GLAPIENTRY
_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
);
591 /* These really are noops outside begin/end:
593 void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
598 void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
603 void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
608 void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
613 void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
615 (void) a
; (void) b
; (void) c
;
618 void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
620 (void) a
; (void) b
; (void) c
; (void) d
;
623 /* Similarly, these have no effect outside begin/end:
625 void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
630 void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
635 void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
640 void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
645 void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
650 void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
656 /* Begin -- call into driver, should result in the vtxfmt being
659 void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
665 /* End -- just raise an error
667 void GLAPIENTRY
_mesa_noop_End( void )
669 GET_CURRENT_CONTEXT(ctx
);
670 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd" );
674 /* Execute a glRectf() function. This is not suitable for GL_COMPILE
675 * modes (as the test for outside begin/end is not compiled),
676 * but may be useful for drivers in circumstances which exclude
677 * display list interactions.
679 * (None of the functions in this file are suitable for GL_COMPILE
682 void GLAPIENTRY
_mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
685 GET_CURRENT_CONTEXT(ctx
);
686 ASSERT_OUTSIDE_BEGIN_END(ctx
);
689 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
690 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
691 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
692 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
693 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
694 CALL_End(GET_DISPATCH(), ());
698 /* Some very basic support for arrays. Drivers without explicit array
699 * support can hook these in, but still need to supply an array-elt
702 void GLAPIENTRY
_mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
704 GET_CURRENT_CONTEXT(ctx
);
707 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
710 CALL_Begin(GET_DISPATCH(), (mode
));
711 for (i
= 0; i
< count
; i
++)
712 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
713 CALL_End(GET_DISPATCH(), ());
717 void GLAPIENTRY
_mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
718 const GLvoid
*indices
)
720 GET_CURRENT_CONTEXT(ctx
);
723 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
))
726 CALL_Begin(GET_DISPATCH(), (mode
));
729 case GL_UNSIGNED_BYTE
:
730 for (i
= 0 ; i
< count
; i
++)
731 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
733 case GL_UNSIGNED_SHORT
:
734 for (i
= 0 ; i
< count
; i
++)
735 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
737 case GL_UNSIGNED_INT
:
738 for (i
= 0 ; i
< count
; i
++)
739 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
742 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
746 CALL_End(GET_DISPATCH(), ());
749 void GLAPIENTRY
_mesa_noop_DrawRangeElements(GLenum mode
,
750 GLuint start
, GLuint end
,
751 GLsizei count
, GLenum type
,
752 const GLvoid
*indices
)
754 GET_CURRENT_CONTEXT(ctx
);
756 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
758 count
, type
, indices
))
759 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
766 /* KW: If are compiling, we don't know whether eval will produce a
767 * vertex when it is run in the future. If this is pure immediate
768 * mode, eval is a noop if neither vertex map is enabled.
770 * Thus we need to have a check in the display list code or
771 * elsewhere for eval(1,2) vertices in the case where
772 * map(1,2)_vertex is disabled, and to purge those vertices from
775 void GLAPIENTRY
_mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
777 GET_CURRENT_CONTEXT(ctx
);
787 prim
= GL_LINE_STRIP
;
790 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
794 /* No effect if vertex maps disabled.
796 if (!ctx
->Eval
.Map1Vertex4
&&
797 !ctx
->Eval
.Map1Vertex3
&&
798 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
801 du
= ctx
->Eval
.MapGrid1du
;
802 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
804 CALL_Begin(GET_DISPATCH(), (prim
));
805 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
806 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
808 CALL_End(GET_DISPATCH(), ());
813 void GLAPIENTRY
_mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
815 GET_CURRENT_CONTEXT(ctx
);
816 GLfloat u
, du
, v
, dv
, v1
, u1
;
825 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
829 /* No effect if vertex maps disabled.
831 if (!ctx
->Eval
.Map2Vertex4
&&
832 !ctx
->Eval
.Map2Vertex3
&&
833 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
836 du
= ctx
->Eval
.MapGrid2du
;
837 dv
= ctx
->Eval
.MapGrid2dv
;
838 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
839 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
843 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
844 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
845 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
846 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
849 CALL_End(GET_DISPATCH(), ());
852 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
853 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
854 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
855 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
857 CALL_End(GET_DISPATCH(), ());
859 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
860 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
861 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
862 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
864 CALL_End(GET_DISPATCH(), ());
868 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
869 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
870 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
871 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
872 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
874 CALL_End(GET_DISPATCH(), ());
878 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
885 /* Build a vertexformat full of things to use outside begin/end pairs.
887 * TODO -- build a whole dispatch table for this purpose, and likewise
888 * for inside begin/end.
890 void _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
892 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
893 vfmt
->Begin
= _mesa_noop_Begin
;
894 vfmt
->CallList
= _mesa_CallList
;
895 vfmt
->CallLists
= _mesa_CallLists
;
896 vfmt
->Color3f
= _mesa_noop_Color3f
;
897 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
898 vfmt
->Color4f
= _mesa_noop_Color4f
;
899 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
900 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
901 vfmt
->EdgeFlagv
= _mesa_noop_EdgeFlagv
;
902 vfmt
->End
= _mesa_noop_End
;
903 vfmt
->EvalCoord1f
= _mesa_noop_EvalCoord1f
;
904 vfmt
->EvalCoord1fv
= _mesa_noop_EvalCoord1fv
;
905 vfmt
->EvalCoord2f
= _mesa_noop_EvalCoord2f
;
906 vfmt
->EvalCoord2fv
= _mesa_noop_EvalCoord2fv
;
907 vfmt
->EvalPoint1
= _mesa_noop_EvalPoint1
;
908 vfmt
->EvalPoint2
= _mesa_noop_EvalPoint2
;
909 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
910 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
911 vfmt
->Indexf
= _mesa_noop_Indexf
;
912 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
913 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
914 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
915 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
916 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
917 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
918 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
919 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
920 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
921 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
922 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
923 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
924 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
925 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
926 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
927 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
928 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
929 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
930 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
931 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
932 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
933 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
934 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
935 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
936 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
937 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
938 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
939 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
940 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
941 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
942 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
943 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
944 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
945 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
946 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
947 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
948 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
949 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
950 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
951 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
952 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
953 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
954 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
955 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
957 vfmt
->Rectf
= _mesa_noop_Rectf
;
959 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
960 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
961 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
962 vfmt
->EvalMesh1
= _mesa_noop_EvalMesh1
;
963 vfmt
->EvalMesh2
= _mesa_noop_EvalMesh2
;