2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. 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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
36 #include "api_loopback.h"
37 #include "api_validate.h"
38 #include "atifragshader.h"
40 #include "bufferobj.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
61 #include "texstorage.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
67 #include "math/m_matrix.h"
69 #include "main/dispatch.h"
76 * Other parts of Mesa (such as the VBO module) can plug into the display
77 * list system. This structure describes new display list instructions.
79 struct gl_list_instruction
82 void (*Execute
)( struct gl_context
*ctx
, void *data
);
83 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
84 void (*Print
)( struct gl_context
*ctx
, void *data
);
88 #define MAX_DLIST_EXT_OPCODES 16
91 * Used by device drivers to hook new commands into display lists.
93 struct gl_list_extensions
95 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
104 * \param ctx GL context.
106 * Checks if dd_function_table::SaveNeedFlush is marked to flush
107 * stored (save) vertices, and calls
108 * dd_function_table::SaveFlushVertices if so.
110 #define SAVE_FLUSH_VERTICES(ctx) \
112 if (ctx->Driver.SaveNeedFlush) \
113 ctx->Driver.SaveFlushVertices(ctx); \
118 * Macro to assert that the API call was made outside the
119 * glBegin()/glEnd() pair, with return value.
121 * \param ctx GL context.
122 * \param retval value to return value in case the assertion fails.
124 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
126 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
127 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 * Macro to assert that the API call was made outside the
134 * glBegin()/glEnd() pair.
136 * \param ctx GL context.
138 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
140 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
141 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 * Macro to assert that the API call was made outside the
148 * glBegin()/glEnd() pair and flush the vertices.
150 * \param ctx GL context.
152 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
155 SAVE_FLUSH_VERTICES(ctx); \
159 * Macro to assert that the API call was made outside the
160 * glBegin()/glEnd() pair and flush the vertices, with return value.
162 * \param ctx GL context.
163 * \param retval value to return value in case the assertion fails.
165 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
167 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
168 SAVE_FLUSH_VERTICES(ctx); \
174 * Display list opcodes.
176 * The fact that these identifiers are assigned consecutive
177 * integer values starting at 0 is very important, see InstSize array usage)
181 OPCODE_INVALID
= -1, /* Force signed enum */
187 OPCODE_BLEND_EQUATION
,
188 OPCODE_BLEND_EQUATION_SEPARATE
,
189 OPCODE_BLEND_FUNC_SEPARATE
,
191 OPCODE_BLEND_EQUATION_I
,
192 OPCODE_BLEND_EQUATION_SEPARATE_I
,
194 OPCODE_BLEND_FUNC_SEPARATE_I
,
197 OPCODE_CALL_LIST_OFFSET
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COPY_TEX_IMAGE1D
,
214 OPCODE_COPY_TEX_IMAGE2D
,
215 OPCODE_COPY_TEX_SUB_IMAGE1D
,
216 OPCODE_COPY_TEX_SUB_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE3D
,
223 OPCODE_DISABLE_INDEXED
,
227 OPCODE_ENABLE_INDEXED
,
241 OPCODE_LOAD_IDENTITY
,
254 OPCODE_PIXEL_TRANSFER
,
257 OPCODE_POINT_PARAMETERS
,
259 OPCODE_POLYGON_STIPPLE
,
260 OPCODE_POLYGON_OFFSET
,
264 OPCODE_PRIORITIZE_TEXTURE
,
273 OPCODE_SELECT_TEXTURE_SGIS
,
274 OPCODE_SELECT_TEXTURE_COORD_SET
,
285 OPCODE_TEX_SUB_IMAGE1D
,
286 OPCODE_TEX_SUB_IMAGE2D
,
287 OPCODE_TEX_SUB_IMAGE3D
,
291 /* GL_ARB_multitexture */
292 OPCODE_ACTIVE_TEXTURE
,
293 /* GL_ARB_texture_compression */
294 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
300 /* GL_ARB_multisample */
301 OPCODE_SAMPLE_COVERAGE
,
302 /* GL_ARB_window_pos */
303 OPCODE_WINDOW_POS_ARB
,
304 /* GL_NV_fragment_program */
305 OPCODE_BIND_PROGRAM_NV
,
306 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
307 /* GL_EXT_stencil_two_side */
308 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
309 /* GL_EXT_depth_bounds_test */
310 OPCODE_DEPTH_BOUNDS_EXT
,
311 /* GL_ARB_vertex/fragment_program */
312 OPCODE_PROGRAM_STRING_ARB
,
313 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
314 /* GL_ARB_occlusion_query */
315 OPCODE_BEGIN_QUERY_ARB
,
316 OPCODE_END_QUERY_ARB
,
317 /* GL_ARB_draw_buffers */
318 OPCODE_DRAW_BUFFERS_ARB
,
319 /* GL_ATI_fragment_shader */
320 OPCODE_TEX_BUMP_PARAMETER_ATI
,
321 /* GL_ATI_fragment_shader */
322 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
323 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
325 OPCODE_STENCIL_FUNC_SEPARATE
,
326 OPCODE_STENCIL_OP_SEPARATE
,
327 OPCODE_STENCIL_MASK_SEPARATE
,
329 /* GL_ARB_shader_objects */
347 OPCODE_UNIFORM_MATRIX22
,
348 OPCODE_UNIFORM_MATRIX33
,
349 OPCODE_UNIFORM_MATRIX44
,
350 OPCODE_UNIFORM_MATRIX23
,
351 OPCODE_UNIFORM_MATRIX32
,
352 OPCODE_UNIFORM_MATRIX24
,
353 OPCODE_UNIFORM_MATRIX42
,
354 OPCODE_UNIFORM_MATRIX34
,
355 OPCODE_UNIFORM_MATRIX43
,
367 /* GL_ARB_color_buffer_float */
370 /* GL_EXT_framebuffer_blit */
371 OPCODE_BLIT_FRAMEBUFFER
,
373 /* Vertex attributes -- fallback for when optimized display
374 * list build isn't active.
393 /* GL_EXT_provoking_vertex */
394 OPCODE_PROVOKING_VERTEX
,
396 /* GL_EXT_transform_feedback */
397 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
398 OPCODE_END_TRANSFORM_FEEDBACK
,
399 OPCODE_BIND_TRANSFORM_FEEDBACK
,
400 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
401 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
402 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
404 /* GL_EXT_texture_integer */
406 OPCODE_CLEARCOLOR_UI
,
407 OPCODE_TEXPARAMETER_I
,
408 OPCODE_TEXPARAMETER_UI
,
410 /* GL_EXT_separate_shader_objects */
411 OPCODE_ACTIVE_PROGRAM_EXT
,
412 OPCODE_USE_SHADER_PROGRAM_EXT
,
414 /* GL_ARB_instanced_arrays */
415 OPCODE_VERTEX_ATTRIB_DIVISOR
,
417 /* GL_NV_texture_barrier */
418 OPCODE_TEXTURE_BARRIER_NV
,
420 /* GL_ARB_sampler_object */
422 OPCODE_SAMPLER_PARAMETERIV
,
423 OPCODE_SAMPLER_PARAMETERFV
,
424 OPCODE_SAMPLER_PARAMETERIIV
,
425 OPCODE_SAMPLER_PARAMETERUIV
,
427 /* GL_ARB_geometry_shader4 */
428 OPCODE_PROGRAM_PARAMETERI
,
429 OPCODE_FRAMEBUFFER_TEXTURE
,
430 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
435 /* GL_NV_conditional_render */
436 OPCODE_BEGIN_CONDITIONAL_RENDER
,
437 OPCODE_END_CONDITIONAL_RENDER
,
439 /* ARB_timer_query */
440 OPCODE_QUERY_COUNTER
,
442 /* ARB_transform_feedback3 */
443 OPCODE_BEGIN_QUERY_INDEXED
,
444 OPCODE_END_QUERY_INDEXED
,
445 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
447 /* ARB_transform_feedback_instanced */
448 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
449 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
451 /* ARB_uniform_buffer_object */
452 OPCODE_UNIFORM_BLOCK_BINDING
,
454 /* The following three are meta instructions */
455 OPCODE_ERROR
, /* raise compiled-in error */
466 * Display list instructions are stored as sequences of "nodes". Nodes
467 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
468 * are linked together with a pointer.
470 * Each instruction in the display list is stored as a sequence of
471 * contiguous nodes in memory.
472 * Each node is the union of a variety of data types.
488 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
492 typedef union gl_dlist_node Node
;
496 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
497 * environment. In 64-bit env, sizeof(Node)==8 anyway.
507 * How many nodes to allocate at a time.
509 * \note Reduced now that we hold vertices etc. elsewhere.
511 #define BLOCK_SIZE 256
516 * Number of nodes of storage needed for each instruction.
517 * Sizes for dynamically allocated opcodes are stored in the context struct.
519 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
522 void mesa_print_display_list(GLuint list
);
525 /**********************************************************************/
526 /***** Private *****/
527 /**********************************************************************/
531 * Make an empty display list. This is used by glGenLists() to
532 * reserve display list IDs.
534 static struct gl_display_list
*
535 make_list(GLuint name
, GLuint count
)
537 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
539 dlist
->Head
= malloc(sizeof(Node
) * count
);
540 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
546 * Lookup function to just encapsulate casting.
548 struct gl_display_list
*
549 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
551 return (struct gl_display_list
*)
552 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
556 /** Is the given opcode an extension code? */
557 static inline GLboolean
558 is_ext_opcode(OpCode opcode
)
560 return (opcode
>= OPCODE_EXT_0
);
564 /** Destroy an extended opcode instruction */
566 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
568 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
570 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
571 step
= ctx
->ListExt
->Opcode
[i
].Size
;
576 /** Execute an extended opcode instruction */
578 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
580 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
582 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
583 step
= ctx
->ListExt
->Opcode
[i
].Size
;
588 /** Print an extended opcode instruction */
590 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
592 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
594 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
595 step
= ctx
->ListExt
->Opcode
[i
].Size
;
601 * Delete the named display list, but don't remove from hash table.
602 * \param dlist - display list pointer
605 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
610 n
= block
= dlist
->Head
;
612 done
= block
? GL_FALSE
: GL_TRUE
;
614 const OpCode opcode
= n
[0].opcode
;
616 /* check for extension opcodes first */
617 if (is_ext_opcode(opcode
)) {
618 n
+= ext_opcode_destroy(ctx
, n
);
622 /* for some commands, we need to free malloc'd memory */
625 n
+= InstSize
[n
[0].opcode
];
629 n
+= InstSize
[n
[0].opcode
];
631 case OPCODE_DRAW_PIXELS
:
633 n
+= InstSize
[n
[0].opcode
];
637 n
+= InstSize
[n
[0].opcode
];
639 case OPCODE_POLYGON_STIPPLE
:
641 n
+= InstSize
[n
[0].opcode
];
643 case OPCODE_TEX_IMAGE1D
:
645 n
+= InstSize
[n
[0].opcode
];
647 case OPCODE_TEX_IMAGE2D
:
649 n
+= InstSize
[n
[0].opcode
];
651 case OPCODE_TEX_IMAGE3D
:
653 n
+= InstSize
[n
[0].opcode
];
655 case OPCODE_TEX_SUB_IMAGE1D
:
657 n
+= InstSize
[n
[0].opcode
];
659 case OPCODE_TEX_SUB_IMAGE2D
:
661 n
+= InstSize
[n
[0].opcode
];
663 case OPCODE_TEX_SUB_IMAGE3D
:
665 n
+= InstSize
[n
[0].opcode
];
667 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
669 n
+= InstSize
[n
[0].opcode
];
671 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
673 n
+= InstSize
[n
[0].opcode
];
675 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
677 n
+= InstSize
[n
[0].opcode
];
679 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
681 n
+= InstSize
[n
[0].opcode
];
683 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
685 n
+= InstSize
[n
[0].opcode
];
687 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
689 n
+= InstSize
[n
[0].opcode
];
691 case OPCODE_PROGRAM_STRING_ARB
:
692 free(n
[4].data
); /* program string */
693 n
+= InstSize
[n
[0].opcode
];
695 case OPCODE_UNIFORM_1FV
:
696 case OPCODE_UNIFORM_2FV
:
697 case OPCODE_UNIFORM_3FV
:
698 case OPCODE_UNIFORM_4FV
:
699 case OPCODE_UNIFORM_1IV
:
700 case OPCODE_UNIFORM_2IV
:
701 case OPCODE_UNIFORM_3IV
:
702 case OPCODE_UNIFORM_4IV
:
703 case OPCODE_UNIFORM_1UIV
:
704 case OPCODE_UNIFORM_2UIV
:
705 case OPCODE_UNIFORM_3UIV
:
706 case OPCODE_UNIFORM_4UIV
:
708 n
+= InstSize
[n
[0].opcode
];
710 case OPCODE_UNIFORM_MATRIX22
:
711 case OPCODE_UNIFORM_MATRIX33
:
712 case OPCODE_UNIFORM_MATRIX44
:
713 case OPCODE_UNIFORM_MATRIX24
:
714 case OPCODE_UNIFORM_MATRIX42
:
715 case OPCODE_UNIFORM_MATRIX23
:
716 case OPCODE_UNIFORM_MATRIX32
:
717 case OPCODE_UNIFORM_MATRIX34
:
718 case OPCODE_UNIFORM_MATRIX43
:
720 n
+= InstSize
[n
[0].opcode
];
722 case OPCODE_PIXEL_MAP
:
726 case OPCODE_CONTINUE
:
727 n
= (Node
*) n
[1].next
;
731 case OPCODE_END_OF_LIST
:
736 /* Most frequent case */
737 n
+= InstSize
[n
[0].opcode
];
749 * Destroy a display list and remove from hash table.
750 * \param list - display list number
753 destroy_list(struct gl_context
*ctx
, GLuint list
)
755 struct gl_display_list
*dlist
;
760 dlist
= _mesa_lookup_list(ctx
, list
);
764 _mesa_delete_list(ctx
, dlist
);
765 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
770 * Translate the nth element of list from <type> to GLint.
773 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
785 bptr
= (GLbyte
*) list
;
786 return (GLint
) bptr
[n
];
787 case GL_UNSIGNED_BYTE
:
788 ubptr
= (GLubyte
*) list
;
789 return (GLint
) ubptr
[n
];
791 sptr
= (GLshort
*) list
;
792 return (GLint
) sptr
[n
];
793 case GL_UNSIGNED_SHORT
:
794 usptr
= (GLushort
*) list
;
795 return (GLint
) usptr
[n
];
797 iptr
= (GLint
*) list
;
799 case GL_UNSIGNED_INT
:
800 uiptr
= (GLuint
*) list
;
801 return (GLint
) uiptr
[n
];
803 fptr
= (GLfloat
*) list
;
804 return (GLint
) FLOORF(fptr
[n
]);
806 ubptr
= ((GLubyte
*) list
) + 2 * n
;
807 return (GLint
) ubptr
[0] * 256
810 ubptr
= ((GLubyte
*) list
) + 3 * n
;
811 return (GLint
) ubptr
[0] * 65536
812 + (GLint
) ubptr
[1] * 256
815 ubptr
= ((GLubyte
*) list
) + 4 * n
;
816 return (GLint
) ubptr
[0] * 16777216
817 + (GLint
) ubptr
[1] * 65536
818 + (GLint
) ubptr
[2] * 256
828 /**********************************************************************/
830 /**********************************************************************/
833 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
834 * If width < 0 or height < 0 or format or type are invalid we'll just
835 * return NULL. We will not generate an error since OpenGL command
836 * arguments aren't error-checked until the command is actually executed
837 * (not when they're compiled).
838 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
841 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
842 GLsizei width
, GLsizei height
, GLsizei depth
,
843 GLenum format
, GLenum type
, const GLvoid
* pixels
,
844 const struct gl_pixelstore_attrib
*unpack
)
846 if (width
<= 0 || height
<= 0) {
850 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
851 /* bad format and/or type */
855 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
859 if (type
== GL_BITMAP
)
860 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
862 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
863 format
, type
, pixels
, unpack
);
864 if (pixels
&& !image
) {
865 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
869 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
870 depth
, format
, type
, INT_MAX
, pixels
)) {
871 const GLubyte
*map
, *src
;
875 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
876 GL_MAP_READ_BIT
, unpack
->BufferObj
);
878 /* unable to map src buffer! */
879 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
883 src
= ADD_POINTERS(map
, pixels
);
884 if (type
== GL_BITMAP
)
885 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
887 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
888 format
, type
, src
, unpack
);
890 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
893 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
899 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
904 /** Return copy of memory */
906 memdup(const void *src
, GLsizei bytes
)
908 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
910 memcpy(b
, src
, bytes
);
916 * Allocate space for a display list instruction (opcode + payload space).
917 * \param opcode the instruction opcode (OPCODE_* value)
918 * \param bytes instruction payload size (not counting opcode)
919 * \return pointer to allocated memory (the opcode space)
922 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
924 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
927 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
928 if (InstSize
[opcode
] == 0) {
929 /* save instruction size now */
930 InstSize
[opcode
] = numNodes
;
933 /* make sure instruction size agrees */
934 ASSERT(numNodes
== InstSize
[opcode
]);
938 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
939 /* This block is full. Allocate a new block and chain to it */
941 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
942 n
[0].opcode
= OPCODE_CONTINUE
;
943 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
945 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
948 n
[1].next
= (Node
*) newblock
;
949 ctx
->ListState
.CurrentBlock
= newblock
;
950 ctx
->ListState
.CurrentPos
= 0;
953 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
954 ctx
->ListState
.CurrentPos
+= numNodes
;
956 n
[0].opcode
= opcode
;
964 * Allocate space for a display list instruction. Used by callers outside
965 * this file for things like VBO vertex data.
967 * \param opcode the instruction opcode (OPCODE_* value)
968 * \param bytes instruction size in bytes, not counting opcode.
969 * \return pointer to the usable data area (not including the internal
973 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
975 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
977 return n
+ 1; /* return pointer to payload area, after opcode */
984 * This function allows modules and drivers to get their own opcodes
985 * for extending display list functionality.
986 * \param ctx the rendering context
987 * \param size number of bytes for storing the new display list command
988 * \param execute function to execute the new display list command
989 * \param destroy function to destroy the new display list command
990 * \param print function to print the new display list command
991 * \return the new opcode number or -1 if error
994 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
996 void (*execute
) (struct gl_context
*, void *),
997 void (*destroy
) (struct gl_context
*, void *),
998 void (*print
) (struct gl_context
*, void *))
1000 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1001 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1002 ctx
->ListExt
->Opcode
[i
].Size
=
1003 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1004 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1005 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1006 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1007 return i
+ OPCODE_EXT_0
;
1014 * Allocate space for a display list instruction. The space is basically
1015 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1016 * function parameter, node[2] is the second parameter, etc.
1018 * \param opcode one of OPCODE_x
1019 * \param nparams number of function parameters
1020 * \return pointer to start of instruction space
1022 static inline Node
*
1023 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1025 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1031 * Display List compilation functions
1033 static void GLAPIENTRY
1034 save_Accum(GLenum op
, GLfloat value
)
1036 GET_CURRENT_CONTEXT(ctx
);
1038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1039 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1044 if (ctx
->ExecuteFlag
) {
1045 CALL_Accum(ctx
->Exec
, (op
, value
));
1050 static void GLAPIENTRY
1051 save_AlphaFunc(GLenum func
, GLclampf ref
)
1053 GET_CURRENT_CONTEXT(ctx
);
1055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1056 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1059 n
[2].f
= (GLfloat
) ref
;
1061 if (ctx
->ExecuteFlag
) {
1062 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1067 static void GLAPIENTRY
1068 save_BindTexture(GLenum target
, GLuint texture
)
1070 GET_CURRENT_CONTEXT(ctx
);
1072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1073 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1078 if (ctx
->ExecuteFlag
) {
1079 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1084 static void GLAPIENTRY
1085 save_Bitmap(GLsizei width
, GLsizei height
,
1086 GLfloat xorig
, GLfloat yorig
,
1087 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1089 GET_CURRENT_CONTEXT(ctx
);
1091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1092 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1094 n
[1].i
= (GLint
) width
;
1095 n
[2].i
= (GLint
) height
;
1100 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1101 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1103 if (ctx
->ExecuteFlag
) {
1104 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1105 xorig
, yorig
, xmove
, ymove
, pixels
));
1110 static void GLAPIENTRY
1111 save_BlendEquation(GLenum mode
)
1113 GET_CURRENT_CONTEXT(ctx
);
1115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1116 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1120 if (ctx
->ExecuteFlag
) {
1121 CALL_BlendEquation(ctx
->Exec
, (mode
));
1126 static void GLAPIENTRY
1127 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1129 GET_CURRENT_CONTEXT(ctx
);
1131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1132 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1137 if (ctx
->ExecuteFlag
) {
1138 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1143 static void GLAPIENTRY
1144 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1145 GLenum sfactorA
, GLenum dfactorA
)
1147 GET_CURRENT_CONTEXT(ctx
);
1149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1150 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1152 n
[1].e
= sfactorRGB
;
1153 n
[2].e
= dfactorRGB
;
1157 if (ctx
->ExecuteFlag
) {
1158 CALL_BlendFuncSeparate(ctx
->Exec
,
1159 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1164 static void GLAPIENTRY
1165 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1167 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1171 static void GLAPIENTRY
1172 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1174 GET_CURRENT_CONTEXT(ctx
);
1176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1177 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1184 if (ctx
->ExecuteFlag
) {
1185 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1189 /* GL_ARB_draw_buffers_blend */
1190 static void GLAPIENTRY
1191 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1192 GLenum sfactorA
, GLenum dfactorA
)
1194 GET_CURRENT_CONTEXT(ctx
);
1196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1197 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1200 n
[2].e
= sfactorRGB
;
1201 n
[3].e
= dfactorRGB
;
1205 if (ctx
->ExecuteFlag
) {
1206 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1207 sfactorA
, dfactorA
));
1211 /* GL_ARB_draw_buffers_blend */
1212 static void GLAPIENTRY
1213 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1215 GET_CURRENT_CONTEXT(ctx
);
1217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1218 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1224 if (ctx
->ExecuteFlag
) {
1225 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1229 /* GL_ARB_draw_buffers_blend */
1230 static void GLAPIENTRY
1231 save_BlendEquationi(GLuint buf
, GLenum mode
)
1233 GET_CURRENT_CONTEXT(ctx
);
1235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1236 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1241 if (ctx
->ExecuteFlag
) {
1242 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1246 /* GL_ARB_draw_buffers_blend */
1247 static void GLAPIENTRY
1248 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1250 GET_CURRENT_CONTEXT(ctx
);
1252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1253 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1259 if (ctx
->ExecuteFlag
) {
1260 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1265 /* GL_ARB_draw_instanced. */
1266 static void GLAPIENTRY
1267 save_DrawArraysInstancedARB(GLenum mode
,
1272 GET_CURRENT_CONTEXT(ctx
);
1273 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1274 "glDrawArraysInstanced() during display list compile");
1277 static void GLAPIENTRY
1278 save_DrawElementsInstancedARB(GLenum mode
,
1281 const GLvoid
*indices
,
1284 GET_CURRENT_CONTEXT(ctx
);
1285 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1286 "glDrawElementsInstanced() during display list compile");
1289 static void GLAPIENTRY
1290 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1293 const GLvoid
*indices
,
1297 GET_CURRENT_CONTEXT(ctx
);
1298 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1299 "glDrawElementsInstancedBaseVertex() during display list compile");
1302 /* GL_ARB_base_instance. */
1303 static void GLAPIENTRY
1304 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1308 GLuint baseinstance
)
1310 GET_CURRENT_CONTEXT(ctx
);
1311 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1312 "glDrawArraysInstancedBaseInstance() during display list compile");
1315 static void APIENTRY
1316 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1319 const void *indices
,
1321 GLuint baseinstance
)
1323 GET_CURRENT_CONTEXT(ctx
);
1324 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1325 "glDrawElementsInstancedBaseInstance() during display list compile");
1328 static void APIENTRY
1329 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1332 const void *indices
,
1335 GLuint baseinstance
)
1337 GET_CURRENT_CONTEXT(ctx
);
1338 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1339 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1344 * While building a display list we cache some OpenGL state.
1345 * Under some circumstances we need to invalidate that state (immediately
1346 * when we start compiling a list, or after glCallList(s)).
1349 invalidate_saved_current_state(struct gl_context
*ctx
)
1353 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1354 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1356 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1357 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1359 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1361 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1365 static void GLAPIENTRY
1366 save_CallList(GLuint list
)
1368 GET_CURRENT_CONTEXT(ctx
);
1370 SAVE_FLUSH_VERTICES(ctx
);
1372 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1377 /* After this, we don't know what state we're in. Invalidate all
1378 * cached information previously gathered:
1380 invalidate_saved_current_state( ctx
);
1382 if (ctx
->ExecuteFlag
) {
1383 _mesa_CallList(list
);
1388 static void GLAPIENTRY
1389 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1391 GET_CURRENT_CONTEXT(ctx
);
1393 GLboolean typeErrorFlag
;
1395 SAVE_FLUSH_VERTICES(ctx
);
1399 case GL_UNSIGNED_BYTE
:
1401 case GL_UNSIGNED_SHORT
:
1403 case GL_UNSIGNED_INT
:
1408 typeErrorFlag
= GL_FALSE
;
1411 typeErrorFlag
= GL_TRUE
;
1414 for (i
= 0; i
< num
; i
++) {
1415 GLint list
= translate_id(i
, type
, lists
);
1416 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1419 n
[2].b
= typeErrorFlag
;
1423 /* After this, we don't know what state we're in. Invalidate all
1424 * cached information previously gathered:
1426 invalidate_saved_current_state( ctx
);
1428 if (ctx
->ExecuteFlag
) {
1429 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1434 static void GLAPIENTRY
1435 save_Clear(GLbitfield mask
)
1437 GET_CURRENT_CONTEXT(ctx
);
1439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1440 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1444 if (ctx
->ExecuteFlag
) {
1445 CALL_Clear(ctx
->Exec
, (mask
));
1450 static void GLAPIENTRY
1451 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1453 GET_CURRENT_CONTEXT(ctx
);
1455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1456 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1459 n
[2].i
= drawbuffer
;
1461 if (buffer
== GL_COLOR
) {
1472 if (ctx
->ExecuteFlag
) {
1473 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1478 static void GLAPIENTRY
1479 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1481 GET_CURRENT_CONTEXT(ctx
);
1483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1484 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1487 n
[2].i
= drawbuffer
;
1489 if (buffer
== GL_COLOR
) {
1500 if (ctx
->ExecuteFlag
) {
1501 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1506 static void GLAPIENTRY
1507 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1509 GET_CURRENT_CONTEXT(ctx
);
1511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1512 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1515 n
[2].i
= drawbuffer
;
1517 if (buffer
== GL_COLOR
) {
1528 if (ctx
->ExecuteFlag
) {
1529 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1534 static void GLAPIENTRY
1535 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1536 GLfloat depth
, GLint stencil
)
1538 GET_CURRENT_CONTEXT(ctx
);
1540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1541 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1544 n
[2].i
= drawbuffer
;
1548 if (ctx
->ExecuteFlag
) {
1549 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1554 static void GLAPIENTRY
1555 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1557 GET_CURRENT_CONTEXT(ctx
);
1559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1560 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1567 if (ctx
->ExecuteFlag
) {
1568 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1573 static void GLAPIENTRY
1574 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1576 GET_CURRENT_CONTEXT(ctx
);
1578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1579 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1586 if (ctx
->ExecuteFlag
) {
1587 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1592 static void GLAPIENTRY
1593 save_ClearDepth(GLclampd depth
)
1595 GET_CURRENT_CONTEXT(ctx
);
1597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1598 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1600 n
[1].f
= (GLfloat
) depth
;
1602 if (ctx
->ExecuteFlag
) {
1603 CALL_ClearDepth(ctx
->Exec
, (depth
));
1608 static void GLAPIENTRY
1609 save_ClearIndex(GLfloat c
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1618 if (ctx
->ExecuteFlag
) {
1619 CALL_ClearIndex(ctx
->Exec
, (c
));
1624 static void GLAPIENTRY
1625 save_ClearStencil(GLint s
)
1627 GET_CURRENT_CONTEXT(ctx
);
1629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1630 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1634 if (ctx
->ExecuteFlag
) {
1635 CALL_ClearStencil(ctx
->Exec
, (s
));
1640 static void GLAPIENTRY
1641 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1643 GET_CURRENT_CONTEXT(ctx
);
1645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1646 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1649 n
[2].f
= (GLfloat
) equ
[0];
1650 n
[3].f
= (GLfloat
) equ
[1];
1651 n
[4].f
= (GLfloat
) equ
[2];
1652 n
[5].f
= (GLfloat
) equ
[3];
1654 if (ctx
->ExecuteFlag
) {
1655 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1661 static void GLAPIENTRY
1662 save_ColorMask(GLboolean red
, GLboolean green
,
1663 GLboolean blue
, GLboolean alpha
)
1665 GET_CURRENT_CONTEXT(ctx
);
1667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1668 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1675 if (ctx
->ExecuteFlag
) {
1676 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1681 static void GLAPIENTRY
1682 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1683 GLboolean blue
, GLboolean alpha
)
1685 GET_CURRENT_CONTEXT(ctx
);
1687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1688 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1696 if (ctx
->ExecuteFlag
) {
1697 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1702 static void GLAPIENTRY
1703 save_ColorMaterial(GLenum face
, GLenum mode
)
1705 GET_CURRENT_CONTEXT(ctx
);
1707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1709 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1714 if (ctx
->ExecuteFlag
) {
1715 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1720 static void GLAPIENTRY
1721 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1723 GET_CURRENT_CONTEXT(ctx
);
1725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1726 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1730 n
[3].i
= (GLint
) width
;
1731 n
[4].i
= (GLint
) height
;
1734 if (ctx
->ExecuteFlag
) {
1735 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1741 static void GLAPIENTRY
1742 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1743 GLint x
, GLint y
, GLsizei width
, GLint border
)
1745 GET_CURRENT_CONTEXT(ctx
);
1747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1748 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1752 n
[3].e
= internalformat
;
1758 if (ctx
->ExecuteFlag
) {
1759 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1760 x
, y
, width
, border
));
1765 static void GLAPIENTRY
1766 save_CopyTexImage2D(GLenum target
, GLint level
,
1767 GLenum internalformat
,
1768 GLint x
, GLint y
, GLsizei width
,
1769 GLsizei height
, GLint border
)
1771 GET_CURRENT_CONTEXT(ctx
);
1773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1774 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1778 n
[3].e
= internalformat
;
1785 if (ctx
->ExecuteFlag
) {
1786 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1787 x
, y
, width
, height
, border
));
1793 static void GLAPIENTRY
1794 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1795 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1797 GET_CURRENT_CONTEXT(ctx
);
1799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1800 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1809 if (ctx
->ExecuteFlag
) {
1810 CALL_CopyTexSubImage1D(ctx
->Exec
,
1811 (target
, level
, xoffset
, x
, y
, width
));
1816 static void GLAPIENTRY
1817 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1818 GLint xoffset
, GLint yoffset
,
1819 GLint x
, GLint y
, GLsizei width
, GLint height
)
1821 GET_CURRENT_CONTEXT(ctx
);
1823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1824 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1835 if (ctx
->ExecuteFlag
) {
1836 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1837 x
, y
, width
, height
));
1842 static void GLAPIENTRY
1843 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1844 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1845 GLint x
, GLint y
, GLsizei width
, GLint height
)
1847 GET_CURRENT_CONTEXT(ctx
);
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1850 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1862 if (ctx
->ExecuteFlag
) {
1863 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1864 xoffset
, yoffset
, zoffset
,
1865 x
, y
, width
, height
));
1870 static void GLAPIENTRY
1871 save_CullFace(GLenum mode
)
1873 GET_CURRENT_CONTEXT(ctx
);
1875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1876 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1880 if (ctx
->ExecuteFlag
) {
1881 CALL_CullFace(ctx
->Exec
, (mode
));
1886 static void GLAPIENTRY
1887 save_DepthFunc(GLenum func
)
1889 GET_CURRENT_CONTEXT(ctx
);
1891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1892 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1896 if (ctx
->ExecuteFlag
) {
1897 CALL_DepthFunc(ctx
->Exec
, (func
));
1902 static void GLAPIENTRY
1903 save_DepthMask(GLboolean mask
)
1905 GET_CURRENT_CONTEXT(ctx
);
1907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1908 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1912 if (ctx
->ExecuteFlag
) {
1913 CALL_DepthMask(ctx
->Exec
, (mask
));
1918 static void GLAPIENTRY
1919 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1921 GET_CURRENT_CONTEXT(ctx
);
1923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1926 n
[1].f
= (GLfloat
) nearval
;
1927 n
[2].f
= (GLfloat
) farval
;
1929 if (ctx
->ExecuteFlag
) {
1930 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1935 static void GLAPIENTRY
1936 save_Disable(GLenum cap
)
1938 GET_CURRENT_CONTEXT(ctx
);
1940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1941 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
1945 if (ctx
->ExecuteFlag
) {
1946 CALL_Disable(ctx
->Exec
, (cap
));
1951 static void GLAPIENTRY
1952 save_DisableIndexed(GLuint index
, GLenum cap
)
1954 GET_CURRENT_CONTEXT(ctx
);
1956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1957 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
1962 if (ctx
->ExecuteFlag
) {
1963 CALL_Disablei(ctx
->Exec
, (index
, cap
));
1968 static void GLAPIENTRY
1969 save_DrawBuffer(GLenum mode
)
1971 GET_CURRENT_CONTEXT(ctx
);
1973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1974 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
1978 if (ctx
->ExecuteFlag
) {
1979 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1984 static void GLAPIENTRY
1985 save_DrawPixels(GLsizei width
, GLsizei height
,
1986 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1988 GET_CURRENT_CONTEXT(ctx
);
1991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1993 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
1999 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2000 pixels
, &ctx
->Unpack
);
2002 if (ctx
->ExecuteFlag
) {
2003 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2009 static void GLAPIENTRY
2010 save_Enable(GLenum cap
)
2012 GET_CURRENT_CONTEXT(ctx
);
2014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2015 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2019 if (ctx
->ExecuteFlag
) {
2020 CALL_Enable(ctx
->Exec
, (cap
));
2026 static void GLAPIENTRY
2027 save_EnableIndexed(GLuint index
, GLenum cap
)
2029 GET_CURRENT_CONTEXT(ctx
);
2031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2032 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2037 if (ctx
->ExecuteFlag
) {
2038 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2044 static void GLAPIENTRY
2045 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2047 GET_CURRENT_CONTEXT(ctx
);
2049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2050 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2056 if (ctx
->ExecuteFlag
) {
2057 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2062 static void GLAPIENTRY
2063 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2065 GET_CURRENT_CONTEXT(ctx
);
2067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2068 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2076 if (ctx
->ExecuteFlag
) {
2077 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2084 static void GLAPIENTRY
2085 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2090 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2098 if (ctx
->ExecuteFlag
) {
2099 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2104 static void GLAPIENTRY
2105 save_Fogf(GLenum pname
, GLfloat param
)
2109 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2110 save_Fogfv(pname
, parray
);
2114 static void GLAPIENTRY
2115 save_Fogiv(GLenum pname
, const GLint
*params
)
2120 case GL_FOG_DENSITY
:
2124 p
[0] = (GLfloat
) *params
;
2130 p
[0] = INT_TO_FLOAT(params
[0]);
2131 p
[1] = INT_TO_FLOAT(params
[1]);
2132 p
[2] = INT_TO_FLOAT(params
[2]);
2133 p
[3] = INT_TO_FLOAT(params
[3]);
2136 /* Error will be caught later in gl_Fogfv */
2137 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2139 save_Fogfv(pname
, p
);
2143 static void GLAPIENTRY
2144 save_Fogi(GLenum pname
, GLint param
)
2148 parray
[1] = parray
[2] = parray
[3] = 0;
2149 save_Fogiv(pname
, parray
);
2153 static void GLAPIENTRY
2154 save_FrontFace(GLenum mode
)
2156 GET_CURRENT_CONTEXT(ctx
);
2158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2159 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2163 if (ctx
->ExecuteFlag
) {
2164 CALL_FrontFace(ctx
->Exec
, (mode
));
2169 static void GLAPIENTRY
2170 save_Frustum(GLdouble left
, GLdouble right
,
2171 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2173 GET_CURRENT_CONTEXT(ctx
);
2175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2176 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2178 n
[1].f
= (GLfloat
) left
;
2179 n
[2].f
= (GLfloat
) right
;
2180 n
[3].f
= (GLfloat
) bottom
;
2181 n
[4].f
= (GLfloat
) top
;
2182 n
[5].f
= (GLfloat
) nearval
;
2183 n
[6].f
= (GLfloat
) farval
;
2185 if (ctx
->ExecuteFlag
) {
2186 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2191 static void GLAPIENTRY
2192 save_Hint(GLenum target
, GLenum mode
)
2194 GET_CURRENT_CONTEXT(ctx
);
2196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2197 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2202 if (ctx
->ExecuteFlag
) {
2203 CALL_Hint(ctx
->Exec
, (target
, mode
));
2208 static void GLAPIENTRY
2209 save_IndexMask(GLuint mask
)
2211 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2218 if (ctx
->ExecuteFlag
) {
2219 CALL_IndexMask(ctx
->Exec
, (mask
));
2224 static void GLAPIENTRY
2225 save_InitNames(void)
2227 GET_CURRENT_CONTEXT(ctx
);
2228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2229 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2230 if (ctx
->ExecuteFlag
) {
2231 CALL_InitNames(ctx
->Exec
, ());
2236 static void GLAPIENTRY
2237 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2239 GET_CURRENT_CONTEXT(ctx
);
2241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2242 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2260 case GL_SPOT_DIRECTION
:
2263 case GL_SPOT_EXPONENT
:
2266 case GL_SPOT_CUTOFF
:
2269 case GL_CONSTANT_ATTENUATION
:
2272 case GL_LINEAR_ATTENUATION
:
2275 case GL_QUADRATIC_ATTENUATION
:
2281 for (i
= 0; i
< nParams
; i
++) {
2282 n
[3 + i
].f
= params
[i
];
2285 if (ctx
->ExecuteFlag
) {
2286 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2291 static void GLAPIENTRY
2292 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2296 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2297 save_Lightfv(light
, pname
, parray
);
2301 static void GLAPIENTRY
2302 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2309 fparam
[0] = INT_TO_FLOAT(params
[0]);
2310 fparam
[1] = INT_TO_FLOAT(params
[1]);
2311 fparam
[2] = INT_TO_FLOAT(params
[2]);
2312 fparam
[3] = INT_TO_FLOAT(params
[3]);
2315 fparam
[0] = (GLfloat
) params
[0];
2316 fparam
[1] = (GLfloat
) params
[1];
2317 fparam
[2] = (GLfloat
) params
[2];
2318 fparam
[3] = (GLfloat
) params
[3];
2320 case GL_SPOT_DIRECTION
:
2321 fparam
[0] = (GLfloat
) params
[0];
2322 fparam
[1] = (GLfloat
) params
[1];
2323 fparam
[2] = (GLfloat
) params
[2];
2325 case GL_SPOT_EXPONENT
:
2326 case GL_SPOT_CUTOFF
:
2327 case GL_CONSTANT_ATTENUATION
:
2328 case GL_LINEAR_ATTENUATION
:
2329 case GL_QUADRATIC_ATTENUATION
:
2330 fparam
[0] = (GLfloat
) params
[0];
2333 /* error will be caught later in gl_Lightfv */
2336 save_Lightfv(light
, pname
, fparam
);
2340 static void GLAPIENTRY
2341 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2345 parray
[1] = parray
[2] = parray
[3] = 0;
2346 save_Lightiv(light
, pname
, parray
);
2350 static void GLAPIENTRY
2351 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2353 GET_CURRENT_CONTEXT(ctx
);
2355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2356 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2364 if (ctx
->ExecuteFlag
) {
2365 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2370 static void GLAPIENTRY
2371 save_LightModelf(GLenum pname
, GLfloat param
)
2375 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2376 save_LightModelfv(pname
, parray
);
2380 static void GLAPIENTRY
2381 save_LightModeliv(GLenum pname
, const GLint
*params
)
2385 case GL_LIGHT_MODEL_AMBIENT
:
2386 fparam
[0] = INT_TO_FLOAT(params
[0]);
2387 fparam
[1] = INT_TO_FLOAT(params
[1]);
2388 fparam
[2] = INT_TO_FLOAT(params
[2]);
2389 fparam
[3] = INT_TO_FLOAT(params
[3]);
2391 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2392 case GL_LIGHT_MODEL_TWO_SIDE
:
2393 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2394 fparam
[0] = (GLfloat
) params
[0];
2400 /* Error will be caught later in gl_LightModelfv */
2401 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2403 save_LightModelfv(pname
, fparam
);
2407 static void GLAPIENTRY
2408 save_LightModeli(GLenum pname
, GLint param
)
2412 parray
[1] = parray
[2] = parray
[3] = 0;
2413 save_LightModeliv(pname
, parray
);
2417 static void GLAPIENTRY
2418 save_LineStipple(GLint factor
, GLushort pattern
)
2420 GET_CURRENT_CONTEXT(ctx
);
2422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2423 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2428 if (ctx
->ExecuteFlag
) {
2429 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2434 static void GLAPIENTRY
2435 save_LineWidth(GLfloat width
)
2437 GET_CURRENT_CONTEXT(ctx
);
2439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2440 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2444 if (ctx
->ExecuteFlag
) {
2445 CALL_LineWidth(ctx
->Exec
, (width
));
2450 static void GLAPIENTRY
2451 save_ListBase(GLuint base
)
2453 GET_CURRENT_CONTEXT(ctx
);
2455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2456 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2460 if (ctx
->ExecuteFlag
) {
2461 CALL_ListBase(ctx
->Exec
, (base
));
2466 static void GLAPIENTRY
2467 save_LoadIdentity(void)
2469 GET_CURRENT_CONTEXT(ctx
);
2470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2471 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2472 if (ctx
->ExecuteFlag
) {
2473 CALL_LoadIdentity(ctx
->Exec
, ());
2478 static void GLAPIENTRY
2479 save_LoadMatrixf(const GLfloat
* m
)
2481 GET_CURRENT_CONTEXT(ctx
);
2483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2484 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2487 for (i
= 0; i
< 16; i
++) {
2491 if (ctx
->ExecuteFlag
) {
2492 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2497 static void GLAPIENTRY
2498 save_LoadMatrixd(const GLdouble
* m
)
2502 for (i
= 0; i
< 16; i
++) {
2503 f
[i
] = (GLfloat
) m
[i
];
2505 save_LoadMatrixf(f
);
2509 static void GLAPIENTRY
2510 save_LoadName(GLuint name
)
2512 GET_CURRENT_CONTEXT(ctx
);
2514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2515 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2519 if (ctx
->ExecuteFlag
) {
2520 CALL_LoadName(ctx
->Exec
, (name
));
2525 static void GLAPIENTRY
2526 save_LogicOp(GLenum opcode
)
2528 GET_CURRENT_CONTEXT(ctx
);
2530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2531 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2535 if (ctx
->ExecuteFlag
) {
2536 CALL_LogicOp(ctx
->Exec
, (opcode
));
2541 static void GLAPIENTRY
2542 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2543 GLint order
, const GLdouble
* points
)
2545 GET_CURRENT_CONTEXT(ctx
);
2547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2548 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2550 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2552 n
[2].f
= (GLfloat
) u1
;
2553 n
[3].f
= (GLfloat
) u2
;
2554 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2556 n
[6].data
= (void *) pnts
;
2558 if (ctx
->ExecuteFlag
) {
2559 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2563 static void GLAPIENTRY
2564 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2565 GLint order
, const GLfloat
* points
)
2567 GET_CURRENT_CONTEXT(ctx
);
2569 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2570 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2572 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2576 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2578 n
[6].data
= (void *) pnts
;
2580 if (ctx
->ExecuteFlag
) {
2581 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2586 static void GLAPIENTRY
2587 save_Map2d(GLenum target
,
2588 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2589 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2590 const GLdouble
* points
)
2592 GET_CURRENT_CONTEXT(ctx
);
2594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2595 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2597 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2598 vstride
, vorder
, points
);
2600 n
[2].f
= (GLfloat
) u1
;
2601 n
[3].f
= (GLfloat
) u2
;
2602 n
[4].f
= (GLfloat
) v1
;
2603 n
[5].f
= (GLfloat
) v2
;
2604 /* XXX verify these strides are correct */
2605 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2606 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2609 n
[10].data
= (void *) pnts
;
2611 if (ctx
->ExecuteFlag
) {
2612 CALL_Map2d(ctx
->Exec
, (target
,
2613 u1
, u2
, ustride
, uorder
,
2614 v1
, v2
, vstride
, vorder
, points
));
2619 static void GLAPIENTRY
2620 save_Map2f(GLenum target
,
2621 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2622 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2623 const GLfloat
* points
)
2625 GET_CURRENT_CONTEXT(ctx
);
2627 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2628 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2630 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2631 vstride
, vorder
, points
);
2637 /* XXX verify these strides are correct */
2638 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2639 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2642 n
[10].data
= (void *) pnts
;
2644 if (ctx
->ExecuteFlag
) {
2645 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2646 v1
, v2
, vstride
, vorder
, points
));
2651 static void GLAPIENTRY
2652 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2654 GET_CURRENT_CONTEXT(ctx
);
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2657 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2663 if (ctx
->ExecuteFlag
) {
2664 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2669 static void GLAPIENTRY
2670 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2672 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2676 static void GLAPIENTRY
2677 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2678 GLint vn
, GLfloat v1
, GLfloat v2
)
2680 GET_CURRENT_CONTEXT(ctx
);
2682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2683 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2692 if (ctx
->ExecuteFlag
) {
2693 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2699 static void GLAPIENTRY
2700 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2701 GLint vn
, GLdouble v1
, GLdouble v2
)
2703 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2704 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2708 static void GLAPIENTRY
2709 save_MatrixMode(GLenum mode
)
2711 GET_CURRENT_CONTEXT(ctx
);
2713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2714 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2718 if (ctx
->ExecuteFlag
) {
2719 CALL_MatrixMode(ctx
->Exec
, (mode
));
2724 static void GLAPIENTRY
2725 save_MultMatrixf(const GLfloat
* m
)
2727 GET_CURRENT_CONTEXT(ctx
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2733 for (i
= 0; i
< 16; i
++) {
2737 if (ctx
->ExecuteFlag
) {
2738 CALL_MultMatrixf(ctx
->Exec
, (m
));
2743 static void GLAPIENTRY
2744 save_MultMatrixd(const GLdouble
* m
)
2748 for (i
= 0; i
< 16; i
++) {
2749 f
[i
] = (GLfloat
) m
[i
];
2751 save_MultMatrixf(f
);
2755 static void GLAPIENTRY
2756 save_NewList(GLuint name
, GLenum mode
)
2758 GET_CURRENT_CONTEXT(ctx
);
2759 /* It's an error to call this function while building a display list */
2760 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2767 static void GLAPIENTRY
2768 save_Ortho(GLdouble left
, GLdouble right
,
2769 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2771 GET_CURRENT_CONTEXT(ctx
);
2773 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2774 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2776 n
[1].f
= (GLfloat
) left
;
2777 n
[2].f
= (GLfloat
) right
;
2778 n
[3].f
= (GLfloat
) bottom
;
2779 n
[4].f
= (GLfloat
) top
;
2780 n
[5].f
= (GLfloat
) nearval
;
2781 n
[6].f
= (GLfloat
) farval
;
2783 if (ctx
->ExecuteFlag
) {
2784 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2789 static void GLAPIENTRY
2790 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2792 GET_CURRENT_CONTEXT(ctx
);
2794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2795 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
2799 n
[3].data
= memdup(values
, mapsize
* sizeof(GLfloat
));
2801 if (ctx
->ExecuteFlag
) {
2802 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2807 static void GLAPIENTRY
2808 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2810 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2812 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2813 for (i
= 0; i
< mapsize
; i
++) {
2814 fvalues
[i
] = (GLfloat
) values
[i
];
2818 for (i
= 0; i
< mapsize
; i
++) {
2819 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2822 save_PixelMapfv(map
, mapsize
, fvalues
);
2826 static void GLAPIENTRY
2827 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2829 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2831 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2832 for (i
= 0; i
< mapsize
; i
++) {
2833 fvalues
[i
] = (GLfloat
) values
[i
];
2837 for (i
= 0; i
< mapsize
; i
++) {
2838 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2841 save_PixelMapfv(map
, mapsize
, fvalues
);
2845 static void GLAPIENTRY
2846 save_PixelTransferf(GLenum pname
, GLfloat param
)
2848 GET_CURRENT_CONTEXT(ctx
);
2850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2851 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2856 if (ctx
->ExecuteFlag
) {
2857 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2862 static void GLAPIENTRY
2863 save_PixelTransferi(GLenum pname
, GLint param
)
2865 save_PixelTransferf(pname
, (GLfloat
) param
);
2869 static void GLAPIENTRY
2870 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2872 GET_CURRENT_CONTEXT(ctx
);
2874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2875 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2880 if (ctx
->ExecuteFlag
) {
2881 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2886 static void GLAPIENTRY
2887 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2889 GET_CURRENT_CONTEXT(ctx
);
2891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2892 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2899 if (ctx
->ExecuteFlag
) {
2900 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2905 static void GLAPIENTRY
2906 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2910 parray
[1] = parray
[2] = 0.0F
;
2911 save_PointParameterfvEXT(pname
, parray
);
2914 static void GLAPIENTRY
2915 save_PointParameteriNV(GLenum pname
, GLint param
)
2918 parray
[0] = (GLfloat
) param
;
2919 parray
[1] = parray
[2] = 0.0F
;
2920 save_PointParameterfvEXT(pname
, parray
);
2923 static void GLAPIENTRY
2924 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2927 parray
[0] = (GLfloat
) param
[0];
2928 parray
[1] = parray
[2] = 0.0F
;
2929 save_PointParameterfvEXT(pname
, parray
);
2933 static void GLAPIENTRY
2934 save_PointSize(GLfloat size
)
2936 GET_CURRENT_CONTEXT(ctx
);
2938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2939 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
2943 if (ctx
->ExecuteFlag
) {
2944 CALL_PointSize(ctx
->Exec
, (size
));
2949 static void GLAPIENTRY
2950 save_PolygonMode(GLenum face
, GLenum mode
)
2952 GET_CURRENT_CONTEXT(ctx
);
2954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2955 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
2960 if (ctx
->ExecuteFlag
) {
2961 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2966 static void GLAPIENTRY
2967 save_PolygonStipple(const GLubyte
* pattern
)
2969 GET_CURRENT_CONTEXT(ctx
);
2972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2974 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2976 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2977 pattern
, &ctx
->Unpack
);
2979 if (ctx
->ExecuteFlag
) {
2980 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2985 static void GLAPIENTRY
2986 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2988 GET_CURRENT_CONTEXT(ctx
);
2990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2991 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2996 if (ctx
->ExecuteFlag
) {
2997 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3002 static void GLAPIENTRY
3003 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3005 GET_CURRENT_CONTEXT(ctx
);
3006 /* XXX mult by DepthMaxF here??? */
3007 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3011 static void GLAPIENTRY
3012 save_PopAttrib(void)
3014 GET_CURRENT_CONTEXT(ctx
);
3015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3016 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3017 if (ctx
->ExecuteFlag
) {
3018 CALL_PopAttrib(ctx
->Exec
, ());
3023 static void GLAPIENTRY
3024 save_PopMatrix(void)
3026 GET_CURRENT_CONTEXT(ctx
);
3027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3028 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3029 if (ctx
->ExecuteFlag
) {
3030 CALL_PopMatrix(ctx
->Exec
, ());
3035 static void GLAPIENTRY
3038 GET_CURRENT_CONTEXT(ctx
);
3039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3040 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3041 if (ctx
->ExecuteFlag
) {
3042 CALL_PopName(ctx
->Exec
, ());
3047 static void GLAPIENTRY
3048 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3049 const GLclampf
* priorities
)
3051 GET_CURRENT_CONTEXT(ctx
);
3053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3055 for (i
= 0; i
< num
; i
++) {
3057 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3059 n
[1].ui
= textures
[i
];
3060 n
[2].f
= priorities
[i
];
3063 if (ctx
->ExecuteFlag
) {
3064 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3069 static void GLAPIENTRY
3070 save_PushAttrib(GLbitfield mask
)
3072 GET_CURRENT_CONTEXT(ctx
);
3074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3075 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3079 if (ctx
->ExecuteFlag
) {
3080 CALL_PushAttrib(ctx
->Exec
, (mask
));
3085 static void GLAPIENTRY
3086 save_PushMatrix(void)
3088 GET_CURRENT_CONTEXT(ctx
);
3089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3090 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3091 if (ctx
->ExecuteFlag
) {
3092 CALL_PushMatrix(ctx
->Exec
, ());
3097 static void GLAPIENTRY
3098 save_PushName(GLuint name
)
3100 GET_CURRENT_CONTEXT(ctx
);
3102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3103 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3107 if (ctx
->ExecuteFlag
) {
3108 CALL_PushName(ctx
->Exec
, (name
));
3113 static void GLAPIENTRY
3114 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3116 GET_CURRENT_CONTEXT(ctx
);
3118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3119 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3126 if (ctx
->ExecuteFlag
) {
3127 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3131 static void GLAPIENTRY
3132 save_RasterPos2d(GLdouble x
, GLdouble y
)
3134 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3137 static void GLAPIENTRY
3138 save_RasterPos2f(GLfloat x
, GLfloat y
)
3140 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3143 static void GLAPIENTRY
3144 save_RasterPos2i(GLint x
, GLint y
)
3146 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3149 static void GLAPIENTRY
3150 save_RasterPos2s(GLshort x
, GLshort y
)
3152 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3155 static void GLAPIENTRY
3156 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3158 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3161 static void GLAPIENTRY
3162 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3164 save_RasterPos4f(x
, y
, z
, 1.0F
);
3167 static void GLAPIENTRY
3168 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3170 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3173 static void GLAPIENTRY
3174 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3176 save_RasterPos4f(x
, y
, z
, 1.0F
);
3179 static void GLAPIENTRY
3180 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3182 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3185 static void GLAPIENTRY
3186 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3188 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3191 static void GLAPIENTRY
3192 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3194 save_RasterPos4f(x
, y
, z
, w
);
3197 static void GLAPIENTRY
3198 save_RasterPos2dv(const GLdouble
* v
)
3200 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3203 static void GLAPIENTRY
3204 save_RasterPos2fv(const GLfloat
* v
)
3206 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3209 static void GLAPIENTRY
3210 save_RasterPos2iv(const GLint
* v
)
3212 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3215 static void GLAPIENTRY
3216 save_RasterPos2sv(const GLshort
* v
)
3218 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3221 static void GLAPIENTRY
3222 save_RasterPos3dv(const GLdouble
* v
)
3224 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3227 static void GLAPIENTRY
3228 save_RasterPos3fv(const GLfloat
* v
)
3230 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3233 static void GLAPIENTRY
3234 save_RasterPos3iv(const GLint
* v
)
3236 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3239 static void GLAPIENTRY
3240 save_RasterPos3sv(const GLshort
* v
)
3242 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3245 static void GLAPIENTRY
3246 save_RasterPos4dv(const GLdouble
* v
)
3248 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3249 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3252 static void GLAPIENTRY
3253 save_RasterPos4fv(const GLfloat
* v
)
3255 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3258 static void GLAPIENTRY
3259 save_RasterPos4iv(const GLint
* v
)
3261 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3262 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3265 static void GLAPIENTRY
3266 save_RasterPos4sv(const GLshort
* v
)
3268 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3272 static void GLAPIENTRY
3273 save_PassThrough(GLfloat token
)
3275 GET_CURRENT_CONTEXT(ctx
);
3277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3278 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3282 if (ctx
->ExecuteFlag
) {
3283 CALL_PassThrough(ctx
->Exec
, (token
));
3288 static void GLAPIENTRY
3289 save_ReadBuffer(GLenum mode
)
3291 GET_CURRENT_CONTEXT(ctx
);
3293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3294 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3298 if (ctx
->ExecuteFlag
) {
3299 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3304 static void GLAPIENTRY
3305 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3307 GET_CURRENT_CONTEXT(ctx
);
3309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3310 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3317 if (ctx
->ExecuteFlag
) {
3318 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3323 static void GLAPIENTRY
3324 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3326 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3330 static void GLAPIENTRY
3331 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3333 GET_CURRENT_CONTEXT(ctx
);
3335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3336 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3342 if (ctx
->ExecuteFlag
) {
3343 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3348 static void GLAPIENTRY
3349 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3351 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3355 static void GLAPIENTRY
3356 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3358 GET_CURRENT_CONTEXT(ctx
);
3360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3361 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3368 if (ctx
->ExecuteFlag
) {
3369 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3374 static void GLAPIENTRY
3375 save_ShadeModel(GLenum mode
)
3377 GET_CURRENT_CONTEXT(ctx
);
3379 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3381 if (ctx
->ExecuteFlag
) {
3382 CALL_ShadeModel(ctx
->Exec
, (mode
));
3385 /* Don't compile this call if it's a no-op.
3386 * By avoiding this state change we have a better chance of
3387 * coalescing subsequent drawing commands into one batch.
3389 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3392 SAVE_FLUSH_VERTICES(ctx
);
3394 ctx
->ListState
.Current
.ShadeModel
= mode
;
3396 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3403 static void GLAPIENTRY
3404 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3406 GET_CURRENT_CONTEXT(ctx
);
3408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3409 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3415 if (ctx
->ExecuteFlag
) {
3416 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3421 static void GLAPIENTRY
3422 save_StencilMask(GLuint mask
)
3424 GET_CURRENT_CONTEXT(ctx
);
3426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3427 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3431 if (ctx
->ExecuteFlag
) {
3432 CALL_StencilMask(ctx
->Exec
, (mask
));
3437 static void GLAPIENTRY
3438 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3440 GET_CURRENT_CONTEXT(ctx
);
3442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3443 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3449 if (ctx
->ExecuteFlag
) {
3450 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3455 static void GLAPIENTRY
3456 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3458 GET_CURRENT_CONTEXT(ctx
);
3460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3461 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3468 if (ctx
->ExecuteFlag
) {
3469 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3474 static void GLAPIENTRY
3475 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3478 GET_CURRENT_CONTEXT(ctx
);
3480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3482 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3490 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3497 if (ctx
->ExecuteFlag
) {
3498 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3499 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3504 static void GLAPIENTRY
3505 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3507 GET_CURRENT_CONTEXT(ctx
);
3509 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3510 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3515 if (ctx
->ExecuteFlag
) {
3516 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3521 static void GLAPIENTRY
3522 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3524 GET_CURRENT_CONTEXT(ctx
);
3526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3527 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3534 if (ctx
->ExecuteFlag
) {
3535 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3540 static void GLAPIENTRY
3541 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3543 GET_CURRENT_CONTEXT(ctx
);
3545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3546 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3550 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3558 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3561 if (ctx
->ExecuteFlag
) {
3562 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3567 static void GLAPIENTRY
3568 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3571 parray
[0] = (GLfloat
) param
;
3572 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3573 save_TexEnvfv(target
, pname
, parray
);
3577 static void GLAPIENTRY
3578 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3581 p
[0] = (GLfloat
) param
;
3582 p
[1] = p
[2] = p
[3] = 0.0F
;
3583 save_TexEnvfv(target
, pname
, p
);
3587 static void GLAPIENTRY
3588 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3591 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3592 p
[0] = INT_TO_FLOAT(param
[0]);
3593 p
[1] = INT_TO_FLOAT(param
[1]);
3594 p
[2] = INT_TO_FLOAT(param
[2]);
3595 p
[3] = INT_TO_FLOAT(param
[3]);
3598 p
[0] = (GLfloat
) param
[0];
3599 p
[1] = p
[2] = p
[3] = 0.0F
;
3601 save_TexEnvfv(target
, pname
, p
);
3605 static void GLAPIENTRY
3606 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3608 GET_CURRENT_CONTEXT(ctx
);
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3611 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3620 if (ctx
->ExecuteFlag
) {
3621 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3626 static void GLAPIENTRY
3627 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3630 p
[0] = (GLfloat
) params
[0];
3631 p
[1] = (GLfloat
) params
[1];
3632 p
[2] = (GLfloat
) params
[2];
3633 p
[3] = (GLfloat
) params
[3];
3634 save_TexGenfv(coord
, pname
, p
);
3638 static void GLAPIENTRY
3639 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3642 parray
[0] = (GLfloat
) param
;
3643 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3644 save_TexGenfv(coord
, pname
, parray
);
3648 static void GLAPIENTRY
3649 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3652 p
[0] = (GLfloat
) params
[0];
3653 p
[1] = (GLfloat
) params
[1];
3654 p
[2] = (GLfloat
) params
[2];
3655 p
[3] = (GLfloat
) params
[3];
3656 save_TexGenfv(coord
, pname
, p
);
3660 static void GLAPIENTRY
3661 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3665 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3666 save_TexGenfv(coord
, pname
, parray
);
3670 static void GLAPIENTRY
3671 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3675 parray
[1] = parray
[2] = parray
[3] = 0;
3676 save_TexGeniv(coord
, pname
, parray
);
3680 static void GLAPIENTRY
3681 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3683 GET_CURRENT_CONTEXT(ctx
);
3685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3686 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3695 if (ctx
->ExecuteFlag
) {
3696 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3701 static void GLAPIENTRY
3702 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3706 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3707 save_TexParameterfv(target
, pname
, parray
);
3711 static void GLAPIENTRY
3712 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3715 fparam
[0] = (GLfloat
) param
;
3716 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3717 save_TexParameterfv(target
, pname
, fparam
);
3721 static void GLAPIENTRY
3722 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3725 fparam
[0] = (GLfloat
) params
[0];
3726 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3727 save_TexParameterfv(target
, pname
, fparam
);
3731 static void GLAPIENTRY
3732 save_TexImage1D(GLenum target
,
3733 GLint level
, GLint components
,
3734 GLsizei width
, GLint border
,
3735 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3737 GET_CURRENT_CONTEXT(ctx
);
3738 if (target
== GL_PROXY_TEXTURE_1D
) {
3739 /* don't compile, execute immediately */
3740 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3741 border
, format
, type
, pixels
));
3745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3746 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3750 n
[3].i
= components
;
3751 n
[4].i
= (GLint
) width
;
3755 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3756 pixels
, &ctx
->Unpack
);
3758 if (ctx
->ExecuteFlag
) {
3759 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3760 border
, format
, type
, pixels
));
3766 static void GLAPIENTRY
3767 save_TexImage2D(GLenum target
,
3768 GLint level
, GLint components
,
3769 GLsizei width
, GLsizei height
, GLint border
,
3770 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3772 GET_CURRENT_CONTEXT(ctx
);
3773 if (target
== GL_PROXY_TEXTURE_2D
) {
3774 /* don't compile, execute immediately */
3775 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3776 height
, border
, format
, type
, pixels
));
3780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3781 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3785 n
[3].i
= components
;
3786 n
[4].i
= (GLint
) width
;
3787 n
[5].i
= (GLint
) height
;
3791 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3792 pixels
, &ctx
->Unpack
);
3794 if (ctx
->ExecuteFlag
) {
3795 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3796 height
, border
, format
, type
, pixels
));
3802 static void GLAPIENTRY
3803 save_TexImage3D(GLenum target
,
3804 GLint level
, GLint internalFormat
,
3805 GLsizei width
, GLsizei height
, GLsizei depth
,
3807 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3809 GET_CURRENT_CONTEXT(ctx
);
3810 if (target
== GL_PROXY_TEXTURE_3D
) {
3811 /* don't compile, execute immediately */
3812 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3813 height
, depth
, border
, format
, type
,
3818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3819 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3823 n
[3].i
= (GLint
) internalFormat
;
3824 n
[4].i
= (GLint
) width
;
3825 n
[5].i
= (GLint
) height
;
3826 n
[6].i
= (GLint
) depth
;
3830 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3831 pixels
, &ctx
->Unpack
);
3833 if (ctx
->ExecuteFlag
) {
3834 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3835 height
, depth
, border
, format
, type
,
3842 static void GLAPIENTRY
3843 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3844 GLsizei width
, GLenum format
, GLenum type
,
3845 const GLvoid
* pixels
)
3847 GET_CURRENT_CONTEXT(ctx
);
3850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3852 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3857 n
[4].i
= (GLint
) width
;
3860 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3861 pixels
, &ctx
->Unpack
);
3863 if (ctx
->ExecuteFlag
) {
3864 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3865 format
, type
, pixels
));
3870 static void GLAPIENTRY
3871 save_TexSubImage2D(GLenum target
, GLint level
,
3872 GLint xoffset
, GLint yoffset
,
3873 GLsizei width
, GLsizei height
,
3874 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3876 GET_CURRENT_CONTEXT(ctx
);
3879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3881 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3887 n
[5].i
= (GLint
) width
;
3888 n
[6].i
= (GLint
) height
;
3891 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3892 pixels
, &ctx
->Unpack
);
3894 if (ctx
->ExecuteFlag
) {
3895 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3896 width
, height
, format
, type
, pixels
));
3901 static void GLAPIENTRY
3902 save_TexSubImage3D(GLenum target
, GLint level
,
3903 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3904 GLsizei width
, GLsizei height
, GLsizei depth
,
3905 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3907 GET_CURRENT_CONTEXT(ctx
);
3910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3912 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3919 n
[6].i
= (GLint
) width
;
3920 n
[7].i
= (GLint
) height
;
3921 n
[8].i
= (GLint
) depth
;
3924 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3925 pixels
, &ctx
->Unpack
);
3927 if (ctx
->ExecuteFlag
) {
3928 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3929 xoffset
, yoffset
, zoffset
,
3930 width
, height
, depth
, format
, type
,
3936 static void GLAPIENTRY
3937 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3939 GET_CURRENT_CONTEXT(ctx
);
3941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3942 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
3948 if (ctx
->ExecuteFlag
) {
3949 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3954 static void GLAPIENTRY
3955 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3957 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3962 static void GLAPIENTRY
3963 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3965 GET_CURRENT_CONTEXT(ctx
);
3967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3968 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
3972 n
[3].i
= (GLint
) width
;
3973 n
[4].i
= (GLint
) height
;
3975 if (ctx
->ExecuteFlag
) {
3976 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3981 static void GLAPIENTRY
3982 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3984 GET_CURRENT_CONTEXT(ctx
);
3986 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3987 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
3994 if (ctx
->ExecuteFlag
) {
3995 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3999 static void GLAPIENTRY
4000 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4002 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4005 static void GLAPIENTRY
4006 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4008 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4011 static void GLAPIENTRY
4012 save_WindowPos2iMESA(GLint x
, GLint y
)
4014 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4017 static void GLAPIENTRY
4018 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4020 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4023 static void GLAPIENTRY
4024 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4026 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4029 static void GLAPIENTRY
4030 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4032 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4035 static void GLAPIENTRY
4036 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4038 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4041 static void GLAPIENTRY
4042 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4044 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4047 static void GLAPIENTRY
4048 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4050 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4053 static void GLAPIENTRY
4054 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4056 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4059 static void GLAPIENTRY
4060 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4062 save_WindowPos4fMESA(x
, y
, z
, w
);
4065 static void GLAPIENTRY
4066 save_WindowPos2dvMESA(const GLdouble
* v
)
4068 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4071 static void GLAPIENTRY
4072 save_WindowPos2fvMESA(const GLfloat
* v
)
4074 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4077 static void GLAPIENTRY
4078 save_WindowPos2ivMESA(const GLint
* v
)
4080 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4083 static void GLAPIENTRY
4084 save_WindowPos2svMESA(const GLshort
* v
)
4086 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4089 static void GLAPIENTRY
4090 save_WindowPos3dvMESA(const GLdouble
* v
)
4092 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4095 static void GLAPIENTRY
4096 save_WindowPos3fvMESA(const GLfloat
* v
)
4098 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4101 static void GLAPIENTRY
4102 save_WindowPos3ivMESA(const GLint
* v
)
4104 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4107 static void GLAPIENTRY
4108 save_WindowPos3svMESA(const GLshort
* v
)
4110 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4113 static void GLAPIENTRY
4114 save_WindowPos4dvMESA(const GLdouble
* v
)
4116 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4117 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4120 static void GLAPIENTRY
4121 save_WindowPos4fvMESA(const GLfloat
* v
)
4123 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4126 static void GLAPIENTRY
4127 save_WindowPos4ivMESA(const GLint
* v
)
4129 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4130 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4133 static void GLAPIENTRY
4134 save_WindowPos4svMESA(const GLshort
* v
)
4136 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4141 /* GL_ARB_multitexture */
4142 static void GLAPIENTRY
4143 save_ActiveTextureARB(GLenum target
)
4145 GET_CURRENT_CONTEXT(ctx
);
4147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4148 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4152 if (ctx
->ExecuteFlag
) {
4153 CALL_ActiveTexture(ctx
->Exec
, (target
));
4158 /* GL_ARB_transpose_matrix */
4160 static void GLAPIENTRY
4161 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4164 _math_transposefd(tm
, m
);
4165 save_LoadMatrixf(tm
);
4169 static void GLAPIENTRY
4170 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4173 _math_transposef(tm
, m
);
4174 save_LoadMatrixf(tm
);
4178 static void GLAPIENTRY
4179 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4182 _math_transposefd(tm
, m
);
4183 save_MultMatrixf(tm
);
4187 static void GLAPIENTRY
4188 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4191 _math_transposef(tm
, m
);
4192 save_MultMatrixf(tm
);
4195 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4197 GET_CURRENT_CONTEXT(ctx
);
4203 image
= malloc(size
);
4205 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4208 memcpy(image
, data
, size
);
4214 /* GL_ARB_texture_compression */
4215 static void GLAPIENTRY
4216 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4217 GLenum internalFormat
, GLsizei width
,
4218 GLint border
, GLsizei imageSize
,
4219 const GLvoid
* data
)
4221 GET_CURRENT_CONTEXT(ctx
);
4222 if (target
== GL_PROXY_TEXTURE_1D
) {
4223 /* don't compile, execute immediately */
4224 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4225 width
, border
, imageSize
,
4230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4232 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4236 n
[3].e
= internalFormat
;
4237 n
[4].i
= (GLint
) width
;
4240 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4242 if (ctx
->ExecuteFlag
) {
4243 CALL_CompressedTexImage1D(ctx
->Exec
,
4244 (target
, level
, internalFormat
, width
,
4245 border
, imageSize
, data
));
4251 static void GLAPIENTRY
4252 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4253 GLenum internalFormat
, GLsizei width
,
4254 GLsizei height
, GLint border
, GLsizei imageSize
,
4255 const GLvoid
* data
)
4257 GET_CURRENT_CONTEXT(ctx
);
4258 if (target
== GL_PROXY_TEXTURE_2D
) {
4259 /* don't compile, execute immediately */
4260 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4261 width
, height
, border
,
4266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4268 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4272 n
[3].e
= internalFormat
;
4273 n
[4].i
= (GLint
) width
;
4274 n
[5].i
= (GLint
) height
;
4277 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4279 if (ctx
->ExecuteFlag
) {
4280 CALL_CompressedTexImage2D(ctx
->Exec
,
4281 (target
, level
, internalFormat
, width
,
4282 height
, border
, imageSize
, data
));
4288 static void GLAPIENTRY
4289 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4290 GLenum internalFormat
, GLsizei width
,
4291 GLsizei height
, GLsizei depth
, GLint border
,
4292 GLsizei imageSize
, const GLvoid
* data
)
4294 GET_CURRENT_CONTEXT(ctx
);
4295 if (target
== GL_PROXY_TEXTURE_3D
) {
4296 /* don't compile, execute immediately */
4297 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4298 width
, height
, depth
, border
,
4303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4305 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4309 n
[3].e
= internalFormat
;
4310 n
[4].i
= (GLint
) width
;
4311 n
[5].i
= (GLint
) height
;
4312 n
[6].i
= (GLint
) depth
;
4315 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4317 if (ctx
->ExecuteFlag
) {
4318 CALL_CompressedTexImage3D(ctx
->Exec
,
4319 (target
, level
, internalFormat
, width
,
4320 height
, depth
, border
, imageSize
,
4327 static void GLAPIENTRY
4328 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4329 GLsizei width
, GLenum format
,
4330 GLsizei imageSize
, const GLvoid
* data
)
4333 GET_CURRENT_CONTEXT(ctx
);
4334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4336 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4341 n
[4].i
= (GLint
) width
;
4344 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4346 if (ctx
->ExecuteFlag
) {
4347 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4348 width
, format
, imageSize
,
4354 static void GLAPIENTRY
4355 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4356 GLint yoffset
, GLsizei width
, GLsizei height
,
4357 GLenum format
, GLsizei imageSize
,
4358 const GLvoid
* data
)
4361 GET_CURRENT_CONTEXT(ctx
);
4362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4364 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4370 n
[5].i
= (GLint
) width
;
4371 n
[6].i
= (GLint
) height
;
4374 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4376 if (ctx
->ExecuteFlag
) {
4377 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4378 (target
, level
, xoffset
, yoffset
, width
,
4379 height
, format
, imageSize
, data
));
4384 static void GLAPIENTRY
4385 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4386 GLint yoffset
, GLint zoffset
, GLsizei width
,
4387 GLsizei height
, GLsizei depth
, GLenum format
,
4388 GLsizei imageSize
, const GLvoid
* data
)
4391 GET_CURRENT_CONTEXT(ctx
);
4392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4394 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4401 n
[6].i
= (GLint
) width
;
4402 n
[7].i
= (GLint
) height
;
4403 n
[8].i
= (GLint
) depth
;
4405 n
[10].i
= imageSize
;
4406 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4408 if (ctx
->ExecuteFlag
) {
4409 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4410 (target
, level
, xoffset
, yoffset
,
4411 zoffset
, width
, height
, depth
, format
,
4417 /* GL_ARB_multisample */
4418 static void GLAPIENTRY
4419 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4421 GET_CURRENT_CONTEXT(ctx
);
4423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4424 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4429 if (ctx
->ExecuteFlag
) {
4430 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4436 * GL_NV_fragment_program
4438 static void GLAPIENTRY
4439 save_BindProgramNV(GLenum target
, GLuint id
)
4441 GET_CURRENT_CONTEXT(ctx
);
4443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4444 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4449 if (ctx
->ExecuteFlag
) {
4450 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4454 static void GLAPIENTRY
4455 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4456 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4458 GET_CURRENT_CONTEXT(ctx
);
4460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4461 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4470 if (ctx
->ExecuteFlag
) {
4471 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4476 static void GLAPIENTRY
4477 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4478 const GLfloat
*params
)
4480 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4481 params
[2], params
[3]);
4485 static void GLAPIENTRY
4486 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4487 const GLfloat
* params
)
4489 GET_CURRENT_CONTEXT(ctx
);
4491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4495 const GLfloat
* p
= params
;
4497 for (i
= 0 ; i
< count
; i
++) {
4498 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4511 if (ctx
->ExecuteFlag
) {
4512 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4517 static void GLAPIENTRY
4518 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4519 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4521 save_ProgramEnvParameter4fARB(target
, index
,
4523 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4527 static void GLAPIENTRY
4528 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4529 const GLdouble
*params
)
4531 save_ProgramEnvParameter4fARB(target
, index
,
4532 (GLfloat
) params
[0],
4533 (GLfloat
) params
[1],
4534 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4538 static void GLAPIENTRY
4539 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4540 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4542 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4545 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4554 if (ctx
->ExecuteFlag
) {
4555 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4560 static void GLAPIENTRY
4561 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4562 const GLfloat
*params
)
4564 GET_CURRENT_CONTEXT(ctx
);
4566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4567 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4576 if (ctx
->ExecuteFlag
) {
4577 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4582 static void GLAPIENTRY
4583 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4584 const GLfloat
*params
)
4586 GET_CURRENT_CONTEXT(ctx
);
4588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4592 const GLfloat
* p
= params
;
4594 for (i
= 0 ; i
< count
; i
++) {
4595 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4608 if (ctx
->ExecuteFlag
) {
4609 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4614 static void GLAPIENTRY
4615 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4616 GLdouble x
, GLdouble y
,
4617 GLdouble z
, GLdouble w
)
4619 GET_CURRENT_CONTEXT(ctx
);
4621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4622 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4626 n
[3].f
= (GLfloat
) x
;
4627 n
[4].f
= (GLfloat
) y
;
4628 n
[5].f
= (GLfloat
) z
;
4629 n
[6].f
= (GLfloat
) w
;
4631 if (ctx
->ExecuteFlag
) {
4632 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4637 static void GLAPIENTRY
4638 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4639 const GLdouble
*params
)
4641 GET_CURRENT_CONTEXT(ctx
);
4643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4644 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4648 n
[3].f
= (GLfloat
) params
[0];
4649 n
[4].f
= (GLfloat
) params
[1];
4650 n
[5].f
= (GLfloat
) params
[2];
4651 n
[6].f
= (GLfloat
) params
[3];
4653 if (ctx
->ExecuteFlag
) {
4654 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4659 /* GL_EXT_stencil_two_side */
4660 static void GLAPIENTRY
4661 save_ActiveStencilFaceEXT(GLenum face
)
4663 GET_CURRENT_CONTEXT(ctx
);
4665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4666 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4670 if (ctx
->ExecuteFlag
) {
4671 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4676 /* GL_EXT_depth_bounds_test */
4677 static void GLAPIENTRY
4678 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4680 GET_CURRENT_CONTEXT(ctx
);
4682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4683 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4685 n
[1].f
= (GLfloat
) zmin
;
4686 n
[2].f
= (GLfloat
) zmax
;
4688 if (ctx
->ExecuteFlag
) {
4689 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4695 static void GLAPIENTRY
4696 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4697 const GLvoid
* string
)
4699 GET_CURRENT_CONTEXT(ctx
);
4702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4704 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4706 GLubyte
*programCopy
= malloc(len
);
4708 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4711 memcpy(programCopy
, string
, len
);
4715 n
[4].data
= programCopy
;
4717 if (ctx
->ExecuteFlag
) {
4718 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4723 static void GLAPIENTRY
4724 save_BeginQueryARB(GLenum target
, GLuint id
)
4726 GET_CURRENT_CONTEXT(ctx
);
4728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4729 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4734 if (ctx
->ExecuteFlag
) {
4735 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4739 static void GLAPIENTRY
4740 save_EndQueryARB(GLenum target
)
4742 GET_CURRENT_CONTEXT(ctx
);
4744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4745 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4749 if (ctx
->ExecuteFlag
) {
4750 CALL_EndQuery(ctx
->Exec
, (target
));
4754 static void GLAPIENTRY
4755 save_QueryCounter(GLuint id
, GLenum target
)
4757 GET_CURRENT_CONTEXT(ctx
);
4759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4760 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4765 if (ctx
->ExecuteFlag
) {
4766 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4770 static void GLAPIENTRY
4771 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4773 GET_CURRENT_CONTEXT(ctx
);
4775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4776 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4782 if (ctx
->ExecuteFlag
) {
4783 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4787 static void GLAPIENTRY
4788 save_EndQueryIndexed(GLenum target
, GLuint index
)
4790 GET_CURRENT_CONTEXT(ctx
);
4792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4793 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4798 if (ctx
->ExecuteFlag
) {
4799 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4804 static void GLAPIENTRY
4805 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4807 GET_CURRENT_CONTEXT(ctx
);
4809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4810 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4814 if (count
> MAX_DRAW_BUFFERS
)
4815 count
= MAX_DRAW_BUFFERS
;
4816 for (i
= 0; i
< count
; i
++) {
4817 n
[2 + i
].e
= buffers
[i
];
4820 if (ctx
->ExecuteFlag
) {
4821 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4825 static void GLAPIENTRY
4826 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4828 GET_CURRENT_CONTEXT(ctx
);
4831 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4839 if (ctx
->ExecuteFlag
) {
4840 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4844 static void GLAPIENTRY
4845 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4848 p
[0] = INT_TO_FLOAT(param
[0]);
4849 p
[1] = INT_TO_FLOAT(param
[1]);
4850 p
[2] = INT_TO_FLOAT(param
[2]);
4851 p
[3] = INT_TO_FLOAT(param
[3]);
4852 save_TexBumpParameterfvATI(pname
, p
);
4855 static void GLAPIENTRY
4856 save_BindFragmentShaderATI(GLuint id
)
4858 GET_CURRENT_CONTEXT(ctx
);
4861 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4865 if (ctx
->ExecuteFlag
) {
4866 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4870 static void GLAPIENTRY
4871 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4873 GET_CURRENT_CONTEXT(ctx
);
4876 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4884 if (ctx
->ExecuteFlag
) {
4885 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4889 static void GLAPIENTRY
4890 save_Attr1fNV(GLenum attr
, GLfloat x
)
4892 GET_CURRENT_CONTEXT(ctx
);
4894 SAVE_FLUSH_VERTICES(ctx
);
4895 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4901 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4902 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4903 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4905 if (ctx
->ExecuteFlag
) {
4906 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4910 static void GLAPIENTRY
4911 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4913 GET_CURRENT_CONTEXT(ctx
);
4915 SAVE_FLUSH_VERTICES(ctx
);
4916 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
4923 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4924 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4925 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4927 if (ctx
->ExecuteFlag
) {
4928 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4932 static void GLAPIENTRY
4933 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4935 GET_CURRENT_CONTEXT(ctx
);
4937 SAVE_FLUSH_VERTICES(ctx
);
4938 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
4946 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4947 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4948 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4950 if (ctx
->ExecuteFlag
) {
4951 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4955 static void GLAPIENTRY
4956 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4958 GET_CURRENT_CONTEXT(ctx
);
4960 SAVE_FLUSH_VERTICES(ctx
);
4961 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
4970 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4971 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4972 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4974 if (ctx
->ExecuteFlag
) {
4975 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4980 static void GLAPIENTRY
4981 save_Attr1fARB(GLenum attr
, GLfloat x
)
4983 GET_CURRENT_CONTEXT(ctx
);
4985 SAVE_FLUSH_VERTICES(ctx
);
4986 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4992 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4993 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4994 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4996 if (ctx
->ExecuteFlag
) {
4997 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5001 static void GLAPIENTRY
5002 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5004 GET_CURRENT_CONTEXT(ctx
);
5006 SAVE_FLUSH_VERTICES(ctx
);
5007 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5014 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5015 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5016 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5018 if (ctx
->ExecuteFlag
) {
5019 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5023 static void GLAPIENTRY
5024 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5026 GET_CURRENT_CONTEXT(ctx
);
5028 SAVE_FLUSH_VERTICES(ctx
);
5029 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5037 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5038 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5039 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5041 if (ctx
->ExecuteFlag
) {
5042 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5046 static void GLAPIENTRY
5047 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5049 GET_CURRENT_CONTEXT(ctx
);
5051 SAVE_FLUSH_VERTICES(ctx
);
5052 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5061 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5062 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5063 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5065 if (ctx
->ExecuteFlag
) {
5066 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5071 static void GLAPIENTRY
5072 save_EvalCoord1f(GLfloat x
)
5074 GET_CURRENT_CONTEXT(ctx
);
5076 SAVE_FLUSH_VERTICES(ctx
);
5077 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5081 if (ctx
->ExecuteFlag
) {
5082 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5086 static void GLAPIENTRY
5087 save_EvalCoord1fv(const GLfloat
* v
)
5089 save_EvalCoord1f(v
[0]);
5092 static void GLAPIENTRY
5093 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5095 GET_CURRENT_CONTEXT(ctx
);
5097 SAVE_FLUSH_VERTICES(ctx
);
5098 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5103 if (ctx
->ExecuteFlag
) {
5104 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5108 static void GLAPIENTRY
5109 save_EvalCoord2fv(const GLfloat
* v
)
5111 save_EvalCoord2f(v
[0], v
[1]);
5115 static void GLAPIENTRY
5116 save_EvalPoint1(GLint x
)
5118 GET_CURRENT_CONTEXT(ctx
);
5120 SAVE_FLUSH_VERTICES(ctx
);
5121 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5125 if (ctx
->ExecuteFlag
) {
5126 CALL_EvalPoint1(ctx
->Exec
, (x
));
5130 static void GLAPIENTRY
5131 save_EvalPoint2(GLint x
, GLint y
)
5133 GET_CURRENT_CONTEXT(ctx
);
5135 SAVE_FLUSH_VERTICES(ctx
);
5136 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5141 if (ctx
->ExecuteFlag
) {
5142 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5146 static void GLAPIENTRY
5147 save_Indexf(GLfloat x
)
5149 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5152 static void GLAPIENTRY
5153 save_Indexfv(const GLfloat
* v
)
5155 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5158 static void GLAPIENTRY
5159 save_EdgeFlag(GLboolean x
)
5161 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5166 * Compare 'count' elements of vectors 'a' and 'b'.
5167 * \return GL_TRUE if equal, GL_FALSE if different.
5169 static inline GLboolean
5170 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5172 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5177 * This glMaterial function is used for glMaterial calls that are outside
5178 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5180 static void GLAPIENTRY
5181 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5183 GET_CURRENT_CONTEXT(ctx
);
5191 case GL_FRONT_AND_BACK
:
5194 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5203 case GL_AMBIENT_AND_DIFFUSE
:
5209 case GL_COLOR_INDEXES
:
5213 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5217 if (ctx
->ExecuteFlag
) {
5218 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5221 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5223 /* Try to eliminate redundant statechanges. Because it is legal to
5224 * call glMaterial even inside begin/end calls, don't need to worry
5225 * about ctx->Driver.CurrentSavePrimitive here.
5227 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5228 if (bitmask
& (1 << i
)) {
5229 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5230 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5231 /* no change in material value */
5232 bitmask
&= ~(1 << i
);
5235 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5236 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5241 /* If this call has no effect, return early */
5245 SAVE_FLUSH_VERTICES(ctx
);
5247 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5251 for (i
= 0; i
< args
; i
++)
5252 n
[3 + i
].f
= param
[i
];
5256 static void GLAPIENTRY
5257 save_Begin(GLenum mode
)
5259 GET_CURRENT_CONTEXT(ctx
);
5261 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5262 /* compile this error into the display list */
5263 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5265 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5266 /* compile this error into the display list */
5267 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5272 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5274 /* Give the driver an opportunity to hook in an optimized
5275 * display list compiler.
5277 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5280 SAVE_FLUSH_VERTICES(ctx
);
5281 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5286 if (ctx
->ExecuteFlag
) {
5287 CALL_Begin(ctx
->Exec
, (mode
));
5292 static void GLAPIENTRY
5295 GET_CURRENT_CONTEXT(ctx
);
5296 SAVE_FLUSH_VERTICES(ctx
);
5297 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5298 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5299 if (ctx
->ExecuteFlag
) {
5300 CALL_End(ctx
->Exec
, ());
5304 static void GLAPIENTRY
5305 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5307 GET_CURRENT_CONTEXT(ctx
);
5309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5310 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5317 if (ctx
->ExecuteFlag
) {
5318 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5323 static void GLAPIENTRY
5324 save_Vertex2f(GLfloat x
, GLfloat y
)
5326 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5329 static void GLAPIENTRY
5330 save_Vertex2fv(const GLfloat
* v
)
5332 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5335 static void GLAPIENTRY
5336 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5338 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5341 static void GLAPIENTRY
5342 save_Vertex3fv(const GLfloat
* v
)
5344 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5347 static void GLAPIENTRY
5348 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5350 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5353 static void GLAPIENTRY
5354 save_Vertex4fv(const GLfloat
* v
)
5356 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5359 static void GLAPIENTRY
5360 save_TexCoord1f(GLfloat x
)
5362 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5365 static void GLAPIENTRY
5366 save_TexCoord1fv(const GLfloat
* v
)
5368 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5371 static void GLAPIENTRY
5372 save_TexCoord2f(GLfloat x
, GLfloat y
)
5374 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5377 static void GLAPIENTRY
5378 save_TexCoord2fv(const GLfloat
* v
)
5380 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5383 static void GLAPIENTRY
5384 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5386 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5389 static void GLAPIENTRY
5390 save_TexCoord3fv(const GLfloat
* v
)
5392 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5395 static void GLAPIENTRY
5396 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5398 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5401 static void GLAPIENTRY
5402 save_TexCoord4fv(const GLfloat
* v
)
5404 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5407 static void GLAPIENTRY
5408 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5410 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5413 static void GLAPIENTRY
5414 save_Normal3fv(const GLfloat
* v
)
5416 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5419 static void GLAPIENTRY
5420 save_FogCoordfEXT(GLfloat x
)
5422 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5425 static void GLAPIENTRY
5426 save_FogCoordfvEXT(const GLfloat
* v
)
5428 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5431 static void GLAPIENTRY
5432 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5434 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5437 static void GLAPIENTRY
5438 save_Color3fv(const GLfloat
* v
)
5440 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5443 static void GLAPIENTRY
5444 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5446 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5449 static void GLAPIENTRY
5450 save_Color4fv(const GLfloat
* v
)
5452 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5455 static void GLAPIENTRY
5456 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5458 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5461 static void GLAPIENTRY
5462 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5464 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5468 /* Just call the respective ATTR for texcoord
5470 static void GLAPIENTRY
5471 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5473 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5474 save_Attr1fNV(attr
, x
);
5477 static void GLAPIENTRY
5478 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5480 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5481 save_Attr1fNV(attr
, v
[0]);
5484 static void GLAPIENTRY
5485 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5487 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5488 save_Attr2fNV(attr
, x
, y
);
5491 static void GLAPIENTRY
5492 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5494 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5495 save_Attr2fNV(attr
, v
[0], v
[1]);
5498 static void GLAPIENTRY
5499 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5501 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5502 save_Attr3fNV(attr
, x
, y
, z
);
5505 static void GLAPIENTRY
5506 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5508 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5509 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5512 static void GLAPIENTRY
5513 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5514 GLfloat z
, GLfloat w
)
5516 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5517 save_Attr4fNV(attr
, x
, y
, z
, w
);
5520 static void GLAPIENTRY
5521 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5523 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5524 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5529 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5535 GET_CURRENT_CONTEXT(ctx
);
5536 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5541 static void GLAPIENTRY
5542 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5544 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5545 save_Attr1fARB(index
, x
);
5550 static void GLAPIENTRY
5551 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5553 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5554 save_Attr1fARB(index
, v
[0]);
5559 static void GLAPIENTRY
5560 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5562 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5563 save_Attr2fARB(index
, x
, y
);
5568 static void GLAPIENTRY
5569 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5571 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5572 save_Attr2fARB(index
, v
[0], v
[1]);
5577 static void GLAPIENTRY
5578 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5580 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5581 save_Attr3fARB(index
, x
, y
, z
);
5586 static void GLAPIENTRY
5587 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5589 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5590 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5595 static void GLAPIENTRY
5596 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5599 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5600 save_Attr4fARB(index
, x
, y
, z
, w
);
5605 static void GLAPIENTRY
5606 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5608 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5609 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5614 static void GLAPIENTRY
5615 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5616 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5617 GLbitfield mask
, GLenum filter
)
5619 GET_CURRENT_CONTEXT(ctx
);
5621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5622 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5635 if (ctx
->ExecuteFlag
) {
5636 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5637 dstX0
, dstY0
, dstX1
, dstY1
,
5643 /** GL_EXT_provoking_vertex */
5644 static void GLAPIENTRY
5645 save_ProvokingVertexEXT(GLenum mode
)
5647 GET_CURRENT_CONTEXT(ctx
);
5649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5650 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5654 if (ctx
->ExecuteFlag
) {
5655 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5656 _mesa_ProvokingVertex(mode
);
5661 /** GL_EXT_transform_feedback */
5662 static void GLAPIENTRY
5663 save_BeginTransformFeedback(GLenum mode
)
5665 GET_CURRENT_CONTEXT(ctx
);
5667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5668 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5672 if (ctx
->ExecuteFlag
) {
5673 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5678 /** GL_EXT_transform_feedback */
5679 static void GLAPIENTRY
5680 save_EndTransformFeedback(void)
5682 GET_CURRENT_CONTEXT(ctx
);
5683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5684 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5685 if (ctx
->ExecuteFlag
) {
5686 CALL_EndTransformFeedback(ctx
->Exec
, ());
5690 static void GLAPIENTRY
5691 save_BindTransformFeedback(GLenum target
, GLuint name
)
5693 GET_CURRENT_CONTEXT(ctx
);
5695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5696 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5701 if (ctx
->ExecuteFlag
) {
5702 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5706 static void GLAPIENTRY
5707 save_PauseTransformFeedback(void)
5709 GET_CURRENT_CONTEXT(ctx
);
5710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5711 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5712 if (ctx
->ExecuteFlag
) {
5713 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5717 static void GLAPIENTRY
5718 save_ResumeTransformFeedback(void)
5720 GET_CURRENT_CONTEXT(ctx
);
5721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5722 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5723 if (ctx
->ExecuteFlag
) {
5724 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5728 static void GLAPIENTRY
5729 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5731 GET_CURRENT_CONTEXT(ctx
);
5733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5734 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5739 if (ctx
->ExecuteFlag
) {
5740 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5744 static void GLAPIENTRY
5745 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5747 GET_CURRENT_CONTEXT(ctx
);
5749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5750 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5756 if (ctx
->ExecuteFlag
) {
5757 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5761 static void GLAPIENTRY
5762 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5765 GET_CURRENT_CONTEXT(ctx
);
5767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5768 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5772 n
[3].si
= primcount
;
5774 if (ctx
->ExecuteFlag
) {
5775 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5779 static void GLAPIENTRY
5780 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5781 GLuint stream
, GLsizei primcount
)
5783 GET_CURRENT_CONTEXT(ctx
);
5785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5786 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5791 n
[4].si
= primcount
;
5793 if (ctx
->ExecuteFlag
) {
5794 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5799 /* aka UseProgram() */
5800 static void GLAPIENTRY
5801 save_UseProgramObjectARB(GLhandleARB program
)
5803 GET_CURRENT_CONTEXT(ctx
);
5805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5806 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5810 if (ctx
->ExecuteFlag
) {
5811 CALL_UseProgram(ctx
->Exec
, (program
));
5816 static void GLAPIENTRY
5817 save_Uniform1fARB(GLint location
, GLfloat x
)
5819 GET_CURRENT_CONTEXT(ctx
);
5821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5822 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5827 if (ctx
->ExecuteFlag
) {
5828 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5833 static void GLAPIENTRY
5834 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5836 GET_CURRENT_CONTEXT(ctx
);
5838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5839 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5845 if (ctx
->ExecuteFlag
) {
5846 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5851 static void GLAPIENTRY
5852 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5854 GET_CURRENT_CONTEXT(ctx
);
5856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5857 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5864 if (ctx
->ExecuteFlag
) {
5865 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5870 static void GLAPIENTRY
5871 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5873 GET_CURRENT_CONTEXT(ctx
);
5875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5876 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5884 if (ctx
->ExecuteFlag
) {
5885 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5890 static void GLAPIENTRY
5891 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5893 GET_CURRENT_CONTEXT(ctx
);
5895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5896 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
5900 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
5902 if (ctx
->ExecuteFlag
) {
5903 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
5907 static void GLAPIENTRY
5908 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5910 GET_CURRENT_CONTEXT(ctx
);
5912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5913 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
5917 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
5919 if (ctx
->ExecuteFlag
) {
5920 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
5924 static void GLAPIENTRY
5925 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5927 GET_CURRENT_CONTEXT(ctx
);
5929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5930 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
5934 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
5936 if (ctx
->ExecuteFlag
) {
5937 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
5941 static void GLAPIENTRY
5942 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5944 GET_CURRENT_CONTEXT(ctx
);
5946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5947 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
5951 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
5953 if (ctx
->ExecuteFlag
) {
5954 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
5959 static void GLAPIENTRY
5960 save_Uniform1iARB(GLint location
, GLint x
)
5962 GET_CURRENT_CONTEXT(ctx
);
5964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5965 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
5970 if (ctx
->ExecuteFlag
) {
5971 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
5975 static void GLAPIENTRY
5976 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
5978 GET_CURRENT_CONTEXT(ctx
);
5980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5981 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
5987 if (ctx
->ExecuteFlag
) {
5988 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
5992 static void GLAPIENTRY
5993 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
5995 GET_CURRENT_CONTEXT(ctx
);
5997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5998 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6005 if (ctx
->ExecuteFlag
) {
6006 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6010 static void GLAPIENTRY
6011 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6013 GET_CURRENT_CONTEXT(ctx
);
6015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6016 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6024 if (ctx
->ExecuteFlag
) {
6025 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6031 static void GLAPIENTRY
6032 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6034 GET_CURRENT_CONTEXT(ctx
);
6036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6037 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6041 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6043 if (ctx
->ExecuteFlag
) {
6044 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6048 static void GLAPIENTRY
6049 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6051 GET_CURRENT_CONTEXT(ctx
);
6053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6054 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6058 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6060 if (ctx
->ExecuteFlag
) {
6061 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6065 static void GLAPIENTRY
6066 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6068 GET_CURRENT_CONTEXT(ctx
);
6070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6071 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6075 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6077 if (ctx
->ExecuteFlag
) {
6078 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6082 static void GLAPIENTRY
6083 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6085 GET_CURRENT_CONTEXT(ctx
);
6087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6088 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6092 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6094 if (ctx
->ExecuteFlag
) {
6095 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6101 static void GLAPIENTRY
6102 save_Uniform1ui(GLint location
, GLuint x
)
6104 GET_CURRENT_CONTEXT(ctx
);
6106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6107 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6112 if (ctx
->ExecuteFlag
) {
6113 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6117 static void GLAPIENTRY
6118 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6120 GET_CURRENT_CONTEXT(ctx
);
6122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6123 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6129 if (ctx
->ExecuteFlag
) {
6130 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6134 static void GLAPIENTRY
6135 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6137 GET_CURRENT_CONTEXT(ctx
);
6139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6140 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6147 if (ctx
->ExecuteFlag
) {
6148 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6152 static void GLAPIENTRY
6153 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6155 GET_CURRENT_CONTEXT(ctx
);
6157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6158 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6166 if (ctx
->ExecuteFlag
) {
6167 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6173 static void GLAPIENTRY
6174 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6176 GET_CURRENT_CONTEXT(ctx
);
6178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6179 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6183 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6185 if (ctx
->ExecuteFlag
) {
6186 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6190 static void GLAPIENTRY
6191 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6193 GET_CURRENT_CONTEXT(ctx
);
6195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6196 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6200 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6202 if (ctx
->ExecuteFlag
) {
6203 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6207 static void GLAPIENTRY
6208 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6210 GET_CURRENT_CONTEXT(ctx
);
6212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6213 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6217 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6219 if (ctx
->ExecuteFlag
) {
6220 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6224 static void GLAPIENTRY
6225 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6227 GET_CURRENT_CONTEXT(ctx
);
6229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6230 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6234 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6236 if (ctx
->ExecuteFlag
) {
6237 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6243 static void GLAPIENTRY
6244 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6247 GET_CURRENT_CONTEXT(ctx
);
6249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6250 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6255 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6257 if (ctx
->ExecuteFlag
) {
6258 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6262 static void GLAPIENTRY
6263 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6266 GET_CURRENT_CONTEXT(ctx
);
6268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6269 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6274 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6276 if (ctx
->ExecuteFlag
) {
6277 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6281 static void GLAPIENTRY
6282 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6285 GET_CURRENT_CONTEXT(ctx
);
6287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6288 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6293 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6295 if (ctx
->ExecuteFlag
) {
6296 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6301 static void GLAPIENTRY
6302 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6305 GET_CURRENT_CONTEXT(ctx
);
6307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6308 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6313 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6315 if (ctx
->ExecuteFlag
) {
6316 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6320 static void GLAPIENTRY
6321 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6324 GET_CURRENT_CONTEXT(ctx
);
6326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6327 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6332 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6334 if (ctx
->ExecuteFlag
) {
6335 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6340 static void GLAPIENTRY
6341 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6344 GET_CURRENT_CONTEXT(ctx
);
6346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6347 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6352 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6354 if (ctx
->ExecuteFlag
) {
6355 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6359 static void GLAPIENTRY
6360 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6363 GET_CURRENT_CONTEXT(ctx
);
6365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6366 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6371 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6373 if (ctx
->ExecuteFlag
) {
6374 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6379 static void GLAPIENTRY
6380 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6383 GET_CURRENT_CONTEXT(ctx
);
6385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6386 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6391 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6393 if (ctx
->ExecuteFlag
) {
6394 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6398 static void GLAPIENTRY
6399 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6402 GET_CURRENT_CONTEXT(ctx
);
6404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6405 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6410 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6412 if (ctx
->ExecuteFlag
) {
6413 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6417 static void GLAPIENTRY
6418 save_ClampColorARB(GLenum target
, GLenum clamp
)
6420 GET_CURRENT_CONTEXT(ctx
);
6422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6423 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6428 if (ctx
->ExecuteFlag
) {
6429 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6433 static void GLAPIENTRY
6434 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6436 GET_CURRENT_CONTEXT(ctx
);
6438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6439 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6444 if (ctx
->ExecuteFlag
) {
6445 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6449 static void GLAPIENTRY
6450 save_ActiveProgramEXT(GLuint program
)
6452 GET_CURRENT_CONTEXT(ctx
);
6454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6455 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6459 if (ctx
->ExecuteFlag
) {
6460 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6464 /** GL_EXT_texture_integer */
6465 static void GLAPIENTRY
6466 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6468 GET_CURRENT_CONTEXT(ctx
);
6470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6471 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6478 if (ctx
->ExecuteFlag
) {
6479 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6483 /** GL_EXT_texture_integer */
6484 static void GLAPIENTRY
6485 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6487 GET_CURRENT_CONTEXT(ctx
);
6489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6490 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6497 if (ctx
->ExecuteFlag
) {
6498 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6502 /** GL_EXT_texture_integer */
6503 static void GLAPIENTRY
6504 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6506 GET_CURRENT_CONTEXT(ctx
);
6508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6509 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6518 if (ctx
->ExecuteFlag
) {
6519 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6523 /** GL_EXT_texture_integer */
6524 static void GLAPIENTRY
6525 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6527 GET_CURRENT_CONTEXT(ctx
);
6529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6530 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6534 n
[3].ui
= params
[0];
6535 n
[4].ui
= params
[1];
6536 n
[5].ui
= params
[2];
6537 n
[6].ui
= params
[3];
6539 if (ctx
->ExecuteFlag
) {
6540 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6544 /* GL_ARB_instanced_arrays */
6545 static void GLAPIENTRY
6546 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6548 GET_CURRENT_CONTEXT(ctx
);
6550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6551 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6556 if (ctx
->ExecuteFlag
) {
6557 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6562 /* GL_NV_texture_barrier */
6563 static void GLAPIENTRY
6564 save_TextureBarrierNV(void)
6566 GET_CURRENT_CONTEXT(ctx
);
6567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6568 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6569 if (ctx
->ExecuteFlag
) {
6570 CALL_TextureBarrierNV(ctx
->Exec
, ());
6575 /* GL_ARB_sampler_objects */
6576 static void GLAPIENTRY
6577 save_BindSampler(GLuint unit
, GLuint sampler
)
6580 GET_CURRENT_CONTEXT(ctx
);
6581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6582 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6587 if (ctx
->ExecuteFlag
) {
6588 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6592 static void GLAPIENTRY
6593 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6596 GET_CURRENT_CONTEXT(ctx
);
6597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6598 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6603 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6609 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6612 if (ctx
->ExecuteFlag
) {
6613 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6617 static void GLAPIENTRY
6618 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6622 parray
[1] = parray
[2] = parray
[3] = 0;
6623 save_SamplerParameteriv(sampler
, pname
, parray
);
6626 static void GLAPIENTRY
6627 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6630 GET_CURRENT_CONTEXT(ctx
);
6631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6632 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6637 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6643 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6646 if (ctx
->ExecuteFlag
) {
6647 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6651 static void GLAPIENTRY
6652 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6656 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6657 save_SamplerParameterfv(sampler
, pname
, parray
);
6660 static void GLAPIENTRY
6661 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6664 GET_CURRENT_CONTEXT(ctx
);
6665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6666 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6671 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6677 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6680 if (ctx
->ExecuteFlag
) {
6681 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6685 static void GLAPIENTRY
6686 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6689 GET_CURRENT_CONTEXT(ctx
);
6690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6691 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6695 n
[3].ui
= params
[0];
6696 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6697 n
[4].ui
= params
[1];
6698 n
[5].ui
= params
[2];
6699 n
[6].ui
= params
[3];
6702 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6705 if (ctx
->ExecuteFlag
) {
6706 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6710 /* GL_ARB_geometry_shader4 */
6711 static void GLAPIENTRY
6712 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6715 GET_CURRENT_CONTEXT(ctx
);
6716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6717 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6723 if (ctx
->ExecuteFlag
) {
6724 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6728 static void GLAPIENTRY
6729 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6730 GLuint texture
, GLint level
)
6733 GET_CURRENT_CONTEXT(ctx
);
6734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6735 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6738 n
[2].e
= attachment
;
6742 if (ctx
->ExecuteFlag
) {
6743 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6747 static void GLAPIENTRY
6748 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6749 GLuint texture
, GLint level
, GLenum face
)
6752 GET_CURRENT_CONTEXT(ctx
);
6753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6754 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6757 n
[2].e
= attachment
;
6762 if (ctx
->ExecuteFlag
) {
6763 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6770 static void GLAPIENTRY
6771 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6774 GET_CURRENT_CONTEXT(ctx
);
6775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6776 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6778 union uint64_pair p
;
6782 n
[3].ui
= p
.uint32
[0];
6783 n
[4].ui
= p
.uint32
[1];
6785 if (ctx
->ExecuteFlag
) {
6786 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6791 /** GL_NV_conditional_render */
6792 static void GLAPIENTRY
6793 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6795 GET_CURRENT_CONTEXT(ctx
);
6797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6798 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6803 if (ctx
->ExecuteFlag
) {
6804 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6808 static void GLAPIENTRY
6809 save_EndConditionalRender(void)
6811 GET_CURRENT_CONTEXT(ctx
);
6812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6813 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6814 if (ctx
->ExecuteFlag
) {
6815 CALL_EndConditionalRender(ctx
->Exec
, ());
6819 static void GLAPIENTRY
6820 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6822 GET_CURRENT_CONTEXT(ctx
);
6824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6825 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6831 if (ctx
->ExecuteFlag
) {
6832 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6838 * Save an error-generating command into display list.
6840 * KW: Will appear in the list before the vertex buffer containing the
6841 * command that provoked the error. I don't see this as a problem.
6844 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6847 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
6850 n
[2].data
= (void *) s
;
6851 /* note: the data/string here doesn't have to be freed in
6852 * _mesa_delete_list() since the string is never dynamically
6860 * Compile an error into current display list.
6863 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6865 if (ctx
->CompileFlag
)
6866 save_error(ctx
, error
, s
);
6867 if (ctx
->ExecuteFlag
)
6868 _mesa_error(ctx
, error
, "%s", s
);
6873 * Test if ID names a display list.
6876 islist(struct gl_context
*ctx
, GLuint list
)
6878 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6888 /**********************************************************************/
6889 /* Display list execution */
6890 /**********************************************************************/
6894 * Execute a display list. Note that the ListBase offset must have already
6895 * been added before calling this function. I.e. the list argument is
6896 * the absolute list number, not relative to ListBase.
6897 * \param list - display list number
6900 execute_list(struct gl_context
*ctx
, GLuint list
)
6902 struct gl_display_list
*dlist
;
6906 if (list
== 0 || !islist(ctx
, list
))
6909 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
6910 /* raise an error? */
6914 dlist
= _mesa_lookup_list(ctx
, list
);
6918 ctx
->ListState
.CallDepth
++;
6920 if (ctx
->Driver
.BeginCallList
)
6921 ctx
->Driver
.BeginCallList(ctx
, dlist
);
6927 const OpCode opcode
= n
[0].opcode
;
6929 if (is_ext_opcode(opcode
)) {
6930 n
+= ext_opcode_execute(ctx
, n
);
6935 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
6938 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6940 case OPCODE_ALPHA_FUNC
:
6941 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6943 case OPCODE_BIND_TEXTURE
:
6944 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6948 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6949 ctx
->Unpack
= ctx
->DefaultPacking
;
6950 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
6951 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
6952 (const GLubyte
*) n
[7].data
));
6953 ctx
->Unpack
= save
; /* restore */
6956 case OPCODE_BLEND_COLOR
:
6957 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6959 case OPCODE_BLEND_EQUATION
:
6960 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
6962 case OPCODE_BLEND_EQUATION_SEPARATE
:
6963 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6965 case OPCODE_BLEND_FUNC_SEPARATE
:
6966 CALL_BlendFuncSeparate(ctx
->Exec
,
6967 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6970 case OPCODE_BLEND_FUNC_I
:
6971 /* GL_ARB_draw_buffers_blend */
6972 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
6974 case OPCODE_BLEND_FUNC_SEPARATE_I
:
6975 /* GL_ARB_draw_buffers_blend */
6976 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
6979 case OPCODE_BLEND_EQUATION_I
:
6980 /* GL_ARB_draw_buffers_blend */
6981 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
6983 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
6984 /* GL_ARB_draw_buffers_blend */
6985 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
6986 (n
[1].ui
, n
[2].e
, n
[3].e
));
6989 case OPCODE_CALL_LIST
:
6990 /* Generated by glCallList(), don't add ListBase */
6991 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
6992 execute_list(ctx
, n
[1].ui
);
6995 case OPCODE_CALL_LIST_OFFSET
:
6996 /* Generated by glCallLists() so we must add ListBase */
6998 /* user specified a bad data type at compile time */
6999 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7001 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7002 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7003 execute_list(ctx
, list
);
7007 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7009 case OPCODE_CLEAR_BUFFER_IV
:
7016 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7019 case OPCODE_CLEAR_BUFFER_UIV
:
7026 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7029 case OPCODE_CLEAR_BUFFER_FV
:
7036 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7039 case OPCODE_CLEAR_BUFFER_FI
:
7040 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7042 case OPCODE_CLEAR_COLOR
:
7043 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7045 case OPCODE_CLEAR_ACCUM
:
7046 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7048 case OPCODE_CLEAR_DEPTH
:
7049 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7051 case OPCODE_CLEAR_INDEX
:
7052 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7054 case OPCODE_CLEAR_STENCIL
:
7055 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7057 case OPCODE_CLIP_PLANE
:
7064 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7067 case OPCODE_COLOR_MASK
:
7068 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7070 case OPCODE_COLOR_MASK_INDEXED
:
7071 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7074 case OPCODE_COLOR_MATERIAL
:
7075 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7077 case OPCODE_COPY_PIXELS
:
7078 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7079 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7082 case OPCODE_COPY_TEX_IMAGE1D
:
7083 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7084 n
[5].i
, n
[6].i
, n
[7].i
));
7086 case OPCODE_COPY_TEX_IMAGE2D
:
7087 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7088 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7090 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7091 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7092 n
[4].i
, n
[5].i
, n
[6].i
));
7094 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7095 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7096 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7099 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7100 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7101 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7104 case OPCODE_CULL_FACE
:
7105 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7107 case OPCODE_DEPTH_FUNC
:
7108 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7110 case OPCODE_DEPTH_MASK
:
7111 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7113 case OPCODE_DEPTH_RANGE
:
7114 CALL_DepthRange(ctx
->Exec
,
7115 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7117 case OPCODE_DISABLE
:
7118 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7120 case OPCODE_DISABLE_INDEXED
:
7121 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7123 case OPCODE_DRAW_BUFFER
:
7124 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7126 case OPCODE_DRAW_PIXELS
:
7128 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7129 ctx
->Unpack
= ctx
->DefaultPacking
;
7130 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7132 ctx
->Unpack
= save
; /* restore */
7136 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7138 case OPCODE_ENABLE_INDEXED
:
7139 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7141 case OPCODE_EVALMESH1
:
7142 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7144 case OPCODE_EVALMESH2
:
7145 CALL_EvalMesh2(ctx
->Exec
,
7146 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7155 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7158 case OPCODE_FRONT_FACE
:
7159 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7161 case OPCODE_FRUSTUM
:
7162 CALL_Frustum(ctx
->Exec
,
7163 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7166 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7168 case OPCODE_INDEX_MASK
:
7169 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7171 case OPCODE_INIT_NAMES
:
7172 CALL_InitNames(ctx
->Exec
, ());
7181 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7184 case OPCODE_LIGHT_MODEL
:
7191 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7194 case OPCODE_LINE_STIPPLE
:
7195 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7197 case OPCODE_LINE_WIDTH
:
7198 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7200 case OPCODE_LIST_BASE
:
7201 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7203 case OPCODE_LOAD_IDENTITY
:
7204 CALL_LoadIdentity(ctx
->Exec
, ());
7206 case OPCODE_LOAD_MATRIX
:
7207 if (sizeof(Node
) == sizeof(GLfloat
)) {
7208 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7213 for (i
= 0; i
< 16; i
++) {
7216 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7219 case OPCODE_LOAD_NAME
:
7220 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7222 case OPCODE_LOGIC_OP
:
7223 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7227 GLenum target
= n
[1].e
;
7228 GLint ustride
= _mesa_evaluator_components(target
);
7229 GLint uorder
= n
[5].i
;
7230 GLfloat u1
= n
[2].f
;
7231 GLfloat u2
= n
[3].f
;
7232 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7233 (GLfloat
*) n
[6].data
));
7238 GLenum target
= n
[1].e
;
7239 GLfloat u1
= n
[2].f
;
7240 GLfloat u2
= n
[3].f
;
7241 GLfloat v1
= n
[4].f
;
7242 GLfloat v2
= n
[5].f
;
7243 GLint ustride
= n
[6].i
;
7244 GLint vstride
= n
[7].i
;
7245 GLint uorder
= n
[8].i
;
7246 GLint vorder
= n
[9].i
;
7247 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7248 v1
, v2
, vstride
, vorder
,
7249 (GLfloat
*) n
[10].data
));
7252 case OPCODE_MAPGRID1
:
7253 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7255 case OPCODE_MAPGRID2
:
7256 CALL_MapGrid2f(ctx
->Exec
,
7257 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7259 case OPCODE_MATRIX_MODE
:
7260 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7262 case OPCODE_MULT_MATRIX
:
7263 if (sizeof(Node
) == sizeof(GLfloat
)) {
7264 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7269 for (i
= 0; i
< 16; i
++) {
7272 CALL_MultMatrixf(ctx
->Exec
, (m
));
7276 CALL_Ortho(ctx
->Exec
,
7277 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7279 case OPCODE_PASSTHROUGH
:
7280 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7282 case OPCODE_PIXEL_MAP
:
7283 CALL_PixelMapfv(ctx
->Exec
,
7284 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7286 case OPCODE_PIXEL_TRANSFER
:
7287 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7289 case OPCODE_PIXEL_ZOOM
:
7290 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7292 case OPCODE_POINT_SIZE
:
7293 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7295 case OPCODE_POINT_PARAMETERS
:
7301 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7304 case OPCODE_POLYGON_MODE
:
7305 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7307 case OPCODE_POLYGON_STIPPLE
:
7309 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7310 ctx
->Unpack
= ctx
->DefaultPacking
;
7311 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7312 ctx
->Unpack
= save
; /* restore */
7315 case OPCODE_POLYGON_OFFSET
:
7316 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7318 case OPCODE_POP_ATTRIB
:
7319 CALL_PopAttrib(ctx
->Exec
, ());
7321 case OPCODE_POP_MATRIX
:
7322 CALL_PopMatrix(ctx
->Exec
, ());
7324 case OPCODE_POP_NAME
:
7325 CALL_PopName(ctx
->Exec
, ());
7327 case OPCODE_PRIORITIZE_TEXTURE
:
7328 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7330 case OPCODE_PUSH_ATTRIB
:
7331 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7333 case OPCODE_PUSH_MATRIX
:
7334 CALL_PushMatrix(ctx
->Exec
, ());
7336 case OPCODE_PUSH_NAME
:
7337 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7339 case OPCODE_RASTER_POS
:
7340 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7342 case OPCODE_READ_BUFFER
:
7343 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7346 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7349 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7351 case OPCODE_SCISSOR
:
7352 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7354 case OPCODE_SHADE_MODEL
:
7355 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7357 case OPCODE_PROVOKING_VERTEX
:
7358 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7360 case OPCODE_STENCIL_FUNC
:
7361 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7363 case OPCODE_STENCIL_MASK
:
7364 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7366 case OPCODE_STENCIL_OP
:
7367 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7369 case OPCODE_STENCIL_FUNC_SEPARATE
:
7370 CALL_StencilFuncSeparate(ctx
->Exec
,
7371 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7373 case OPCODE_STENCIL_MASK_SEPARATE
:
7374 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7376 case OPCODE_STENCIL_OP_SEPARATE
:
7377 CALL_StencilOpSeparate(ctx
->Exec
,
7378 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7387 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7397 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7400 case OPCODE_TEXPARAMETER
:
7407 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7410 case OPCODE_TEX_IMAGE1D
:
7412 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7413 ctx
->Unpack
= ctx
->DefaultPacking
;
7414 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7416 n
[3].i
, /* components */
7418 n
[5].e
, /* border */
7419 n
[6].e
, /* format */
7422 ctx
->Unpack
= save
; /* restore */
7425 case OPCODE_TEX_IMAGE2D
:
7427 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7428 ctx
->Unpack
= ctx
->DefaultPacking
;
7429 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7431 n
[3].i
, /* components */
7433 n
[5].i
, /* height */
7434 n
[6].e
, /* border */
7435 n
[7].e
, /* format */
7438 ctx
->Unpack
= save
; /* restore */
7441 case OPCODE_TEX_IMAGE3D
:
7443 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7444 ctx
->Unpack
= ctx
->DefaultPacking
;
7445 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7447 n
[3].i
, /* components */
7449 n
[5].i
, /* height */
7451 n
[7].e
, /* border */
7452 n
[8].e
, /* format */
7455 ctx
->Unpack
= save
; /* restore */
7458 case OPCODE_TEX_SUB_IMAGE1D
:
7460 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7461 ctx
->Unpack
= ctx
->DefaultPacking
;
7462 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7464 n
[6].e
, n
[7].data
));
7465 ctx
->Unpack
= save
; /* restore */
7468 case OPCODE_TEX_SUB_IMAGE2D
:
7470 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7471 ctx
->Unpack
= ctx
->DefaultPacking
;
7472 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7474 n
[6].i
, n
[7].e
, n
[8].e
,
7476 ctx
->Unpack
= save
; /* restore */
7479 case OPCODE_TEX_SUB_IMAGE3D
:
7481 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7482 ctx
->Unpack
= ctx
->DefaultPacking
;
7483 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7484 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7485 n
[8].i
, n
[9].e
, n
[10].e
,
7487 ctx
->Unpack
= save
; /* restore */
7490 case OPCODE_TRANSLATE
:
7491 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7493 case OPCODE_VIEWPORT
:
7494 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7495 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7497 case OPCODE_WINDOW_POS
:
7498 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7500 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7501 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7503 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7504 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7505 n
[4].i
, n
[5].i
, n
[6].i
,
7508 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7509 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7510 n
[4].i
, n
[5].i
, n
[6].i
,
7511 n
[7].i
, n
[8].data
));
7513 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7514 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7515 n
[4].i
, n
[5].i
, n
[6].i
,
7519 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7520 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7521 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7522 n
[5].e
, n
[6].i
, n
[7].data
));
7524 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7525 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7526 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7527 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7530 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7531 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7532 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7533 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7534 n
[9].e
, n
[10].i
, n
[11].data
));
7536 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7537 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7539 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7540 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7542 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7543 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7545 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7546 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7547 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7550 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7551 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7553 case OPCODE_DEPTH_BOUNDS_EXT
:
7554 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7556 case OPCODE_PROGRAM_STRING_ARB
:
7557 CALL_ProgramStringARB(ctx
->Exec
,
7558 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
7560 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7561 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7565 case OPCODE_BEGIN_QUERY_ARB
:
7566 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7568 case OPCODE_END_QUERY_ARB
:
7569 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7571 case OPCODE_QUERY_COUNTER
:
7572 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7574 case OPCODE_BEGIN_QUERY_INDEXED
:
7575 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7577 case OPCODE_END_QUERY_INDEXED
:
7578 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7580 case OPCODE_DRAW_BUFFERS_ARB
:
7582 GLenum buffers
[MAX_DRAW_BUFFERS
];
7583 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7584 for (i
= 0; i
< count
; i
++)
7585 buffers
[i
] = n
[2 + i
].e
;
7586 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7589 case OPCODE_BLIT_FRAMEBUFFER
:
7590 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7591 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7594 case OPCODE_USE_PROGRAM
:
7595 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7597 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7598 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7600 case OPCODE_ACTIVE_PROGRAM_EXT
:
7601 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7603 case OPCODE_UNIFORM_1F
:
7604 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7606 case OPCODE_UNIFORM_2F
:
7607 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7609 case OPCODE_UNIFORM_3F
:
7610 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7612 case OPCODE_UNIFORM_4F
:
7613 CALL_Uniform4f(ctx
->Exec
,
7614 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7616 case OPCODE_UNIFORM_1FV
:
7617 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7619 case OPCODE_UNIFORM_2FV
:
7620 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7622 case OPCODE_UNIFORM_3FV
:
7623 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7625 case OPCODE_UNIFORM_4FV
:
7626 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7628 case OPCODE_UNIFORM_1I
:
7629 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7631 case OPCODE_UNIFORM_2I
:
7632 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7634 case OPCODE_UNIFORM_3I
:
7635 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7637 case OPCODE_UNIFORM_4I
:
7638 CALL_Uniform4i(ctx
->Exec
,
7639 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7641 case OPCODE_UNIFORM_1IV
:
7642 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7644 case OPCODE_UNIFORM_2IV
:
7645 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7647 case OPCODE_UNIFORM_3IV
:
7648 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7650 case OPCODE_UNIFORM_4IV
:
7651 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7653 case OPCODE_UNIFORM_1UI
:
7654 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7656 case OPCODE_UNIFORM_2UI
:
7657 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7659 case OPCODE_UNIFORM_3UI
:
7660 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7662 case OPCODE_UNIFORM_4UI
:
7663 /*CALL_Uniform4uiARB(ctx->Exec,
7664 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7667 case OPCODE_UNIFORM_1UIV
:
7668 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7670 case OPCODE_UNIFORM_2UIV
:
7671 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7673 case OPCODE_UNIFORM_3UIV
:
7674 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7676 case OPCODE_UNIFORM_4UIV
:
7677 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7679 case OPCODE_UNIFORM_MATRIX22
:
7680 CALL_UniformMatrix2fv(ctx
->Exec
,
7681 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7683 case OPCODE_UNIFORM_MATRIX33
:
7684 CALL_UniformMatrix3fv(ctx
->Exec
,
7685 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7687 case OPCODE_UNIFORM_MATRIX44
:
7688 CALL_UniformMatrix4fv(ctx
->Exec
,
7689 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7691 case OPCODE_UNIFORM_MATRIX23
:
7692 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7693 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7695 case OPCODE_UNIFORM_MATRIX32
:
7696 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7697 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7699 case OPCODE_UNIFORM_MATRIX24
:
7700 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7701 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7703 case OPCODE_UNIFORM_MATRIX42
:
7704 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7705 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7707 case OPCODE_UNIFORM_MATRIX34
:
7708 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7709 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7711 case OPCODE_UNIFORM_MATRIX43
:
7712 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7713 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7716 case OPCODE_CLAMP_COLOR
:
7717 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7720 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7723 GLuint i
, pname
= n
[1].ui
;
7725 for (i
= 0; i
< 4; i
++)
7726 values
[i
] = n
[1 + i
].f
;
7727 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7730 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7731 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7733 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7736 GLuint i
, dst
= n
[1].ui
;
7738 for (i
= 0; i
< 4; i
++)
7739 values
[i
] = n
[1 + i
].f
;
7740 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7743 case OPCODE_ATTR_1F_NV
:
7744 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7746 case OPCODE_ATTR_2F_NV
:
7747 /* Really shouldn't have to do this - the Node structure
7748 * is convenient, but it would be better to store the data
7749 * packed appropriately so that it can be sent directly
7750 * on. With x86_64 becoming common, this will start to
7753 if (sizeof(Node
) == sizeof(GLfloat
))
7754 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7756 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7758 case OPCODE_ATTR_3F_NV
:
7759 if (sizeof(Node
) == sizeof(GLfloat
))
7760 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7762 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7765 case OPCODE_ATTR_4F_NV
:
7766 if (sizeof(Node
) == sizeof(GLfloat
))
7767 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7769 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7772 case OPCODE_ATTR_1F_ARB
:
7773 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7775 case OPCODE_ATTR_2F_ARB
:
7776 /* Really shouldn't have to do this - the Node structure
7777 * is convenient, but it would be better to store the data
7778 * packed appropriately so that it can be sent directly
7779 * on. With x86_64 becoming common, this will start to
7782 if (sizeof(Node
) == sizeof(GLfloat
))
7783 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7785 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7787 case OPCODE_ATTR_3F_ARB
:
7788 if (sizeof(Node
) == sizeof(GLfloat
))
7789 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7791 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7794 case OPCODE_ATTR_4F_ARB
:
7795 if (sizeof(Node
) == sizeof(GLfloat
))
7796 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7798 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7801 case OPCODE_MATERIAL
:
7802 if (sizeof(Node
) == sizeof(GLfloat
))
7803 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7810 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7814 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7817 CALL_End(ctx
->Exec
, ());
7820 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7822 case OPCODE_EVAL_C1
:
7823 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7825 case OPCODE_EVAL_C2
:
7826 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7828 case OPCODE_EVAL_P1
:
7829 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7831 case OPCODE_EVAL_P2
:
7832 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7835 /* GL_EXT_texture_integer */
7836 case OPCODE_CLEARCOLOR_I
:
7837 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7839 case OPCODE_CLEARCOLOR_UI
:
7840 CALL_ClearColorIuiEXT(ctx
->Exec
,
7841 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7843 case OPCODE_TEXPARAMETER_I
:
7850 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7853 case OPCODE_TEXPARAMETER_UI
:
7856 params
[0] = n
[3].ui
;
7857 params
[1] = n
[4].ui
;
7858 params
[2] = n
[5].ui
;
7859 params
[3] = n
[6].ui
;
7860 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7864 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7865 /* GL_ARB_instanced_arrays */
7866 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7869 case OPCODE_TEXTURE_BARRIER_NV
:
7870 CALL_TextureBarrierNV(ctx
->Exec
, ());
7873 /* GL_EXT/ARB_transform_feedback */
7874 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7875 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7877 case OPCODE_END_TRANSFORM_FEEDBACK
:
7878 CALL_EndTransformFeedback(ctx
->Exec
, ());
7880 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7881 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7883 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7884 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7886 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7887 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7889 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7890 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7892 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7893 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7894 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7896 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7897 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
7898 (n
[1].e
, n
[2].ui
, n
[3].si
));
7900 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
7901 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
7902 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
7906 case OPCODE_BIND_SAMPLER
:
7907 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7909 case OPCODE_SAMPLER_PARAMETERIV
:
7916 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7919 case OPCODE_SAMPLER_PARAMETERFV
:
7926 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7929 case OPCODE_SAMPLER_PARAMETERIIV
:
7936 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7939 case OPCODE_SAMPLER_PARAMETERUIV
:
7942 params
[0] = n
[3].ui
;
7943 params
[1] = n
[4].ui
;
7944 params
[2] = n
[5].ui
;
7945 params
[3] = n
[6].ui
;
7946 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7950 /* GL_ARB_geometry_shader4 */
7951 case OPCODE_PROGRAM_PARAMETERI
:
7952 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
7954 case OPCODE_FRAMEBUFFER_TEXTURE
:
7955 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
7958 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
7959 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
7960 n
[3].ui
, n
[4].i
, n
[5].e
));
7964 case OPCODE_WAIT_SYNC
:
7966 union uint64_pair p
;
7967 p
.uint32
[0] = n
[3].ui
;
7968 p
.uint32
[1] = n
[4].ui
;
7969 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
7973 /* GL_NV_conditional_render */
7974 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
7975 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
7977 case OPCODE_END_CONDITIONAL_RENDER
:
7978 CALL_EndConditionalRender(ctx
->Exec
, ());
7981 case OPCODE_UNIFORM_BLOCK_BINDING
:
7982 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
7985 case OPCODE_CONTINUE
:
7986 n
= (Node
*) n
[1].next
;
7988 case OPCODE_END_OF_LIST
:
7994 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
7996 _mesa_problem(ctx
, "%s", msg
);
8001 /* increment n to point to next compiled command */
8002 if (opcode
!= OPCODE_CONTINUE
) {
8003 n
+= InstSize
[opcode
];
8008 if (ctx
->Driver
.EndCallList
)
8009 ctx
->Driver
.EndCallList(ctx
);
8011 ctx
->ListState
.CallDepth
--;
8016 /**********************************************************************/
8018 /**********************************************************************/
8021 * Test if a display list number is valid.
8023 GLboolean GLAPIENTRY
8024 _mesa_IsList(GLuint list
)
8026 GET_CURRENT_CONTEXT(ctx
);
8027 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8028 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8029 return islist(ctx
, list
);
8034 * Delete a sequence of consecutive display lists.
8037 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8039 GET_CURRENT_CONTEXT(ctx
);
8041 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8042 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8045 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8048 for (i
= list
; i
< list
+ range
; i
++) {
8049 destroy_list(ctx
, i
);
8055 * Return a display list number, n, such that lists n through n+range-1
8059 _mesa_GenLists(GLsizei range
)
8061 GET_CURRENT_CONTEXT(ctx
);
8063 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8064 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8067 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8075 * Make this an atomic operation
8077 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8079 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8081 /* reserve the list IDs by with empty/dummy lists */
8083 for (i
= 0; i
< range
; i
++) {
8084 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8085 make_list(base
+ i
, 1));
8089 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8096 * Begin a new display list.
8099 _mesa_NewList(GLuint name
, GLenum mode
)
8101 GET_CURRENT_CONTEXT(ctx
);
8103 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8104 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8106 if (MESA_VERBOSE
& VERBOSE_API
)
8107 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8108 _mesa_lookup_enum_by_nr(mode
));
8111 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8115 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8116 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8120 if (ctx
->ListState
.CurrentList
) {
8121 /* already compiling a display list */
8122 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8126 ctx
->CompileFlag
= GL_TRUE
;
8127 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8129 /* Reset accumulated list state */
8130 invalidate_saved_current_state( ctx
);
8132 /* Allocate new display list */
8133 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8134 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8135 ctx
->ListState
.CurrentPos
= 0;
8137 ctx
->Driver
.NewList(ctx
, name
, mode
);
8139 ctx
->CurrentDispatch
= ctx
->Save
;
8140 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8145 * End definition of current display list.
8150 GET_CURRENT_CONTEXT(ctx
);
8151 SAVE_FLUSH_VERTICES(ctx
);
8152 FLUSH_VERTICES(ctx
, 0);
8154 if (MESA_VERBOSE
& VERBOSE_API
)
8155 _mesa_debug(ctx
, "glEndList\n");
8157 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8158 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8159 "glEndList() called inside glBegin/End");
8162 /* Check that a list is under construction */
8163 if (!ctx
->ListState
.CurrentList
) {
8164 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8168 /* Call before emitting END_OF_LIST, in case the driver wants to
8169 * emit opcodes itself.
8171 ctx
->Driver
.EndList(ctx
);
8173 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8175 /* Destroy old list, if any */
8176 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8178 /* Install the new list */
8179 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8180 ctx
->ListState
.CurrentList
->Name
,
8181 ctx
->ListState
.CurrentList
);
8184 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8185 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8187 ctx
->ListState
.CurrentList
= NULL
;
8188 ctx
->ExecuteFlag
= GL_TRUE
;
8189 ctx
->CompileFlag
= GL_FALSE
;
8191 ctx
->CurrentDispatch
= ctx
->Exec
;
8192 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8197 _mesa_CallList(GLuint list
)
8199 GLboolean save_compile_flag
;
8200 GET_CURRENT_CONTEXT(ctx
);
8201 FLUSH_CURRENT(ctx
, 0);
8203 if (MESA_VERBOSE
& VERBOSE_API
)
8204 _mesa_debug(ctx
, "glCallList %d\n", list
);
8207 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8212 mesa_print_display_list( list
);
8214 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8215 * execute the display list, and restore the CompileFlag.
8217 save_compile_flag
= ctx
->CompileFlag
;
8218 if (save_compile_flag
) {
8219 ctx
->CompileFlag
= GL_FALSE
;
8222 execute_list(ctx
, list
);
8223 ctx
->CompileFlag
= save_compile_flag
;
8225 /* also restore API function pointers to point to "save" versions */
8226 if (save_compile_flag
) {
8227 ctx
->CurrentDispatch
= ctx
->Save
;
8228 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8234 * Execute glCallLists: call multiple display lists.
8237 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8239 GET_CURRENT_CONTEXT(ctx
);
8241 GLboolean save_compile_flag
;
8243 if (MESA_VERBOSE
& VERBOSE_API
)
8244 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8248 case GL_UNSIGNED_BYTE
:
8250 case GL_UNSIGNED_SHORT
:
8252 case GL_UNSIGNED_INT
:
8260 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8264 /* Save the CompileFlag status, turn it off, execute display list,
8265 * and restore the CompileFlag.
8267 save_compile_flag
= ctx
->CompileFlag
;
8268 ctx
->CompileFlag
= GL_FALSE
;
8270 for (i
= 0; i
< n
; i
++) {
8271 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8272 execute_list(ctx
, list
);
8275 ctx
->CompileFlag
= save_compile_flag
;
8277 /* also restore API function pointers to point to "save" versions */
8278 if (save_compile_flag
) {
8279 ctx
->CurrentDispatch
= ctx
->Save
;
8280 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8286 * Set the offset added to list numbers in glCallLists.
8289 _mesa_ListBase(GLuint base
)
8291 GET_CURRENT_CONTEXT(ctx
);
8292 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8293 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8294 ctx
->List
.ListBase
= base
;
8298 * Setup the given dispatch table to point to Mesa's display list
8299 * building functions.
8301 * This does not include any of the tnl functions - they are
8302 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8306 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8308 struct _glapi_table
*table
= ctx
->Save
;
8309 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8311 /* Initially populate the dispatch table with the contents of the
8312 * normal-execution dispatch table. This lets us skip populating functions
8313 * that should be called directly instead of compiled into display lists.
8315 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8317 _mesa_loopback_init_api_table(ctx
, table
);
8320 vbo_initialize_save_dispatch(ctx
, table
);
8323 SET_Accum(table
, save_Accum
);
8324 SET_AlphaFunc(table
, save_AlphaFunc
);
8325 SET_Bitmap(table
, save_Bitmap
);
8326 SET_BlendFunc(table
, save_BlendFunc
);
8327 SET_CallList(table
, save_CallList
);
8328 SET_CallLists(table
, save_CallLists
);
8329 SET_Clear(table
, save_Clear
);
8330 SET_ClearAccum(table
, save_ClearAccum
);
8331 SET_ClearColor(table
, save_ClearColor
);
8332 SET_ClearDepth(table
, save_ClearDepth
);
8333 SET_ClearIndex(table
, save_ClearIndex
);
8334 SET_ClearStencil(table
, save_ClearStencil
);
8335 SET_ClipPlane(table
, save_ClipPlane
);
8336 SET_ColorMask(table
, save_ColorMask
);
8337 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8338 SET_ColorMaterial(table
, save_ColorMaterial
);
8339 SET_CopyPixels(table
, save_CopyPixels
);
8340 SET_CullFace(table
, save_CullFace
);
8341 SET_DepthFunc(table
, save_DepthFunc
);
8342 SET_DepthMask(table
, save_DepthMask
);
8343 SET_DepthRange(table
, save_DepthRange
);
8344 SET_Disable(table
, save_Disable
);
8345 SET_Disablei(table
, save_DisableIndexed
);
8346 SET_DrawBuffer(table
, save_DrawBuffer
);
8347 SET_DrawPixels(table
, save_DrawPixels
);
8348 SET_Enable(table
, save_Enable
);
8349 SET_Enablei(table
, save_EnableIndexed
);
8350 SET_EvalMesh1(table
, save_EvalMesh1
);
8351 SET_EvalMesh2(table
, save_EvalMesh2
);
8352 SET_Fogf(table
, save_Fogf
);
8353 SET_Fogfv(table
, save_Fogfv
);
8354 SET_Fogi(table
, save_Fogi
);
8355 SET_Fogiv(table
, save_Fogiv
);
8356 SET_FrontFace(table
, save_FrontFace
);
8357 SET_Frustum(table
, save_Frustum
);
8358 SET_Hint(table
, save_Hint
);
8359 SET_IndexMask(table
, save_IndexMask
);
8360 SET_InitNames(table
, save_InitNames
);
8361 SET_LightModelf(table
, save_LightModelf
);
8362 SET_LightModelfv(table
, save_LightModelfv
);
8363 SET_LightModeli(table
, save_LightModeli
);
8364 SET_LightModeliv(table
, save_LightModeliv
);
8365 SET_Lightf(table
, save_Lightf
);
8366 SET_Lightfv(table
, save_Lightfv
);
8367 SET_Lighti(table
, save_Lighti
);
8368 SET_Lightiv(table
, save_Lightiv
);
8369 SET_LineStipple(table
, save_LineStipple
);
8370 SET_LineWidth(table
, save_LineWidth
);
8371 SET_ListBase(table
, save_ListBase
);
8372 SET_LoadIdentity(table
, save_LoadIdentity
);
8373 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8374 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8375 SET_LoadName(table
, save_LoadName
);
8376 SET_LogicOp(table
, save_LogicOp
);
8377 SET_Map1d(table
, save_Map1d
);
8378 SET_Map1f(table
, save_Map1f
);
8379 SET_Map2d(table
, save_Map2d
);
8380 SET_Map2f(table
, save_Map2f
);
8381 SET_MapGrid1d(table
, save_MapGrid1d
);
8382 SET_MapGrid1f(table
, save_MapGrid1f
);
8383 SET_MapGrid2d(table
, save_MapGrid2d
);
8384 SET_MapGrid2f(table
, save_MapGrid2f
);
8385 SET_MatrixMode(table
, save_MatrixMode
);
8386 SET_MultMatrixd(table
, save_MultMatrixd
);
8387 SET_MultMatrixf(table
, save_MultMatrixf
);
8388 SET_NewList(table
, save_NewList
);
8389 SET_Ortho(table
, save_Ortho
);
8390 SET_PassThrough(table
, save_PassThrough
);
8391 SET_PixelMapfv(table
, save_PixelMapfv
);
8392 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8393 SET_PixelMapusv(table
, save_PixelMapusv
);
8394 SET_PixelTransferf(table
, save_PixelTransferf
);
8395 SET_PixelTransferi(table
, save_PixelTransferi
);
8396 SET_PixelZoom(table
, save_PixelZoom
);
8397 SET_PointSize(table
, save_PointSize
);
8398 SET_PolygonMode(table
, save_PolygonMode
);
8399 SET_PolygonOffset(table
, save_PolygonOffset
);
8400 SET_PolygonStipple(table
, save_PolygonStipple
);
8401 SET_PopAttrib(table
, save_PopAttrib
);
8402 SET_PopMatrix(table
, save_PopMatrix
);
8403 SET_PopName(table
, save_PopName
);
8404 SET_PushAttrib(table
, save_PushAttrib
);
8405 SET_PushMatrix(table
, save_PushMatrix
);
8406 SET_PushName(table
, save_PushName
);
8407 SET_RasterPos2d(table
, save_RasterPos2d
);
8408 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8409 SET_RasterPos2f(table
, save_RasterPos2f
);
8410 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8411 SET_RasterPos2i(table
, save_RasterPos2i
);
8412 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8413 SET_RasterPos2s(table
, save_RasterPos2s
);
8414 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8415 SET_RasterPos3d(table
, save_RasterPos3d
);
8416 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8417 SET_RasterPos3f(table
, save_RasterPos3f
);
8418 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8419 SET_RasterPos3i(table
, save_RasterPos3i
);
8420 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8421 SET_RasterPos3s(table
, save_RasterPos3s
);
8422 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8423 SET_RasterPos4d(table
, save_RasterPos4d
);
8424 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8425 SET_RasterPos4f(table
, save_RasterPos4f
);
8426 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8427 SET_RasterPos4i(table
, save_RasterPos4i
);
8428 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8429 SET_RasterPos4s(table
, save_RasterPos4s
);
8430 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8431 SET_ReadBuffer(table
, save_ReadBuffer
);
8432 SET_Rectf(table
, save_Rectf
);
8433 SET_Rotated(table
, save_Rotated
);
8434 SET_Rotatef(table
, save_Rotatef
);
8435 SET_Scaled(table
, save_Scaled
);
8436 SET_Scalef(table
, save_Scalef
);
8437 SET_Scissor(table
, save_Scissor
);
8438 SET_ShadeModel(table
, save_ShadeModel
);
8439 SET_StencilFunc(table
, save_StencilFunc
);
8440 SET_StencilMask(table
, save_StencilMask
);
8441 SET_StencilOp(table
, save_StencilOp
);
8442 SET_TexEnvf(table
, save_TexEnvf
);
8443 SET_TexEnvfv(table
, save_TexEnvfv
);
8444 SET_TexEnvi(table
, save_TexEnvi
);
8445 SET_TexEnviv(table
, save_TexEnviv
);
8446 SET_TexGend(table
, save_TexGend
);
8447 SET_TexGendv(table
, save_TexGendv
);
8448 SET_TexGenf(table
, save_TexGenf
);
8449 SET_TexGenfv(table
, save_TexGenfv
);
8450 SET_TexGeni(table
, save_TexGeni
);
8451 SET_TexGeniv(table
, save_TexGeniv
);
8452 SET_TexImage1D(table
, save_TexImage1D
);
8453 SET_TexImage2D(table
, save_TexImage2D
);
8454 SET_TexParameterf(table
, save_TexParameterf
);
8455 SET_TexParameterfv(table
, save_TexParameterfv
);
8456 SET_TexParameteri(table
, save_TexParameteri
);
8457 SET_TexParameteriv(table
, save_TexParameteriv
);
8458 SET_Translated(table
, save_Translated
);
8459 SET_Translatef(table
, save_Translatef
);
8460 SET_Viewport(table
, save_Viewport
);
8463 SET_BindTexture(table
, save_BindTexture
);
8464 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8465 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8466 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8467 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8468 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8469 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8470 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8473 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8474 SET_TexImage3D(table
, save_TexImage3D
);
8475 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8478 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8479 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8480 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8482 /* ATI_separate_stencil */
8483 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8485 /* GL_ARB_imaging */
8486 /* Not all are supported */
8487 SET_BlendColor(table
, save_BlendColor
);
8488 SET_BlendEquation(table
, save_BlendEquation
);
8490 /* 2. GL_EXT_blend_color */
8492 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8495 /* 3. GL_EXT_polygon_offset */
8496 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8498 /* 6. GL_EXT_texture3d */
8500 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8501 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8502 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8505 /* 37. GL_EXT_blend_minmax */
8507 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8510 /* 54. GL_EXT_point_parameters */
8511 SET_PointParameterf(table
, save_PointParameterfEXT
);
8512 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8514 /* 173. GL_EXT_blend_func_separate */
8515 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8517 /* 197. GL_MESA_window_pos */
8518 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8519 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8520 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8521 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8522 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8523 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8524 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8525 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8526 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8527 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8528 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8529 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8530 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8531 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8532 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8533 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8534 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8535 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8536 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8537 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8538 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8539 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8540 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8541 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8543 /* 233. GL_NV_vertex_program */
8544 /* The following commands DO NOT go into display lists:
8545 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8546 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8548 SET_BindProgramARB(table
, save_BindProgramNV
);
8550 /* 244. GL_ATI_envmap_bumpmap */
8551 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8552 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8554 /* 245. GL_ATI_fragment_shader */
8555 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8556 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8558 /* 262. GL_NV_point_sprite */
8559 SET_PointParameteri(table
, save_PointParameteriNV
);
8560 SET_PointParameteriv(table
, save_PointParameterivNV
);
8562 /* 268. GL_EXT_stencil_two_side */
8563 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8565 /* ???. GL_EXT_depth_bounds_test */
8566 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8568 /* ARB 1. GL_ARB_multitexture */
8569 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8571 /* ARB 3. GL_ARB_transpose_matrix */
8572 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8573 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8574 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8575 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8577 /* ARB 5. GL_ARB_multisample */
8578 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8580 /* ARB 12. GL_ARB_texture_compression */
8581 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8582 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8583 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8584 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8585 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8586 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8588 /* ARB 14. GL_ARB_point_parameters */
8589 /* aliased with EXT_point_parameters functions */
8591 /* ARB 25. GL_ARB_window_pos */
8592 /* aliased with MESA_window_pos functions */
8594 /* ARB 26. GL_ARB_vertex_program */
8595 /* ARB 27. GL_ARB_fragment_program */
8596 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8597 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8598 SET_BindProgramARB(table
, save_BindProgramNV
);
8599 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8600 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8601 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8602 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8603 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8604 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8605 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8606 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8608 SET_BeginQuery(table
, save_BeginQueryARB
);
8609 SET_EndQuery(table
, save_EndQueryARB
);
8610 SET_QueryCounter(table
, save_QueryCounter
);
8612 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8614 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8616 SET_UseProgram(table
, save_UseProgramObjectARB
);
8617 SET_Uniform1f(table
, save_Uniform1fARB
);
8618 SET_Uniform2f(table
, save_Uniform2fARB
);
8619 SET_Uniform3f(table
, save_Uniform3fARB
);
8620 SET_Uniform4f(table
, save_Uniform4fARB
);
8621 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8622 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8623 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8624 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8625 SET_Uniform1i(table
, save_Uniform1iARB
);
8626 SET_Uniform2i(table
, save_Uniform2iARB
);
8627 SET_Uniform3i(table
, save_Uniform3iARB
);
8628 SET_Uniform4i(table
, save_Uniform4iARB
);
8629 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8630 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8631 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8632 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8633 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8634 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8635 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8636 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8637 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8638 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8639 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8640 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8641 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8643 /* 299. GL_EXT_blend_equation_separate */
8644 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8646 /* GL_EXT_gpu_program_parameters */
8647 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8648 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8650 /* 364. GL_EXT_provoking_vertex */
8651 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8653 /* GL_EXT_texture_integer */
8654 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8655 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8656 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8657 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8659 /* 377. GL_EXT_separate_shader_objects */
8660 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8661 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8663 /* GL_ARB_color_buffer_float */
8664 SET_ClampColor(table
, save_ClampColorARB
);
8667 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8668 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8669 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8670 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8672 SET_Uniform1ui(table
, save_Uniform1ui
);
8673 SET_Uniform2ui(table
, save_Uniform2ui
);
8674 SET_Uniform3ui(table
, save_Uniform3ui
);
8675 SET_Uniform4ui(table
, save_Uniform4ui
);
8676 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8677 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8678 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8679 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8681 (void) save_Uniform1ui
;
8682 (void) save_Uniform2ui
;
8683 (void) save_Uniform3ui
;
8684 (void) save_Uniform4ui
;
8685 (void) save_Uniform1uiv
;
8686 (void) save_Uniform2uiv
;
8687 (void) save_Uniform3uiv
;
8688 (void) save_Uniform4uiv
;
8692 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8693 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8694 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8695 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8696 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8697 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8698 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8699 SET_DrawTransformFeedbackInstanced(table
,
8700 save_DrawTransformFeedbackInstanced
);
8701 SET_DrawTransformFeedbackStreamInstanced(table
,
8702 save_DrawTransformFeedbackStreamInstanced
);
8703 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8704 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8706 /* GL_ARB_instanced_arrays */
8707 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8709 /* GL_NV_texture_barrier */
8710 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8712 SET_BindSampler(table
, save_BindSampler
);
8713 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8714 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8715 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8716 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8717 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8718 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8720 /* GL_ARB_draw_buffer_blend */
8721 SET_BlendFunciARB(table
, save_BlendFunci
);
8722 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8723 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8724 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8726 /* GL_ARB_geometry_shader4 */
8727 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8728 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8729 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8731 /* GL_NV_conditional_render */
8732 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8733 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8736 SET_WaitSync(table
, save_WaitSync
);
8738 /* GL_ARB_uniform_buffer_object */
8739 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8741 /* GL_ARB_draw_instanced */
8742 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8743 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8745 /* GL_ARB_draw_elements_base_vertex */
8746 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8748 /* GL_ARB_base_instance */
8749 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8750 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8751 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8757 enum_string(GLenum k
)
8759 return _mesa_lookup_enum_by_nr(k
);
8764 * Print the commands in a display list. For debugging only.
8765 * TODO: many commands aren't handled yet.
8767 static void GLAPIENTRY
8768 print_list(struct gl_context
*ctx
, GLuint list
)
8770 struct gl_display_list
*dlist
;
8774 if (!islist(ctx
, list
)) {
8775 printf("%u is not a display list ID\n", list
);
8779 dlist
= _mesa_lookup_list(ctx
, list
);
8785 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8787 done
= n
? GL_FALSE
: GL_TRUE
;
8789 const OpCode opcode
= n
[0].opcode
;
8791 if (is_ext_opcode(opcode
)) {
8792 n
+= ext_opcode_print(ctx
, n
);
8797 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8800 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8801 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8803 case OPCODE_CALL_LIST
:
8804 printf("CallList %d\n", (int) n
[1].ui
);
8806 case OPCODE_CALL_LIST_OFFSET
:
8807 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8808 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8810 case OPCODE_DISABLE
:
8811 printf("Disable %s\n", enum_string(n
[1].e
));
8814 printf("Enable %s\n", enum_string(n
[1].e
));
8816 case OPCODE_FRUSTUM
:
8817 printf("Frustum %g %g %g %g %g %g\n",
8818 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8820 case OPCODE_LINE_STIPPLE
:
8821 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8823 case OPCODE_LOAD_IDENTITY
:
8824 printf("LoadIdentity\n");
8826 case OPCODE_LOAD_MATRIX
:
8827 printf("LoadMatrix\n");
8828 printf(" %8f %8f %8f %8f\n",
8829 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8830 printf(" %8f %8f %8f %8f\n",
8831 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8832 printf(" %8f %8f %8f %8f\n",
8833 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8834 printf(" %8f %8f %8f %8f\n",
8835 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8837 case OPCODE_MULT_MATRIX
:
8838 printf("MultMatrix (or Rotate)\n");
8839 printf(" %8f %8f %8f %8f\n",
8840 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8841 printf(" %8f %8f %8f %8f\n",
8842 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8843 printf(" %8f %8f %8f %8f\n",
8844 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8845 printf(" %8f %8f %8f %8f\n",
8846 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8849 printf("Ortho %g %g %g %g %g %g\n",
8850 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8852 case OPCODE_POP_ATTRIB
:
8853 printf("PopAttrib\n");
8855 case OPCODE_POP_MATRIX
:
8856 printf("PopMatrix\n");
8858 case OPCODE_POP_NAME
:
8859 printf("PopName\n");
8861 case OPCODE_PUSH_ATTRIB
:
8862 printf("PushAttrib %x\n", n
[1].bf
);
8864 case OPCODE_PUSH_MATRIX
:
8865 printf("PushMatrix\n");
8867 case OPCODE_PUSH_NAME
:
8868 printf("PushName %d\n", (int) n
[1].ui
);
8870 case OPCODE_RASTER_POS
:
8871 printf("RasterPos %g %g %g %g\n",
8872 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8875 printf("Rotate %g %g %g %g\n",
8876 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8879 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8881 case OPCODE_TRANSLATE
:
8882 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8884 case OPCODE_BIND_TEXTURE
:
8885 printf("BindTexture %s %d\n",
8886 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8888 case OPCODE_SHADE_MODEL
:
8889 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8892 printf("Map1 %s %.3f %.3f %d %d\n",
8893 _mesa_lookup_enum_by_nr(n
[1].ui
),
8894 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8897 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8898 _mesa_lookup_enum_by_nr(n
[1].ui
),
8899 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8900 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8902 case OPCODE_MAPGRID1
:
8903 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8905 case OPCODE_MAPGRID2
:
8906 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8907 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8909 case OPCODE_EVALMESH1
:
8910 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8912 case OPCODE_EVALMESH2
:
8913 printf("EvalMesh2 %d %d %d %d\n",
8914 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8917 case OPCODE_ATTR_1F_NV
:
8918 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8920 case OPCODE_ATTR_2F_NV
:
8921 printf("ATTR_2F_NV attr %d: %f %f\n",
8922 n
[1].i
, n
[2].f
, n
[3].f
);
8924 case OPCODE_ATTR_3F_NV
:
8925 printf("ATTR_3F_NV attr %d: %f %f %f\n",
8926 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8928 case OPCODE_ATTR_4F_NV
:
8929 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8930 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8932 case OPCODE_ATTR_1F_ARB
:
8933 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8935 case OPCODE_ATTR_2F_ARB
:
8936 printf("ATTR_2F_ARB attr %d: %f %f\n",
8937 n
[1].i
, n
[2].f
, n
[3].f
);
8939 case OPCODE_ATTR_3F_ARB
:
8940 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8941 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8943 case OPCODE_ATTR_4F_ARB
:
8944 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8945 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8948 case OPCODE_MATERIAL
:
8949 printf("MATERIAL %x %x: %f %f %f %f\n",
8950 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8953 printf("BEGIN %x\n", n
[1].i
);
8959 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8962 case OPCODE_EVAL_C1
:
8963 printf("EVAL_C1 %f\n", n
[1].f
);
8965 case OPCODE_EVAL_C2
:
8966 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8968 case OPCODE_EVAL_P1
:
8969 printf("EVAL_P1 %d\n", n
[1].i
);
8971 case OPCODE_EVAL_P2
:
8972 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8975 case OPCODE_PROVOKING_VERTEX
:
8976 printf("ProvokingVertex %s\n",
8977 _mesa_lookup_enum_by_nr(n
[1].ui
));
8981 * meta opcodes/commands
8984 printf("Error: %s %s\n",
8985 enum_string(n
[1].e
), (const char *) n
[2].data
);
8987 case OPCODE_CONTINUE
:
8988 printf("DISPLAY-LIST-CONTINUE\n");
8989 n
= (Node
*) n
[1].next
;
8991 case OPCODE_END_OF_LIST
:
8992 printf("END-LIST %u\n", list
);
8996 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8998 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8999 opcode
, (void *) n
);
9003 printf("command %d, %u operands\n", opcode
,
9007 /* increment n to point to next compiled command */
9008 if (opcode
!= OPCODE_CONTINUE
) {
9009 n
+= InstSize
[opcode
];
9018 * Clients may call this function to help debug display list problems.
9019 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9020 * changed, or break in the future without notice.
9023 mesa_print_display_list(GLuint list
)
9025 GET_CURRENT_CONTEXT(ctx
);
9026 print_list(ctx
, list
);
9030 /**********************************************************************/
9031 /***** Initialization *****/
9032 /**********************************************************************/
9035 save_vtxfmt_init(GLvertexformat
* vfmt
)
9037 vfmt
->ArrayElement
= _ae_ArrayElement
;
9039 vfmt
->Begin
= save_Begin
;
9041 vfmt
->CallList
= save_CallList
;
9042 vfmt
->CallLists
= save_CallLists
;
9044 vfmt
->Color3f
= save_Color3f
;
9045 vfmt
->Color3fv
= save_Color3fv
;
9046 vfmt
->Color4f
= save_Color4f
;
9047 vfmt
->Color4fv
= save_Color4fv
;
9048 vfmt
->EdgeFlag
= save_EdgeFlag
;
9049 vfmt
->End
= save_End
;
9051 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9052 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9053 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9054 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9055 vfmt
->EvalPoint1
= save_EvalPoint1
;
9056 vfmt
->EvalPoint2
= save_EvalPoint2
;
9058 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9059 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9060 vfmt
->Indexf
= save_Indexf
;
9061 vfmt
->Indexfv
= save_Indexfv
;
9062 vfmt
->Materialfv
= save_Materialfv
;
9063 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9064 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9065 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9066 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9067 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9068 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9069 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9070 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9071 vfmt
->Normal3f
= save_Normal3f
;
9072 vfmt
->Normal3fv
= save_Normal3fv
;
9073 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9074 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9075 vfmt
->TexCoord1f
= save_TexCoord1f
;
9076 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9077 vfmt
->TexCoord2f
= save_TexCoord2f
;
9078 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9079 vfmt
->TexCoord3f
= save_TexCoord3f
;
9080 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9081 vfmt
->TexCoord4f
= save_TexCoord4f
;
9082 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9083 vfmt
->Vertex2f
= save_Vertex2f
;
9084 vfmt
->Vertex2fv
= save_Vertex2fv
;
9085 vfmt
->Vertex3f
= save_Vertex3f
;
9086 vfmt
->Vertex3fv
= save_Vertex3fv
;
9087 vfmt
->Vertex4f
= save_Vertex4f
;
9088 vfmt
->Vertex4fv
= save_Vertex4fv
;
9089 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9090 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9091 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9092 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9093 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9094 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9095 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9096 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9101 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9102 const GLvertexformat
*vfmt
)
9104 SET_CallList(disp
, vfmt
->CallList
);
9105 SET_CallLists(disp
, vfmt
->CallLists
);
9110 * Initialize display list state for given context.
9113 _mesa_init_display_list(struct gl_context
*ctx
)
9115 static GLboolean tableInitialized
= GL_FALSE
;
9117 /* zero-out the instruction size table, just once */
9118 if (!tableInitialized
) {
9119 memset(InstSize
, 0, sizeof(InstSize
));
9120 tableInitialized
= GL_TRUE
;
9123 /* extension info */
9124 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9127 ctx
->ListState
.CallDepth
= 0;
9128 ctx
->ExecuteFlag
= GL_TRUE
;
9129 ctx
->CompileFlag
= GL_FALSE
;
9130 ctx
->ListState
.CurrentBlock
= NULL
;
9131 ctx
->ListState
.CurrentPos
= 0;
9133 /* Display List group */
9134 ctx
->List
.ListBase
= 0;
9136 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9141 _mesa_free_display_list_data(struct gl_context
*ctx
)
9144 ctx
->ListExt
= NULL
;