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
];
723 case OPCODE_CONTINUE
:
724 n
= (Node
*) n
[1].next
;
728 case OPCODE_END_OF_LIST
:
733 /* Most frequent case */
734 n
+= InstSize
[n
[0].opcode
];
746 * Destroy a display list and remove from hash table.
747 * \param list - display list number
750 destroy_list(struct gl_context
*ctx
, GLuint list
)
752 struct gl_display_list
*dlist
;
757 dlist
= _mesa_lookup_list(ctx
, list
);
761 _mesa_delete_list(ctx
, dlist
);
762 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
767 * Translate the nth element of list from <type> to GLint.
770 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
782 bptr
= (GLbyte
*) list
;
783 return (GLint
) bptr
[n
];
784 case GL_UNSIGNED_BYTE
:
785 ubptr
= (GLubyte
*) list
;
786 return (GLint
) ubptr
[n
];
788 sptr
= (GLshort
*) list
;
789 return (GLint
) sptr
[n
];
790 case GL_UNSIGNED_SHORT
:
791 usptr
= (GLushort
*) list
;
792 return (GLint
) usptr
[n
];
794 iptr
= (GLint
*) list
;
796 case GL_UNSIGNED_INT
:
797 uiptr
= (GLuint
*) list
;
798 return (GLint
) uiptr
[n
];
800 fptr
= (GLfloat
*) list
;
801 return (GLint
) FLOORF(fptr
[n
]);
803 ubptr
= ((GLubyte
*) list
) + 2 * n
;
804 return (GLint
) ubptr
[0] * 256
807 ubptr
= ((GLubyte
*) list
) + 3 * n
;
808 return (GLint
) ubptr
[0] * 65536
809 + (GLint
) ubptr
[1] * 256
812 ubptr
= ((GLubyte
*) list
) + 4 * n
;
813 return (GLint
) ubptr
[0] * 16777216
814 + (GLint
) ubptr
[1] * 65536
815 + (GLint
) ubptr
[2] * 256
825 /**********************************************************************/
827 /**********************************************************************/
830 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
831 * If width < 0 or height < 0 or format or type are invalid we'll just
832 * return NULL. We will not generate an error since OpenGL command
833 * arguments aren't error-checked until the command is actually executed
834 * (not when they're compiled).
835 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
838 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
839 GLsizei width
, GLsizei height
, GLsizei depth
,
840 GLenum format
, GLenum type
, const GLvoid
* pixels
,
841 const struct gl_pixelstore_attrib
*unpack
)
843 if (width
<= 0 || height
<= 0) {
847 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
848 /* bad format and/or type */
852 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
856 if (type
== GL_BITMAP
)
857 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
859 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
860 format
, type
, pixels
, unpack
);
861 if (pixels
&& !image
) {
862 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
866 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
867 depth
, format
, type
, INT_MAX
, pixels
)) {
868 const GLubyte
*map
, *src
;
872 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
873 GL_MAP_READ_BIT
, unpack
->BufferObj
);
875 /* unable to map src buffer! */
876 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
880 src
= ADD_POINTERS(map
, pixels
);
881 if (type
== GL_BITMAP
)
882 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
884 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
885 format
, type
, src
, unpack
);
887 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
890 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
896 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
901 * Allocate space for a display list instruction (opcode + payload space).
902 * \param opcode the instruction opcode (OPCODE_* value)
903 * \param bytes instruction payload size (not counting opcode)
904 * \return pointer to allocated memory (the opcode space)
907 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
909 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
912 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
913 if (InstSize
[opcode
] == 0) {
914 /* save instruction size now */
915 InstSize
[opcode
] = numNodes
;
918 /* make sure instruction size agrees */
919 ASSERT(numNodes
== InstSize
[opcode
]);
923 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
924 /* This block is full. Allocate a new block and chain to it */
926 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
927 n
[0].opcode
= OPCODE_CONTINUE
;
928 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
930 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
933 n
[1].next
= (Node
*) newblock
;
934 ctx
->ListState
.CurrentBlock
= newblock
;
935 ctx
->ListState
.CurrentPos
= 0;
938 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
939 ctx
->ListState
.CurrentPos
+= numNodes
;
941 n
[0].opcode
= opcode
;
949 * Allocate space for a display list instruction. Used by callers outside
950 * this file for things like VBO vertex data.
952 * \param opcode the instruction opcode (OPCODE_* value)
953 * \param bytes instruction size in bytes, not counting opcode.
954 * \return pointer to the usable data area (not including the internal
958 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
960 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
962 return n
+ 1; /* return pointer to payload area, after opcode */
969 * This function allows modules and drivers to get their own opcodes
970 * for extending display list functionality.
971 * \param ctx the rendering context
972 * \param size number of bytes for storing the new display list command
973 * \param execute function to execute the new display list command
974 * \param destroy function to destroy the new display list command
975 * \param print function to print the new display list command
976 * \return the new opcode number or -1 if error
979 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
981 void (*execute
) (struct gl_context
*, void *),
982 void (*destroy
) (struct gl_context
*, void *),
983 void (*print
) (struct gl_context
*, void *))
985 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
986 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
987 ctx
->ListExt
->Opcode
[i
].Size
=
988 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
989 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
990 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
991 ctx
->ListExt
->Opcode
[i
].Print
= print
;
992 return i
+ OPCODE_EXT_0
;
999 * Allocate space for a display list instruction. The space is basically
1000 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1001 * function parameter, node[2] is the second parameter, etc.
1003 * \param opcode one of OPCODE_x
1004 * \param nparams number of function parameters
1005 * \return pointer to start of instruction space
1007 static inline Node
*
1008 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1010 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1016 * Display List compilation functions
1018 static void GLAPIENTRY
1019 save_Accum(GLenum op
, GLfloat value
)
1021 GET_CURRENT_CONTEXT(ctx
);
1023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1024 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1029 if (ctx
->ExecuteFlag
) {
1030 CALL_Accum(ctx
->Exec
, (op
, value
));
1035 static void GLAPIENTRY
1036 save_AlphaFunc(GLenum func
, GLclampf ref
)
1038 GET_CURRENT_CONTEXT(ctx
);
1040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1041 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1044 n
[2].f
= (GLfloat
) ref
;
1046 if (ctx
->ExecuteFlag
) {
1047 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1052 static void GLAPIENTRY
1053 save_BindTexture(GLenum target
, GLuint texture
)
1055 GET_CURRENT_CONTEXT(ctx
);
1057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1058 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1063 if (ctx
->ExecuteFlag
) {
1064 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1069 static void GLAPIENTRY
1070 save_Bitmap(GLsizei width
, GLsizei height
,
1071 GLfloat xorig
, GLfloat yorig
,
1072 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1074 GET_CURRENT_CONTEXT(ctx
);
1076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1077 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1079 n
[1].i
= (GLint
) width
;
1080 n
[2].i
= (GLint
) height
;
1085 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1086 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1088 if (ctx
->ExecuteFlag
) {
1089 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1090 xorig
, yorig
, xmove
, ymove
, pixels
));
1095 static void GLAPIENTRY
1096 save_BlendEquation(GLenum mode
)
1098 GET_CURRENT_CONTEXT(ctx
);
1100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1101 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1105 if (ctx
->ExecuteFlag
) {
1106 CALL_BlendEquation(ctx
->Exec
, (mode
));
1111 static void GLAPIENTRY
1112 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1114 GET_CURRENT_CONTEXT(ctx
);
1116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1117 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1122 if (ctx
->ExecuteFlag
) {
1123 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1128 static void GLAPIENTRY
1129 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1130 GLenum sfactorA
, GLenum dfactorA
)
1132 GET_CURRENT_CONTEXT(ctx
);
1134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1135 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1137 n
[1].e
= sfactorRGB
;
1138 n
[2].e
= dfactorRGB
;
1142 if (ctx
->ExecuteFlag
) {
1143 CALL_BlendFuncSeparate(ctx
->Exec
,
1144 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1149 static void GLAPIENTRY
1150 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1152 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1156 static void GLAPIENTRY
1157 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1159 GET_CURRENT_CONTEXT(ctx
);
1161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1162 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1169 if (ctx
->ExecuteFlag
) {
1170 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1174 /* GL_ARB_draw_buffers_blend */
1175 static void GLAPIENTRY
1176 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1177 GLenum sfactorA
, GLenum dfactorA
)
1179 GET_CURRENT_CONTEXT(ctx
);
1181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1182 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1185 n
[2].e
= sfactorRGB
;
1186 n
[3].e
= dfactorRGB
;
1190 if (ctx
->ExecuteFlag
) {
1191 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1192 sfactorA
, dfactorA
));
1196 /* GL_ARB_draw_buffers_blend */
1197 static void GLAPIENTRY
1198 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1200 GET_CURRENT_CONTEXT(ctx
);
1202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1203 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1209 if (ctx
->ExecuteFlag
) {
1210 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1214 /* GL_ARB_draw_buffers_blend */
1215 static void GLAPIENTRY
1216 save_BlendEquationi(GLuint buf
, GLenum mode
)
1218 GET_CURRENT_CONTEXT(ctx
);
1220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1221 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1226 if (ctx
->ExecuteFlag
) {
1227 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1231 /* GL_ARB_draw_buffers_blend */
1232 static void GLAPIENTRY
1233 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1235 GET_CURRENT_CONTEXT(ctx
);
1237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1238 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1244 if (ctx
->ExecuteFlag
) {
1245 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1250 /* GL_ARB_draw_instanced. */
1251 static void GLAPIENTRY
1252 save_DrawArraysInstancedARB(GLenum mode
,
1257 GET_CURRENT_CONTEXT(ctx
);
1258 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1259 "glDrawArraysInstanced() during display list compile");
1262 static void GLAPIENTRY
1263 save_DrawElementsInstancedARB(GLenum mode
,
1266 const GLvoid
*indices
,
1269 GET_CURRENT_CONTEXT(ctx
);
1270 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1271 "glDrawElementsInstanced() during display list compile");
1274 static void GLAPIENTRY
1275 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1278 const GLvoid
*indices
,
1282 GET_CURRENT_CONTEXT(ctx
);
1283 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1284 "glDrawElementsInstancedBaseVertex() during display list compile");
1287 /* GL_ARB_base_instance. */
1288 static void GLAPIENTRY
1289 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1293 GLuint baseinstance
)
1295 GET_CURRENT_CONTEXT(ctx
);
1296 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1297 "glDrawArraysInstancedBaseInstance() during display list compile");
1300 static void APIENTRY
1301 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1304 const void *indices
,
1306 GLuint baseinstance
)
1308 GET_CURRENT_CONTEXT(ctx
);
1309 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1310 "glDrawElementsInstancedBaseInstance() during display list compile");
1313 static void APIENTRY
1314 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1317 const void *indices
,
1320 GLuint baseinstance
)
1322 GET_CURRENT_CONTEXT(ctx
);
1323 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1324 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1329 * While building a display list we cache some OpenGL state.
1330 * Under some circumstances we need to invalidate that state (immediately
1331 * when we start compiling a list, or after glCallList(s)).
1334 invalidate_saved_current_state(struct gl_context
*ctx
)
1338 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1339 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1341 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1342 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1344 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1346 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1350 static void GLAPIENTRY
1351 save_CallList(GLuint list
)
1353 GET_CURRENT_CONTEXT(ctx
);
1355 SAVE_FLUSH_VERTICES(ctx
);
1357 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1362 /* After this, we don't know what state we're in. Invalidate all
1363 * cached information previously gathered:
1365 invalidate_saved_current_state( ctx
);
1367 if (ctx
->ExecuteFlag
) {
1368 _mesa_CallList(list
);
1373 static void GLAPIENTRY
1374 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1376 GET_CURRENT_CONTEXT(ctx
);
1378 GLboolean typeErrorFlag
;
1380 SAVE_FLUSH_VERTICES(ctx
);
1384 case GL_UNSIGNED_BYTE
:
1386 case GL_UNSIGNED_SHORT
:
1388 case GL_UNSIGNED_INT
:
1393 typeErrorFlag
= GL_FALSE
;
1396 typeErrorFlag
= GL_TRUE
;
1399 for (i
= 0; i
< num
; i
++) {
1400 GLint list
= translate_id(i
, type
, lists
);
1401 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1404 n
[2].b
= typeErrorFlag
;
1408 /* After this, we don't know what state we're in. Invalidate all
1409 * cached information previously gathered:
1411 invalidate_saved_current_state( ctx
);
1413 if (ctx
->ExecuteFlag
) {
1414 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1419 static void GLAPIENTRY
1420 save_Clear(GLbitfield mask
)
1422 GET_CURRENT_CONTEXT(ctx
);
1424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1425 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1429 if (ctx
->ExecuteFlag
) {
1430 CALL_Clear(ctx
->Exec
, (mask
));
1435 static void GLAPIENTRY
1436 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1438 GET_CURRENT_CONTEXT(ctx
);
1440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1441 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1444 n
[2].i
= drawbuffer
;
1446 if (buffer
== GL_COLOR
) {
1457 if (ctx
->ExecuteFlag
) {
1458 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1463 static void GLAPIENTRY
1464 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1466 GET_CURRENT_CONTEXT(ctx
);
1468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1469 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1472 n
[2].i
= drawbuffer
;
1474 if (buffer
== GL_COLOR
) {
1485 if (ctx
->ExecuteFlag
) {
1486 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1491 static void GLAPIENTRY
1492 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1494 GET_CURRENT_CONTEXT(ctx
);
1496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1497 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1500 n
[2].i
= drawbuffer
;
1502 if (buffer
== GL_COLOR
) {
1513 if (ctx
->ExecuteFlag
) {
1514 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1519 static void GLAPIENTRY
1520 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1521 GLfloat depth
, GLint stencil
)
1523 GET_CURRENT_CONTEXT(ctx
);
1525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1526 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1529 n
[2].i
= drawbuffer
;
1533 if (ctx
->ExecuteFlag
) {
1534 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1539 static void GLAPIENTRY
1540 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1542 GET_CURRENT_CONTEXT(ctx
);
1544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1545 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1552 if (ctx
->ExecuteFlag
) {
1553 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1558 static void GLAPIENTRY
1559 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1561 GET_CURRENT_CONTEXT(ctx
);
1563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1564 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1571 if (ctx
->ExecuteFlag
) {
1572 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1577 static void GLAPIENTRY
1578 save_ClearDepth(GLclampd depth
)
1580 GET_CURRENT_CONTEXT(ctx
);
1582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1583 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1585 n
[1].f
= (GLfloat
) depth
;
1587 if (ctx
->ExecuteFlag
) {
1588 CALL_ClearDepth(ctx
->Exec
, (depth
));
1593 static void GLAPIENTRY
1594 save_ClearIndex(GLfloat c
)
1596 GET_CURRENT_CONTEXT(ctx
);
1598 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1599 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1603 if (ctx
->ExecuteFlag
) {
1604 CALL_ClearIndex(ctx
->Exec
, (c
));
1609 static void GLAPIENTRY
1610 save_ClearStencil(GLint s
)
1612 GET_CURRENT_CONTEXT(ctx
);
1614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1615 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1619 if (ctx
->ExecuteFlag
) {
1620 CALL_ClearStencil(ctx
->Exec
, (s
));
1625 static void GLAPIENTRY
1626 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1628 GET_CURRENT_CONTEXT(ctx
);
1630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1631 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1634 n
[2].f
= (GLfloat
) equ
[0];
1635 n
[3].f
= (GLfloat
) equ
[1];
1636 n
[4].f
= (GLfloat
) equ
[2];
1637 n
[5].f
= (GLfloat
) equ
[3];
1639 if (ctx
->ExecuteFlag
) {
1640 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1646 static void GLAPIENTRY
1647 save_ColorMask(GLboolean red
, GLboolean green
,
1648 GLboolean blue
, GLboolean alpha
)
1650 GET_CURRENT_CONTEXT(ctx
);
1652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1653 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1660 if (ctx
->ExecuteFlag
) {
1661 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1666 static void GLAPIENTRY
1667 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1668 GLboolean blue
, GLboolean alpha
)
1670 GET_CURRENT_CONTEXT(ctx
);
1672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1673 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1681 if (ctx
->ExecuteFlag
) {
1682 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1687 static void GLAPIENTRY
1688 save_ColorMaterial(GLenum face
, GLenum mode
)
1690 GET_CURRENT_CONTEXT(ctx
);
1692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1694 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1699 if (ctx
->ExecuteFlag
) {
1700 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1705 static void GLAPIENTRY
1706 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1708 GET_CURRENT_CONTEXT(ctx
);
1710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1711 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1715 n
[3].i
= (GLint
) width
;
1716 n
[4].i
= (GLint
) height
;
1719 if (ctx
->ExecuteFlag
) {
1720 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1726 static void GLAPIENTRY
1727 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1728 GLint x
, GLint y
, GLsizei width
, GLint border
)
1730 GET_CURRENT_CONTEXT(ctx
);
1732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1733 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1737 n
[3].e
= internalformat
;
1743 if (ctx
->ExecuteFlag
) {
1744 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1745 x
, y
, width
, border
));
1750 static void GLAPIENTRY
1751 save_CopyTexImage2D(GLenum target
, GLint level
,
1752 GLenum internalformat
,
1753 GLint x
, GLint y
, GLsizei width
,
1754 GLsizei height
, GLint border
)
1756 GET_CURRENT_CONTEXT(ctx
);
1758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1759 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1763 n
[3].e
= internalformat
;
1770 if (ctx
->ExecuteFlag
) {
1771 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1772 x
, y
, width
, height
, border
));
1778 static void GLAPIENTRY
1779 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1780 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1782 GET_CURRENT_CONTEXT(ctx
);
1784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1785 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1794 if (ctx
->ExecuteFlag
) {
1795 CALL_CopyTexSubImage1D(ctx
->Exec
,
1796 (target
, level
, xoffset
, x
, y
, width
));
1801 static void GLAPIENTRY
1802 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1803 GLint xoffset
, GLint yoffset
,
1804 GLint x
, GLint y
, GLsizei width
, GLint height
)
1806 GET_CURRENT_CONTEXT(ctx
);
1808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1809 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1820 if (ctx
->ExecuteFlag
) {
1821 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1822 x
, y
, width
, height
));
1827 static void GLAPIENTRY
1828 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1829 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1830 GLint x
, GLint y
, GLsizei width
, GLint height
)
1832 GET_CURRENT_CONTEXT(ctx
);
1834 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1835 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1847 if (ctx
->ExecuteFlag
) {
1848 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1849 xoffset
, yoffset
, zoffset
,
1850 x
, y
, width
, height
));
1855 static void GLAPIENTRY
1856 save_CullFace(GLenum mode
)
1858 GET_CURRENT_CONTEXT(ctx
);
1860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1861 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1865 if (ctx
->ExecuteFlag
) {
1866 CALL_CullFace(ctx
->Exec
, (mode
));
1871 static void GLAPIENTRY
1872 save_DepthFunc(GLenum func
)
1874 GET_CURRENT_CONTEXT(ctx
);
1876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1877 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1881 if (ctx
->ExecuteFlag
) {
1882 CALL_DepthFunc(ctx
->Exec
, (func
));
1887 static void GLAPIENTRY
1888 save_DepthMask(GLboolean mask
)
1890 GET_CURRENT_CONTEXT(ctx
);
1892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1893 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1897 if (ctx
->ExecuteFlag
) {
1898 CALL_DepthMask(ctx
->Exec
, (mask
));
1903 static void GLAPIENTRY
1904 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1906 GET_CURRENT_CONTEXT(ctx
);
1908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1909 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1911 n
[1].f
= (GLfloat
) nearval
;
1912 n
[2].f
= (GLfloat
) farval
;
1914 if (ctx
->ExecuteFlag
) {
1915 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1920 static void GLAPIENTRY
1921 save_Disable(GLenum cap
)
1923 GET_CURRENT_CONTEXT(ctx
);
1925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1926 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
1930 if (ctx
->ExecuteFlag
) {
1931 CALL_Disable(ctx
->Exec
, (cap
));
1936 static void GLAPIENTRY
1937 save_DisableIndexed(GLuint index
, GLenum cap
)
1939 GET_CURRENT_CONTEXT(ctx
);
1941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1942 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
1947 if (ctx
->ExecuteFlag
) {
1948 CALL_Disablei(ctx
->Exec
, (index
, cap
));
1953 static void GLAPIENTRY
1954 save_DrawBuffer(GLenum mode
)
1956 GET_CURRENT_CONTEXT(ctx
);
1958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1959 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
1963 if (ctx
->ExecuteFlag
) {
1964 CALL_DrawBuffer(ctx
->Exec
, (mode
));
1969 static void GLAPIENTRY
1970 save_DrawPixels(GLsizei width
, GLsizei height
,
1971 GLenum format
, GLenum type
, const GLvoid
* pixels
)
1973 GET_CURRENT_CONTEXT(ctx
);
1976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1978 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
1984 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
1985 pixels
, &ctx
->Unpack
);
1987 if (ctx
->ExecuteFlag
) {
1988 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
1994 static void GLAPIENTRY
1995 save_Enable(GLenum cap
)
1997 GET_CURRENT_CONTEXT(ctx
);
1999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2000 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2004 if (ctx
->ExecuteFlag
) {
2005 CALL_Enable(ctx
->Exec
, (cap
));
2011 static void GLAPIENTRY
2012 save_EnableIndexed(GLuint index
, GLenum cap
)
2014 GET_CURRENT_CONTEXT(ctx
);
2016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2017 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2022 if (ctx
->ExecuteFlag
) {
2023 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2029 static void GLAPIENTRY
2030 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2032 GET_CURRENT_CONTEXT(ctx
);
2034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2035 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2041 if (ctx
->ExecuteFlag
) {
2042 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2047 static void GLAPIENTRY
2048 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2050 GET_CURRENT_CONTEXT(ctx
);
2052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2053 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2061 if (ctx
->ExecuteFlag
) {
2062 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2069 static void GLAPIENTRY
2070 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2072 GET_CURRENT_CONTEXT(ctx
);
2074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2075 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2083 if (ctx
->ExecuteFlag
) {
2084 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2089 static void GLAPIENTRY
2090 save_Fogf(GLenum pname
, GLfloat param
)
2094 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2095 save_Fogfv(pname
, parray
);
2099 static void GLAPIENTRY
2100 save_Fogiv(GLenum pname
, const GLint
*params
)
2105 case GL_FOG_DENSITY
:
2109 p
[0] = (GLfloat
) *params
;
2115 p
[0] = INT_TO_FLOAT(params
[0]);
2116 p
[1] = INT_TO_FLOAT(params
[1]);
2117 p
[2] = INT_TO_FLOAT(params
[2]);
2118 p
[3] = INT_TO_FLOAT(params
[3]);
2121 /* Error will be caught later in gl_Fogfv */
2122 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2124 save_Fogfv(pname
, p
);
2128 static void GLAPIENTRY
2129 save_Fogi(GLenum pname
, GLint param
)
2133 parray
[1] = parray
[2] = parray
[3] = 0;
2134 save_Fogiv(pname
, parray
);
2138 static void GLAPIENTRY
2139 save_FrontFace(GLenum mode
)
2141 GET_CURRENT_CONTEXT(ctx
);
2143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2144 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2148 if (ctx
->ExecuteFlag
) {
2149 CALL_FrontFace(ctx
->Exec
, (mode
));
2154 static void GLAPIENTRY
2155 save_Frustum(GLdouble left
, GLdouble right
,
2156 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2158 GET_CURRENT_CONTEXT(ctx
);
2160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2161 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2163 n
[1].f
= (GLfloat
) left
;
2164 n
[2].f
= (GLfloat
) right
;
2165 n
[3].f
= (GLfloat
) bottom
;
2166 n
[4].f
= (GLfloat
) top
;
2167 n
[5].f
= (GLfloat
) nearval
;
2168 n
[6].f
= (GLfloat
) farval
;
2170 if (ctx
->ExecuteFlag
) {
2171 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2176 static void GLAPIENTRY
2177 save_Hint(GLenum target
, GLenum mode
)
2179 GET_CURRENT_CONTEXT(ctx
);
2181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2182 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2187 if (ctx
->ExecuteFlag
) {
2188 CALL_Hint(ctx
->Exec
, (target
, mode
));
2193 static void GLAPIENTRY
2194 save_IndexMask(GLuint mask
)
2196 GET_CURRENT_CONTEXT(ctx
);
2198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2199 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2203 if (ctx
->ExecuteFlag
) {
2204 CALL_IndexMask(ctx
->Exec
, (mask
));
2209 static void GLAPIENTRY
2210 save_InitNames(void)
2212 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2215 if (ctx
->ExecuteFlag
) {
2216 CALL_InitNames(ctx
->Exec
, ());
2221 static void GLAPIENTRY
2222 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2224 GET_CURRENT_CONTEXT(ctx
);
2226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2227 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2245 case GL_SPOT_DIRECTION
:
2248 case GL_SPOT_EXPONENT
:
2251 case GL_SPOT_CUTOFF
:
2254 case GL_CONSTANT_ATTENUATION
:
2257 case GL_LINEAR_ATTENUATION
:
2260 case GL_QUADRATIC_ATTENUATION
:
2266 for (i
= 0; i
< nParams
; i
++) {
2267 n
[3 + i
].f
= params
[i
];
2270 if (ctx
->ExecuteFlag
) {
2271 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2276 static void GLAPIENTRY
2277 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2281 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2282 save_Lightfv(light
, pname
, parray
);
2286 static void GLAPIENTRY
2287 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2294 fparam
[0] = INT_TO_FLOAT(params
[0]);
2295 fparam
[1] = INT_TO_FLOAT(params
[1]);
2296 fparam
[2] = INT_TO_FLOAT(params
[2]);
2297 fparam
[3] = INT_TO_FLOAT(params
[3]);
2300 fparam
[0] = (GLfloat
) params
[0];
2301 fparam
[1] = (GLfloat
) params
[1];
2302 fparam
[2] = (GLfloat
) params
[2];
2303 fparam
[3] = (GLfloat
) params
[3];
2305 case GL_SPOT_DIRECTION
:
2306 fparam
[0] = (GLfloat
) params
[0];
2307 fparam
[1] = (GLfloat
) params
[1];
2308 fparam
[2] = (GLfloat
) params
[2];
2310 case GL_SPOT_EXPONENT
:
2311 case GL_SPOT_CUTOFF
:
2312 case GL_CONSTANT_ATTENUATION
:
2313 case GL_LINEAR_ATTENUATION
:
2314 case GL_QUADRATIC_ATTENUATION
:
2315 fparam
[0] = (GLfloat
) params
[0];
2318 /* error will be caught later in gl_Lightfv */
2321 save_Lightfv(light
, pname
, fparam
);
2325 static void GLAPIENTRY
2326 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2330 parray
[1] = parray
[2] = parray
[3] = 0;
2331 save_Lightiv(light
, pname
, parray
);
2335 static void GLAPIENTRY
2336 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2338 GET_CURRENT_CONTEXT(ctx
);
2340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2341 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2349 if (ctx
->ExecuteFlag
) {
2350 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2355 static void GLAPIENTRY
2356 save_LightModelf(GLenum pname
, GLfloat param
)
2360 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2361 save_LightModelfv(pname
, parray
);
2365 static void GLAPIENTRY
2366 save_LightModeliv(GLenum pname
, const GLint
*params
)
2370 case GL_LIGHT_MODEL_AMBIENT
:
2371 fparam
[0] = INT_TO_FLOAT(params
[0]);
2372 fparam
[1] = INT_TO_FLOAT(params
[1]);
2373 fparam
[2] = INT_TO_FLOAT(params
[2]);
2374 fparam
[3] = INT_TO_FLOAT(params
[3]);
2376 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2377 case GL_LIGHT_MODEL_TWO_SIDE
:
2378 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2379 fparam
[0] = (GLfloat
) params
[0];
2385 /* Error will be caught later in gl_LightModelfv */
2386 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2388 save_LightModelfv(pname
, fparam
);
2392 static void GLAPIENTRY
2393 save_LightModeli(GLenum pname
, GLint param
)
2397 parray
[1] = parray
[2] = parray
[3] = 0;
2398 save_LightModeliv(pname
, parray
);
2402 static void GLAPIENTRY
2403 save_LineStipple(GLint factor
, GLushort pattern
)
2405 GET_CURRENT_CONTEXT(ctx
);
2407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2408 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2419 static void GLAPIENTRY
2420 save_LineWidth(GLfloat width
)
2422 GET_CURRENT_CONTEXT(ctx
);
2424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2425 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2429 if (ctx
->ExecuteFlag
) {
2430 CALL_LineWidth(ctx
->Exec
, (width
));
2435 static void GLAPIENTRY
2436 save_ListBase(GLuint base
)
2438 GET_CURRENT_CONTEXT(ctx
);
2440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2441 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2445 if (ctx
->ExecuteFlag
) {
2446 CALL_ListBase(ctx
->Exec
, (base
));
2451 static void GLAPIENTRY
2452 save_LoadIdentity(void)
2454 GET_CURRENT_CONTEXT(ctx
);
2455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2456 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2457 if (ctx
->ExecuteFlag
) {
2458 CALL_LoadIdentity(ctx
->Exec
, ());
2463 static void GLAPIENTRY
2464 save_LoadMatrixf(const GLfloat
* m
)
2466 GET_CURRENT_CONTEXT(ctx
);
2468 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2469 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2472 for (i
= 0; i
< 16; i
++) {
2476 if (ctx
->ExecuteFlag
) {
2477 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2482 static void GLAPIENTRY
2483 save_LoadMatrixd(const GLdouble
* m
)
2487 for (i
= 0; i
< 16; i
++) {
2488 f
[i
] = (GLfloat
) m
[i
];
2490 save_LoadMatrixf(f
);
2494 static void GLAPIENTRY
2495 save_LoadName(GLuint name
)
2497 GET_CURRENT_CONTEXT(ctx
);
2499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2500 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2504 if (ctx
->ExecuteFlag
) {
2505 CALL_LoadName(ctx
->Exec
, (name
));
2510 static void GLAPIENTRY
2511 save_LogicOp(GLenum opcode
)
2513 GET_CURRENT_CONTEXT(ctx
);
2515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2516 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2520 if (ctx
->ExecuteFlag
) {
2521 CALL_LogicOp(ctx
->Exec
, (opcode
));
2526 static void GLAPIENTRY
2527 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2528 GLint order
, const GLdouble
* points
)
2530 GET_CURRENT_CONTEXT(ctx
);
2532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2533 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2535 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2537 n
[2].f
= (GLfloat
) u1
;
2538 n
[3].f
= (GLfloat
) u2
;
2539 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2541 n
[6].data
= (void *) pnts
;
2543 if (ctx
->ExecuteFlag
) {
2544 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2548 static void GLAPIENTRY
2549 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2550 GLint order
, const GLfloat
* points
)
2552 GET_CURRENT_CONTEXT(ctx
);
2554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2555 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2557 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2561 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2563 n
[6].data
= (void *) pnts
;
2565 if (ctx
->ExecuteFlag
) {
2566 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2571 static void GLAPIENTRY
2572 save_Map2d(GLenum target
,
2573 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2574 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2575 const GLdouble
* points
)
2577 GET_CURRENT_CONTEXT(ctx
);
2579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2580 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2582 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2583 vstride
, vorder
, points
);
2585 n
[2].f
= (GLfloat
) u1
;
2586 n
[3].f
= (GLfloat
) u2
;
2587 n
[4].f
= (GLfloat
) v1
;
2588 n
[5].f
= (GLfloat
) v2
;
2589 /* XXX verify these strides are correct */
2590 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2591 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2594 n
[10].data
= (void *) pnts
;
2596 if (ctx
->ExecuteFlag
) {
2597 CALL_Map2d(ctx
->Exec
, (target
,
2598 u1
, u2
, ustride
, uorder
,
2599 v1
, v2
, vstride
, vorder
, points
));
2604 static void GLAPIENTRY
2605 save_Map2f(GLenum target
,
2606 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2607 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2608 const GLfloat
* points
)
2610 GET_CURRENT_CONTEXT(ctx
);
2612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2613 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2615 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2616 vstride
, vorder
, points
);
2622 /* XXX verify these strides are correct */
2623 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2624 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2627 n
[10].data
= (void *) pnts
;
2629 if (ctx
->ExecuteFlag
) {
2630 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2631 v1
, v2
, vstride
, vorder
, points
));
2636 static void GLAPIENTRY
2637 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2639 GET_CURRENT_CONTEXT(ctx
);
2641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2642 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2648 if (ctx
->ExecuteFlag
) {
2649 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2654 static void GLAPIENTRY
2655 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2657 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2661 static void GLAPIENTRY
2662 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2663 GLint vn
, GLfloat v1
, GLfloat v2
)
2665 GET_CURRENT_CONTEXT(ctx
);
2667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2668 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2677 if (ctx
->ExecuteFlag
) {
2678 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2684 static void GLAPIENTRY
2685 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2686 GLint vn
, GLdouble v1
, GLdouble v2
)
2688 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2689 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2693 static void GLAPIENTRY
2694 save_MatrixMode(GLenum mode
)
2696 GET_CURRENT_CONTEXT(ctx
);
2698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2699 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2703 if (ctx
->ExecuteFlag
) {
2704 CALL_MatrixMode(ctx
->Exec
, (mode
));
2709 static void GLAPIENTRY
2710 save_MultMatrixf(const GLfloat
* m
)
2712 GET_CURRENT_CONTEXT(ctx
);
2714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2715 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2718 for (i
= 0; i
< 16; i
++) {
2722 if (ctx
->ExecuteFlag
) {
2723 CALL_MultMatrixf(ctx
->Exec
, (m
));
2728 static void GLAPIENTRY
2729 save_MultMatrixd(const GLdouble
* m
)
2733 for (i
= 0; i
< 16; i
++) {
2734 f
[i
] = (GLfloat
) m
[i
];
2736 save_MultMatrixf(f
);
2740 static void GLAPIENTRY
2741 save_NewList(GLuint name
, GLenum mode
)
2743 GET_CURRENT_CONTEXT(ctx
);
2744 /* It's an error to call this function while building a display list */
2745 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2752 static void GLAPIENTRY
2753 save_Ortho(GLdouble left
, GLdouble right
,
2754 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2756 GET_CURRENT_CONTEXT(ctx
);
2758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2759 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2761 n
[1].f
= (GLfloat
) left
;
2762 n
[2].f
= (GLfloat
) right
;
2763 n
[3].f
= (GLfloat
) bottom
;
2764 n
[4].f
= (GLfloat
) top
;
2765 n
[5].f
= (GLfloat
) nearval
;
2766 n
[6].f
= (GLfloat
) farval
;
2768 if (ctx
->ExecuteFlag
) {
2769 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2774 static void GLAPIENTRY
2775 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2777 GET_CURRENT_CONTEXT(ctx
);
2779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2780 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
2784 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
2785 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
2787 if (ctx
->ExecuteFlag
) {
2788 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2793 static void GLAPIENTRY
2794 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2796 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2798 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2799 for (i
= 0; i
< mapsize
; i
++) {
2800 fvalues
[i
] = (GLfloat
) values
[i
];
2804 for (i
= 0; i
< mapsize
; i
++) {
2805 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2808 save_PixelMapfv(map
, mapsize
, fvalues
);
2812 static void GLAPIENTRY
2813 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2815 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2817 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2818 for (i
= 0; i
< mapsize
; i
++) {
2819 fvalues
[i
] = (GLfloat
) values
[i
];
2823 for (i
= 0; i
< mapsize
; i
++) {
2824 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2827 save_PixelMapfv(map
, mapsize
, fvalues
);
2831 static void GLAPIENTRY
2832 save_PixelTransferf(GLenum pname
, GLfloat param
)
2834 GET_CURRENT_CONTEXT(ctx
);
2836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2837 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2842 if (ctx
->ExecuteFlag
) {
2843 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2848 static void GLAPIENTRY
2849 save_PixelTransferi(GLenum pname
, GLint param
)
2851 save_PixelTransferf(pname
, (GLfloat
) param
);
2855 static void GLAPIENTRY
2856 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2858 GET_CURRENT_CONTEXT(ctx
);
2860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2861 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2866 if (ctx
->ExecuteFlag
) {
2867 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2872 static void GLAPIENTRY
2873 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2875 GET_CURRENT_CONTEXT(ctx
);
2877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2878 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2885 if (ctx
->ExecuteFlag
) {
2886 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2891 static void GLAPIENTRY
2892 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2896 parray
[1] = parray
[2] = 0.0F
;
2897 save_PointParameterfvEXT(pname
, parray
);
2900 static void GLAPIENTRY
2901 save_PointParameteriNV(GLenum pname
, GLint param
)
2904 parray
[0] = (GLfloat
) param
;
2905 parray
[1] = parray
[2] = 0.0F
;
2906 save_PointParameterfvEXT(pname
, parray
);
2909 static void GLAPIENTRY
2910 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2913 parray
[0] = (GLfloat
) param
[0];
2914 parray
[1] = parray
[2] = 0.0F
;
2915 save_PointParameterfvEXT(pname
, parray
);
2919 static void GLAPIENTRY
2920 save_PointSize(GLfloat size
)
2922 GET_CURRENT_CONTEXT(ctx
);
2924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2925 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
2929 if (ctx
->ExecuteFlag
) {
2930 CALL_PointSize(ctx
->Exec
, (size
));
2935 static void GLAPIENTRY
2936 save_PolygonMode(GLenum face
, GLenum mode
)
2938 GET_CURRENT_CONTEXT(ctx
);
2940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2941 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
2946 if (ctx
->ExecuteFlag
) {
2947 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
2952 static void GLAPIENTRY
2953 save_PolygonStipple(const GLubyte
* pattern
)
2955 GET_CURRENT_CONTEXT(ctx
);
2958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2960 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
2962 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
2963 pattern
, &ctx
->Unpack
);
2965 if (ctx
->ExecuteFlag
) {
2966 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
2971 static void GLAPIENTRY
2972 save_PolygonOffset(GLfloat factor
, GLfloat units
)
2974 GET_CURRENT_CONTEXT(ctx
);
2976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2977 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
2982 if (ctx
->ExecuteFlag
) {
2983 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
2988 static void GLAPIENTRY
2989 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
2991 GET_CURRENT_CONTEXT(ctx
);
2992 /* XXX mult by DepthMaxF here??? */
2993 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
2997 static void GLAPIENTRY
2998 save_PopAttrib(void)
3000 GET_CURRENT_CONTEXT(ctx
);
3001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3002 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3003 if (ctx
->ExecuteFlag
) {
3004 CALL_PopAttrib(ctx
->Exec
, ());
3009 static void GLAPIENTRY
3010 save_PopMatrix(void)
3012 GET_CURRENT_CONTEXT(ctx
);
3013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3014 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3015 if (ctx
->ExecuteFlag
) {
3016 CALL_PopMatrix(ctx
->Exec
, ());
3021 static void GLAPIENTRY
3024 GET_CURRENT_CONTEXT(ctx
);
3025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3026 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3027 if (ctx
->ExecuteFlag
) {
3028 CALL_PopName(ctx
->Exec
, ());
3033 static void GLAPIENTRY
3034 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3035 const GLclampf
* priorities
)
3037 GET_CURRENT_CONTEXT(ctx
);
3039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3041 for (i
= 0; i
< num
; i
++) {
3043 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3045 n
[1].ui
= textures
[i
];
3046 n
[2].f
= priorities
[i
];
3049 if (ctx
->ExecuteFlag
) {
3050 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3055 static void GLAPIENTRY
3056 save_PushAttrib(GLbitfield mask
)
3058 GET_CURRENT_CONTEXT(ctx
);
3060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3061 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3065 if (ctx
->ExecuteFlag
) {
3066 CALL_PushAttrib(ctx
->Exec
, (mask
));
3071 static void GLAPIENTRY
3072 save_PushMatrix(void)
3074 GET_CURRENT_CONTEXT(ctx
);
3075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3076 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3077 if (ctx
->ExecuteFlag
) {
3078 CALL_PushMatrix(ctx
->Exec
, ());
3083 static void GLAPIENTRY
3084 save_PushName(GLuint name
)
3086 GET_CURRENT_CONTEXT(ctx
);
3088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3089 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3093 if (ctx
->ExecuteFlag
) {
3094 CALL_PushName(ctx
->Exec
, (name
));
3099 static void GLAPIENTRY
3100 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3102 GET_CURRENT_CONTEXT(ctx
);
3104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3105 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3112 if (ctx
->ExecuteFlag
) {
3113 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3117 static void GLAPIENTRY
3118 save_RasterPos2d(GLdouble x
, GLdouble y
)
3120 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3123 static void GLAPIENTRY
3124 save_RasterPos2f(GLfloat x
, GLfloat y
)
3126 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3129 static void GLAPIENTRY
3130 save_RasterPos2i(GLint x
, GLint y
)
3132 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3135 static void GLAPIENTRY
3136 save_RasterPos2s(GLshort x
, GLshort y
)
3138 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3141 static void GLAPIENTRY
3142 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3144 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3147 static void GLAPIENTRY
3148 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3150 save_RasterPos4f(x
, y
, z
, 1.0F
);
3153 static void GLAPIENTRY
3154 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3156 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3159 static void GLAPIENTRY
3160 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3162 save_RasterPos4f(x
, y
, z
, 1.0F
);
3165 static void GLAPIENTRY
3166 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3168 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3171 static void GLAPIENTRY
3172 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3174 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3177 static void GLAPIENTRY
3178 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3180 save_RasterPos4f(x
, y
, z
, w
);
3183 static void GLAPIENTRY
3184 save_RasterPos2dv(const GLdouble
* v
)
3186 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3189 static void GLAPIENTRY
3190 save_RasterPos2fv(const GLfloat
* v
)
3192 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3195 static void GLAPIENTRY
3196 save_RasterPos2iv(const GLint
* v
)
3198 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3201 static void GLAPIENTRY
3202 save_RasterPos2sv(const GLshort
* v
)
3204 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3207 static void GLAPIENTRY
3208 save_RasterPos3dv(const GLdouble
* v
)
3210 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3213 static void GLAPIENTRY
3214 save_RasterPos3fv(const GLfloat
* v
)
3216 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3219 static void GLAPIENTRY
3220 save_RasterPos3iv(const GLint
* v
)
3222 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3225 static void GLAPIENTRY
3226 save_RasterPos3sv(const GLshort
* v
)
3228 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3231 static void GLAPIENTRY
3232 save_RasterPos4dv(const GLdouble
* v
)
3234 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3235 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3238 static void GLAPIENTRY
3239 save_RasterPos4fv(const GLfloat
* v
)
3241 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3244 static void GLAPIENTRY
3245 save_RasterPos4iv(const GLint
* v
)
3247 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3248 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3251 static void GLAPIENTRY
3252 save_RasterPos4sv(const GLshort
* v
)
3254 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3258 static void GLAPIENTRY
3259 save_PassThrough(GLfloat token
)
3261 GET_CURRENT_CONTEXT(ctx
);
3263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3264 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3268 if (ctx
->ExecuteFlag
) {
3269 CALL_PassThrough(ctx
->Exec
, (token
));
3274 static void GLAPIENTRY
3275 save_ReadBuffer(GLenum mode
)
3277 GET_CURRENT_CONTEXT(ctx
);
3279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3280 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3284 if (ctx
->ExecuteFlag
) {
3285 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3290 static void GLAPIENTRY
3291 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3293 GET_CURRENT_CONTEXT(ctx
);
3295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3296 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3303 if (ctx
->ExecuteFlag
) {
3304 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3309 static void GLAPIENTRY
3310 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3312 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3316 static void GLAPIENTRY
3317 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3319 GET_CURRENT_CONTEXT(ctx
);
3321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3322 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3328 if (ctx
->ExecuteFlag
) {
3329 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3334 static void GLAPIENTRY
3335 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3337 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3341 static void GLAPIENTRY
3342 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3344 GET_CURRENT_CONTEXT(ctx
);
3346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3347 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3354 if (ctx
->ExecuteFlag
) {
3355 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3360 static void GLAPIENTRY
3361 save_ShadeModel(GLenum mode
)
3363 GET_CURRENT_CONTEXT(ctx
);
3365 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3367 if (ctx
->ExecuteFlag
) {
3368 CALL_ShadeModel(ctx
->Exec
, (mode
));
3371 /* Don't compile this call if it's a no-op.
3372 * By avoiding this state change we have a better chance of
3373 * coalescing subsequent drawing commands into one batch.
3375 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3378 SAVE_FLUSH_VERTICES(ctx
);
3380 ctx
->ListState
.Current
.ShadeModel
= mode
;
3382 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3389 static void GLAPIENTRY
3390 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3392 GET_CURRENT_CONTEXT(ctx
);
3394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3395 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3401 if (ctx
->ExecuteFlag
) {
3402 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3407 static void GLAPIENTRY
3408 save_StencilMask(GLuint mask
)
3410 GET_CURRENT_CONTEXT(ctx
);
3412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3413 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3417 if (ctx
->ExecuteFlag
) {
3418 CALL_StencilMask(ctx
->Exec
, (mask
));
3423 static void GLAPIENTRY
3424 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3426 GET_CURRENT_CONTEXT(ctx
);
3428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3429 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3435 if (ctx
->ExecuteFlag
) {
3436 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3441 static void GLAPIENTRY
3442 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3444 GET_CURRENT_CONTEXT(ctx
);
3446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3447 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3454 if (ctx
->ExecuteFlag
) {
3455 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3460 static void GLAPIENTRY
3461 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3464 GET_CURRENT_CONTEXT(ctx
);
3466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3468 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3476 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3483 if (ctx
->ExecuteFlag
) {
3484 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3485 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3490 static void GLAPIENTRY
3491 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3493 GET_CURRENT_CONTEXT(ctx
);
3495 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3496 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3501 if (ctx
->ExecuteFlag
) {
3502 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3507 static void GLAPIENTRY
3508 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3510 GET_CURRENT_CONTEXT(ctx
);
3512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3513 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3520 if (ctx
->ExecuteFlag
) {
3521 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3526 static void GLAPIENTRY
3527 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3529 GET_CURRENT_CONTEXT(ctx
);
3531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3532 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3536 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3544 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3547 if (ctx
->ExecuteFlag
) {
3548 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3553 static void GLAPIENTRY
3554 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3557 parray
[0] = (GLfloat
) param
;
3558 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3559 save_TexEnvfv(target
, pname
, parray
);
3563 static void GLAPIENTRY
3564 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3567 p
[0] = (GLfloat
) param
;
3568 p
[1] = p
[2] = p
[3] = 0.0F
;
3569 save_TexEnvfv(target
, pname
, p
);
3573 static void GLAPIENTRY
3574 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3577 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3578 p
[0] = INT_TO_FLOAT(param
[0]);
3579 p
[1] = INT_TO_FLOAT(param
[1]);
3580 p
[2] = INT_TO_FLOAT(param
[2]);
3581 p
[3] = INT_TO_FLOAT(param
[3]);
3584 p
[0] = (GLfloat
) param
[0];
3585 p
[1] = p
[2] = p
[3] = 0.0F
;
3587 save_TexEnvfv(target
, pname
, p
);
3591 static void GLAPIENTRY
3592 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3594 GET_CURRENT_CONTEXT(ctx
);
3596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3597 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3606 if (ctx
->ExecuteFlag
) {
3607 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3612 static void GLAPIENTRY
3613 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3616 p
[0] = (GLfloat
) params
[0];
3617 p
[1] = (GLfloat
) params
[1];
3618 p
[2] = (GLfloat
) params
[2];
3619 p
[3] = (GLfloat
) params
[3];
3620 save_TexGenfv(coord
, pname
, p
);
3624 static void GLAPIENTRY
3625 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3628 parray
[0] = (GLfloat
) param
;
3629 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3630 save_TexGenfv(coord
, pname
, parray
);
3634 static void GLAPIENTRY
3635 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3638 p
[0] = (GLfloat
) params
[0];
3639 p
[1] = (GLfloat
) params
[1];
3640 p
[2] = (GLfloat
) params
[2];
3641 p
[3] = (GLfloat
) params
[3];
3642 save_TexGenfv(coord
, pname
, p
);
3646 static void GLAPIENTRY
3647 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3651 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3652 save_TexGenfv(coord
, pname
, parray
);
3656 static void GLAPIENTRY
3657 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3661 parray
[1] = parray
[2] = parray
[3] = 0;
3662 save_TexGeniv(coord
, pname
, parray
);
3666 static void GLAPIENTRY
3667 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3669 GET_CURRENT_CONTEXT(ctx
);
3671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3672 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3681 if (ctx
->ExecuteFlag
) {
3682 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3687 static void GLAPIENTRY
3688 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3692 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3693 save_TexParameterfv(target
, pname
, parray
);
3697 static void GLAPIENTRY
3698 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3701 fparam
[0] = (GLfloat
) param
;
3702 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3703 save_TexParameterfv(target
, pname
, fparam
);
3707 static void GLAPIENTRY
3708 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3711 fparam
[0] = (GLfloat
) params
[0];
3712 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3713 save_TexParameterfv(target
, pname
, fparam
);
3717 static void GLAPIENTRY
3718 save_TexImage1D(GLenum target
,
3719 GLint level
, GLint components
,
3720 GLsizei width
, GLint border
,
3721 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3723 GET_CURRENT_CONTEXT(ctx
);
3724 if (target
== GL_PROXY_TEXTURE_1D
) {
3725 /* don't compile, execute immediately */
3726 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3727 border
, format
, type
, pixels
));
3731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3732 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
3736 n
[3].i
= components
;
3737 n
[4].i
= (GLint
) width
;
3741 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3742 pixels
, &ctx
->Unpack
);
3744 if (ctx
->ExecuteFlag
) {
3745 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3746 border
, format
, type
, pixels
));
3752 static void GLAPIENTRY
3753 save_TexImage2D(GLenum target
,
3754 GLint level
, GLint components
,
3755 GLsizei width
, GLsizei height
, GLint border
,
3756 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3758 GET_CURRENT_CONTEXT(ctx
);
3759 if (target
== GL_PROXY_TEXTURE_2D
) {
3760 /* don't compile, execute immediately */
3761 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3762 height
, border
, format
, type
, pixels
));
3766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3767 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
3771 n
[3].i
= components
;
3772 n
[4].i
= (GLint
) width
;
3773 n
[5].i
= (GLint
) height
;
3777 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3778 pixels
, &ctx
->Unpack
);
3780 if (ctx
->ExecuteFlag
) {
3781 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3782 height
, border
, format
, type
, pixels
));
3788 static void GLAPIENTRY
3789 save_TexImage3D(GLenum target
,
3790 GLint level
, GLint internalFormat
,
3791 GLsizei width
, GLsizei height
, GLsizei depth
,
3793 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3795 GET_CURRENT_CONTEXT(ctx
);
3796 if (target
== GL_PROXY_TEXTURE_3D
) {
3797 /* don't compile, execute immediately */
3798 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3799 height
, depth
, border
, format
, type
,
3804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3805 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
3809 n
[3].i
= (GLint
) internalFormat
;
3810 n
[4].i
= (GLint
) width
;
3811 n
[5].i
= (GLint
) height
;
3812 n
[6].i
= (GLint
) depth
;
3816 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3817 pixels
, &ctx
->Unpack
);
3819 if (ctx
->ExecuteFlag
) {
3820 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3821 height
, depth
, border
, format
, type
,
3828 static void GLAPIENTRY
3829 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3830 GLsizei width
, GLenum format
, GLenum type
,
3831 const GLvoid
* pixels
)
3833 GET_CURRENT_CONTEXT(ctx
);
3836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3838 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
3843 n
[4].i
= (GLint
) width
;
3846 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3847 pixels
, &ctx
->Unpack
);
3849 if (ctx
->ExecuteFlag
) {
3850 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3851 format
, type
, pixels
));
3856 static void GLAPIENTRY
3857 save_TexSubImage2D(GLenum target
, GLint level
,
3858 GLint xoffset
, GLint yoffset
,
3859 GLsizei width
, GLsizei height
,
3860 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3862 GET_CURRENT_CONTEXT(ctx
);
3865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3867 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
3873 n
[5].i
= (GLint
) width
;
3874 n
[6].i
= (GLint
) height
;
3877 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3878 pixels
, &ctx
->Unpack
);
3880 if (ctx
->ExecuteFlag
) {
3881 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3882 width
, height
, format
, type
, pixels
));
3887 static void GLAPIENTRY
3888 save_TexSubImage3D(GLenum target
, GLint level
,
3889 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3890 GLsizei width
, GLsizei height
, GLsizei depth
,
3891 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3893 GET_CURRENT_CONTEXT(ctx
);
3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3898 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
3905 n
[6].i
= (GLint
) width
;
3906 n
[7].i
= (GLint
) height
;
3907 n
[8].i
= (GLint
) depth
;
3910 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3911 pixels
, &ctx
->Unpack
);
3913 if (ctx
->ExecuteFlag
) {
3914 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3915 xoffset
, yoffset
, zoffset
,
3916 width
, height
, depth
, format
, type
,
3922 static void GLAPIENTRY
3923 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3925 GET_CURRENT_CONTEXT(ctx
);
3927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3928 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
3934 if (ctx
->ExecuteFlag
) {
3935 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
3940 static void GLAPIENTRY
3941 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
3943 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3948 static void GLAPIENTRY
3949 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3951 GET_CURRENT_CONTEXT(ctx
);
3953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3954 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
3958 n
[3].i
= (GLint
) width
;
3959 n
[4].i
= (GLint
) height
;
3961 if (ctx
->ExecuteFlag
) {
3962 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
3967 static void GLAPIENTRY
3968 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3970 GET_CURRENT_CONTEXT(ctx
);
3972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3973 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
3980 if (ctx
->ExecuteFlag
) {
3981 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
3985 static void GLAPIENTRY
3986 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
3988 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3991 static void GLAPIENTRY
3992 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
3994 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
3997 static void GLAPIENTRY
3998 save_WindowPos2iMESA(GLint x
, GLint y
)
4000 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4003 static void GLAPIENTRY
4004 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4006 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4009 static void GLAPIENTRY
4010 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4012 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4015 static void GLAPIENTRY
4016 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4018 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4021 static void GLAPIENTRY
4022 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4024 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4027 static void GLAPIENTRY
4028 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4030 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4033 static void GLAPIENTRY
4034 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4036 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4039 static void GLAPIENTRY
4040 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4042 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4045 static void GLAPIENTRY
4046 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4048 save_WindowPos4fMESA(x
, y
, z
, w
);
4051 static void GLAPIENTRY
4052 save_WindowPos2dvMESA(const GLdouble
* v
)
4054 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4057 static void GLAPIENTRY
4058 save_WindowPos2fvMESA(const GLfloat
* v
)
4060 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4063 static void GLAPIENTRY
4064 save_WindowPos2ivMESA(const GLint
* v
)
4066 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4069 static void GLAPIENTRY
4070 save_WindowPos2svMESA(const GLshort
* v
)
4072 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4075 static void GLAPIENTRY
4076 save_WindowPos3dvMESA(const GLdouble
* v
)
4078 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4081 static void GLAPIENTRY
4082 save_WindowPos3fvMESA(const GLfloat
* v
)
4084 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4087 static void GLAPIENTRY
4088 save_WindowPos3ivMESA(const GLint
* v
)
4090 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4093 static void GLAPIENTRY
4094 save_WindowPos3svMESA(const GLshort
* v
)
4096 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4099 static void GLAPIENTRY
4100 save_WindowPos4dvMESA(const GLdouble
* v
)
4102 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4103 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4106 static void GLAPIENTRY
4107 save_WindowPos4fvMESA(const GLfloat
* v
)
4109 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4112 static void GLAPIENTRY
4113 save_WindowPos4ivMESA(const GLint
* v
)
4115 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4116 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4119 static void GLAPIENTRY
4120 save_WindowPos4svMESA(const GLshort
* v
)
4122 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4127 /* GL_ARB_multitexture */
4128 static void GLAPIENTRY
4129 save_ActiveTextureARB(GLenum target
)
4131 GET_CURRENT_CONTEXT(ctx
);
4133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4134 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4138 if (ctx
->ExecuteFlag
) {
4139 CALL_ActiveTexture(ctx
->Exec
, (target
));
4144 /* GL_ARB_transpose_matrix */
4146 static void GLAPIENTRY
4147 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4150 _math_transposefd(tm
, m
);
4151 save_LoadMatrixf(tm
);
4155 static void GLAPIENTRY
4156 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4159 _math_transposef(tm
, m
);
4160 save_LoadMatrixf(tm
);
4164 static void GLAPIENTRY
4165 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4168 _math_transposefd(tm
, m
);
4169 save_MultMatrixf(tm
);
4173 static void GLAPIENTRY
4174 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4177 _math_transposef(tm
, m
);
4178 save_MultMatrixf(tm
);
4181 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4183 GET_CURRENT_CONTEXT(ctx
);
4189 image
= malloc(size
);
4191 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4194 memcpy(image
, data
, size
);
4200 /* GL_ARB_texture_compression */
4201 static void GLAPIENTRY
4202 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4203 GLenum internalFormat
, GLsizei width
,
4204 GLint border
, GLsizei imageSize
,
4205 const GLvoid
* data
)
4207 GET_CURRENT_CONTEXT(ctx
);
4208 if (target
== GL_PROXY_TEXTURE_1D
) {
4209 /* don't compile, execute immediately */
4210 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4211 width
, border
, imageSize
,
4216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4218 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4222 n
[3].e
= internalFormat
;
4223 n
[4].i
= (GLint
) width
;
4226 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4228 if (ctx
->ExecuteFlag
) {
4229 CALL_CompressedTexImage1D(ctx
->Exec
,
4230 (target
, level
, internalFormat
, width
,
4231 border
, imageSize
, data
));
4237 static void GLAPIENTRY
4238 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4239 GLenum internalFormat
, GLsizei width
,
4240 GLsizei height
, GLint border
, GLsizei imageSize
,
4241 const GLvoid
* data
)
4243 GET_CURRENT_CONTEXT(ctx
);
4244 if (target
== GL_PROXY_TEXTURE_2D
) {
4245 /* don't compile, execute immediately */
4246 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4247 width
, height
, border
,
4252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4254 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4258 n
[3].e
= internalFormat
;
4259 n
[4].i
= (GLint
) width
;
4260 n
[5].i
= (GLint
) height
;
4263 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4265 if (ctx
->ExecuteFlag
) {
4266 CALL_CompressedTexImage2D(ctx
->Exec
,
4267 (target
, level
, internalFormat
, width
,
4268 height
, border
, imageSize
, data
));
4274 static void GLAPIENTRY
4275 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4276 GLenum internalFormat
, GLsizei width
,
4277 GLsizei height
, GLsizei depth
, GLint border
,
4278 GLsizei imageSize
, const GLvoid
* data
)
4280 GET_CURRENT_CONTEXT(ctx
);
4281 if (target
== GL_PROXY_TEXTURE_3D
) {
4282 /* don't compile, execute immediately */
4283 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4284 width
, height
, depth
, border
,
4289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4291 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4295 n
[3].e
= internalFormat
;
4296 n
[4].i
= (GLint
) width
;
4297 n
[5].i
= (GLint
) height
;
4298 n
[6].i
= (GLint
) depth
;
4301 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4303 if (ctx
->ExecuteFlag
) {
4304 CALL_CompressedTexImage3D(ctx
->Exec
,
4305 (target
, level
, internalFormat
, width
,
4306 height
, depth
, border
, imageSize
,
4313 static void GLAPIENTRY
4314 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4315 GLsizei width
, GLenum format
,
4316 GLsizei imageSize
, const GLvoid
* data
)
4319 GET_CURRENT_CONTEXT(ctx
);
4320 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4322 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4327 n
[4].i
= (GLint
) width
;
4330 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4332 if (ctx
->ExecuteFlag
) {
4333 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4334 width
, format
, imageSize
,
4340 static void GLAPIENTRY
4341 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4342 GLint yoffset
, GLsizei width
, GLsizei height
,
4343 GLenum format
, GLsizei imageSize
,
4344 const GLvoid
* data
)
4347 GET_CURRENT_CONTEXT(ctx
);
4348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4350 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4356 n
[5].i
= (GLint
) width
;
4357 n
[6].i
= (GLint
) height
;
4360 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4362 if (ctx
->ExecuteFlag
) {
4363 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4364 (target
, level
, xoffset
, yoffset
, width
,
4365 height
, format
, imageSize
, data
));
4370 static void GLAPIENTRY
4371 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4372 GLint yoffset
, GLint zoffset
, GLsizei width
,
4373 GLsizei height
, GLsizei depth
, GLenum format
,
4374 GLsizei imageSize
, const GLvoid
* data
)
4377 GET_CURRENT_CONTEXT(ctx
);
4378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4380 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4387 n
[6].i
= (GLint
) width
;
4388 n
[7].i
= (GLint
) height
;
4389 n
[8].i
= (GLint
) depth
;
4391 n
[10].i
= imageSize
;
4392 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4394 if (ctx
->ExecuteFlag
) {
4395 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4396 (target
, level
, xoffset
, yoffset
,
4397 zoffset
, width
, height
, depth
, format
,
4403 /* GL_ARB_multisample */
4404 static void GLAPIENTRY
4405 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4407 GET_CURRENT_CONTEXT(ctx
);
4409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4410 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4415 if (ctx
->ExecuteFlag
) {
4416 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4422 * GL_NV_fragment_program
4424 static void GLAPIENTRY
4425 save_BindProgramNV(GLenum target
, GLuint id
)
4427 GET_CURRENT_CONTEXT(ctx
);
4429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4430 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4435 if (ctx
->ExecuteFlag
) {
4436 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4440 static void GLAPIENTRY
4441 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4442 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4444 GET_CURRENT_CONTEXT(ctx
);
4446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4447 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4456 if (ctx
->ExecuteFlag
) {
4457 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4462 static void GLAPIENTRY
4463 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4464 const GLfloat
*params
)
4466 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4467 params
[2], params
[3]);
4471 static void GLAPIENTRY
4472 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4473 const GLfloat
* params
)
4475 GET_CURRENT_CONTEXT(ctx
);
4477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4481 const GLfloat
* p
= params
;
4483 for (i
= 0 ; i
< count
; i
++) {
4484 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4497 if (ctx
->ExecuteFlag
) {
4498 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4503 static void GLAPIENTRY
4504 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4505 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4507 save_ProgramEnvParameter4fARB(target
, index
,
4509 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4513 static void GLAPIENTRY
4514 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4515 const GLdouble
*params
)
4517 save_ProgramEnvParameter4fARB(target
, index
,
4518 (GLfloat
) params
[0],
4519 (GLfloat
) params
[1],
4520 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4524 static void GLAPIENTRY
4525 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4526 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4528 GET_CURRENT_CONTEXT(ctx
);
4530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4531 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4540 if (ctx
->ExecuteFlag
) {
4541 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4546 static void GLAPIENTRY
4547 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4548 const GLfloat
*params
)
4550 GET_CURRENT_CONTEXT(ctx
);
4552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4553 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4562 if (ctx
->ExecuteFlag
) {
4563 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4568 static void GLAPIENTRY
4569 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4570 const GLfloat
*params
)
4572 GET_CURRENT_CONTEXT(ctx
);
4574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4578 const GLfloat
* p
= params
;
4580 for (i
= 0 ; i
< count
; i
++) {
4581 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4594 if (ctx
->ExecuteFlag
) {
4595 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4600 static void GLAPIENTRY
4601 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4602 GLdouble x
, GLdouble y
,
4603 GLdouble z
, GLdouble w
)
4605 GET_CURRENT_CONTEXT(ctx
);
4607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4608 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4612 n
[3].f
= (GLfloat
) x
;
4613 n
[4].f
= (GLfloat
) y
;
4614 n
[5].f
= (GLfloat
) z
;
4615 n
[6].f
= (GLfloat
) w
;
4617 if (ctx
->ExecuteFlag
) {
4618 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4623 static void GLAPIENTRY
4624 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4625 const GLdouble
*params
)
4627 GET_CURRENT_CONTEXT(ctx
);
4629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4630 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4634 n
[3].f
= (GLfloat
) params
[0];
4635 n
[4].f
= (GLfloat
) params
[1];
4636 n
[5].f
= (GLfloat
) params
[2];
4637 n
[6].f
= (GLfloat
) params
[3];
4639 if (ctx
->ExecuteFlag
) {
4640 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4645 /* GL_EXT_stencil_two_side */
4646 static void GLAPIENTRY
4647 save_ActiveStencilFaceEXT(GLenum face
)
4649 GET_CURRENT_CONTEXT(ctx
);
4651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4652 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4656 if (ctx
->ExecuteFlag
) {
4657 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4662 /* GL_EXT_depth_bounds_test */
4663 static void GLAPIENTRY
4664 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4666 GET_CURRENT_CONTEXT(ctx
);
4668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4669 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4671 n
[1].f
= (GLfloat
) zmin
;
4672 n
[2].f
= (GLfloat
) zmax
;
4674 if (ctx
->ExecuteFlag
) {
4675 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4681 static void GLAPIENTRY
4682 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4683 const GLvoid
* string
)
4685 GET_CURRENT_CONTEXT(ctx
);
4688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4690 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
4692 GLubyte
*programCopy
= malloc(len
);
4694 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4697 memcpy(programCopy
, string
, len
);
4701 n
[4].data
= programCopy
;
4703 if (ctx
->ExecuteFlag
) {
4704 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4709 static void GLAPIENTRY
4710 save_BeginQueryARB(GLenum target
, GLuint id
)
4712 GET_CURRENT_CONTEXT(ctx
);
4714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4715 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4720 if (ctx
->ExecuteFlag
) {
4721 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4725 static void GLAPIENTRY
4726 save_EndQueryARB(GLenum target
)
4728 GET_CURRENT_CONTEXT(ctx
);
4730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4731 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4735 if (ctx
->ExecuteFlag
) {
4736 CALL_EndQuery(ctx
->Exec
, (target
));
4740 static void GLAPIENTRY
4741 save_QueryCounter(GLuint id
, GLenum target
)
4743 GET_CURRENT_CONTEXT(ctx
);
4745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4746 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4751 if (ctx
->ExecuteFlag
) {
4752 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4756 static void GLAPIENTRY
4757 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4759 GET_CURRENT_CONTEXT(ctx
);
4761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4762 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4768 if (ctx
->ExecuteFlag
) {
4769 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4773 static void GLAPIENTRY
4774 save_EndQueryIndexed(GLenum target
, GLuint index
)
4776 GET_CURRENT_CONTEXT(ctx
);
4778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4779 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4784 if (ctx
->ExecuteFlag
) {
4785 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4790 static void GLAPIENTRY
4791 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4793 GET_CURRENT_CONTEXT(ctx
);
4795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4796 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4800 if (count
> MAX_DRAW_BUFFERS
)
4801 count
= MAX_DRAW_BUFFERS
;
4802 for (i
= 0; i
< count
; i
++) {
4803 n
[2 + i
].e
= buffers
[i
];
4806 if (ctx
->ExecuteFlag
) {
4807 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4811 static void GLAPIENTRY
4812 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4814 GET_CURRENT_CONTEXT(ctx
);
4817 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4825 if (ctx
->ExecuteFlag
) {
4826 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4830 static void GLAPIENTRY
4831 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4834 p
[0] = INT_TO_FLOAT(param
[0]);
4835 p
[1] = INT_TO_FLOAT(param
[1]);
4836 p
[2] = INT_TO_FLOAT(param
[2]);
4837 p
[3] = INT_TO_FLOAT(param
[3]);
4838 save_TexBumpParameterfvATI(pname
, p
);
4841 static void GLAPIENTRY
4842 save_BindFragmentShaderATI(GLuint id
)
4844 GET_CURRENT_CONTEXT(ctx
);
4847 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4851 if (ctx
->ExecuteFlag
) {
4852 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4856 static void GLAPIENTRY
4857 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4859 GET_CURRENT_CONTEXT(ctx
);
4862 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4870 if (ctx
->ExecuteFlag
) {
4871 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4875 static void GLAPIENTRY
4876 save_Attr1fNV(GLenum attr
, GLfloat x
)
4878 GET_CURRENT_CONTEXT(ctx
);
4880 SAVE_FLUSH_VERTICES(ctx
);
4881 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4887 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4888 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4889 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4891 if (ctx
->ExecuteFlag
) {
4892 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4896 static void GLAPIENTRY
4897 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4899 GET_CURRENT_CONTEXT(ctx
);
4901 SAVE_FLUSH_VERTICES(ctx
);
4902 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
4909 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4910 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4911 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4913 if (ctx
->ExecuteFlag
) {
4914 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4918 static void GLAPIENTRY
4919 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4921 GET_CURRENT_CONTEXT(ctx
);
4923 SAVE_FLUSH_VERTICES(ctx
);
4924 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
4932 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4933 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
4934 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
4936 if (ctx
->ExecuteFlag
) {
4937 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
4941 static void GLAPIENTRY
4942 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4944 GET_CURRENT_CONTEXT(ctx
);
4946 SAVE_FLUSH_VERTICES(ctx
);
4947 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
4956 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4957 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
4958 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
4960 if (ctx
->ExecuteFlag
) {
4961 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
4966 static void GLAPIENTRY
4967 save_Attr1fARB(GLenum attr
, GLfloat x
)
4969 GET_CURRENT_CONTEXT(ctx
);
4971 SAVE_FLUSH_VERTICES(ctx
);
4972 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
4978 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4979 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4980 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4982 if (ctx
->ExecuteFlag
) {
4983 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
4987 static void GLAPIENTRY
4988 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
4990 GET_CURRENT_CONTEXT(ctx
);
4992 SAVE_FLUSH_VERTICES(ctx
);
4993 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5000 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5001 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5002 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5004 if (ctx
->ExecuteFlag
) {
5005 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5009 static void GLAPIENTRY
5010 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5012 GET_CURRENT_CONTEXT(ctx
);
5014 SAVE_FLUSH_VERTICES(ctx
);
5015 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5023 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5024 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5025 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5027 if (ctx
->ExecuteFlag
) {
5028 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5032 static void GLAPIENTRY
5033 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5035 GET_CURRENT_CONTEXT(ctx
);
5037 SAVE_FLUSH_VERTICES(ctx
);
5038 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5047 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5048 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5049 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5051 if (ctx
->ExecuteFlag
) {
5052 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5057 static void GLAPIENTRY
5058 save_EvalCoord1f(GLfloat x
)
5060 GET_CURRENT_CONTEXT(ctx
);
5062 SAVE_FLUSH_VERTICES(ctx
);
5063 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5067 if (ctx
->ExecuteFlag
) {
5068 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5072 static void GLAPIENTRY
5073 save_EvalCoord1fv(const GLfloat
* v
)
5075 save_EvalCoord1f(v
[0]);
5078 static void GLAPIENTRY
5079 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5081 GET_CURRENT_CONTEXT(ctx
);
5083 SAVE_FLUSH_VERTICES(ctx
);
5084 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5089 if (ctx
->ExecuteFlag
) {
5090 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5094 static void GLAPIENTRY
5095 save_EvalCoord2fv(const GLfloat
* v
)
5097 save_EvalCoord2f(v
[0], v
[1]);
5101 static void GLAPIENTRY
5102 save_EvalPoint1(GLint x
)
5104 GET_CURRENT_CONTEXT(ctx
);
5106 SAVE_FLUSH_VERTICES(ctx
);
5107 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5111 if (ctx
->ExecuteFlag
) {
5112 CALL_EvalPoint1(ctx
->Exec
, (x
));
5116 static void GLAPIENTRY
5117 save_EvalPoint2(GLint x
, GLint y
)
5119 GET_CURRENT_CONTEXT(ctx
);
5121 SAVE_FLUSH_VERTICES(ctx
);
5122 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5127 if (ctx
->ExecuteFlag
) {
5128 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5132 static void GLAPIENTRY
5133 save_Indexf(GLfloat x
)
5135 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5138 static void GLAPIENTRY
5139 save_Indexfv(const GLfloat
* v
)
5141 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5144 static void GLAPIENTRY
5145 save_EdgeFlag(GLboolean x
)
5147 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5152 * Compare 'count' elements of vectors 'a' and 'b'.
5153 * \return GL_TRUE if equal, GL_FALSE if different.
5155 static inline GLboolean
5156 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5158 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5163 * This glMaterial function is used for glMaterial calls that are outside
5164 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5166 static void GLAPIENTRY
5167 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5169 GET_CURRENT_CONTEXT(ctx
);
5177 case GL_FRONT_AND_BACK
:
5180 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5189 case GL_AMBIENT_AND_DIFFUSE
:
5195 case GL_COLOR_INDEXES
:
5199 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5203 if (ctx
->ExecuteFlag
) {
5204 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5207 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5209 /* Try to eliminate redundant statechanges. Because it is legal to
5210 * call glMaterial even inside begin/end calls, don't need to worry
5211 * about ctx->Driver.CurrentSavePrimitive here.
5213 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5214 if (bitmask
& (1 << i
)) {
5215 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5216 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5217 /* no change in material value */
5218 bitmask
&= ~(1 << i
);
5221 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5222 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5227 /* If this call has no effect, return early */
5231 SAVE_FLUSH_VERTICES(ctx
);
5233 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5237 for (i
= 0; i
< args
; i
++)
5238 n
[3 + i
].f
= param
[i
];
5242 static void GLAPIENTRY
5243 save_Begin(GLenum mode
)
5245 GET_CURRENT_CONTEXT(ctx
);
5247 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5248 /* compile this error into the display list */
5249 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5251 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5252 /* compile this error into the display list */
5253 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5258 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5260 /* Give the driver an opportunity to hook in an optimized
5261 * display list compiler.
5263 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5266 SAVE_FLUSH_VERTICES(ctx
);
5267 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5272 if (ctx
->ExecuteFlag
) {
5273 CALL_Begin(ctx
->Exec
, (mode
));
5278 static void GLAPIENTRY
5281 GET_CURRENT_CONTEXT(ctx
);
5282 SAVE_FLUSH_VERTICES(ctx
);
5283 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5284 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5285 if (ctx
->ExecuteFlag
) {
5286 CALL_End(ctx
->Exec
, ());
5290 static void GLAPIENTRY
5291 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5293 GET_CURRENT_CONTEXT(ctx
);
5295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5296 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5303 if (ctx
->ExecuteFlag
) {
5304 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5309 static void GLAPIENTRY
5310 save_Vertex2f(GLfloat x
, GLfloat y
)
5312 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5315 static void GLAPIENTRY
5316 save_Vertex2fv(const GLfloat
* v
)
5318 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5321 static void GLAPIENTRY
5322 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5324 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5327 static void GLAPIENTRY
5328 save_Vertex3fv(const GLfloat
* v
)
5330 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5333 static void GLAPIENTRY
5334 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5336 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5339 static void GLAPIENTRY
5340 save_Vertex4fv(const GLfloat
* v
)
5342 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5345 static void GLAPIENTRY
5346 save_TexCoord1f(GLfloat x
)
5348 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5351 static void GLAPIENTRY
5352 save_TexCoord1fv(const GLfloat
* v
)
5354 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5357 static void GLAPIENTRY
5358 save_TexCoord2f(GLfloat x
, GLfloat y
)
5360 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5363 static void GLAPIENTRY
5364 save_TexCoord2fv(const GLfloat
* v
)
5366 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5369 static void GLAPIENTRY
5370 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5372 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5375 static void GLAPIENTRY
5376 save_TexCoord3fv(const GLfloat
* v
)
5378 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5381 static void GLAPIENTRY
5382 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5384 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5387 static void GLAPIENTRY
5388 save_TexCoord4fv(const GLfloat
* v
)
5390 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5393 static void GLAPIENTRY
5394 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5396 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5399 static void GLAPIENTRY
5400 save_Normal3fv(const GLfloat
* v
)
5402 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5405 static void GLAPIENTRY
5406 save_FogCoordfEXT(GLfloat x
)
5408 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5411 static void GLAPIENTRY
5412 save_FogCoordfvEXT(const GLfloat
* v
)
5414 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5417 static void GLAPIENTRY
5418 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5420 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5423 static void GLAPIENTRY
5424 save_Color3fv(const GLfloat
* v
)
5426 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5429 static void GLAPIENTRY
5430 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5432 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5435 static void GLAPIENTRY
5436 save_Color4fv(const GLfloat
* v
)
5438 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5441 static void GLAPIENTRY
5442 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5444 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5447 static void GLAPIENTRY
5448 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5450 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5454 /* Just call the respective ATTR for texcoord
5456 static void GLAPIENTRY
5457 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5459 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5460 save_Attr1fNV(attr
, x
);
5463 static void GLAPIENTRY
5464 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5466 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5467 save_Attr1fNV(attr
, v
[0]);
5470 static void GLAPIENTRY
5471 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5473 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5474 save_Attr2fNV(attr
, x
, y
);
5477 static void GLAPIENTRY
5478 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5480 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5481 save_Attr2fNV(attr
, v
[0], v
[1]);
5484 static void GLAPIENTRY
5485 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5487 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5488 save_Attr3fNV(attr
, x
, y
, z
);
5491 static void GLAPIENTRY
5492 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5494 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5495 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5498 static void GLAPIENTRY
5499 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5500 GLfloat z
, GLfloat w
)
5502 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5503 save_Attr4fNV(attr
, x
, y
, z
, w
);
5506 static void GLAPIENTRY
5507 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5509 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5510 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5515 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5521 GET_CURRENT_CONTEXT(ctx
);
5522 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5527 static void GLAPIENTRY
5528 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5530 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5531 save_Attr1fARB(index
, x
);
5536 static void GLAPIENTRY
5537 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5539 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5540 save_Attr1fARB(index
, v
[0]);
5545 static void GLAPIENTRY
5546 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5548 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5549 save_Attr2fARB(index
, x
, y
);
5554 static void GLAPIENTRY
5555 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5557 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5558 save_Attr2fARB(index
, v
[0], v
[1]);
5563 static void GLAPIENTRY
5564 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5566 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5567 save_Attr3fARB(index
, x
, y
, z
);
5572 static void GLAPIENTRY
5573 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5575 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5576 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5581 static void GLAPIENTRY
5582 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5585 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5586 save_Attr4fARB(index
, x
, y
, z
, w
);
5591 static void GLAPIENTRY
5592 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5594 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5595 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5600 static void GLAPIENTRY
5601 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5602 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5603 GLbitfield mask
, GLenum filter
)
5605 GET_CURRENT_CONTEXT(ctx
);
5607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5608 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5621 if (ctx
->ExecuteFlag
) {
5622 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5623 dstX0
, dstY0
, dstX1
, dstY1
,
5629 /** GL_EXT_provoking_vertex */
5630 static void GLAPIENTRY
5631 save_ProvokingVertexEXT(GLenum mode
)
5633 GET_CURRENT_CONTEXT(ctx
);
5635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5636 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5640 if (ctx
->ExecuteFlag
) {
5641 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5642 _mesa_ProvokingVertex(mode
);
5647 /** GL_EXT_transform_feedback */
5648 static void GLAPIENTRY
5649 save_BeginTransformFeedback(GLenum mode
)
5651 GET_CURRENT_CONTEXT(ctx
);
5653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5654 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5658 if (ctx
->ExecuteFlag
) {
5659 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5664 /** GL_EXT_transform_feedback */
5665 static void GLAPIENTRY
5666 save_EndTransformFeedback(void)
5668 GET_CURRENT_CONTEXT(ctx
);
5669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5670 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5671 if (ctx
->ExecuteFlag
) {
5672 CALL_EndTransformFeedback(ctx
->Exec
, ());
5676 static void GLAPIENTRY
5677 save_BindTransformFeedback(GLenum target
, GLuint name
)
5679 GET_CURRENT_CONTEXT(ctx
);
5681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5682 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5687 if (ctx
->ExecuteFlag
) {
5688 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5692 static void GLAPIENTRY
5693 save_PauseTransformFeedback(void)
5695 GET_CURRENT_CONTEXT(ctx
);
5696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5697 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5698 if (ctx
->ExecuteFlag
) {
5699 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5703 static void GLAPIENTRY
5704 save_ResumeTransformFeedback(void)
5706 GET_CURRENT_CONTEXT(ctx
);
5707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5708 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5709 if (ctx
->ExecuteFlag
) {
5710 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5714 static void GLAPIENTRY
5715 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5717 GET_CURRENT_CONTEXT(ctx
);
5719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5720 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5725 if (ctx
->ExecuteFlag
) {
5726 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5730 static void GLAPIENTRY
5731 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5733 GET_CURRENT_CONTEXT(ctx
);
5735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5736 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5742 if (ctx
->ExecuteFlag
) {
5743 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5747 static void GLAPIENTRY
5748 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5751 GET_CURRENT_CONTEXT(ctx
);
5753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5754 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5758 n
[3].si
= primcount
;
5760 if (ctx
->ExecuteFlag
) {
5761 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5765 static void GLAPIENTRY
5766 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5767 GLuint stream
, GLsizei primcount
)
5769 GET_CURRENT_CONTEXT(ctx
);
5771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5772 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5777 n
[4].si
= primcount
;
5779 if (ctx
->ExecuteFlag
) {
5780 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5785 /* aka UseProgram() */
5786 static void GLAPIENTRY
5787 save_UseProgramObjectARB(GLhandleARB program
)
5789 GET_CURRENT_CONTEXT(ctx
);
5791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5792 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5796 if (ctx
->ExecuteFlag
) {
5797 CALL_UseProgram(ctx
->Exec
, (program
));
5802 static void GLAPIENTRY
5803 save_Uniform1fARB(GLint location
, GLfloat x
)
5805 GET_CURRENT_CONTEXT(ctx
);
5807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5808 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5813 if (ctx
->ExecuteFlag
) {
5814 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5819 static void GLAPIENTRY
5820 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5822 GET_CURRENT_CONTEXT(ctx
);
5824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5825 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5831 if (ctx
->ExecuteFlag
) {
5832 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5837 static void GLAPIENTRY
5838 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5840 GET_CURRENT_CONTEXT(ctx
);
5842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5843 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5850 if (ctx
->ExecuteFlag
) {
5851 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5856 static void GLAPIENTRY
5857 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5859 GET_CURRENT_CONTEXT(ctx
);
5861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5862 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5870 if (ctx
->ExecuteFlag
) {
5871 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5876 /** Return copy of memory */
5878 memdup(const void *src
, GLsizei bytes
)
5880 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
5882 memcpy(b
, src
, bytes
);
5887 static void GLAPIENTRY
5888 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5890 GET_CURRENT_CONTEXT(ctx
);
5892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5893 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
5897 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
5899 if (ctx
->ExecuteFlag
) {
5900 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
5904 static void GLAPIENTRY
5905 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5907 GET_CURRENT_CONTEXT(ctx
);
5909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5910 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
5914 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
5916 if (ctx
->ExecuteFlag
) {
5917 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
5921 static void GLAPIENTRY
5922 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5924 GET_CURRENT_CONTEXT(ctx
);
5926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5927 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
5931 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
5933 if (ctx
->ExecuteFlag
) {
5934 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
5938 static void GLAPIENTRY
5939 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5941 GET_CURRENT_CONTEXT(ctx
);
5943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5944 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
5948 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
5950 if (ctx
->ExecuteFlag
) {
5951 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
5956 static void GLAPIENTRY
5957 save_Uniform1iARB(GLint location
, GLint x
)
5959 GET_CURRENT_CONTEXT(ctx
);
5961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5962 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
5967 if (ctx
->ExecuteFlag
) {
5968 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
5972 static void GLAPIENTRY
5973 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
5975 GET_CURRENT_CONTEXT(ctx
);
5977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5978 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
5984 if (ctx
->ExecuteFlag
) {
5985 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
5989 static void GLAPIENTRY
5990 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
5992 GET_CURRENT_CONTEXT(ctx
);
5994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5995 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6002 if (ctx
->ExecuteFlag
) {
6003 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6007 static void GLAPIENTRY
6008 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6010 GET_CURRENT_CONTEXT(ctx
);
6012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6013 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6021 if (ctx
->ExecuteFlag
) {
6022 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6028 static void GLAPIENTRY
6029 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6031 GET_CURRENT_CONTEXT(ctx
);
6033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6034 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6038 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6040 if (ctx
->ExecuteFlag
) {
6041 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6045 static void GLAPIENTRY
6046 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6048 GET_CURRENT_CONTEXT(ctx
);
6050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6051 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6055 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6057 if (ctx
->ExecuteFlag
) {
6058 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6062 static void GLAPIENTRY
6063 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6065 GET_CURRENT_CONTEXT(ctx
);
6067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6068 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6072 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6074 if (ctx
->ExecuteFlag
) {
6075 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6079 static void GLAPIENTRY
6080 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6082 GET_CURRENT_CONTEXT(ctx
);
6084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6085 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6089 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6091 if (ctx
->ExecuteFlag
) {
6092 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6098 static void GLAPIENTRY
6099 save_Uniform1ui(GLint location
, GLuint x
)
6101 GET_CURRENT_CONTEXT(ctx
);
6103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6104 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6109 if (ctx
->ExecuteFlag
) {
6110 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6114 static void GLAPIENTRY
6115 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6117 GET_CURRENT_CONTEXT(ctx
);
6119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6120 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6126 if (ctx
->ExecuteFlag
) {
6127 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6131 static void GLAPIENTRY
6132 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6134 GET_CURRENT_CONTEXT(ctx
);
6136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6137 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6144 if (ctx
->ExecuteFlag
) {
6145 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6149 static void GLAPIENTRY
6150 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6152 GET_CURRENT_CONTEXT(ctx
);
6154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6155 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6163 if (ctx
->ExecuteFlag
) {
6164 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6170 static void GLAPIENTRY
6171 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6173 GET_CURRENT_CONTEXT(ctx
);
6175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6176 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6180 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6182 if (ctx
->ExecuteFlag
) {
6183 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6187 static void GLAPIENTRY
6188 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6190 GET_CURRENT_CONTEXT(ctx
);
6192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6193 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6197 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6199 if (ctx
->ExecuteFlag
) {
6200 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6204 static void GLAPIENTRY
6205 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6207 GET_CURRENT_CONTEXT(ctx
);
6209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6210 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6214 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6216 if (ctx
->ExecuteFlag
) {
6217 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6221 static void GLAPIENTRY
6222 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6224 GET_CURRENT_CONTEXT(ctx
);
6226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6227 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6231 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6233 if (ctx
->ExecuteFlag
) {
6234 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6240 static void GLAPIENTRY
6241 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6244 GET_CURRENT_CONTEXT(ctx
);
6246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6247 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6252 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6254 if (ctx
->ExecuteFlag
) {
6255 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6259 static void GLAPIENTRY
6260 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6263 GET_CURRENT_CONTEXT(ctx
);
6265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6266 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6271 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6273 if (ctx
->ExecuteFlag
) {
6274 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6278 static void GLAPIENTRY
6279 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6282 GET_CURRENT_CONTEXT(ctx
);
6284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6285 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6290 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6292 if (ctx
->ExecuteFlag
) {
6293 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6298 static void GLAPIENTRY
6299 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6302 GET_CURRENT_CONTEXT(ctx
);
6304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6305 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6310 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6312 if (ctx
->ExecuteFlag
) {
6313 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6317 static void GLAPIENTRY
6318 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6321 GET_CURRENT_CONTEXT(ctx
);
6323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6324 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6329 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6331 if (ctx
->ExecuteFlag
) {
6332 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6337 static void GLAPIENTRY
6338 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6341 GET_CURRENT_CONTEXT(ctx
);
6343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6344 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6349 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6351 if (ctx
->ExecuteFlag
) {
6352 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6356 static void GLAPIENTRY
6357 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6360 GET_CURRENT_CONTEXT(ctx
);
6362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6363 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6368 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6370 if (ctx
->ExecuteFlag
) {
6371 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6376 static void GLAPIENTRY
6377 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6380 GET_CURRENT_CONTEXT(ctx
);
6382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6383 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6388 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6390 if (ctx
->ExecuteFlag
) {
6391 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6395 static void GLAPIENTRY
6396 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6399 GET_CURRENT_CONTEXT(ctx
);
6401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6402 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6407 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6409 if (ctx
->ExecuteFlag
) {
6410 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6414 static void GLAPIENTRY
6415 save_ClampColorARB(GLenum target
, GLenum clamp
)
6417 GET_CURRENT_CONTEXT(ctx
);
6419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6420 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6425 if (ctx
->ExecuteFlag
) {
6426 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6430 static void GLAPIENTRY
6431 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6433 GET_CURRENT_CONTEXT(ctx
);
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6436 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6441 if (ctx
->ExecuteFlag
) {
6442 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6446 static void GLAPIENTRY
6447 save_ActiveProgramEXT(GLuint program
)
6449 GET_CURRENT_CONTEXT(ctx
);
6451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6452 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6456 if (ctx
->ExecuteFlag
) {
6457 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6461 /** GL_EXT_texture_integer */
6462 static void GLAPIENTRY
6463 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6465 GET_CURRENT_CONTEXT(ctx
);
6467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6468 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6475 if (ctx
->ExecuteFlag
) {
6476 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6480 /** GL_EXT_texture_integer */
6481 static void GLAPIENTRY
6482 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6484 GET_CURRENT_CONTEXT(ctx
);
6486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6487 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6494 if (ctx
->ExecuteFlag
) {
6495 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6499 /** GL_EXT_texture_integer */
6500 static void GLAPIENTRY
6501 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6503 GET_CURRENT_CONTEXT(ctx
);
6505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6506 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6515 if (ctx
->ExecuteFlag
) {
6516 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6520 /** GL_EXT_texture_integer */
6521 static void GLAPIENTRY
6522 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6524 GET_CURRENT_CONTEXT(ctx
);
6526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6527 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6531 n
[3].ui
= params
[0];
6532 n
[4].ui
= params
[1];
6533 n
[5].ui
= params
[2];
6534 n
[6].ui
= params
[3];
6536 if (ctx
->ExecuteFlag
) {
6537 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6541 /* GL_ARB_instanced_arrays */
6542 static void GLAPIENTRY
6543 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6545 GET_CURRENT_CONTEXT(ctx
);
6547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6548 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6553 if (ctx
->ExecuteFlag
) {
6554 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6559 /* GL_NV_texture_barrier */
6560 static void GLAPIENTRY
6561 save_TextureBarrierNV(void)
6563 GET_CURRENT_CONTEXT(ctx
);
6564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6565 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6566 if (ctx
->ExecuteFlag
) {
6567 CALL_TextureBarrierNV(ctx
->Exec
, ());
6572 /* GL_ARB_sampler_objects */
6573 static void GLAPIENTRY
6574 save_BindSampler(GLuint unit
, GLuint sampler
)
6577 GET_CURRENT_CONTEXT(ctx
);
6578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6579 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6584 if (ctx
->ExecuteFlag
) {
6585 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6589 static void GLAPIENTRY
6590 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6593 GET_CURRENT_CONTEXT(ctx
);
6594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6595 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6600 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6606 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6609 if (ctx
->ExecuteFlag
) {
6610 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6614 static void GLAPIENTRY
6615 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6619 parray
[1] = parray
[2] = parray
[3] = 0;
6620 save_SamplerParameteriv(sampler
, pname
, parray
);
6623 static void GLAPIENTRY
6624 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6627 GET_CURRENT_CONTEXT(ctx
);
6628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6629 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6634 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6640 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6643 if (ctx
->ExecuteFlag
) {
6644 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6648 static void GLAPIENTRY
6649 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6653 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6654 save_SamplerParameterfv(sampler
, pname
, parray
);
6657 static void GLAPIENTRY
6658 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6661 GET_CURRENT_CONTEXT(ctx
);
6662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6663 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6668 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6674 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6677 if (ctx
->ExecuteFlag
) {
6678 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6682 static void GLAPIENTRY
6683 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6686 GET_CURRENT_CONTEXT(ctx
);
6687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6688 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6692 n
[3].ui
= params
[0];
6693 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6694 n
[4].ui
= params
[1];
6695 n
[5].ui
= params
[2];
6696 n
[6].ui
= params
[3];
6699 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6702 if (ctx
->ExecuteFlag
) {
6703 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6707 /* GL_ARB_geometry_shader4 */
6708 static void GLAPIENTRY
6709 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6712 GET_CURRENT_CONTEXT(ctx
);
6713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6714 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6720 if (ctx
->ExecuteFlag
) {
6721 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6725 static void GLAPIENTRY
6726 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6727 GLuint texture
, GLint level
)
6730 GET_CURRENT_CONTEXT(ctx
);
6731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6732 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6735 n
[2].e
= attachment
;
6739 if (ctx
->ExecuteFlag
) {
6740 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6744 static void GLAPIENTRY
6745 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6746 GLuint texture
, GLint level
, GLenum face
)
6749 GET_CURRENT_CONTEXT(ctx
);
6750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6751 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6754 n
[2].e
= attachment
;
6759 if (ctx
->ExecuteFlag
) {
6760 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6767 static void GLAPIENTRY
6768 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6771 GET_CURRENT_CONTEXT(ctx
);
6772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6773 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6775 union uint64_pair p
;
6779 n
[3].ui
= p
.uint32
[0];
6780 n
[4].ui
= p
.uint32
[1];
6782 if (ctx
->ExecuteFlag
) {
6783 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6788 /** GL_NV_conditional_render */
6789 static void GLAPIENTRY
6790 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6792 GET_CURRENT_CONTEXT(ctx
);
6794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6795 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6800 if (ctx
->ExecuteFlag
) {
6801 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6805 static void GLAPIENTRY
6806 save_EndConditionalRender(void)
6808 GET_CURRENT_CONTEXT(ctx
);
6809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6810 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6811 if (ctx
->ExecuteFlag
) {
6812 CALL_EndConditionalRender(ctx
->Exec
, ());
6816 static void GLAPIENTRY
6817 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6819 GET_CURRENT_CONTEXT(ctx
);
6821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6822 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6828 if (ctx
->ExecuteFlag
) {
6829 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6835 * Save an error-generating command into display list.
6837 * KW: Will appear in the list before the vertex buffer containing the
6838 * command that provoked the error. I don't see this as a problem.
6841 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6844 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
6847 n
[2].data
= (void *) s
;
6853 * Compile an error into current display list.
6856 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6858 if (ctx
->CompileFlag
)
6859 save_error(ctx
, error
, s
);
6860 if (ctx
->ExecuteFlag
)
6861 _mesa_error(ctx
, error
, "%s", s
);
6866 * Test if ID names a display list.
6869 islist(struct gl_context
*ctx
, GLuint list
)
6871 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6881 /**********************************************************************/
6882 /* Display list execution */
6883 /**********************************************************************/
6887 * Execute a display list. Note that the ListBase offset must have already
6888 * been added before calling this function. I.e. the list argument is
6889 * the absolute list number, not relative to ListBase.
6890 * \param list - display list number
6893 execute_list(struct gl_context
*ctx
, GLuint list
)
6895 struct gl_display_list
*dlist
;
6899 if (list
== 0 || !islist(ctx
, list
))
6902 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
6903 /* raise an error? */
6907 dlist
= _mesa_lookup_list(ctx
, list
);
6911 ctx
->ListState
.CallDepth
++;
6913 if (ctx
->Driver
.BeginCallList
)
6914 ctx
->Driver
.BeginCallList(ctx
, dlist
);
6920 const OpCode opcode
= n
[0].opcode
;
6922 if (is_ext_opcode(opcode
)) {
6923 n
+= ext_opcode_execute(ctx
, n
);
6928 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
6931 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6933 case OPCODE_ALPHA_FUNC
:
6934 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
6936 case OPCODE_BIND_TEXTURE
:
6937 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
6941 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
6942 ctx
->Unpack
= ctx
->DefaultPacking
;
6943 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
6944 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
6945 (const GLubyte
*) n
[7].data
));
6946 ctx
->Unpack
= save
; /* restore */
6949 case OPCODE_BLEND_COLOR
:
6950 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
6952 case OPCODE_BLEND_EQUATION
:
6953 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
6955 case OPCODE_BLEND_EQUATION_SEPARATE
:
6956 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
6958 case OPCODE_BLEND_FUNC_SEPARATE
:
6959 CALL_BlendFuncSeparate(ctx
->Exec
,
6960 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
6963 case OPCODE_BLEND_FUNC_I
:
6964 /* GL_ARB_draw_buffers_blend */
6965 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
6967 case OPCODE_BLEND_FUNC_SEPARATE_I
:
6968 /* GL_ARB_draw_buffers_blend */
6969 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
6972 case OPCODE_BLEND_EQUATION_I
:
6973 /* GL_ARB_draw_buffers_blend */
6974 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
6976 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
6977 /* GL_ARB_draw_buffers_blend */
6978 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
6979 (n
[1].ui
, n
[2].e
, n
[3].e
));
6982 case OPCODE_CALL_LIST
:
6983 /* Generated by glCallList(), don't add ListBase */
6984 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
6985 execute_list(ctx
, n
[1].ui
);
6988 case OPCODE_CALL_LIST_OFFSET
:
6989 /* Generated by glCallLists() so we must add ListBase */
6991 /* user specified a bad data type at compile time */
6992 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
6994 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
6995 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
6996 execute_list(ctx
, list
);
7000 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7002 case OPCODE_CLEAR_BUFFER_IV
:
7009 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7012 case OPCODE_CLEAR_BUFFER_UIV
:
7019 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7022 case OPCODE_CLEAR_BUFFER_FV
:
7029 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7032 case OPCODE_CLEAR_BUFFER_FI
:
7033 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7035 case OPCODE_CLEAR_COLOR
:
7036 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7038 case OPCODE_CLEAR_ACCUM
:
7039 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7041 case OPCODE_CLEAR_DEPTH
:
7042 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7044 case OPCODE_CLEAR_INDEX
:
7045 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7047 case OPCODE_CLEAR_STENCIL
:
7048 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7050 case OPCODE_CLIP_PLANE
:
7057 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7060 case OPCODE_COLOR_MASK
:
7061 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7063 case OPCODE_COLOR_MASK_INDEXED
:
7064 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7067 case OPCODE_COLOR_MATERIAL
:
7068 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7070 case OPCODE_COPY_PIXELS
:
7071 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7072 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7075 case OPCODE_COPY_TEX_IMAGE1D
:
7076 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7077 n
[5].i
, n
[6].i
, n
[7].i
));
7079 case OPCODE_COPY_TEX_IMAGE2D
:
7080 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7081 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7083 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7084 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7085 n
[4].i
, n
[5].i
, n
[6].i
));
7087 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7088 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7089 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7092 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7093 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7094 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7097 case OPCODE_CULL_FACE
:
7098 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7100 case OPCODE_DEPTH_FUNC
:
7101 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7103 case OPCODE_DEPTH_MASK
:
7104 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7106 case OPCODE_DEPTH_RANGE
:
7107 CALL_DepthRange(ctx
->Exec
,
7108 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7110 case OPCODE_DISABLE
:
7111 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7113 case OPCODE_DISABLE_INDEXED
:
7114 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7116 case OPCODE_DRAW_BUFFER
:
7117 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7119 case OPCODE_DRAW_PIXELS
:
7121 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7122 ctx
->Unpack
= ctx
->DefaultPacking
;
7123 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7125 ctx
->Unpack
= save
; /* restore */
7129 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7131 case OPCODE_ENABLE_INDEXED
:
7132 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7134 case OPCODE_EVALMESH1
:
7135 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7137 case OPCODE_EVALMESH2
:
7138 CALL_EvalMesh2(ctx
->Exec
,
7139 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7148 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7151 case OPCODE_FRONT_FACE
:
7152 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7154 case OPCODE_FRUSTUM
:
7155 CALL_Frustum(ctx
->Exec
,
7156 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7159 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7161 case OPCODE_INDEX_MASK
:
7162 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7164 case OPCODE_INIT_NAMES
:
7165 CALL_InitNames(ctx
->Exec
, ());
7174 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7177 case OPCODE_LIGHT_MODEL
:
7184 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7187 case OPCODE_LINE_STIPPLE
:
7188 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7190 case OPCODE_LINE_WIDTH
:
7191 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7193 case OPCODE_LIST_BASE
:
7194 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7196 case OPCODE_LOAD_IDENTITY
:
7197 CALL_LoadIdentity(ctx
->Exec
, ());
7199 case OPCODE_LOAD_MATRIX
:
7200 if (sizeof(Node
) == sizeof(GLfloat
)) {
7201 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7206 for (i
= 0; i
< 16; i
++) {
7209 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7212 case OPCODE_LOAD_NAME
:
7213 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7215 case OPCODE_LOGIC_OP
:
7216 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7220 GLenum target
= n
[1].e
;
7221 GLint ustride
= _mesa_evaluator_components(target
);
7222 GLint uorder
= n
[5].i
;
7223 GLfloat u1
= n
[2].f
;
7224 GLfloat u2
= n
[3].f
;
7225 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7226 (GLfloat
*) n
[6].data
));
7231 GLenum target
= n
[1].e
;
7232 GLfloat u1
= n
[2].f
;
7233 GLfloat u2
= n
[3].f
;
7234 GLfloat v1
= n
[4].f
;
7235 GLfloat v2
= n
[5].f
;
7236 GLint ustride
= n
[6].i
;
7237 GLint vstride
= n
[7].i
;
7238 GLint uorder
= n
[8].i
;
7239 GLint vorder
= n
[9].i
;
7240 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7241 v1
, v2
, vstride
, vorder
,
7242 (GLfloat
*) n
[10].data
));
7245 case OPCODE_MAPGRID1
:
7246 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7248 case OPCODE_MAPGRID2
:
7249 CALL_MapGrid2f(ctx
->Exec
,
7250 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7252 case OPCODE_MATRIX_MODE
:
7253 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7255 case OPCODE_MULT_MATRIX
:
7256 if (sizeof(Node
) == sizeof(GLfloat
)) {
7257 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7262 for (i
= 0; i
< 16; i
++) {
7265 CALL_MultMatrixf(ctx
->Exec
, (m
));
7269 CALL_Ortho(ctx
->Exec
,
7270 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7272 case OPCODE_PASSTHROUGH
:
7273 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7275 case OPCODE_PIXEL_MAP
:
7276 CALL_PixelMapfv(ctx
->Exec
,
7277 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7279 case OPCODE_PIXEL_TRANSFER
:
7280 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7282 case OPCODE_PIXEL_ZOOM
:
7283 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7285 case OPCODE_POINT_SIZE
:
7286 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7288 case OPCODE_POINT_PARAMETERS
:
7294 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7297 case OPCODE_POLYGON_MODE
:
7298 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7300 case OPCODE_POLYGON_STIPPLE
:
7302 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7303 ctx
->Unpack
= ctx
->DefaultPacking
;
7304 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7305 ctx
->Unpack
= save
; /* restore */
7308 case OPCODE_POLYGON_OFFSET
:
7309 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7311 case OPCODE_POP_ATTRIB
:
7312 CALL_PopAttrib(ctx
->Exec
, ());
7314 case OPCODE_POP_MATRIX
:
7315 CALL_PopMatrix(ctx
->Exec
, ());
7317 case OPCODE_POP_NAME
:
7318 CALL_PopName(ctx
->Exec
, ());
7320 case OPCODE_PRIORITIZE_TEXTURE
:
7321 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7323 case OPCODE_PUSH_ATTRIB
:
7324 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7326 case OPCODE_PUSH_MATRIX
:
7327 CALL_PushMatrix(ctx
->Exec
, ());
7329 case OPCODE_PUSH_NAME
:
7330 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7332 case OPCODE_RASTER_POS
:
7333 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7335 case OPCODE_READ_BUFFER
:
7336 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7339 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7342 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7344 case OPCODE_SCISSOR
:
7345 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7347 case OPCODE_SHADE_MODEL
:
7348 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7350 case OPCODE_PROVOKING_VERTEX
:
7351 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7353 case OPCODE_STENCIL_FUNC
:
7354 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7356 case OPCODE_STENCIL_MASK
:
7357 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7359 case OPCODE_STENCIL_OP
:
7360 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7362 case OPCODE_STENCIL_FUNC_SEPARATE
:
7363 CALL_StencilFuncSeparate(ctx
->Exec
,
7364 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7366 case OPCODE_STENCIL_MASK_SEPARATE
:
7367 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7369 case OPCODE_STENCIL_OP_SEPARATE
:
7370 CALL_StencilOpSeparate(ctx
->Exec
,
7371 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7380 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7390 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7393 case OPCODE_TEXPARAMETER
:
7400 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7403 case OPCODE_TEX_IMAGE1D
:
7405 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7406 ctx
->Unpack
= ctx
->DefaultPacking
;
7407 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7409 n
[3].i
, /* components */
7411 n
[5].e
, /* border */
7412 n
[6].e
, /* format */
7415 ctx
->Unpack
= save
; /* restore */
7418 case OPCODE_TEX_IMAGE2D
:
7420 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7421 ctx
->Unpack
= ctx
->DefaultPacking
;
7422 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7424 n
[3].i
, /* components */
7426 n
[5].i
, /* height */
7427 n
[6].e
, /* border */
7428 n
[7].e
, /* format */
7431 ctx
->Unpack
= save
; /* restore */
7434 case OPCODE_TEX_IMAGE3D
:
7436 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7437 ctx
->Unpack
= ctx
->DefaultPacking
;
7438 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7440 n
[3].i
, /* components */
7442 n
[5].i
, /* height */
7444 n
[7].e
, /* border */
7445 n
[8].e
, /* format */
7448 ctx
->Unpack
= save
; /* restore */
7451 case OPCODE_TEX_SUB_IMAGE1D
:
7453 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7454 ctx
->Unpack
= ctx
->DefaultPacking
;
7455 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7457 n
[6].e
, n
[7].data
));
7458 ctx
->Unpack
= save
; /* restore */
7461 case OPCODE_TEX_SUB_IMAGE2D
:
7463 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7464 ctx
->Unpack
= ctx
->DefaultPacking
;
7465 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7467 n
[6].i
, n
[7].e
, n
[8].e
,
7469 ctx
->Unpack
= save
; /* restore */
7472 case OPCODE_TEX_SUB_IMAGE3D
:
7474 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7475 ctx
->Unpack
= ctx
->DefaultPacking
;
7476 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7477 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7478 n
[8].i
, n
[9].e
, n
[10].e
,
7480 ctx
->Unpack
= save
; /* restore */
7483 case OPCODE_TRANSLATE
:
7484 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7486 case OPCODE_VIEWPORT
:
7487 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7488 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7490 case OPCODE_WINDOW_POS
:
7491 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7493 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7494 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7496 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7497 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7498 n
[4].i
, n
[5].i
, n
[6].i
,
7501 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7502 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7503 n
[4].i
, n
[5].i
, n
[6].i
,
7504 n
[7].i
, n
[8].data
));
7506 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7507 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7508 n
[4].i
, n
[5].i
, n
[6].i
,
7512 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7513 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7514 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7515 n
[5].e
, n
[6].i
, n
[7].data
));
7517 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7518 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7519 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7520 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7523 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7524 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7525 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7526 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7527 n
[9].e
, n
[10].i
, n
[11].data
));
7529 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7530 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7532 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7533 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7535 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7536 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7538 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7539 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7540 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7543 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7544 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7546 case OPCODE_DEPTH_BOUNDS_EXT
:
7547 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7549 case OPCODE_PROGRAM_STRING_ARB
:
7550 CALL_ProgramStringARB(ctx
->Exec
,
7551 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
7553 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7554 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7558 case OPCODE_BEGIN_QUERY_ARB
:
7559 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7561 case OPCODE_END_QUERY_ARB
:
7562 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7564 case OPCODE_QUERY_COUNTER
:
7565 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7567 case OPCODE_BEGIN_QUERY_INDEXED
:
7568 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7570 case OPCODE_END_QUERY_INDEXED
:
7571 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7573 case OPCODE_DRAW_BUFFERS_ARB
:
7575 GLenum buffers
[MAX_DRAW_BUFFERS
];
7576 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7577 for (i
= 0; i
< count
; i
++)
7578 buffers
[i
] = n
[2 + i
].e
;
7579 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7582 case OPCODE_BLIT_FRAMEBUFFER
:
7583 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7584 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7587 case OPCODE_USE_PROGRAM
:
7588 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7590 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7591 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7593 case OPCODE_ACTIVE_PROGRAM_EXT
:
7594 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7596 case OPCODE_UNIFORM_1F
:
7597 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7599 case OPCODE_UNIFORM_2F
:
7600 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7602 case OPCODE_UNIFORM_3F
:
7603 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7605 case OPCODE_UNIFORM_4F
:
7606 CALL_Uniform4f(ctx
->Exec
,
7607 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7609 case OPCODE_UNIFORM_1FV
:
7610 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7612 case OPCODE_UNIFORM_2FV
:
7613 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7615 case OPCODE_UNIFORM_3FV
:
7616 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7618 case OPCODE_UNIFORM_4FV
:
7619 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7621 case OPCODE_UNIFORM_1I
:
7622 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7624 case OPCODE_UNIFORM_2I
:
7625 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7627 case OPCODE_UNIFORM_3I
:
7628 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7630 case OPCODE_UNIFORM_4I
:
7631 CALL_Uniform4i(ctx
->Exec
,
7632 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7634 case OPCODE_UNIFORM_1IV
:
7635 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7637 case OPCODE_UNIFORM_2IV
:
7638 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7640 case OPCODE_UNIFORM_3IV
:
7641 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7643 case OPCODE_UNIFORM_4IV
:
7644 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
7646 case OPCODE_UNIFORM_1UI
:
7647 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7649 case OPCODE_UNIFORM_2UI
:
7650 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7652 case OPCODE_UNIFORM_3UI
:
7653 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7655 case OPCODE_UNIFORM_4UI
:
7656 /*CALL_Uniform4uiARB(ctx->Exec,
7657 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7660 case OPCODE_UNIFORM_1UIV
:
7661 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7663 case OPCODE_UNIFORM_2UIV
:
7664 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7666 case OPCODE_UNIFORM_3UIV
:
7667 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7669 case OPCODE_UNIFORM_4UIV
:
7670 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
7672 case OPCODE_UNIFORM_MATRIX22
:
7673 CALL_UniformMatrix2fv(ctx
->Exec
,
7674 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7676 case OPCODE_UNIFORM_MATRIX33
:
7677 CALL_UniformMatrix3fv(ctx
->Exec
,
7678 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7680 case OPCODE_UNIFORM_MATRIX44
:
7681 CALL_UniformMatrix4fv(ctx
->Exec
,
7682 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7684 case OPCODE_UNIFORM_MATRIX23
:
7685 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7686 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7688 case OPCODE_UNIFORM_MATRIX32
:
7689 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7690 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7692 case OPCODE_UNIFORM_MATRIX24
:
7693 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7694 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7696 case OPCODE_UNIFORM_MATRIX42
:
7697 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7698 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7700 case OPCODE_UNIFORM_MATRIX34
:
7701 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7702 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7704 case OPCODE_UNIFORM_MATRIX43
:
7705 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7706 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
7709 case OPCODE_CLAMP_COLOR
:
7710 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7713 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7716 GLuint i
, pname
= n
[1].ui
;
7718 for (i
= 0; i
< 4; i
++)
7719 values
[i
] = n
[1 + i
].f
;
7720 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7723 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7724 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7726 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7729 GLuint i
, dst
= n
[1].ui
;
7731 for (i
= 0; i
< 4; i
++)
7732 values
[i
] = n
[1 + i
].f
;
7733 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7736 case OPCODE_ATTR_1F_NV
:
7737 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7739 case OPCODE_ATTR_2F_NV
:
7740 /* Really shouldn't have to do this - the Node structure
7741 * is convenient, but it would be better to store the data
7742 * packed appropriately so that it can be sent directly
7743 * on. With x86_64 becoming common, this will start to
7746 if (sizeof(Node
) == sizeof(GLfloat
))
7747 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7749 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7751 case OPCODE_ATTR_3F_NV
:
7752 if (sizeof(Node
) == sizeof(GLfloat
))
7753 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7755 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7758 case OPCODE_ATTR_4F_NV
:
7759 if (sizeof(Node
) == sizeof(GLfloat
))
7760 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7762 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7765 case OPCODE_ATTR_1F_ARB
:
7766 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7768 case OPCODE_ATTR_2F_ARB
:
7769 /* Really shouldn't have to do this - the Node structure
7770 * is convenient, but it would be better to store the data
7771 * packed appropriately so that it can be sent directly
7772 * on. With x86_64 becoming common, this will start to
7775 if (sizeof(Node
) == sizeof(GLfloat
))
7776 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7778 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7780 case OPCODE_ATTR_3F_ARB
:
7781 if (sizeof(Node
) == sizeof(GLfloat
))
7782 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7784 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7787 case OPCODE_ATTR_4F_ARB
:
7788 if (sizeof(Node
) == sizeof(GLfloat
))
7789 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7791 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7794 case OPCODE_MATERIAL
:
7795 if (sizeof(Node
) == sizeof(GLfloat
))
7796 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7803 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7807 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7810 CALL_End(ctx
->Exec
, ());
7813 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7815 case OPCODE_EVAL_C1
:
7816 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7818 case OPCODE_EVAL_C2
:
7819 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7821 case OPCODE_EVAL_P1
:
7822 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7824 case OPCODE_EVAL_P2
:
7825 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7828 /* GL_EXT_texture_integer */
7829 case OPCODE_CLEARCOLOR_I
:
7830 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7832 case OPCODE_CLEARCOLOR_UI
:
7833 CALL_ClearColorIuiEXT(ctx
->Exec
,
7834 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7836 case OPCODE_TEXPARAMETER_I
:
7843 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7846 case OPCODE_TEXPARAMETER_UI
:
7849 params
[0] = n
[3].ui
;
7850 params
[1] = n
[4].ui
;
7851 params
[2] = n
[5].ui
;
7852 params
[3] = n
[6].ui
;
7853 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7857 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7858 /* GL_ARB_instanced_arrays */
7859 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7862 case OPCODE_TEXTURE_BARRIER_NV
:
7863 CALL_TextureBarrierNV(ctx
->Exec
, ());
7866 /* GL_EXT/ARB_transform_feedback */
7867 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7868 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7870 case OPCODE_END_TRANSFORM_FEEDBACK
:
7871 CALL_EndTransformFeedback(ctx
->Exec
, ());
7873 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7874 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7876 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7877 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7879 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7880 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7882 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7883 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7885 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7886 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7887 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7889 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7890 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
7891 (n
[1].e
, n
[2].ui
, n
[3].si
));
7893 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
7894 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
7895 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
7899 case OPCODE_BIND_SAMPLER
:
7900 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7902 case OPCODE_SAMPLER_PARAMETERIV
:
7909 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7912 case OPCODE_SAMPLER_PARAMETERFV
:
7919 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7922 case OPCODE_SAMPLER_PARAMETERIIV
:
7929 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7932 case OPCODE_SAMPLER_PARAMETERUIV
:
7935 params
[0] = n
[3].ui
;
7936 params
[1] = n
[4].ui
;
7937 params
[2] = n
[5].ui
;
7938 params
[3] = n
[6].ui
;
7939 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7943 /* GL_ARB_geometry_shader4 */
7944 case OPCODE_PROGRAM_PARAMETERI
:
7945 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
7947 case OPCODE_FRAMEBUFFER_TEXTURE
:
7948 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
7951 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
7952 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
7953 n
[3].ui
, n
[4].i
, n
[5].e
));
7957 case OPCODE_WAIT_SYNC
:
7959 union uint64_pair p
;
7960 p
.uint32
[0] = n
[3].ui
;
7961 p
.uint32
[1] = n
[4].ui
;
7962 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
7966 /* GL_NV_conditional_render */
7967 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
7968 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
7970 case OPCODE_END_CONDITIONAL_RENDER
:
7971 CALL_EndConditionalRender(ctx
->Exec
, ());
7974 case OPCODE_UNIFORM_BLOCK_BINDING
:
7975 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
7978 case OPCODE_CONTINUE
:
7979 n
= (Node
*) n
[1].next
;
7981 case OPCODE_END_OF_LIST
:
7987 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
7989 _mesa_problem(ctx
, "%s", msg
);
7994 /* increment n to point to next compiled command */
7995 if (opcode
!= OPCODE_CONTINUE
) {
7996 n
+= InstSize
[opcode
];
8001 if (ctx
->Driver
.EndCallList
)
8002 ctx
->Driver
.EndCallList(ctx
);
8004 ctx
->ListState
.CallDepth
--;
8009 /**********************************************************************/
8011 /**********************************************************************/
8014 * Test if a display list number is valid.
8016 GLboolean GLAPIENTRY
8017 _mesa_IsList(GLuint list
)
8019 GET_CURRENT_CONTEXT(ctx
);
8020 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8021 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8022 return islist(ctx
, list
);
8027 * Delete a sequence of consecutive display lists.
8030 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8032 GET_CURRENT_CONTEXT(ctx
);
8034 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8035 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8038 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8041 for (i
= list
; i
< list
+ range
; i
++) {
8042 destroy_list(ctx
, i
);
8048 * Return a display list number, n, such that lists n through n+range-1
8052 _mesa_GenLists(GLsizei range
)
8054 GET_CURRENT_CONTEXT(ctx
);
8056 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8057 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8060 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8068 * Make this an atomic operation
8070 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8072 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8074 /* reserve the list IDs by with empty/dummy lists */
8076 for (i
= 0; i
< range
; i
++) {
8077 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8078 make_list(base
+ i
, 1));
8082 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8089 * Begin a new display list.
8092 _mesa_NewList(GLuint name
, GLenum mode
)
8094 GET_CURRENT_CONTEXT(ctx
);
8096 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8097 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8099 if (MESA_VERBOSE
& VERBOSE_API
)
8100 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8101 _mesa_lookup_enum_by_nr(mode
));
8104 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8108 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8109 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8113 if (ctx
->ListState
.CurrentList
) {
8114 /* already compiling a display list */
8115 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8119 ctx
->CompileFlag
= GL_TRUE
;
8120 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8122 /* Reset accumulated list state */
8123 invalidate_saved_current_state( ctx
);
8125 /* Allocate new display list */
8126 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8127 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8128 ctx
->ListState
.CurrentPos
= 0;
8130 ctx
->Driver
.NewList(ctx
, name
, mode
);
8132 ctx
->CurrentDispatch
= ctx
->Save
;
8133 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8138 * End definition of current display list.
8143 GET_CURRENT_CONTEXT(ctx
);
8144 SAVE_FLUSH_VERTICES(ctx
);
8145 FLUSH_VERTICES(ctx
, 0);
8147 if (MESA_VERBOSE
& VERBOSE_API
)
8148 _mesa_debug(ctx
, "glEndList\n");
8150 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8151 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8152 "glEndList() called inside glBegin/End");
8155 /* Check that a list is under construction */
8156 if (!ctx
->ListState
.CurrentList
) {
8157 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8161 /* Call before emitting END_OF_LIST, in case the driver wants to
8162 * emit opcodes itself.
8164 ctx
->Driver
.EndList(ctx
);
8166 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8168 /* Destroy old list, if any */
8169 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8171 /* Install the new list */
8172 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8173 ctx
->ListState
.CurrentList
->Name
,
8174 ctx
->ListState
.CurrentList
);
8177 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8178 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8180 ctx
->ListState
.CurrentList
= NULL
;
8181 ctx
->ExecuteFlag
= GL_TRUE
;
8182 ctx
->CompileFlag
= GL_FALSE
;
8184 ctx
->CurrentDispatch
= ctx
->Exec
;
8185 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8190 _mesa_CallList(GLuint list
)
8192 GLboolean save_compile_flag
;
8193 GET_CURRENT_CONTEXT(ctx
);
8194 FLUSH_CURRENT(ctx
, 0);
8196 if (MESA_VERBOSE
& VERBOSE_API
)
8197 _mesa_debug(ctx
, "glCallList %d\n", list
);
8200 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8205 mesa_print_display_list( list
);
8207 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8208 * execute the display list, and restore the CompileFlag.
8210 save_compile_flag
= ctx
->CompileFlag
;
8211 if (save_compile_flag
) {
8212 ctx
->CompileFlag
= GL_FALSE
;
8215 execute_list(ctx
, list
);
8216 ctx
->CompileFlag
= save_compile_flag
;
8218 /* also restore API function pointers to point to "save" versions */
8219 if (save_compile_flag
) {
8220 ctx
->CurrentDispatch
= ctx
->Save
;
8221 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8227 * Execute glCallLists: call multiple display lists.
8230 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8232 GET_CURRENT_CONTEXT(ctx
);
8234 GLboolean save_compile_flag
;
8236 if (MESA_VERBOSE
& VERBOSE_API
)
8237 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8241 case GL_UNSIGNED_BYTE
:
8243 case GL_UNSIGNED_SHORT
:
8245 case GL_UNSIGNED_INT
:
8253 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8257 /* Save the CompileFlag status, turn it off, execute display list,
8258 * and restore the CompileFlag.
8260 save_compile_flag
= ctx
->CompileFlag
;
8261 ctx
->CompileFlag
= GL_FALSE
;
8263 for (i
= 0; i
< n
; i
++) {
8264 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8265 execute_list(ctx
, list
);
8268 ctx
->CompileFlag
= save_compile_flag
;
8270 /* also restore API function pointers to point to "save" versions */
8271 if (save_compile_flag
) {
8272 ctx
->CurrentDispatch
= ctx
->Save
;
8273 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8279 * Set the offset added to list numbers in glCallLists.
8282 _mesa_ListBase(GLuint base
)
8284 GET_CURRENT_CONTEXT(ctx
);
8285 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8286 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8287 ctx
->List
.ListBase
= base
;
8291 * Setup the given dispatch table to point to Mesa's display list
8292 * building functions.
8294 * This does not include any of the tnl functions - they are
8295 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8299 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8301 struct _glapi_table
*table
= ctx
->Save
;
8302 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8304 /* Initially populate the dispatch table with the contents of the
8305 * normal-execution dispatch table. This lets us skip populating functions
8306 * that should be called directly instead of compiled into display lists.
8308 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8310 _mesa_loopback_init_api_table(ctx
, table
);
8313 vbo_initialize_save_dispatch(ctx
, table
);
8316 SET_Accum(table
, save_Accum
);
8317 SET_AlphaFunc(table
, save_AlphaFunc
);
8318 SET_Bitmap(table
, save_Bitmap
);
8319 SET_BlendFunc(table
, save_BlendFunc
);
8320 SET_CallList(table
, save_CallList
);
8321 SET_CallLists(table
, save_CallLists
);
8322 SET_Clear(table
, save_Clear
);
8323 SET_ClearAccum(table
, save_ClearAccum
);
8324 SET_ClearColor(table
, save_ClearColor
);
8325 SET_ClearDepth(table
, save_ClearDepth
);
8326 SET_ClearIndex(table
, save_ClearIndex
);
8327 SET_ClearStencil(table
, save_ClearStencil
);
8328 SET_ClipPlane(table
, save_ClipPlane
);
8329 SET_ColorMask(table
, save_ColorMask
);
8330 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8331 SET_ColorMaterial(table
, save_ColorMaterial
);
8332 SET_CopyPixels(table
, save_CopyPixels
);
8333 SET_CullFace(table
, save_CullFace
);
8334 SET_DepthFunc(table
, save_DepthFunc
);
8335 SET_DepthMask(table
, save_DepthMask
);
8336 SET_DepthRange(table
, save_DepthRange
);
8337 SET_Disable(table
, save_Disable
);
8338 SET_Disablei(table
, save_DisableIndexed
);
8339 SET_DrawBuffer(table
, save_DrawBuffer
);
8340 SET_DrawPixels(table
, save_DrawPixels
);
8341 SET_Enable(table
, save_Enable
);
8342 SET_Enablei(table
, save_EnableIndexed
);
8343 SET_EvalMesh1(table
, save_EvalMesh1
);
8344 SET_EvalMesh2(table
, save_EvalMesh2
);
8345 SET_Fogf(table
, save_Fogf
);
8346 SET_Fogfv(table
, save_Fogfv
);
8347 SET_Fogi(table
, save_Fogi
);
8348 SET_Fogiv(table
, save_Fogiv
);
8349 SET_FrontFace(table
, save_FrontFace
);
8350 SET_Frustum(table
, save_Frustum
);
8351 SET_Hint(table
, save_Hint
);
8352 SET_IndexMask(table
, save_IndexMask
);
8353 SET_InitNames(table
, save_InitNames
);
8354 SET_LightModelf(table
, save_LightModelf
);
8355 SET_LightModelfv(table
, save_LightModelfv
);
8356 SET_LightModeli(table
, save_LightModeli
);
8357 SET_LightModeliv(table
, save_LightModeliv
);
8358 SET_Lightf(table
, save_Lightf
);
8359 SET_Lightfv(table
, save_Lightfv
);
8360 SET_Lighti(table
, save_Lighti
);
8361 SET_Lightiv(table
, save_Lightiv
);
8362 SET_LineStipple(table
, save_LineStipple
);
8363 SET_LineWidth(table
, save_LineWidth
);
8364 SET_ListBase(table
, save_ListBase
);
8365 SET_LoadIdentity(table
, save_LoadIdentity
);
8366 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8367 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8368 SET_LoadName(table
, save_LoadName
);
8369 SET_LogicOp(table
, save_LogicOp
);
8370 SET_Map1d(table
, save_Map1d
);
8371 SET_Map1f(table
, save_Map1f
);
8372 SET_Map2d(table
, save_Map2d
);
8373 SET_Map2f(table
, save_Map2f
);
8374 SET_MapGrid1d(table
, save_MapGrid1d
);
8375 SET_MapGrid1f(table
, save_MapGrid1f
);
8376 SET_MapGrid2d(table
, save_MapGrid2d
);
8377 SET_MapGrid2f(table
, save_MapGrid2f
);
8378 SET_MatrixMode(table
, save_MatrixMode
);
8379 SET_MultMatrixd(table
, save_MultMatrixd
);
8380 SET_MultMatrixf(table
, save_MultMatrixf
);
8381 SET_NewList(table
, save_NewList
);
8382 SET_Ortho(table
, save_Ortho
);
8383 SET_PassThrough(table
, save_PassThrough
);
8384 SET_PixelMapfv(table
, save_PixelMapfv
);
8385 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8386 SET_PixelMapusv(table
, save_PixelMapusv
);
8387 SET_PixelTransferf(table
, save_PixelTransferf
);
8388 SET_PixelTransferi(table
, save_PixelTransferi
);
8389 SET_PixelZoom(table
, save_PixelZoom
);
8390 SET_PointSize(table
, save_PointSize
);
8391 SET_PolygonMode(table
, save_PolygonMode
);
8392 SET_PolygonOffset(table
, save_PolygonOffset
);
8393 SET_PolygonStipple(table
, save_PolygonStipple
);
8394 SET_PopAttrib(table
, save_PopAttrib
);
8395 SET_PopMatrix(table
, save_PopMatrix
);
8396 SET_PopName(table
, save_PopName
);
8397 SET_PushAttrib(table
, save_PushAttrib
);
8398 SET_PushMatrix(table
, save_PushMatrix
);
8399 SET_PushName(table
, save_PushName
);
8400 SET_RasterPos2d(table
, save_RasterPos2d
);
8401 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8402 SET_RasterPos2f(table
, save_RasterPos2f
);
8403 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8404 SET_RasterPos2i(table
, save_RasterPos2i
);
8405 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8406 SET_RasterPos2s(table
, save_RasterPos2s
);
8407 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8408 SET_RasterPos3d(table
, save_RasterPos3d
);
8409 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8410 SET_RasterPos3f(table
, save_RasterPos3f
);
8411 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8412 SET_RasterPos3i(table
, save_RasterPos3i
);
8413 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8414 SET_RasterPos3s(table
, save_RasterPos3s
);
8415 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8416 SET_RasterPos4d(table
, save_RasterPos4d
);
8417 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8418 SET_RasterPos4f(table
, save_RasterPos4f
);
8419 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8420 SET_RasterPos4i(table
, save_RasterPos4i
);
8421 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8422 SET_RasterPos4s(table
, save_RasterPos4s
);
8423 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8424 SET_ReadBuffer(table
, save_ReadBuffer
);
8425 SET_Rectf(table
, save_Rectf
);
8426 SET_Rotated(table
, save_Rotated
);
8427 SET_Rotatef(table
, save_Rotatef
);
8428 SET_Scaled(table
, save_Scaled
);
8429 SET_Scalef(table
, save_Scalef
);
8430 SET_Scissor(table
, save_Scissor
);
8431 SET_ShadeModel(table
, save_ShadeModel
);
8432 SET_StencilFunc(table
, save_StencilFunc
);
8433 SET_StencilMask(table
, save_StencilMask
);
8434 SET_StencilOp(table
, save_StencilOp
);
8435 SET_TexEnvf(table
, save_TexEnvf
);
8436 SET_TexEnvfv(table
, save_TexEnvfv
);
8437 SET_TexEnvi(table
, save_TexEnvi
);
8438 SET_TexEnviv(table
, save_TexEnviv
);
8439 SET_TexGend(table
, save_TexGend
);
8440 SET_TexGendv(table
, save_TexGendv
);
8441 SET_TexGenf(table
, save_TexGenf
);
8442 SET_TexGenfv(table
, save_TexGenfv
);
8443 SET_TexGeni(table
, save_TexGeni
);
8444 SET_TexGeniv(table
, save_TexGeniv
);
8445 SET_TexImage1D(table
, save_TexImage1D
);
8446 SET_TexImage2D(table
, save_TexImage2D
);
8447 SET_TexParameterf(table
, save_TexParameterf
);
8448 SET_TexParameterfv(table
, save_TexParameterfv
);
8449 SET_TexParameteri(table
, save_TexParameteri
);
8450 SET_TexParameteriv(table
, save_TexParameteriv
);
8451 SET_Translated(table
, save_Translated
);
8452 SET_Translatef(table
, save_Translatef
);
8453 SET_Viewport(table
, save_Viewport
);
8456 SET_BindTexture(table
, save_BindTexture
);
8457 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8458 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8459 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8460 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8461 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8462 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8463 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8466 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8467 SET_TexImage3D(table
, save_TexImage3D
);
8468 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8471 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8472 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8473 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8475 /* ATI_separate_stencil */
8476 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8478 /* GL_ARB_imaging */
8479 /* Not all are supported */
8480 SET_BlendColor(table
, save_BlendColor
);
8481 SET_BlendEquation(table
, save_BlendEquation
);
8483 /* 2. GL_EXT_blend_color */
8485 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8488 /* 3. GL_EXT_polygon_offset */
8489 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8491 /* 6. GL_EXT_texture3d */
8493 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8494 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8495 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8498 /* 37. GL_EXT_blend_minmax */
8500 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8503 /* 54. GL_EXT_point_parameters */
8504 SET_PointParameterf(table
, save_PointParameterfEXT
);
8505 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8507 /* 173. GL_EXT_blend_func_separate */
8508 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8510 /* 197. GL_MESA_window_pos */
8511 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8512 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8513 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8514 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8515 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8516 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8517 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8518 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8519 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8520 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8521 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8522 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8523 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8524 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8525 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8526 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8527 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8528 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8529 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8530 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8531 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8532 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8533 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8534 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8536 /* 233. GL_NV_vertex_program */
8537 /* The following commands DO NOT go into display lists:
8538 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8539 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8541 SET_BindProgramARB(table
, save_BindProgramNV
);
8543 /* 244. GL_ATI_envmap_bumpmap */
8544 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8545 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8547 /* 245. GL_ATI_fragment_shader */
8548 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8549 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8551 /* 262. GL_NV_point_sprite */
8552 SET_PointParameteri(table
, save_PointParameteriNV
);
8553 SET_PointParameteriv(table
, save_PointParameterivNV
);
8555 /* 268. GL_EXT_stencil_two_side */
8556 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8558 /* ???. GL_EXT_depth_bounds_test */
8559 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8561 /* ARB 1. GL_ARB_multitexture */
8562 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8564 /* ARB 3. GL_ARB_transpose_matrix */
8565 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8566 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8567 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8568 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8570 /* ARB 5. GL_ARB_multisample */
8571 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8573 /* ARB 12. GL_ARB_texture_compression */
8574 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8575 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8576 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8577 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8578 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8579 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8581 /* ARB 14. GL_ARB_point_parameters */
8582 /* aliased with EXT_point_parameters functions */
8584 /* ARB 25. GL_ARB_window_pos */
8585 /* aliased with MESA_window_pos functions */
8587 /* ARB 26. GL_ARB_vertex_program */
8588 /* ARB 27. GL_ARB_fragment_program */
8589 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8590 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8591 SET_BindProgramARB(table
, save_BindProgramNV
);
8592 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8593 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8594 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8595 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8596 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8597 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8598 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8599 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8601 SET_BeginQuery(table
, save_BeginQueryARB
);
8602 SET_EndQuery(table
, save_EndQueryARB
);
8603 SET_QueryCounter(table
, save_QueryCounter
);
8605 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8607 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8609 SET_UseProgram(table
, save_UseProgramObjectARB
);
8610 SET_Uniform1f(table
, save_Uniform1fARB
);
8611 SET_Uniform2f(table
, save_Uniform2fARB
);
8612 SET_Uniform3f(table
, save_Uniform3fARB
);
8613 SET_Uniform4f(table
, save_Uniform4fARB
);
8614 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8615 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8616 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8617 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8618 SET_Uniform1i(table
, save_Uniform1iARB
);
8619 SET_Uniform2i(table
, save_Uniform2iARB
);
8620 SET_Uniform3i(table
, save_Uniform3iARB
);
8621 SET_Uniform4i(table
, save_Uniform4iARB
);
8622 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8623 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8624 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8625 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8626 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8627 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8628 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8629 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8630 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8631 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8632 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8633 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8634 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8636 /* 299. GL_EXT_blend_equation_separate */
8637 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8639 /* GL_EXT_gpu_program_parameters */
8640 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8641 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8643 /* 364. GL_EXT_provoking_vertex */
8644 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8646 /* GL_EXT_texture_integer */
8647 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8648 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8649 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8650 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8652 /* 377. GL_EXT_separate_shader_objects */
8653 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8654 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8656 /* GL_ARB_color_buffer_float */
8657 SET_ClampColor(table
, save_ClampColorARB
);
8660 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8661 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8662 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8663 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8665 SET_Uniform1ui(table
, save_Uniform1ui
);
8666 SET_Uniform2ui(table
, save_Uniform2ui
);
8667 SET_Uniform3ui(table
, save_Uniform3ui
);
8668 SET_Uniform4ui(table
, save_Uniform4ui
);
8669 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8670 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8671 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8672 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8674 (void) save_Uniform1ui
;
8675 (void) save_Uniform2ui
;
8676 (void) save_Uniform3ui
;
8677 (void) save_Uniform4ui
;
8678 (void) save_Uniform1uiv
;
8679 (void) save_Uniform2uiv
;
8680 (void) save_Uniform3uiv
;
8681 (void) save_Uniform4uiv
;
8685 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8686 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8687 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8688 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8689 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8690 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8691 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8692 SET_DrawTransformFeedbackInstanced(table
,
8693 save_DrawTransformFeedbackInstanced
);
8694 SET_DrawTransformFeedbackStreamInstanced(table
,
8695 save_DrawTransformFeedbackStreamInstanced
);
8696 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8697 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8699 /* GL_ARB_instanced_arrays */
8700 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8702 /* GL_NV_texture_barrier */
8703 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8705 SET_BindSampler(table
, save_BindSampler
);
8706 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8707 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8708 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8709 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8710 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8711 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8713 /* GL_ARB_draw_buffer_blend */
8714 SET_BlendFunciARB(table
, save_BlendFunci
);
8715 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8716 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8717 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8719 /* GL_ARB_geometry_shader4 */
8720 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8721 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8722 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8724 /* GL_NV_conditional_render */
8725 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8726 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8729 SET_WaitSync(table
, save_WaitSync
);
8731 /* GL_ARB_uniform_buffer_object */
8732 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8734 /* GL_ARB_draw_instanced */
8735 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8736 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8738 /* GL_ARB_draw_elements_base_vertex */
8739 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8741 /* GL_ARB_base_instance */
8742 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8743 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8744 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8750 enum_string(GLenum k
)
8752 return _mesa_lookup_enum_by_nr(k
);
8757 * Print the commands in a display list. For debugging only.
8758 * TODO: many commands aren't handled yet.
8760 static void GLAPIENTRY
8761 print_list(struct gl_context
*ctx
, GLuint list
)
8763 struct gl_display_list
*dlist
;
8767 if (!islist(ctx
, list
)) {
8768 printf("%u is not a display list ID\n", list
);
8772 dlist
= _mesa_lookup_list(ctx
, list
);
8778 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8780 done
= n
? GL_FALSE
: GL_TRUE
;
8782 const OpCode opcode
= n
[0].opcode
;
8784 if (is_ext_opcode(opcode
)) {
8785 n
+= ext_opcode_print(ctx
, n
);
8790 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8793 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8794 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
8796 case OPCODE_CALL_LIST
:
8797 printf("CallList %d\n", (int) n
[1].ui
);
8799 case OPCODE_CALL_LIST_OFFSET
:
8800 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8801 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8803 case OPCODE_DISABLE
:
8804 printf("Disable %s\n", enum_string(n
[1].e
));
8807 printf("Enable %s\n", enum_string(n
[1].e
));
8809 case OPCODE_FRUSTUM
:
8810 printf("Frustum %g %g %g %g %g %g\n",
8811 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8813 case OPCODE_LINE_STIPPLE
:
8814 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8816 case OPCODE_LOAD_IDENTITY
:
8817 printf("LoadIdentity\n");
8819 case OPCODE_LOAD_MATRIX
:
8820 printf("LoadMatrix\n");
8821 printf(" %8f %8f %8f %8f\n",
8822 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8823 printf(" %8f %8f %8f %8f\n",
8824 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8825 printf(" %8f %8f %8f %8f\n",
8826 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8827 printf(" %8f %8f %8f %8f\n",
8828 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8830 case OPCODE_MULT_MATRIX
:
8831 printf("MultMatrix (or Rotate)\n");
8832 printf(" %8f %8f %8f %8f\n",
8833 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8834 printf(" %8f %8f %8f %8f\n",
8835 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8836 printf(" %8f %8f %8f %8f\n",
8837 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8838 printf(" %8f %8f %8f %8f\n",
8839 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8842 printf("Ortho %g %g %g %g %g %g\n",
8843 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8845 case OPCODE_POP_ATTRIB
:
8846 printf("PopAttrib\n");
8848 case OPCODE_POP_MATRIX
:
8849 printf("PopMatrix\n");
8851 case OPCODE_POP_NAME
:
8852 printf("PopName\n");
8854 case OPCODE_PUSH_ATTRIB
:
8855 printf("PushAttrib %x\n", n
[1].bf
);
8857 case OPCODE_PUSH_MATRIX
:
8858 printf("PushMatrix\n");
8860 case OPCODE_PUSH_NAME
:
8861 printf("PushName %d\n", (int) n
[1].ui
);
8863 case OPCODE_RASTER_POS
:
8864 printf("RasterPos %g %g %g %g\n",
8865 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8868 printf("Rotate %g %g %g %g\n",
8869 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8872 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8874 case OPCODE_TRANSLATE
:
8875 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8877 case OPCODE_BIND_TEXTURE
:
8878 printf("BindTexture %s %d\n",
8879 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8881 case OPCODE_SHADE_MODEL
:
8882 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8885 printf("Map1 %s %.3f %.3f %d %d\n",
8886 _mesa_lookup_enum_by_nr(n
[1].ui
),
8887 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8890 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8891 _mesa_lookup_enum_by_nr(n
[1].ui
),
8892 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8893 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8895 case OPCODE_MAPGRID1
:
8896 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8898 case OPCODE_MAPGRID2
:
8899 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8900 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8902 case OPCODE_EVALMESH1
:
8903 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8905 case OPCODE_EVALMESH2
:
8906 printf("EvalMesh2 %d %d %d %d\n",
8907 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8910 case OPCODE_ATTR_1F_NV
:
8911 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8913 case OPCODE_ATTR_2F_NV
:
8914 printf("ATTR_2F_NV attr %d: %f %f\n",
8915 n
[1].i
, n
[2].f
, n
[3].f
);
8917 case OPCODE_ATTR_3F_NV
:
8918 printf("ATTR_3F_NV attr %d: %f %f %f\n",
8919 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8921 case OPCODE_ATTR_4F_NV
:
8922 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
8923 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8925 case OPCODE_ATTR_1F_ARB
:
8926 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
8928 case OPCODE_ATTR_2F_ARB
:
8929 printf("ATTR_2F_ARB attr %d: %f %f\n",
8930 n
[1].i
, n
[2].f
, n
[3].f
);
8932 case OPCODE_ATTR_3F_ARB
:
8933 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
8934 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8936 case OPCODE_ATTR_4F_ARB
:
8937 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
8938 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
8941 case OPCODE_MATERIAL
:
8942 printf("MATERIAL %x %x: %f %f %f %f\n",
8943 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8946 printf("BEGIN %x\n", n
[1].i
);
8952 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
8955 case OPCODE_EVAL_C1
:
8956 printf("EVAL_C1 %f\n", n
[1].f
);
8958 case OPCODE_EVAL_C2
:
8959 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
8961 case OPCODE_EVAL_P1
:
8962 printf("EVAL_P1 %d\n", n
[1].i
);
8964 case OPCODE_EVAL_P2
:
8965 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
8968 case OPCODE_PROVOKING_VERTEX
:
8969 printf("ProvokingVertex %s\n",
8970 _mesa_lookup_enum_by_nr(n
[1].ui
));
8974 * meta opcodes/commands
8977 printf("Error: %s %s\n",
8978 enum_string(n
[1].e
), (const char *) n
[2].data
);
8980 case OPCODE_CONTINUE
:
8981 printf("DISPLAY-LIST-CONTINUE\n");
8982 n
= (Node
*) n
[1].next
;
8984 case OPCODE_END_OF_LIST
:
8985 printf("END-LIST %u\n", list
);
8989 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
8991 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
8992 opcode
, (void *) n
);
8996 printf("command %d, %u operands\n", opcode
,
9000 /* increment n to point to next compiled command */
9001 if (opcode
!= OPCODE_CONTINUE
) {
9002 n
+= InstSize
[opcode
];
9011 * Clients may call this function to help debug display list problems.
9012 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9013 * changed, or break in the future without notice.
9016 mesa_print_display_list(GLuint list
)
9018 GET_CURRENT_CONTEXT(ctx
);
9019 print_list(ctx
, list
);
9023 /**********************************************************************/
9024 /***** Initialization *****/
9025 /**********************************************************************/
9028 save_vtxfmt_init(GLvertexformat
* vfmt
)
9030 vfmt
->ArrayElement
= _ae_ArrayElement
;
9032 vfmt
->Begin
= save_Begin
;
9034 vfmt
->CallList
= save_CallList
;
9035 vfmt
->CallLists
= save_CallLists
;
9037 vfmt
->Color3f
= save_Color3f
;
9038 vfmt
->Color3fv
= save_Color3fv
;
9039 vfmt
->Color4f
= save_Color4f
;
9040 vfmt
->Color4fv
= save_Color4fv
;
9041 vfmt
->EdgeFlag
= save_EdgeFlag
;
9042 vfmt
->End
= save_End
;
9044 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9045 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9046 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9047 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9048 vfmt
->EvalPoint1
= save_EvalPoint1
;
9049 vfmt
->EvalPoint2
= save_EvalPoint2
;
9051 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9052 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9053 vfmt
->Indexf
= save_Indexf
;
9054 vfmt
->Indexfv
= save_Indexfv
;
9055 vfmt
->Materialfv
= save_Materialfv
;
9056 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9057 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9058 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9059 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9060 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9061 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9062 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9063 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9064 vfmt
->Normal3f
= save_Normal3f
;
9065 vfmt
->Normal3fv
= save_Normal3fv
;
9066 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9067 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9068 vfmt
->TexCoord1f
= save_TexCoord1f
;
9069 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9070 vfmt
->TexCoord2f
= save_TexCoord2f
;
9071 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9072 vfmt
->TexCoord3f
= save_TexCoord3f
;
9073 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9074 vfmt
->TexCoord4f
= save_TexCoord4f
;
9075 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9076 vfmt
->Vertex2f
= save_Vertex2f
;
9077 vfmt
->Vertex2fv
= save_Vertex2fv
;
9078 vfmt
->Vertex3f
= save_Vertex3f
;
9079 vfmt
->Vertex3fv
= save_Vertex3fv
;
9080 vfmt
->Vertex4f
= save_Vertex4f
;
9081 vfmt
->Vertex4fv
= save_Vertex4fv
;
9082 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9083 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9084 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9085 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9086 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9087 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9088 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9089 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9094 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9095 const GLvertexformat
*vfmt
)
9097 SET_CallList(disp
, vfmt
->CallList
);
9098 SET_CallLists(disp
, vfmt
->CallLists
);
9103 * Initialize display list state for given context.
9106 _mesa_init_display_list(struct gl_context
*ctx
)
9108 static GLboolean tableInitialized
= GL_FALSE
;
9110 /* zero-out the instruction size table, just once */
9111 if (!tableInitialized
) {
9112 memset(InstSize
, 0, sizeof(InstSize
));
9113 tableInitialized
= GL_TRUE
;
9116 /* extension info */
9117 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9120 ctx
->ListState
.CallDepth
= 0;
9121 ctx
->ExecuteFlag
= GL_TRUE
;
9122 ctx
->CompileFlag
= GL_FALSE
;
9123 ctx
->ListState
.CurrentBlock
= NULL
;
9124 ctx
->ListState
.CurrentPos
= 0;
9126 /* Display List group */
9127 ctx
->List
.ListBase
= 0;
9129 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9134 _mesa_free_display_list_data(struct gl_context
*ctx
)
9137 ctx
->ListExt
= NULL
;