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"
38 /* In states where certain vertex components are required for t&l or
39 * rasterization, we still need to keep track of the current values.
40 * These functions provide this service by keeping uptodate the
41 * 'ctx->Current' struct for all data elements not included in the
42 * currently enabled hardware vertex.
43 * I.e. these functions would typically be used when outside of glBegin/End.
47 void GLAPIENTRY
_mesa_noop_EdgeFlag( GLboolean b
)
49 GET_CURRENT_CONTEXT(ctx
);
50 ctx
->Current
.EdgeFlag
= b
;
53 void GLAPIENTRY
_mesa_noop_EdgeFlagv( const GLboolean
*b
)
55 GET_CURRENT_CONTEXT(ctx
);
56 ctx
->Current
.EdgeFlag
= *b
;
59 void GLAPIENTRY
_mesa_noop_Indexf( GLfloat f
)
61 GET_CURRENT_CONTEXT(ctx
);
62 ctx
->Current
.Index
= f
;
65 void GLAPIENTRY
_mesa_noop_Indexfv( const GLfloat
*v
)
67 GET_CURRENT_CONTEXT(ctx
);
68 ctx
->Current
.Index
= *v
;
71 void GLAPIENTRY
_mesa_noop_FogCoordfEXT( GLfloat a
)
73 GET_CURRENT_CONTEXT(ctx
);
74 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
81 void GLAPIENTRY
_mesa_noop_FogCoordfvEXT( const GLfloat
*v
)
83 GET_CURRENT_CONTEXT(ctx
);
84 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_FOG
];
91 void GLAPIENTRY
_mesa_noop_Normal3f( GLfloat a
, GLfloat b
, GLfloat c
)
93 GET_CURRENT_CONTEXT(ctx
);
94 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
101 void GLAPIENTRY
_mesa_noop_Normal3fv( const GLfloat
*v
)
103 GET_CURRENT_CONTEXT(ctx
);
104 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_NORMAL
];
111 void GLAPIENTRY
_mesa_noop_Color4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
113 GET_CURRENT_CONTEXT(ctx
);
114 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
121 void GLAPIENTRY
_mesa_noop_Color4fv( const GLfloat
*v
)
123 GET_CURRENT_CONTEXT(ctx
);
124 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
131 void GLAPIENTRY
_mesa_noop_Color3f( GLfloat a
, GLfloat b
, GLfloat c
)
133 GET_CURRENT_CONTEXT(ctx
);
134 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
141 void GLAPIENTRY
_mesa_noop_Color3fv( const GLfloat
*v
)
143 GET_CURRENT_CONTEXT(ctx
);
144 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR0
];
151 void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB( GLenum target
, GLfloat a
)
153 GET_CURRENT_CONTEXT(ctx
);
154 GLuint unit
= target
- GL_TEXTURE0_ARB
;
156 /* unit is unsigned -- cannot be less than zero.
158 if (unit
< MAX_TEXTURE_COORD_UNITS
)
160 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
168 void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB( GLenum target
, const GLfloat
*v
)
170 GET_CURRENT_CONTEXT(ctx
);
171 GLuint unit
= target
- GL_TEXTURE0_ARB
;
173 /* unit is unsigned -- cannot be less than zero.
175 if (unit
< MAX_TEXTURE_COORD_UNITS
)
177 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
185 void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB( GLenum target
, GLfloat a
, GLfloat b
)
187 GET_CURRENT_CONTEXT(ctx
);
188 GLuint unit
= target
- GL_TEXTURE0_ARB
;
190 /* unit is unsigned -- cannot be less than zero.
192 if (unit
< MAX_TEXTURE_COORD_UNITS
)
194 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
202 void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB( GLenum target
, const GLfloat
*v
)
204 GET_CURRENT_CONTEXT(ctx
);
205 GLuint unit
= target
- GL_TEXTURE0_ARB
;
207 /* unit is unsigned -- cannot be less than zero.
209 if (unit
< MAX_TEXTURE_COORD_UNITS
)
211 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
219 void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB( GLenum target
, GLfloat a
, GLfloat b
, GLfloat c
)
221 GET_CURRENT_CONTEXT(ctx
);
222 GLuint unit
= target
- GL_TEXTURE0_ARB
;
224 /* unit is unsigned -- cannot be less than zero.
226 if (unit
< MAX_TEXTURE_COORD_UNITS
)
228 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
236 void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB( GLenum target
, const GLfloat
*v
)
238 GET_CURRENT_CONTEXT(ctx
);
239 GLuint unit
= target
- GL_TEXTURE0_ARB
;
241 /* unit is unsigned -- cannot be less than zero.
243 if (unit
< MAX_TEXTURE_COORD_UNITS
)
245 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
253 void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB( GLenum target
, GLfloat a
, GLfloat b
,
254 GLfloat c
, GLfloat d
)
256 GET_CURRENT_CONTEXT(ctx
);
257 GLuint unit
= target
- GL_TEXTURE0_ARB
;
259 /* unit is unsigned -- cannot be less than zero.
261 if (unit
< MAX_TEXTURE_COORD_UNITS
)
263 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
271 void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB( GLenum target
, const GLfloat
*v
)
273 GET_CURRENT_CONTEXT(ctx
);
274 GLuint unit
= target
- GL_TEXTURE0_ARB
;
276 /* unit is unsigned -- cannot be less than zero.
278 if (unit
< MAX_TEXTURE_COORD_UNITS
)
280 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
+ unit
];
288 void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT( GLfloat a
, GLfloat b
, GLfloat c
)
290 GET_CURRENT_CONTEXT(ctx
);
291 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
298 void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT( const GLfloat
*v
)
300 GET_CURRENT_CONTEXT(ctx
);
301 GLfloat
*color
= ctx
->Current
.Attrib
[VERT_ATTRIB_COLOR1
];
308 void GLAPIENTRY
_mesa_noop_TexCoord1f( GLfloat a
)
310 GET_CURRENT_CONTEXT(ctx
);
311 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
318 void GLAPIENTRY
_mesa_noop_TexCoord1fv( const GLfloat
*v
)
320 GET_CURRENT_CONTEXT(ctx
);
321 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
328 void GLAPIENTRY
_mesa_noop_TexCoord2f( GLfloat a
, GLfloat b
)
330 GET_CURRENT_CONTEXT(ctx
);
331 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
338 void GLAPIENTRY
_mesa_noop_TexCoord2fv( const GLfloat
*v
)
340 GET_CURRENT_CONTEXT(ctx
);
341 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
348 void GLAPIENTRY
_mesa_noop_TexCoord3f( GLfloat a
, GLfloat b
, GLfloat c
)
350 GET_CURRENT_CONTEXT(ctx
);
351 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
358 void GLAPIENTRY
_mesa_noop_TexCoord3fv( const GLfloat
*v
)
360 GET_CURRENT_CONTEXT(ctx
);
361 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
368 void GLAPIENTRY
_mesa_noop_TexCoord4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
370 GET_CURRENT_CONTEXT(ctx
);
371 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
378 void GLAPIENTRY
_mesa_noop_TexCoord4fv( const GLfloat
*v
)
380 GET_CURRENT_CONTEXT(ctx
);
381 GLfloat
*dest
= ctx
->Current
.Attrib
[VERT_ATTRIB_TEX0
];
390 void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV( GLuint index
, GLfloat x
)
392 GET_CURRENT_CONTEXT(ctx
);
393 if (index
< VERT_ATTRIB_MAX
) {
394 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
397 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fNV" );
400 void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV( GLuint index
, const GLfloat
*v
)
402 GET_CURRENT_CONTEXT(ctx
);
403 if (index
< VERT_ATTRIB_MAX
) {
404 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
407 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fvNV" );
410 void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV( GLuint index
, GLfloat x
, GLfloat y
)
412 GET_CURRENT_CONTEXT(ctx
);
413 if (index
< VERT_ATTRIB_MAX
) {
414 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
417 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fNV" );
420 void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV( GLuint index
, const GLfloat
*v
)
422 GET_CURRENT_CONTEXT(ctx
);
423 if (index
< VERT_ATTRIB_MAX
) {
424 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
427 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fvNV" );
430 void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV( GLuint index
, GLfloat x
,
431 GLfloat y
, GLfloat z
)
433 GET_CURRENT_CONTEXT(ctx
);
434 if (index
< VERT_ATTRIB_MAX
) {
435 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
438 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fNV" );
441 void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV( GLuint index
, const GLfloat
*v
)
443 GET_CURRENT_CONTEXT(ctx
);
444 if (index
< VERT_ATTRIB_MAX
) {
445 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
448 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fvNV" );
451 void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV( GLuint index
, GLfloat x
,
452 GLfloat y
, GLfloat z
, GLfloat w
)
454 GET_CURRENT_CONTEXT(ctx
);
455 if (index
< VERT_ATTRIB_MAX
) {
456 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
459 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fNV" );
462 void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV( GLuint index
, const GLfloat
*v
)
464 GET_CURRENT_CONTEXT(ctx
);
465 if (index
< VERT_ATTRIB_MAX
) {
466 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
469 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fvNV" );
474 * XXX Un-alias attribs here
477 void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB( GLuint index
, GLfloat x
)
479 GET_CURRENT_CONTEXT(ctx
);
480 if (index
< VERT_ATTRIB_MAX
) {
481 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, 0, 0, 1);
484 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fARB" );
487 void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB( GLuint index
, const GLfloat
*v
)
489 GET_CURRENT_CONTEXT(ctx
);
490 if (index
< VERT_ATTRIB_MAX
) {
491 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], 0, 0, 1);
494 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib1fvARB" );
497 void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB( GLuint index
, GLfloat x
, GLfloat y
)
499 GET_CURRENT_CONTEXT(ctx
);
500 if (index
< VERT_ATTRIB_MAX
) {
501 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, 0, 1);
504 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fARB" );
507 void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB( GLuint index
, const GLfloat
*v
)
509 GET_CURRENT_CONTEXT(ctx
);
510 if (index
< VERT_ATTRIB_MAX
) {
511 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], 0, 1);
514 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib2fvARB" );
517 void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB( GLuint index
, GLfloat x
,
518 GLfloat y
, GLfloat z
)
520 GET_CURRENT_CONTEXT(ctx
);
521 if (index
< VERT_ATTRIB_MAX
) {
522 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, 1);
525 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fARB" );
528 void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB( GLuint index
, const GLfloat
*v
)
530 GET_CURRENT_CONTEXT(ctx
);
531 if (index
< VERT_ATTRIB_MAX
) {
532 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], 1);
535 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib3fvARB" );
538 void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB( GLuint index
, GLfloat x
,
539 GLfloat y
, GLfloat z
, GLfloat w
)
541 GET_CURRENT_CONTEXT(ctx
);
542 if (index
< VERT_ATTRIB_MAX
) {
543 ASSIGN_4V(ctx
->Current
.Attrib
[index
], x
, y
, z
, w
);
546 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fARB" );
549 void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB( GLuint index
, const GLfloat
*v
)
551 GET_CURRENT_CONTEXT(ctx
);
552 if (index
< VERT_ATTRIB_MAX
) {
553 ASSIGN_4V(ctx
->Current
.Attrib
[index
], v
[0], v
[1], v
[2], v
[3]);
556 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttrib4fvARB" );
563 void GLAPIENTRY
_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
);
590 /* These really are noops outside begin/end:
592 void GLAPIENTRY
_mesa_noop_Vertex2fv( const GLfloat
*v
)
597 void GLAPIENTRY
_mesa_noop_Vertex3fv( const GLfloat
*v
)
602 void GLAPIENTRY
_mesa_noop_Vertex4fv( const GLfloat
*v
)
607 void GLAPIENTRY
_mesa_noop_Vertex2f( GLfloat a
, GLfloat b
)
612 void GLAPIENTRY
_mesa_noop_Vertex3f( GLfloat a
, GLfloat b
, GLfloat c
)
614 (void) a
; (void) b
; (void) c
;
617 void GLAPIENTRY
_mesa_noop_Vertex4f( GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
619 (void) a
; (void) b
; (void) c
; (void) d
;
622 /* Similarly, these have no effect outside begin/end:
624 void GLAPIENTRY
_mesa_noop_EvalCoord1f( GLfloat a
)
629 void GLAPIENTRY
_mesa_noop_EvalCoord1fv( const GLfloat
*v
)
634 void GLAPIENTRY
_mesa_noop_EvalCoord2f( GLfloat a
, GLfloat b
)
639 void GLAPIENTRY
_mesa_noop_EvalCoord2fv( const GLfloat
*v
)
644 void GLAPIENTRY
_mesa_noop_EvalPoint1( GLint a
)
649 void GLAPIENTRY
_mesa_noop_EvalPoint2( GLint a
, GLint b
)
655 /* Begin -- call into driver, should result in the vtxfmt being
658 void GLAPIENTRY
_mesa_noop_Begin( GLenum mode
)
664 /* End -- just raise an error
666 void GLAPIENTRY
_mesa_noop_End( void )
668 GET_CURRENT_CONTEXT(ctx
);
669 _mesa_error( ctx
, GL_INVALID_OPERATION
, "glEnd" );
673 /* Execute a glRectf() function. This is not suitable for GL_COMPILE
674 * modes (as the test for outside begin/end is not compiled),
675 * but may be useful for drivers in circumstances which exclude
676 * display list interactions.
678 * (None of the functions in this file are suitable for GL_COMPILE
681 void GLAPIENTRY
_mesa_noop_Rectf( GLfloat x1
, GLfloat y1
, GLfloat x2
, GLfloat y2
)
684 GET_CURRENT_CONTEXT(ctx
);
685 ASSERT_OUTSIDE_BEGIN_END(ctx
);
688 GL_CALL(Begin
)( GL_QUADS
);
689 GL_CALL(Vertex2f
)( x1
, y1
);
690 GL_CALL(Vertex2f
)( x2
, y1
);
691 GL_CALL(Vertex2f
)( x2
, y2
);
692 GL_CALL(Vertex2f
)( x1
, y2
);
697 /* Some very basic support for arrays. Drivers without explicit array
698 * support can hook these in, but still need to supply an array-elt
701 void GLAPIENTRY
_mesa_noop_DrawArrays(GLenum mode
, GLint start
, GLsizei count
)
703 GET_CURRENT_CONTEXT(ctx
);
706 if (!_mesa_validate_DrawArrays( ctx
, mode
, start
, count
))
709 GL_CALL(Begin
)(mode
);
710 for (i
= 0; i
< count
; i
++)
711 GL_CALL(ArrayElement
)(start
+ i
);
716 void GLAPIENTRY
_mesa_noop_DrawElements(GLenum mode
, GLsizei count
, GLenum type
,
717 const GLvoid
*indices
)
719 GET_CURRENT_CONTEXT(ctx
);
722 if (!_mesa_validate_DrawElements( ctx
, mode
, count
, type
, indices
))
725 GL_CALL(Begin
)(mode
);
728 case GL_UNSIGNED_BYTE
:
729 for (i
= 0 ; i
< count
; i
++)
730 GL_CALL(ArrayElement
)( ((GLubyte
*)indices
)[i
] );
732 case GL_UNSIGNED_SHORT
:
733 for (i
= 0 ; i
< count
; i
++)
734 GL_CALL(ArrayElement
)( ((GLushort
*)indices
)[i
] );
736 case GL_UNSIGNED_INT
:
737 for (i
= 0 ; i
< count
; i
++)
738 GL_CALL(ArrayElement
)( ((GLuint
*)indices
)[i
] );
741 _mesa_error( ctx
, GL_INVALID_ENUM
, "glDrawElements(type)" );
748 void GLAPIENTRY
_mesa_noop_DrawRangeElements(GLenum mode
,
749 GLuint start
, GLuint end
,
750 GLsizei count
, GLenum type
,
751 const GLvoid
*indices
)
753 GET_CURRENT_CONTEXT(ctx
);
755 if (_mesa_validate_DrawRangeElements( ctx
, mode
,
757 count
, type
, indices
))
758 GL_CALL(DrawElements
)( mode
, count
, type
, indices
);
765 /* KW: If are compiling, we don't know whether eval will produce a
766 * vertex when it is run in the future. If this is pure immediate
767 * mode, eval is a noop if neither vertex map is enabled.
769 * Thus we need to have a check in the display list code or
770 * elsewhere for eval(1,2) vertices in the case where
771 * map(1,2)_vertex is disabled, and to purge those vertices from
774 void GLAPIENTRY
_mesa_noop_EvalMesh1( GLenum mode
, GLint i1
, GLint i2
)
776 GET_CURRENT_CONTEXT(ctx
);
786 prim
= GL_LINE_STRIP
;
789 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh1(mode)" );
793 /* No effect if vertex maps disabled.
795 if (!ctx
->Eval
.Map1Vertex4
&&
796 !ctx
->Eval
.Map1Vertex3
&&
797 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map1Attrib
[VERT_ATTRIB_POS
]))
800 du
= ctx
->Eval
.MapGrid1du
;
801 u
= ctx
->Eval
.MapGrid1u1
+ i1
* du
;
803 GL_CALL(Begin
)( prim
);
804 for (i
=i1
;i
<=i2
;i
++,u
+=du
) {
805 GL_CALL(EvalCoord1f
)( u
);
812 void GLAPIENTRY
_mesa_noop_EvalMesh2( GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
814 GET_CURRENT_CONTEXT(ctx
);
815 GLfloat u
, du
, v
, dv
, v1
, u1
;
824 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
828 /* No effect if vertex maps disabled.
830 if (!ctx
->Eval
.Map2Vertex4
&&
831 !ctx
->Eval
.Map2Vertex3
&&
832 !(ctx
->VertexProgram
._Enabled
&& ctx
->Eval
.Map2Attrib
[VERT_ATTRIB_POS
]))
835 du
= ctx
->Eval
.MapGrid2du
;
836 dv
= ctx
->Eval
.MapGrid2dv
;
837 v1
= ctx
->Eval
.MapGrid2v1
+ j1
* dv
;
838 u1
= ctx
->Eval
.MapGrid2u1
+ i1
* du
;
842 GL_CALL(Begin
)( GL_POINTS
);
843 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
844 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
845 GL_CALL(EvalCoord2f
)(u
, v
);
851 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
852 GL_CALL(Begin
)( GL_LINE_STRIP
);
853 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
854 GL_CALL(EvalCoord2f
)(u
, v
);
858 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
859 GL_CALL(Begin
)( GL_LINE_STRIP
);
860 for (v
=v1
,j
=j1
;j
<=j2
;j
++,v
+=dv
) {
861 GL_CALL(EvalCoord2f
)(u
, v
);
867 for (v
=v1
,j
=j1
;j
<j2
;j
++,v
+=dv
) {
868 GL_CALL(Begin
)( GL_TRIANGLE_STRIP
);
869 for (u
=u1
,i
=i1
;i
<=i2
;i
++,u
+=du
) {
870 GL_CALL(EvalCoord2f
)(u
, v
);
871 GL_CALL(EvalCoord2f
)(u
, v
+dv
);
877 _mesa_error( ctx
, GL_INVALID_ENUM
, "glEvalMesh2(mode)" );
884 /* Build a vertexformat full of things to use outside begin/end pairs.
886 * TODO -- build a whole dispatch table for this purpose, and likewise
887 * for inside begin/end.
889 void _mesa_noop_vtxfmt_init( GLvertexformat
*vfmt
)
891 vfmt
->ArrayElement
= _ae_loopback_array_elt
; /* generic helper */
892 vfmt
->Begin
= _mesa_noop_Begin
;
893 vfmt
->CallList
= _mesa_CallList
;
894 vfmt
->CallLists
= _mesa_CallLists
;
895 vfmt
->Color3f
= _mesa_noop_Color3f
;
896 vfmt
->Color3fv
= _mesa_noop_Color3fv
;
897 vfmt
->Color4f
= _mesa_noop_Color4f
;
898 vfmt
->Color4fv
= _mesa_noop_Color4fv
;
899 vfmt
->EdgeFlag
= _mesa_noop_EdgeFlag
;
900 vfmt
->EdgeFlagv
= _mesa_noop_EdgeFlagv
;
901 vfmt
->End
= _mesa_noop_End
;
902 vfmt
->EvalCoord1f
= _mesa_noop_EvalCoord1f
;
903 vfmt
->EvalCoord1fv
= _mesa_noop_EvalCoord1fv
;
904 vfmt
->EvalCoord2f
= _mesa_noop_EvalCoord2f
;
905 vfmt
->EvalCoord2fv
= _mesa_noop_EvalCoord2fv
;
906 vfmt
->EvalPoint1
= _mesa_noop_EvalPoint1
;
907 vfmt
->EvalPoint2
= _mesa_noop_EvalPoint2
;
908 vfmt
->FogCoordfEXT
= _mesa_noop_FogCoordfEXT
;
909 vfmt
->FogCoordfvEXT
= _mesa_noop_FogCoordfvEXT
;
910 vfmt
->Indexf
= _mesa_noop_Indexf
;
911 vfmt
->Indexfv
= _mesa_noop_Indexfv
;
912 vfmt
->Materialfv
= _mesa_noop_Materialfv
;
913 vfmt
->MultiTexCoord1fARB
= _mesa_noop_MultiTexCoord1fARB
;
914 vfmt
->MultiTexCoord1fvARB
= _mesa_noop_MultiTexCoord1fvARB
;
915 vfmt
->MultiTexCoord2fARB
= _mesa_noop_MultiTexCoord2fARB
;
916 vfmt
->MultiTexCoord2fvARB
= _mesa_noop_MultiTexCoord2fvARB
;
917 vfmt
->MultiTexCoord3fARB
= _mesa_noop_MultiTexCoord3fARB
;
918 vfmt
->MultiTexCoord3fvARB
= _mesa_noop_MultiTexCoord3fvARB
;
919 vfmt
->MultiTexCoord4fARB
= _mesa_noop_MultiTexCoord4fARB
;
920 vfmt
->MultiTexCoord4fvARB
= _mesa_noop_MultiTexCoord4fvARB
;
921 vfmt
->Normal3f
= _mesa_noop_Normal3f
;
922 vfmt
->Normal3fv
= _mesa_noop_Normal3fv
;
923 vfmt
->SecondaryColor3fEXT
= _mesa_noop_SecondaryColor3fEXT
;
924 vfmt
->SecondaryColor3fvEXT
= _mesa_noop_SecondaryColor3fvEXT
;
925 vfmt
->TexCoord1f
= _mesa_noop_TexCoord1f
;
926 vfmt
->TexCoord1fv
= _mesa_noop_TexCoord1fv
;
927 vfmt
->TexCoord2f
= _mesa_noop_TexCoord2f
;
928 vfmt
->TexCoord2fv
= _mesa_noop_TexCoord2fv
;
929 vfmt
->TexCoord3f
= _mesa_noop_TexCoord3f
;
930 vfmt
->TexCoord3fv
= _mesa_noop_TexCoord3fv
;
931 vfmt
->TexCoord4f
= _mesa_noop_TexCoord4f
;
932 vfmt
->TexCoord4fv
= _mesa_noop_TexCoord4fv
;
933 vfmt
->Vertex2f
= _mesa_noop_Vertex2f
;
934 vfmt
->Vertex2fv
= _mesa_noop_Vertex2fv
;
935 vfmt
->Vertex3f
= _mesa_noop_Vertex3f
;
936 vfmt
->Vertex3fv
= _mesa_noop_Vertex3fv
;
937 vfmt
->Vertex4f
= _mesa_noop_Vertex4f
;
938 vfmt
->Vertex4fv
= _mesa_noop_Vertex4fv
;
939 vfmt
->VertexAttrib1fNV
= _mesa_noop_VertexAttrib1fNV
;
940 vfmt
->VertexAttrib1fvNV
= _mesa_noop_VertexAttrib1fvNV
;
941 vfmt
->VertexAttrib2fNV
= _mesa_noop_VertexAttrib2fNV
;
942 vfmt
->VertexAttrib2fvNV
= _mesa_noop_VertexAttrib2fvNV
;
943 vfmt
->VertexAttrib3fNV
= _mesa_noop_VertexAttrib3fNV
;
944 vfmt
->VertexAttrib3fvNV
= _mesa_noop_VertexAttrib3fvNV
;
945 vfmt
->VertexAttrib4fNV
= _mesa_noop_VertexAttrib4fNV
;
946 vfmt
->VertexAttrib4fvNV
= _mesa_noop_VertexAttrib4fvNV
;
947 vfmt
->VertexAttrib1fARB
= _mesa_noop_VertexAttrib1fARB
;
948 vfmt
->VertexAttrib1fvARB
= _mesa_noop_VertexAttrib1fvARB
;
949 vfmt
->VertexAttrib2fARB
= _mesa_noop_VertexAttrib2fARB
;
950 vfmt
->VertexAttrib2fvARB
= _mesa_noop_VertexAttrib2fvARB
;
951 vfmt
->VertexAttrib3fARB
= _mesa_noop_VertexAttrib3fARB
;
952 vfmt
->VertexAttrib3fvARB
= _mesa_noop_VertexAttrib3fvARB
;
953 vfmt
->VertexAttrib4fARB
= _mesa_noop_VertexAttrib4fARB
;
954 vfmt
->VertexAttrib4fvARB
= _mesa_noop_VertexAttrib4fvARB
;
956 vfmt
->Rectf
= _mesa_noop_Rectf
;
958 vfmt
->DrawArrays
= _mesa_noop_DrawArrays
;
959 vfmt
->DrawElements
= _mesa_noop_DrawElements
;
960 vfmt
->DrawRangeElements
= _mesa_noop_DrawRangeElements
;
961 vfmt
->EvalMesh1
= _mesa_noop_EvalMesh1
;
962 vfmt
->EvalMesh2
= _mesa_noop_EvalMesh2
;