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_EdgeFlagv( const GLboolean
*b
)
53 GET_CURRENT_CONTEXT(ctx
);
54 ctx
->Current
.EdgeFlag
= *b
;
57 static void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
59 GET_CURRENT_CONTEXT(ctx
);
60 ctx
->Current
.Index
= f
;
63 static void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
65 GET_CURRENT_CONTEXT(ctx
);
66 ctx
->Current
.Index
= *v
;
69 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
71 GET_CURRENT_CONTEXT(ctx
);
72 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
79 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
81 GET_CURRENT_CONTEXT(ctx
);
82 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
89 static void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
91 GET_CURRENT_CONTEXT(ctx
);
92 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
99 static void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
101 GET_CURRENT_CONTEXT(ctx
);
102 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
109 static void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
111 GET_CURRENT_CONTEXT(ctx
);
112 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
119 static void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
121 GET_CURRENT_CONTEXT(ctx
);
122 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
129 static void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
131 GET_CURRENT_CONTEXT(ctx
);
132 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
139 static void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
141 GET_CURRENT_CONTEXT(ctx
);
142 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
149 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
151 GET_CURRENT_CONTEXT(ctx
);
152 GLuint unit
= target
- GL_TEXTURE0_ARB
;
154 /* unit is unsigned -- cannot be less than zero.
156 if (unit
< MAX_TEXTURE_COORD_UNITS
)
158 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
166 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
168 GET_CURRENT_CONTEXT(ctx
);
169 GLuint unit
= target
- GL_TEXTURE0_ARB
;
171 /* unit is unsigned -- cannot be less than zero.
173 if (unit
< MAX_TEXTURE_COORD_UNITS
)
175 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
183 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
185 GET_CURRENT_CONTEXT(ctx
);
186 GLuint unit
= target
- GL_TEXTURE0_ARB
;
188 /* unit is unsigned -- cannot be less than zero.
190 if (unit
< MAX_TEXTURE_COORD_UNITS
)
192 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
200 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
202 GET_CURRENT_CONTEXT(ctx
);
203 GLuint unit
= target
- GL_TEXTURE0_ARB
;
205 /* unit is unsigned -- cannot be less than zero.
207 if (unit
< MAX_TEXTURE_COORD_UNITS
)
209 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
217 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
219 GET_CURRENT_CONTEXT(ctx
);
220 GLuint unit
= target
- GL_TEXTURE0_ARB
;
222 /* unit is unsigned -- cannot be less than zero.
224 if (unit
< MAX_TEXTURE_COORD_UNITS
)
226 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
234 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
236 GET_CURRENT_CONTEXT(ctx
);
237 GLuint unit
= target
- GL_TEXTURE0_ARB
;
239 /* unit is unsigned -- cannot be less than zero.
241 if (unit
< MAX_TEXTURE_COORD_UNITS
)
243 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
251 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
252 GLfloat c
, GLfloat d
)
254 GET_CURRENT_CONTEXT(ctx
);
255 GLuint unit
= target
- GL_TEXTURE0_ARB
;
257 /* unit is unsigned -- cannot be less than zero.
259 if (unit
< MAX_TEXTURE_COORD_UNITS
)
261 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
269 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
271 GET_CURRENT_CONTEXT(ctx
);
272 GLuint unit
= target
- GL_TEXTURE0_ARB
;
274 /* unit is unsigned -- cannot be less than zero.
276 if (unit
< MAX_TEXTURE_COORD_UNITS
)
278 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
286 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
288 GET_CURRENT_CONTEXT(ctx
);
289 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
296 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
298 GET_CURRENT_CONTEXT(ctx
);
299 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
306 static void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
308 GET_CURRENT_CONTEXT(ctx
);
309 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
316 static void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
318 GET_CURRENT_CONTEXT(ctx
);
319 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
326 static void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
328 GET_CURRENT_CONTEXT(ctx
);
329 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
336 static void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
338 GET_CURRENT_CONTEXT(ctx
);
339 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
346 static void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
348 GET_CURRENT_CONTEXT(ctx
);
349 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
356 static void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
358 GET_CURRENT_CONTEXT(ctx
);
359 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
366 static void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
368 GET_CURRENT_CONTEXT(ctx
);
369 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
376 static void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
378 GET_CURRENT_CONTEXT(ctx
);
379 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
388 * GL_NV_vertex_program attributes.
389 * Note that these attributes alias the conventional vertex attributes.
392 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
394 GET_CURRENT_CONTEXT(ctx
);
395 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
396 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
399 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fNV(index)" );
402 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
404 GET_CURRENT_CONTEXT(ctx
);
405 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
406 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
409 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvNV(index)" );
412 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
414 GET_CURRENT_CONTEXT(ctx
);
415 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
416 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
419 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fNV(index)" );
422 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
424 GET_CURRENT_CONTEXT(ctx
);
425 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
426 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
429 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvNV(index)" );
432 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
433 GLfloat y
, GLfloat z
)
435 GET_CURRENT_CONTEXT(ctx
);
436 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
437 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
440 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fNV(index)" );
443 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
445 GET_CURRENT_CONTEXT(ctx
);
446 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
447 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
450 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvNV(index)" );
453 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
454 GLfloat y
, GLfloat z
, GLfloat w
)
456 GET_CURRENT_CONTEXT(ctx
);
457 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
458 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
461 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fNV(index)" );
464 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
466 GET_CURRENT_CONTEXT(ctx
);
467 if (index
< MAX_NV_VERTEX_PROGRAM_INPUTS
) {
468 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
471 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvNV(index)" );
477 * GL_ARB_vertex_program attributes.
478 * Note that these attributes DO NOT alias the conventional vertex attributes.
481 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
483 GET_CURRENT_CONTEXT(ctx
);
484 if (index
< MAX_VERTEX_ATTRIBS
) {
485 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, 0, 0, 1);
488 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fARB(index)" );
491 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
493 GET_CURRENT_CONTEXT(ctx
);
494 if (index
< MAX_VERTEX_ATTRIBS
) {
495 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], 0, 0, 1);
498 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib1fvARB(index)" );
501 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
503 GET_CURRENT_CONTEXT(ctx
);
504 if (index
< MAX_VERTEX_ATTRIBS
) {
505 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, 0, 1);
508 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fARB(index)" );
511 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
513 GET_CURRENT_CONTEXT(ctx
);
514 if (index
< MAX_VERTEX_ATTRIBS
) {
515 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], 0, 1);
518 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib2fvARB(index)" );
521 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
522 GLfloat y
, GLfloat z
)
524 GET_CURRENT_CONTEXT(ctx
);
525 if (index
< MAX_VERTEX_ATTRIBS
) {
526 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, 1);
529 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fARB(index)" );
532 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
534 GET_CURRENT_CONTEXT(ctx
);
535 if (index
< MAX_VERTEX_ATTRIBS
) {
536 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], 1);
539 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib3fvARB(index)" );
542 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
543 GLfloat y
, GLfloat z
, GLfloat w
)
545 GET_CURRENT_CONTEXT(ctx
);
546 if (index
< MAX_VERTEX_ATTRIBS
) {
547 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], x
, y
, z
, w
);
550 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fARB(index)" );
553 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
555 GET_CURRENT_CONTEXT(ctx
);
556 if (index
< MAX_VERTEX_ATTRIBS
) {
557 ASSIGN_4V(ctx
->Current
.Attrib
[VERT_ATTRIB_GENERIC0
+ index
], v
[0], v
[1], v
[2], v
[3]);
560 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexAttrib4fvARB(index)" );
566 * Called by glMaterial*()
569 _mesa_noop_Materialfv( GLenum face
, GLenum pname
, const GLfloat
*params
)
571 GET_CURRENT_CONTEXT(ctx
);
573 struct gl_material
*mat
= &ctx
->Light
.Material
;
574 GLuint bitmask
= _mesa_material_bitmask( ctx
, face
, pname
, ~0,
575 "_mesa_noop_Materialfv" );
577 if (ctx
->Light
.ColorMaterialEnabled
)
578 bitmask
&= ~ctx
->Light
.ColorMaterialBitmask
;
584 case GL_SHININESS
: nr
= 1; break;
585 case GL_COLOR_INDEXES
: nr
= 3; break;
586 default: nr
= 4 ; break;
589 for (i
= 0 ; i
< MAT_ATTRIB_MAX
; i
++)
590 if (bitmask
& (1<<i
))
591 COPY_SZ_4V( mat
->Attrib
[i
], nr
, params
);
593 _mesa_update_material( ctx
, bitmask
);
598 * These really are noops outside begin/end:
600 static void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
605 static void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
610 static void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
615 static void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
620 static void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
622 (void) a
; (void) b
; (void) c
;
625 static void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
627 (void) a
; (void) b
; (void) c
; (void) d
;
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
)
663 /* Begin -- call into driver, should result in the vtxfmt being
666 static void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
672 /* End -- just raise an error
674 static void GLAPIENTRY
_mesa_noop_End( void )
676 GET_CURRENT_CONTEXT(ctx
);
677 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd(no glBegin)" );
682 * Execute a glRectf() function. This is not suitable for GL_COMPILE
683 * modes (as the test for outside begin/end is not compiled),
684 * but may be useful for drivers in circumstances which exclude
685 * display list interactions.
687 * (None of the functions in this file are suitable for GL_COMPILE
691 _mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
694 GET_CURRENT_CONTEXT(ctx
);
695 ASSERT_OUTSIDE_BEGIN_END(ctx
);
698 CALL_Begin(GET_DISPATCH(), (GL_QUADS
));
699 CALL_Vertex2f(GET_DISPATCH(), (x1
, y1
));
700 CALL_Vertex2f(GET_DISPATCH(), (x2
, y1
));
701 CALL_Vertex2f(GET_DISPATCH(), (x2
, y2
));
702 CALL_Vertex2f(GET_DISPATCH(), (x1
, y2
));
703 CALL_End(GET_DISPATCH(), ());
708 * Some very basic support for arrays. Drivers without explicit array
709 * support can hook these in, but still need to supply an array-elt
712 static void GLAPIENTRY
713 _mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
715 GET_CURRENT_CONTEXT(ctx
);
718 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
721 CALL_Begin(GET_DISPATCH(), (mode
));
722 for (i
= 0; i
< count
; i
++)
723 CALL_ArrayElement(GET_DISPATCH(), (start
+ i
));
724 CALL_End(GET_DISPATCH(), ());
728 static void GLAPIENTRY
729 _mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
730 const GLvoid
*indices
)
732 GET_CURRENT_CONTEXT(ctx
);
735 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
))
738 CALL_Begin(GET_DISPATCH(), (mode
));
741 case GL_UNSIGNED_BYTE
:
742 for (i
= 0 ; i
< count
; i
++)
743 CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte
*)indices
)[i
] ));
745 case GL_UNSIGNED_SHORT
:
746 for (i
= 0 ; i
< count
; i
++)
747 CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort
*)indices
)[i
] ));
749 case GL_UNSIGNED_INT
:
750 for (i
= 0 ; i
< count
; i
++)
751 CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint
*)indices
)[i
] ));
754 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
758 CALL_End(GET_DISPATCH(), ());
762 static void GLAPIENTRY
763 _mesa_noop_DrawRangeElements(GLenum mode
,
764 GLuint start
, GLuint end
,
765 GLsizei count
, GLenum type
,
766 const GLvoid
*indices
)
768 GET_CURRENT_CONTEXT(ctx
);
770 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
772 count
, type
, indices
))
773 CALL_DrawElements(GET_DISPATCH(), (mode
, count
, type
, indices
));
782 * If are compiling, we don't know whether eval will produce a
783 * vertex when it is run in the future. If this is pure immediate
784 * mode, eval is a noop if neither vertex map is enabled.
786 * Thus we need to have a check in the display list code or elsewhere
787 * for eval(1,2) vertices in the case where map(1,2)_vertex is
788 * disabled, and to purge those vertices from the vb.
791 _mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
793 GET_CURRENT_CONTEXT(ctx
);
803 prim
= GL_LINE_STRIP
;
806 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
810 /* No effect if vertex maps disabled.
812 if (!ctx
->Eval
.Map1Vertex4
&&
813 !ctx
->Eval
.Map1Vertex3
&&
814 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
817 du
= ctx
->Eval
.MapGrid1du
;
818 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
820 CALL_Begin(GET_DISPATCH(), (prim
));
821 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
822 CALL_EvalCoord1f(GET_DISPATCH(), (u
));
824 CALL_End(GET_DISPATCH(), ());
830 _mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
832 GET_CURRENT_CONTEXT(ctx
);
833 GLfloat u
, du
, v
, dv
, v1
, u1
;
842 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
846 /* No effect if vertex maps disabled.
848 if (!ctx
->Eval
.Map2Vertex4
&&
849 !ctx
->Eval
.Map2Vertex3
&&
850 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
853 du
= ctx
->Eval
.MapGrid2du
;
854 dv
= ctx
->Eval
.MapGrid2dv
;
855 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
856 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
860 CALL_Begin(GET_DISPATCH(), (GL_POINTS
));
861 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
862 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
863 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
866 CALL_End(GET_DISPATCH(), ());
869 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
870 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
871 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
872 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
874 CALL_End(GET_DISPATCH(), ());
876 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
877 CALL_Begin(GET_DISPATCH(), (GL_LINE_STRIP
));
878 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
879 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
881 CALL_End(GET_DISPATCH(), ());
885 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
886 CALL_Begin(GET_DISPATCH(), (GL_TRIANGLE_STRIP
));
887 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
888 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
));
889 CALL_EvalCoord2f(GET_DISPATCH(), (u
, v
+dv
));
891 CALL_End(GET_DISPATCH(), ());
895 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
903 * Build a vertexformat of functions to use outside begin/end pairs.
905 * TODO -- build a whole dispatch table for this purpose, and likewise
906 * for inside begin/end.
909 _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
911 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
912 vfmt
->Begin
= _mesa_noop_Begin
;
913 vfmt
->CallList
= _mesa_CallList
;
914 vfmt
->CallLists
= _mesa_CallLists
;
915 vfmt
->Color3f
= _mesa_noop_Color3f
;
916 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
917 vfmt
->Color4f
= _mesa_noop_Color4f
;
918 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
919 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
920 vfmt
->EdgeFlagv
= _mesa_noop_EdgeFlagv
;
921 vfmt
->End
= _mesa_noop_End
;
922 vfmt
->EvalCoord1f
= _mesa_noop_EvalCoord1f
;
923 vfmt
->EvalCoord1fv
= _mesa_noop_EvalCoord1fv
;
924 vfmt
->EvalCoord2f
= _mesa_noop_EvalCoord2f
;
925 vfmt
->EvalCoord2fv
= _mesa_noop_EvalCoord2fv
;
926 vfmt
->EvalPoint1
= _mesa_noop_EvalPoint1
;
927 vfmt
->EvalPoint2
= _mesa_noop_EvalPoint2
;
928 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
929 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
930 vfmt
->Indexf
= _mesa_noop_Indexf
;
931 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
932 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
933 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
934 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
935 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
936 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
937 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
938 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
939 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
940 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
941 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
942 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
943 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
944 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
945 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
946 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
947 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
948 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
949 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
950 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
951 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
952 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
953 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
954 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
955 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
956 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
957 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
958 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
959 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
960 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
961 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
962 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
963 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
964 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
965 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
966 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
967 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
968 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
969 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
970 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
971 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
972 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
973 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
974 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
976 vfmt
->Rectf
= _mesa_noop_Rectf
;
978 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
979 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
980 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
981 vfmt
->EvalMesh1
= _mesa_noop_EvalMesh1
;
982 vfmt
->EvalMesh2
= _mesa_noop_EvalMesh2
;