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"
39 * Just update the ctx->Current vertex attributes.
40 * These functions are used when outside glBegin/glEnd or outside display
45 static void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
47 GET_CURRENT_CONTEXT(ctx
);
48 ctx
->Current
.EdgeFlag
= b
;
51 static void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
53 GET_CURRENT_CONTEXT(ctx
);
54 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = f
;
57 static void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
59 GET_CURRENT_CONTEXT(ctx
);
60 ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR_INDEX
][0] = *v
;
63 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
65 GET_CURRENT_CONTEXT(ctx
);
66 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
73 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
75 GET_CURRENT_CONTEXT(ctx
);
76 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
83 static void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
85 GET_CURRENT_CONTEXT(ctx
);
86 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
93 static void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
95 GET_CURRENT_CONTEXT(ctx
);
96 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
103 static void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
105 GET_CURRENT_CONTEXT(ctx
);
106 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
113 static void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
115 GET_CURRENT_CONTEXT(ctx
);
116 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
123 static void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
125 GET_CURRENT_CONTEXT(ctx
);
126 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
133 static void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
135 GET_CURRENT_CONTEXT(ctx
);
136 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
143 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
145 GET_CURRENT_CONTEXT(ctx
);
146 GLuint unit
= target
- GL_TEXTURE0_ARB
;
148 /* unit is unsigned -- cannot be less than zero.
150 if (unit
< MAX_TEXTURE_COORD_UNITS
)
152 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
160 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
162 GET_CURRENT_CONTEXT(ctx
);
163 GLuint unit
= target
- GL_TEXTURE0_ARB
;
165 /* unit is unsigned -- cannot be less than zero.
167 if (unit
< MAX_TEXTURE_COORD_UNITS
)
169 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
177 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
179 GET_CURRENT_CONTEXT(ctx
);
180 GLuint unit
= target
- GL_TEXTURE0_ARB
;
182 /* unit is unsigned -- cannot be less than zero.
184 if (unit
< MAX_TEXTURE_COORD_UNITS
)
186 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
194 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
196 GET_CURRENT_CONTEXT(ctx
);
197 GLuint unit
= target
- GL_TEXTURE0_ARB
;
199 /* unit is unsigned -- cannot be less than zero.
201 if (unit
< MAX_TEXTURE_COORD_UNITS
)
203 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
211 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
213 GET_CURRENT_CONTEXT(ctx
);
214 GLuint unit
= target
- GL_TEXTURE0_ARB
;
216 /* unit is unsigned -- cannot be less than zero.
218 if (unit
< MAX_TEXTURE_COORD_UNITS
)
220 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
228 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
230 GET_CURRENT_CONTEXT(ctx
);
231 GLuint unit
= target
- GL_TEXTURE0_ARB
;
233 /* unit is unsigned -- cannot be less than zero.
235 if (unit
< MAX_TEXTURE_COORD_UNITS
)
237 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
245 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
246 GLfloat c
, GLfloat d
)
248 GET_CURRENT_CONTEXT(ctx
);
249 GLuint unit
= target
- GL_TEXTURE0_ARB
;
251 /* unit is unsigned -- cannot be less than zero.
253 if (unit
< MAX_TEXTURE_COORD_UNITS
)
255 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
263 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
265 GET_CURRENT_CONTEXT(ctx
);
266 GLuint unit
= target
- GL_TEXTURE0_ARB
;
268 /* unit is unsigned -- cannot be less than zero.
270 if (unit
< MAX_TEXTURE_COORD_UNITS
)
272 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
280 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
282 GET_CURRENT_CONTEXT(ctx
);
283 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
290 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
292 GET_CURRENT_CONTEXT(ctx
);
293 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
300 static void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
302 GET_CURRENT_CONTEXT(ctx
);
303 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
310 static void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
312 GET_CURRENT_CONTEXT(ctx
);
313 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
320 static void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
322 GET_CURRENT_CONTEXT(ctx
);
323 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
330 static void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
332 GET_CURRENT_CONTEXT(ctx
);
333 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
340 static void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
342 GET_CURRENT_CONTEXT(ctx
);
343 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
350 static void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
352 GET_CURRENT_CONTEXT(ctx
);
353 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
360 static void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
362 GET_CURRENT_CONTEXT(ctx
);
363 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
370 static void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
372 GET_CURRENT_CONTEXT(ctx
);
373 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
382 * GL_NV_vertex_program attributes.
383 * Note that these attributes alias the conventional vertex attributes.
386 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
388 GET_CURRENT_CONTEXT(ctx
);
389 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
390 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
393 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fNV(index)" );
396 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
398 GET_CURRENT_CONTEXT(ctx
);
399 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
400 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
403 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvNV(index)" );
406 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
408 GET_CURRENT_CONTEXT(ctx
);
409 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
410 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
413 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fNV(index)" );
416 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
418 GET_CURRENT_CONTEXT(ctx
);
419 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
420 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
423 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvNV(index)" );
426 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
427 GLfloat y
, GLfloat z
)
429 GET_CURRENT_CONTEXT(ctx
);
430 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
431 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
434 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fNV(index)" );
437 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
439 GET_CURRENT_CONTEXT(ctx
);
440 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
441 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
444 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvNV(index)" );
447 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
448 GLfloat y
, GLfloat z
, GLfloat w
)
450 GET_CURRENT_CONTEXT(ctx
);
451 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
452 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
455 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fNV(index)" );
458 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
460 GET_CURRENT_CONTEXT(ctx
);
461 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
462 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
465 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvNV(index)" );
471 * GL_ARB_vertex_program attributes.
472 * Note that these attributes DO NOT alias the conventional vertex attributes.
475 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
477 GET_CURRENT_CONTEXT(ctx
);
478 if (index
< MAX_VERTEX_ATTRIBS
) {
479 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, 0, 0, 1);
482 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fARB(index)" );
485 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
487 GET_CURRENT_CONTEXT(ctx
);
488 if (index
< MAX_VERTEX_ATTRIBS
) {
489 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], 0, 0, 1);
492 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvARB(index)" );
495 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
497 GET_CURRENT_CONTEXT(ctx
);
498 if (index
< MAX_VERTEX_ATTRIBS
) {
499 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, 0, 1);
502 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fARB(index)" );
505 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
507 GET_CURRENT_CONTEXT(ctx
);
508 if (index
< MAX_VERTEX_ATTRIBS
) {
509 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], 0, 1);
512 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvARB(index)" );
515 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
516 GLfloat y
, GLfloat z
)
518 GET_CURRENT_CONTEXT(ctx
);
519 if (index
< MAX_VERTEX_ATTRIBS
) {
520 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, 1);
523 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fARB(index)" );
526 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
528 GET_CURRENT_CONTEXT(ctx
);
529 if (index
< MAX_VERTEX_ATTRIBS
) {
530 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], 1);
533 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvARB(index)" );
536 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
537 GLfloat y
, GLfloat z
, GLfloat w
)
539 GET_CURRENT_CONTEXT(ctx
);
540 if (index
< MAX_VERTEX_ATTRIBS
) {
541 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, w
);
544 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fARB(index)" );
547 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
549 GET_CURRENT_CONTEXT(ctx
);
550 if (index
< MAX_VERTEX_ATTRIBS
) {
551 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], v
[3]);
554 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvARB(index)" );
560 * Called by glMaterial*()
563 _mesa_noop_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*params
)
565 GET_CURRENT_CONTEXT(ctx
);
567 struct gl_material
*mat
= &ctx
->Light
.Material
;
568 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0,
569 "_mesa_noop_Materialfv" );
571 if (ctx
->Light
.ColorMaterialEnabled
)
572 bitmask
&= ~ctx
->Light
.ColorMaterialBitmask
;
578 case GL_SHININESS
: nr
= 1; break;
579 case GL_COLOR_INDEXES
: nr
= 3; break;
580 default: nr
= 4 ; break;
583 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
584 if (bitmask
& (1<<i
))
585 COPY_SZ_4V( mat
->Attrib
[i
], nr
, params
);
587 _mesa_update_material( ctx
, bitmask
);
592 * These really are noops outside begin/end:
594 static void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
599 static void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
604 static void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
609 static void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
614 static void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
616 (void) a
; (void) b
; (void) c
;
619 static void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
621 (void) a
; (void) b
; (void) c
; (void) d
;
624 /* Similarly, these have no effect outside begin/end:
626 static void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
631 static void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
636 static void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
641 static void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
646 static void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
651 static void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
657 /* Begin -- call into driver, should result in the vtxfmt being
660 static void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
666 /* End -- just raise an error
668 static void GLAPIENTRY
_mesa_noop_End( void )
670 GET_CURRENT_CONTEXT(ctx
);
671 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd(no glBegin)" );
676 * Execute a glRectf() function. This is not suitable for GL_COMPILE
677 * modes (as the test for outside begin/end is not compiled),
678 * but may be useful for drivers in circumstances which exclude
679 * display list interactions.
681 * (None of the functions in this file are suitable for GL_COMPILE
685 _mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
688 GET_CURRENT_CONTEXT(ctx
);
689 ASSERT_OUTSIDE_BEGIN_END(ctx
);
692 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
693 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
694 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
695 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
696 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
697 CALL_End(GET_DISPATCH(), ());
702 * Some very basic support for arrays. Drivers without explicit array
703 * support can hook these in, but still need to supply an array-elt
706 static void GLAPIENTRY
707 _mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
709 GET_CURRENT_CONTEXT(ctx
);
712 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
715 CALL_Begin(GET_DISPATCH(), (mode
));
716 for (i
= 0; i
< count
; i
++)
717 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
718 CALL_End(GET_DISPATCH(), ());
722 static void GLAPIENTRY
723 _mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
724 const GLvoid
*indices
)
726 GET_CURRENT_CONTEXT(ctx
);
729 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
))
732 CALL_Begin(GET_DISPATCH(), (mode
));
735 case GL_UNSIGNED_BYTE
:
736 for (i
= 0 ; i
< count
; i
++)
737 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
739 case GL_UNSIGNED_SHORT
:
740 for (i
= 0 ; i
< count
; i
++)
741 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
743 case GL_UNSIGNED_INT
:
744 for (i
= 0 ; i
< count
; i
++)
745 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
748 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
752 CALL_End(GET_DISPATCH(), ());
756 static void GLAPIENTRY
757 _mesa_noop_DrawRangeElements(GLenum mode
,
758 GLuint start
, GLuint end
,
759 GLsizei count
, GLenum type
,
760 const GLvoid
*indices
)
762 GET_CURRENT_CONTEXT(ctx
);
764 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
766 count
, type
, indices
))
767 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
776 * If are compiling, we don't know whether eval will produce a
777 * vertex when it is run in the future. If this is pure immediate
778 * mode, eval is a noop if neither vertex map is enabled.
780 * Thus we need to have a check in the display list code or elsewhere
781 * for eval(1,2) vertices in the case where map(1,2)_vertex is
782 * disabled, and to purge those vertices from the vb.
785 _mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
787 GET_CURRENT_CONTEXT(ctx
);
797 prim
= GL_LINE_STRIP
;
800 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
804 /* No effect if vertex maps disabled.
806 if (!ctx
->Eval
.Map1Vertex4
&&
807 !ctx
->Eval
.Map1Vertex3
&&
808 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
811 du
= ctx
->Eval
.MapGrid1du
;
812 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
814 CALL_Begin(GET_DISPATCH(), (prim
));
815 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
816 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
818 CALL_End(GET_DISPATCH(), ());
824 _mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
826 GET_CURRENT_CONTEXT(ctx
);
827 GLfloat u
, du
, v
, dv
, v1
, u1
;
836 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
840 /* No effect if vertex maps disabled.
842 if (!ctx
->Eval
.Map2Vertex4
&&
843 !ctx
->Eval
.Map2Vertex3
&&
844 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
847 du
= ctx
->Eval
.MapGrid2du
;
848 dv
= ctx
->Eval
.MapGrid2dv
;
849 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
850 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
854 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
855 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
856 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
857 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
860 CALL_End(GET_DISPATCH(), ());
863 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
864 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
865 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
866 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
868 CALL_End(GET_DISPATCH(), ());
870 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
871 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
872 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
873 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
875 CALL_End(GET_DISPATCH(), ());
879 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
880 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
881 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
882 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
883 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
885 CALL_End(GET_DISPATCH(), ());
889 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
897 * Build a vertexformat of functions to use outside begin/end pairs.
899 * TODO -- build a whole dispatch table for this purpose, and likewise
900 * for inside begin/end.
903 _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
905 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
906 vfmt
->Begin
= _mesa_noop_Begin
;
907 vfmt
->CallList
= _mesa_CallList
;
908 vfmt
->CallLists
= _mesa_CallLists
;
909 vfmt
->Color3f
= _mesa_noop_Color3f
;
910 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
911 vfmt
->Color4f
= _mesa_noop_Color4f
;
912 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
913 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
914 vfmt
->End
= _mesa_noop_End
;
915 vfmt
->EvalCoord1f
= _mesa_noop_EvalCoord1f
;
916 vfmt
->EvalCoord1fv
= _mesa_noop_EvalCoord1fv
;
917 vfmt
->EvalCoord2f
= _mesa_noop_EvalCoord2f
;
918 vfmt
->EvalCoord2fv
= _mesa_noop_EvalCoord2fv
;
919 vfmt
->EvalPoint1
= _mesa_noop_EvalPoint1
;
920 vfmt
->EvalPoint2
= _mesa_noop_EvalPoint2
;
921 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
922 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
923 vfmt
->Indexf
= _mesa_noop_Indexf
;
924 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
925 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
926 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
927 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
928 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
929 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
930 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
931 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
932 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
933 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
934 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
935 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
936 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
937 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
938 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
939 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
940 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
941 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
942 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
943 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
944 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
945 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
946 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
947 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
948 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
949 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
950 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
951 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
952 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
953 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
954 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
955 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
956 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
957 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
958 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
959 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
960 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
961 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
962 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
963 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
964 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
965 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
966 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
967 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
969 vfmt
->Rectf
= _mesa_noop_Rectf
;
971 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
972 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
973 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
974 vfmt
->EvalMesh1
= _mesa_noop_EvalMesh1
;
975 vfmt
->EvalMesh2
= _mesa_noop_EvalMesh2
;