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.
474 * Note, all of these members should be 4 bytes in size or less for the
475 * sake of compact display lists. We store 8-byte pointers in a pair of
476 * these nodes using the save/get_pointer() functions below.
494 typedef union gl_dlist_node Node
;
497 /** How many 4-byte dwords to store a pointer */
498 #define POINTER_DWORDS (sizeof(void *) / 4)
500 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
501 * space for display lists. The following types and functions are
502 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
507 GLuint dwords
[POINTER_DWORDS
];
512 * Save a 4 or 8-byte pointer at dest (and dest+1).
515 save_pointer(union gl_dlist_node
*dest
, void *src
)
520 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
521 STATIC_ASSERT(sizeof(union gl_dlist_node
) == 4);
525 for (i
= 0; i
< POINTER_DWORDS
; i
++)
526 dest
[i
].ui
= p
.dwords
[i
];
531 * Retrieve a 4 or 8-byte pointer from node (node+1).
534 get_pointer(const union gl_dlist_node
*node
)
539 for (i
= 0; i
< POINTER_DWORDS
; i
++)
540 p
.dwords
[i
] = node
[i
].ui
;
547 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
548 * environment. In 64-bit env, sizeof(Node)==8 anyway.
558 * How many nodes to allocate at a time. Note that bulk vertex data
559 * from glBegin/glVertex/glEnd primitives will typically wind up in
560 * a VBO, and not directly in the display list itself.
562 #define BLOCK_SIZE 256
567 * Number of nodes of storage needed for each instruction.
568 * Sizes for dynamically allocated opcodes are stored in the context struct.
570 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
573 void mesa_print_display_list(GLuint list
);
577 * Allocate a gl_display_list object with an initial block of storage.
578 * \param count how many display list nodes/tokes to allocate
580 static struct gl_display_list
*
581 make_list(GLuint name
, GLuint count
)
583 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
585 dlist
->Head
= malloc(sizeof(Node
) * count
);
586 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
592 * Lookup function to just encapsulate casting.
594 struct gl_display_list
*
595 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
597 return (struct gl_display_list
*)
598 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
602 /** Is the given opcode an extension code? */
603 static inline GLboolean
604 is_ext_opcode(OpCode opcode
)
606 return (opcode
>= OPCODE_EXT_0
);
610 /** Destroy an extended opcode instruction */
612 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
614 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
616 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
617 step
= ctx
->ListExt
->Opcode
[i
].Size
;
622 /** Execute an extended opcode instruction */
624 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
626 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
628 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
629 step
= ctx
->ListExt
->Opcode
[i
].Size
;
634 /** Print an extended opcode instruction */
636 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
638 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
640 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
641 step
= ctx
->ListExt
->Opcode
[i
].Size
;
647 * Delete the named display list, but don't remove from hash table.
648 * \param dlist - display list pointer
651 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
656 n
= block
= dlist
->Head
;
658 done
= block
? GL_FALSE
: GL_TRUE
;
660 const OpCode opcode
= n
[0].opcode
;
662 /* check for extension opcodes first */
663 if (is_ext_opcode(opcode
)) {
664 n
+= ext_opcode_destroy(ctx
, n
);
668 /* for some commands, we need to free malloc'd memory */
670 free(get_pointer(&n
[6]));
671 n
+= InstSize
[n
[0].opcode
];
674 free(get_pointer(&n
[10]));
675 n
+= InstSize
[n
[0].opcode
];
677 case OPCODE_DRAW_PIXELS
:
678 free(get_pointer(&n
[5]));
679 n
+= InstSize
[n
[0].opcode
];
682 free(get_pointer(&n
[7]));
683 n
+= InstSize
[n
[0].opcode
];
685 case OPCODE_POLYGON_STIPPLE
:
686 free(get_pointer(&n
[1]));
687 n
+= InstSize
[n
[0].opcode
];
689 case OPCODE_TEX_IMAGE1D
:
690 free(get_pointer(&n
[8]));
691 n
+= InstSize
[n
[0].opcode
];
693 case OPCODE_TEX_IMAGE2D
:
694 free(get_pointer(&n
[9]));
695 n
+= InstSize
[n
[0].opcode
];
697 case OPCODE_TEX_IMAGE3D
:
698 free(get_pointer(&n
[10]));
699 n
+= InstSize
[n
[0].opcode
];
701 case OPCODE_TEX_SUB_IMAGE1D
:
702 free(get_pointer(&n
[7]));
703 n
+= InstSize
[n
[0].opcode
];
705 case OPCODE_TEX_SUB_IMAGE2D
:
706 free(get_pointer(&n
[9]));
707 n
+= InstSize
[n
[0].opcode
];
709 case OPCODE_TEX_SUB_IMAGE3D
:
710 free(get_pointer(&n
[11]));
711 n
+= InstSize
[n
[0].opcode
];
713 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
714 free(get_pointer(&n
[7]));
715 n
+= InstSize
[n
[0].opcode
];
717 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
718 free(get_pointer(&n
[8]));
719 n
+= InstSize
[n
[0].opcode
];
721 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
722 free(get_pointer(&n
[9]));
723 n
+= InstSize
[n
[0].opcode
];
725 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
726 free(get_pointer(&n
[7]));
727 n
+= InstSize
[n
[0].opcode
];
729 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
730 free(get_pointer(&n
[9]));
731 n
+= InstSize
[n
[0].opcode
];
733 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
734 free(get_pointer(&n
[11]));
735 n
+= InstSize
[n
[0].opcode
];
737 case OPCODE_PROGRAM_STRING_ARB
:
738 free(get_pointer(&n
[4])); /* program string */
739 n
+= InstSize
[n
[0].opcode
];
741 case OPCODE_UNIFORM_1FV
:
742 case OPCODE_UNIFORM_2FV
:
743 case OPCODE_UNIFORM_3FV
:
744 case OPCODE_UNIFORM_4FV
:
745 case OPCODE_UNIFORM_1IV
:
746 case OPCODE_UNIFORM_2IV
:
747 case OPCODE_UNIFORM_3IV
:
748 case OPCODE_UNIFORM_4IV
:
749 case OPCODE_UNIFORM_1UIV
:
750 case OPCODE_UNIFORM_2UIV
:
751 case OPCODE_UNIFORM_3UIV
:
752 case OPCODE_UNIFORM_4UIV
:
753 free(get_pointer(&n
[3]));
754 n
+= InstSize
[n
[0].opcode
];
756 case OPCODE_UNIFORM_MATRIX22
:
757 case OPCODE_UNIFORM_MATRIX33
:
758 case OPCODE_UNIFORM_MATRIX44
:
759 case OPCODE_UNIFORM_MATRIX24
:
760 case OPCODE_UNIFORM_MATRIX42
:
761 case OPCODE_UNIFORM_MATRIX23
:
762 case OPCODE_UNIFORM_MATRIX32
:
763 case OPCODE_UNIFORM_MATRIX34
:
764 case OPCODE_UNIFORM_MATRIX43
:
765 free(get_pointer(&n
[4]));
766 n
+= InstSize
[n
[0].opcode
];
768 case OPCODE_PIXEL_MAP
:
769 free(get_pointer(&n
[3]));
770 n
+= InstSize
[n
[0].opcode
];
773 case OPCODE_CONTINUE
:
774 n
= (Node
*) get_pointer(&n
[1]);
778 case OPCODE_END_OF_LIST
:
783 /* Most frequent case */
784 n
+= InstSize
[n
[0].opcode
];
796 * Destroy a display list and remove from hash table.
797 * \param list - display list number
800 destroy_list(struct gl_context
*ctx
, GLuint list
)
802 struct gl_display_list
*dlist
;
807 dlist
= _mesa_lookup_list(ctx
, list
);
811 _mesa_delete_list(ctx
, dlist
);
812 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
817 * Translate the nth element of list from <type> to GLint.
820 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
832 bptr
= (GLbyte
*) list
;
833 return (GLint
) bptr
[n
];
834 case GL_UNSIGNED_BYTE
:
835 ubptr
= (GLubyte
*) list
;
836 return (GLint
) ubptr
[n
];
838 sptr
= (GLshort
*) list
;
839 return (GLint
) sptr
[n
];
840 case GL_UNSIGNED_SHORT
:
841 usptr
= (GLushort
*) list
;
842 return (GLint
) usptr
[n
];
844 iptr
= (GLint
*) list
;
846 case GL_UNSIGNED_INT
:
847 uiptr
= (GLuint
*) list
;
848 return (GLint
) uiptr
[n
];
850 fptr
= (GLfloat
*) list
;
851 return (GLint
) FLOORF(fptr
[n
]);
853 ubptr
= ((GLubyte
*) list
) + 2 * n
;
854 return (GLint
) ubptr
[0] * 256
857 ubptr
= ((GLubyte
*) list
) + 3 * n
;
858 return (GLint
) ubptr
[0] * 65536
859 + (GLint
) ubptr
[1] * 256
862 ubptr
= ((GLubyte
*) list
) + 4 * n
;
863 return (GLint
) ubptr
[0] * 16777216
864 + (GLint
) ubptr
[1] * 65536
865 + (GLint
) ubptr
[2] * 256
874 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
875 * If width < 0 or height < 0 or format or type are invalid we'll just
876 * return NULL. We will not generate an error since OpenGL command
877 * arguments aren't error-checked until the command is actually executed
878 * (not when they're compiled).
879 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
882 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
883 GLsizei width
, GLsizei height
, GLsizei depth
,
884 GLenum format
, GLenum type
, const GLvoid
* pixels
,
885 const struct gl_pixelstore_attrib
*unpack
)
887 if (width
<= 0 || height
<= 0) {
891 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
892 /* bad format and/or type */
896 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
900 if (type
== GL_BITMAP
)
901 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
903 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
904 format
, type
, pixels
, unpack
);
905 if (pixels
&& !image
) {
906 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
910 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
911 depth
, format
, type
, INT_MAX
, pixels
)) {
912 const GLubyte
*map
, *src
;
916 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
917 GL_MAP_READ_BIT
, unpack
->BufferObj
,
920 /* unable to map src buffer! */
921 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
925 src
= ADD_POINTERS(map
, pixels
);
926 if (type
== GL_BITMAP
)
927 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
929 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
930 format
, type
, src
, unpack
);
932 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
935 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
941 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
946 /** Return copy of memory */
948 memdup(const void *src
, GLsizei bytes
)
950 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
952 memcpy(b
, src
, bytes
);
958 * Allocate space for a display list instruction (opcode + payload space).
959 * \param opcode the instruction opcode (OPCODE_* value)
960 * \param bytes instruction payload size (not counting opcode)
961 * \return pointer to allocated memory (the opcode space)
964 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
966 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
967 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
970 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
971 if (InstSize
[opcode
] == 0) {
972 /* save instruction size now */
973 InstSize
[opcode
] = numNodes
;
976 /* make sure instruction size agrees */
977 ASSERT(numNodes
== InstSize
[opcode
]);
981 if (ctx
->ListState
.CurrentPos
+ numNodes
+ contNodes
> BLOCK_SIZE
) {
982 /* This block is full. Allocate a new block and chain to it */
984 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
985 n
[0].opcode
= OPCODE_CONTINUE
;
986 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
988 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
991 save_pointer(&n
[1], newblock
);
992 ctx
->ListState
.CurrentBlock
= newblock
;
993 ctx
->ListState
.CurrentPos
= 0;
996 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
997 ctx
->ListState
.CurrentPos
+= numNodes
;
999 n
[0].opcode
= opcode
;
1007 * Allocate space for a display list instruction. Used by callers outside
1008 * this file for things like VBO vertex data.
1010 * \param opcode the instruction opcode (OPCODE_* value)
1011 * \param bytes instruction size in bytes, not counting opcode.
1012 * \return pointer to the usable data area (not including the internal
1016 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1018 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
1020 return n
+ 1; /* return pointer to payload area, after opcode */
1027 * This function allows modules and drivers to get their own opcodes
1028 * for extending display list functionality.
1029 * \param ctx the rendering context
1030 * \param size number of bytes for storing the new display list command
1031 * \param execute function to execute the new display list command
1032 * \param destroy function to destroy the new display list command
1033 * \param print function to print the new display list command
1034 * \return the new opcode number or -1 if error
1037 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1039 void (*execute
) (struct gl_context
*, void *),
1040 void (*destroy
) (struct gl_context
*, void *),
1041 void (*print
) (struct gl_context
*, void *))
1043 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1044 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1045 ctx
->ListExt
->Opcode
[i
].Size
=
1046 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1047 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1048 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1049 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1050 return i
+ OPCODE_EXT_0
;
1057 * Allocate space for a display list instruction. The space is basically
1058 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1059 * function parameter, node[2] is the second parameter, etc.
1061 * \param opcode one of OPCODE_x
1062 * \param nparams number of function parameters
1063 * \return pointer to start of instruction space
1065 static inline Node
*
1066 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1068 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1073 * Called by EndList to try to reduce memory used for the list.
1076 trim_list(struct gl_context
*ctx
)
1078 /* If the list we're ending only has one allocated block of nodes/tokens
1079 * and its size isn't a full block size, realloc the block to use less
1080 * memory. This is important for apps that create many small display
1081 * lists and apps that use glXUseXFont (many lists each containing one
1083 * Note: we currently only trim display lists that allocated one block
1084 * of tokens. That hits the short list case which is what we're mainly
1085 * concerned with. Trimming longer lists would involve traversing the
1086 * linked list of blocks.
1088 struct gl_dlist_state
*list
= &ctx
->ListState
;
1090 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1091 (list
->CurrentPos
< BLOCK_SIZE
)) {
1092 /* There's only one block and it's not full, so realloc */
1093 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1094 list
->CurrentList
->Head
=
1095 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1096 if (!list
->CurrentBlock
) {
1097 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1105 * Display List compilation functions
1107 static void GLAPIENTRY
1108 save_Accum(GLenum op
, GLfloat value
)
1110 GET_CURRENT_CONTEXT(ctx
);
1112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1113 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1118 if (ctx
->ExecuteFlag
) {
1119 CALL_Accum(ctx
->Exec
, (op
, value
));
1124 static void GLAPIENTRY
1125 save_AlphaFunc(GLenum func
, GLclampf ref
)
1127 GET_CURRENT_CONTEXT(ctx
);
1129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1130 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1133 n
[2].f
= (GLfloat
) ref
;
1135 if (ctx
->ExecuteFlag
) {
1136 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1141 static void GLAPIENTRY
1142 save_BindTexture(GLenum target
, GLuint texture
)
1144 GET_CURRENT_CONTEXT(ctx
);
1146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1147 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1152 if (ctx
->ExecuteFlag
) {
1153 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1158 static void GLAPIENTRY
1159 save_Bitmap(GLsizei width
, GLsizei height
,
1160 GLfloat xorig
, GLfloat yorig
,
1161 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1163 GET_CURRENT_CONTEXT(ctx
);
1165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1166 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1168 n
[1].i
= (GLint
) width
;
1169 n
[2].i
= (GLint
) height
;
1175 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1176 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1178 if (ctx
->ExecuteFlag
) {
1179 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1180 xorig
, yorig
, xmove
, ymove
, pixels
));
1185 static void GLAPIENTRY
1186 save_BlendEquation(GLenum mode
)
1188 GET_CURRENT_CONTEXT(ctx
);
1190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1191 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1195 if (ctx
->ExecuteFlag
) {
1196 CALL_BlendEquation(ctx
->Exec
, (mode
));
1201 static void GLAPIENTRY
1202 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1204 GET_CURRENT_CONTEXT(ctx
);
1206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1207 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1212 if (ctx
->ExecuteFlag
) {
1213 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1218 static void GLAPIENTRY
1219 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1220 GLenum sfactorA
, GLenum dfactorA
)
1222 GET_CURRENT_CONTEXT(ctx
);
1224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1225 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1227 n
[1].e
= sfactorRGB
;
1228 n
[2].e
= dfactorRGB
;
1232 if (ctx
->ExecuteFlag
) {
1233 CALL_BlendFuncSeparate(ctx
->Exec
,
1234 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1239 static void GLAPIENTRY
1240 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1242 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1246 static void GLAPIENTRY
1247 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1249 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1252 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1259 if (ctx
->ExecuteFlag
) {
1260 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1264 /* GL_ARB_draw_buffers_blend */
1265 static void GLAPIENTRY
1266 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1267 GLenum sfactorA
, GLenum dfactorA
)
1269 GET_CURRENT_CONTEXT(ctx
);
1271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1272 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1275 n
[2].e
= sfactorRGB
;
1276 n
[3].e
= dfactorRGB
;
1280 if (ctx
->ExecuteFlag
) {
1281 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1282 sfactorA
, dfactorA
));
1286 /* GL_ARB_draw_buffers_blend */
1287 static void GLAPIENTRY
1288 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1290 GET_CURRENT_CONTEXT(ctx
);
1292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1293 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1299 if (ctx
->ExecuteFlag
) {
1300 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1304 /* GL_ARB_draw_buffers_blend */
1305 static void GLAPIENTRY
1306 save_BlendEquationi(GLuint buf
, GLenum mode
)
1308 GET_CURRENT_CONTEXT(ctx
);
1310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1311 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1316 if (ctx
->ExecuteFlag
) {
1317 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1321 /* GL_ARB_draw_buffers_blend */
1322 static void GLAPIENTRY
1323 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1325 GET_CURRENT_CONTEXT(ctx
);
1327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1328 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1334 if (ctx
->ExecuteFlag
) {
1335 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1340 /* GL_ARB_draw_instanced. */
1341 static void GLAPIENTRY
1342 save_DrawArraysInstancedARB(GLenum mode
,
1347 GET_CURRENT_CONTEXT(ctx
);
1348 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1349 "glDrawArraysInstanced() during display list compile");
1352 static void GLAPIENTRY
1353 save_DrawElementsInstancedARB(GLenum mode
,
1356 const GLvoid
*indices
,
1359 GET_CURRENT_CONTEXT(ctx
);
1360 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1361 "glDrawElementsInstanced() during display list compile");
1364 static void GLAPIENTRY
1365 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1368 const GLvoid
*indices
,
1372 GET_CURRENT_CONTEXT(ctx
);
1373 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1374 "glDrawElementsInstancedBaseVertex() during display list compile");
1377 /* GL_ARB_base_instance. */
1378 static void GLAPIENTRY
1379 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1383 GLuint baseinstance
)
1385 GET_CURRENT_CONTEXT(ctx
);
1386 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1387 "glDrawArraysInstancedBaseInstance() during display list compile");
1390 static void APIENTRY
1391 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1394 const void *indices
,
1396 GLuint baseinstance
)
1398 GET_CURRENT_CONTEXT(ctx
);
1399 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1400 "glDrawElementsInstancedBaseInstance() during display list compile");
1403 static void APIENTRY
1404 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1407 const void *indices
,
1410 GLuint baseinstance
)
1412 GET_CURRENT_CONTEXT(ctx
);
1413 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1414 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1419 * While building a display list we cache some OpenGL state.
1420 * Under some circumstances we need to invalidate that state (immediately
1421 * when we start compiling a list, or after glCallList(s)).
1424 invalidate_saved_current_state(struct gl_context
*ctx
)
1428 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1429 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1431 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1432 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1434 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1436 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1440 static void GLAPIENTRY
1441 save_CallList(GLuint list
)
1443 GET_CURRENT_CONTEXT(ctx
);
1445 SAVE_FLUSH_VERTICES(ctx
);
1447 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1452 /* After this, we don't know what state we're in. Invalidate all
1453 * cached information previously gathered:
1455 invalidate_saved_current_state( ctx
);
1457 if (ctx
->ExecuteFlag
) {
1458 _mesa_CallList(list
);
1463 static void GLAPIENTRY
1464 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1466 GET_CURRENT_CONTEXT(ctx
);
1468 GLboolean typeErrorFlag
;
1470 SAVE_FLUSH_VERTICES(ctx
);
1474 case GL_UNSIGNED_BYTE
:
1476 case GL_UNSIGNED_SHORT
:
1478 case GL_UNSIGNED_INT
:
1483 typeErrorFlag
= GL_FALSE
;
1486 typeErrorFlag
= GL_TRUE
;
1489 for (i
= 0; i
< num
; i
++) {
1490 GLint list
= translate_id(i
, type
, lists
);
1491 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1494 n
[2].b
= typeErrorFlag
;
1498 /* After this, we don't know what state we're in. Invalidate all
1499 * cached information previously gathered:
1501 invalidate_saved_current_state( ctx
);
1503 if (ctx
->ExecuteFlag
) {
1504 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1509 static void GLAPIENTRY
1510 save_Clear(GLbitfield mask
)
1512 GET_CURRENT_CONTEXT(ctx
);
1514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1515 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1519 if (ctx
->ExecuteFlag
) {
1520 CALL_Clear(ctx
->Exec
, (mask
));
1525 static void GLAPIENTRY
1526 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1528 GET_CURRENT_CONTEXT(ctx
);
1530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1531 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1534 n
[2].i
= drawbuffer
;
1536 if (buffer
== GL_COLOR
) {
1547 if (ctx
->ExecuteFlag
) {
1548 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1553 static void GLAPIENTRY
1554 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1556 GET_CURRENT_CONTEXT(ctx
);
1558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1559 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1562 n
[2].i
= drawbuffer
;
1564 if (buffer
== GL_COLOR
) {
1575 if (ctx
->ExecuteFlag
) {
1576 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1581 static void GLAPIENTRY
1582 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1584 GET_CURRENT_CONTEXT(ctx
);
1586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1587 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1590 n
[2].i
= drawbuffer
;
1592 if (buffer
== GL_COLOR
) {
1603 if (ctx
->ExecuteFlag
) {
1604 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1609 static void GLAPIENTRY
1610 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1611 GLfloat depth
, GLint stencil
)
1613 GET_CURRENT_CONTEXT(ctx
);
1615 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1616 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1619 n
[2].i
= drawbuffer
;
1623 if (ctx
->ExecuteFlag
) {
1624 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1629 static void GLAPIENTRY
1630 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1632 GET_CURRENT_CONTEXT(ctx
);
1634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1635 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1642 if (ctx
->ExecuteFlag
) {
1643 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1648 static void GLAPIENTRY
1649 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1651 GET_CURRENT_CONTEXT(ctx
);
1653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1654 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1661 if (ctx
->ExecuteFlag
) {
1662 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1667 static void GLAPIENTRY
1668 save_ClearDepth(GLclampd depth
)
1670 GET_CURRENT_CONTEXT(ctx
);
1672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1673 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1675 n
[1].f
= (GLfloat
) depth
;
1677 if (ctx
->ExecuteFlag
) {
1678 CALL_ClearDepth(ctx
->Exec
, (depth
));
1683 static void GLAPIENTRY
1684 save_ClearIndex(GLfloat c
)
1686 GET_CURRENT_CONTEXT(ctx
);
1688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1689 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1693 if (ctx
->ExecuteFlag
) {
1694 CALL_ClearIndex(ctx
->Exec
, (c
));
1699 static void GLAPIENTRY
1700 save_ClearStencil(GLint s
)
1702 GET_CURRENT_CONTEXT(ctx
);
1704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1705 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1709 if (ctx
->ExecuteFlag
) {
1710 CALL_ClearStencil(ctx
->Exec
, (s
));
1715 static void GLAPIENTRY
1716 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1718 GET_CURRENT_CONTEXT(ctx
);
1720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1721 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1724 n
[2].f
= (GLfloat
) equ
[0];
1725 n
[3].f
= (GLfloat
) equ
[1];
1726 n
[4].f
= (GLfloat
) equ
[2];
1727 n
[5].f
= (GLfloat
) equ
[3];
1729 if (ctx
->ExecuteFlag
) {
1730 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1736 static void GLAPIENTRY
1737 save_ColorMask(GLboolean red
, GLboolean green
,
1738 GLboolean blue
, GLboolean alpha
)
1740 GET_CURRENT_CONTEXT(ctx
);
1742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1743 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1750 if (ctx
->ExecuteFlag
) {
1751 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1756 static void GLAPIENTRY
1757 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1758 GLboolean blue
, GLboolean alpha
)
1760 GET_CURRENT_CONTEXT(ctx
);
1762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1763 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1771 if (ctx
->ExecuteFlag
) {
1772 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1777 static void GLAPIENTRY
1778 save_ColorMaterial(GLenum face
, GLenum mode
)
1780 GET_CURRENT_CONTEXT(ctx
);
1782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1784 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1789 if (ctx
->ExecuteFlag
) {
1790 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1795 static void GLAPIENTRY
1796 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1798 GET_CURRENT_CONTEXT(ctx
);
1800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1801 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1805 n
[3].i
= (GLint
) width
;
1806 n
[4].i
= (GLint
) height
;
1809 if (ctx
->ExecuteFlag
) {
1810 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1816 static void GLAPIENTRY
1817 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1818 GLint x
, GLint y
, GLsizei width
, GLint border
)
1820 GET_CURRENT_CONTEXT(ctx
);
1822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1823 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1827 n
[3].e
= internalformat
;
1833 if (ctx
->ExecuteFlag
) {
1834 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1835 x
, y
, width
, border
));
1840 static void GLAPIENTRY
1841 save_CopyTexImage2D(GLenum target
, GLint level
,
1842 GLenum internalformat
,
1843 GLint x
, GLint y
, GLsizei width
,
1844 GLsizei height
, GLint border
)
1846 GET_CURRENT_CONTEXT(ctx
);
1848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1849 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1853 n
[3].e
= internalformat
;
1860 if (ctx
->ExecuteFlag
) {
1861 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1862 x
, y
, width
, height
, border
));
1868 static void GLAPIENTRY
1869 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1870 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1872 GET_CURRENT_CONTEXT(ctx
);
1874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1875 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1884 if (ctx
->ExecuteFlag
) {
1885 CALL_CopyTexSubImage1D(ctx
->Exec
,
1886 (target
, level
, xoffset
, x
, y
, width
));
1891 static void GLAPIENTRY
1892 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1893 GLint xoffset
, GLint yoffset
,
1894 GLint x
, GLint y
, GLsizei width
, GLint height
)
1896 GET_CURRENT_CONTEXT(ctx
);
1898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1899 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1910 if (ctx
->ExecuteFlag
) {
1911 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1912 x
, y
, width
, height
));
1917 static void GLAPIENTRY
1918 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1919 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1920 GLint x
, GLint y
, GLsizei width
, GLint height
)
1922 GET_CURRENT_CONTEXT(ctx
);
1924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1925 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1937 if (ctx
->ExecuteFlag
) {
1938 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1939 xoffset
, yoffset
, zoffset
,
1940 x
, y
, width
, height
));
1945 static void GLAPIENTRY
1946 save_CullFace(GLenum mode
)
1948 GET_CURRENT_CONTEXT(ctx
);
1950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1951 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1955 if (ctx
->ExecuteFlag
) {
1956 CALL_CullFace(ctx
->Exec
, (mode
));
1961 static void GLAPIENTRY
1962 save_DepthFunc(GLenum func
)
1964 GET_CURRENT_CONTEXT(ctx
);
1966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1967 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1971 if (ctx
->ExecuteFlag
) {
1972 CALL_DepthFunc(ctx
->Exec
, (func
));
1977 static void GLAPIENTRY
1978 save_DepthMask(GLboolean mask
)
1980 GET_CURRENT_CONTEXT(ctx
);
1982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1983 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1987 if (ctx
->ExecuteFlag
) {
1988 CALL_DepthMask(ctx
->Exec
, (mask
));
1993 static void GLAPIENTRY
1994 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1996 GET_CURRENT_CONTEXT(ctx
);
1998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1999 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2001 n
[1].f
= (GLfloat
) nearval
;
2002 n
[2].f
= (GLfloat
) farval
;
2004 if (ctx
->ExecuteFlag
) {
2005 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2010 static void GLAPIENTRY
2011 save_Disable(GLenum cap
)
2013 GET_CURRENT_CONTEXT(ctx
);
2015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2016 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2020 if (ctx
->ExecuteFlag
) {
2021 CALL_Disable(ctx
->Exec
, (cap
));
2026 static void GLAPIENTRY
2027 save_DisableIndexed(GLuint index
, GLenum cap
)
2029 GET_CURRENT_CONTEXT(ctx
);
2031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2032 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2037 if (ctx
->ExecuteFlag
) {
2038 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2043 static void GLAPIENTRY
2044 save_DrawBuffer(GLenum mode
)
2046 GET_CURRENT_CONTEXT(ctx
);
2048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2049 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2053 if (ctx
->ExecuteFlag
) {
2054 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2059 static void GLAPIENTRY
2060 save_DrawPixels(GLsizei width
, GLsizei height
,
2061 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2063 GET_CURRENT_CONTEXT(ctx
);
2066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2068 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2075 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2076 pixels
, &ctx
->Unpack
));
2078 if (ctx
->ExecuteFlag
) {
2079 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2085 static void GLAPIENTRY
2086 save_Enable(GLenum cap
)
2088 GET_CURRENT_CONTEXT(ctx
);
2090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2091 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2095 if (ctx
->ExecuteFlag
) {
2096 CALL_Enable(ctx
->Exec
, (cap
));
2102 static void GLAPIENTRY
2103 save_EnableIndexed(GLuint index
, GLenum cap
)
2105 GET_CURRENT_CONTEXT(ctx
);
2107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2108 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2113 if (ctx
->ExecuteFlag
) {
2114 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2120 static void GLAPIENTRY
2121 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2123 GET_CURRENT_CONTEXT(ctx
);
2125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2126 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2132 if (ctx
->ExecuteFlag
) {
2133 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2138 static void GLAPIENTRY
2139 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2141 GET_CURRENT_CONTEXT(ctx
);
2143 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2144 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2152 if (ctx
->ExecuteFlag
) {
2153 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2160 static void GLAPIENTRY
2161 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2163 GET_CURRENT_CONTEXT(ctx
);
2165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2166 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2174 if (ctx
->ExecuteFlag
) {
2175 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2180 static void GLAPIENTRY
2181 save_Fogf(GLenum pname
, GLfloat param
)
2185 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2186 save_Fogfv(pname
, parray
);
2190 static void GLAPIENTRY
2191 save_Fogiv(GLenum pname
, const GLint
*params
)
2196 case GL_FOG_DENSITY
:
2200 p
[0] = (GLfloat
) *params
;
2206 p
[0] = INT_TO_FLOAT(params
[0]);
2207 p
[1] = INT_TO_FLOAT(params
[1]);
2208 p
[2] = INT_TO_FLOAT(params
[2]);
2209 p
[3] = INT_TO_FLOAT(params
[3]);
2212 /* Error will be caught later in gl_Fogfv */
2213 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2215 save_Fogfv(pname
, p
);
2219 static void GLAPIENTRY
2220 save_Fogi(GLenum pname
, GLint param
)
2224 parray
[1] = parray
[2] = parray
[3] = 0;
2225 save_Fogiv(pname
, parray
);
2229 static void GLAPIENTRY
2230 save_FrontFace(GLenum mode
)
2232 GET_CURRENT_CONTEXT(ctx
);
2234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2235 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2239 if (ctx
->ExecuteFlag
) {
2240 CALL_FrontFace(ctx
->Exec
, (mode
));
2245 static void GLAPIENTRY
2246 save_Frustum(GLdouble left
, GLdouble right
,
2247 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2249 GET_CURRENT_CONTEXT(ctx
);
2251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2252 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2254 n
[1].f
= (GLfloat
) left
;
2255 n
[2].f
= (GLfloat
) right
;
2256 n
[3].f
= (GLfloat
) bottom
;
2257 n
[4].f
= (GLfloat
) top
;
2258 n
[5].f
= (GLfloat
) nearval
;
2259 n
[6].f
= (GLfloat
) farval
;
2261 if (ctx
->ExecuteFlag
) {
2262 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2267 static void GLAPIENTRY
2268 save_Hint(GLenum target
, GLenum mode
)
2270 GET_CURRENT_CONTEXT(ctx
);
2272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2273 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2278 if (ctx
->ExecuteFlag
) {
2279 CALL_Hint(ctx
->Exec
, (target
, mode
));
2284 static void GLAPIENTRY
2285 save_IndexMask(GLuint mask
)
2287 GET_CURRENT_CONTEXT(ctx
);
2289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2290 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2294 if (ctx
->ExecuteFlag
) {
2295 CALL_IndexMask(ctx
->Exec
, (mask
));
2300 static void GLAPIENTRY
2301 save_InitNames(void)
2303 GET_CURRENT_CONTEXT(ctx
);
2304 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2305 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2306 if (ctx
->ExecuteFlag
) {
2307 CALL_InitNames(ctx
->Exec
, ());
2312 static void GLAPIENTRY
2313 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2315 GET_CURRENT_CONTEXT(ctx
);
2317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2318 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2336 case GL_SPOT_DIRECTION
:
2339 case GL_SPOT_EXPONENT
:
2342 case GL_SPOT_CUTOFF
:
2345 case GL_CONSTANT_ATTENUATION
:
2348 case GL_LINEAR_ATTENUATION
:
2351 case GL_QUADRATIC_ATTENUATION
:
2357 for (i
= 0; i
< nParams
; i
++) {
2358 n
[3 + i
].f
= params
[i
];
2361 if (ctx
->ExecuteFlag
) {
2362 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2367 static void GLAPIENTRY
2368 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2372 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2373 save_Lightfv(light
, pname
, parray
);
2377 static void GLAPIENTRY
2378 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2385 fparam
[0] = INT_TO_FLOAT(params
[0]);
2386 fparam
[1] = INT_TO_FLOAT(params
[1]);
2387 fparam
[2] = INT_TO_FLOAT(params
[2]);
2388 fparam
[3] = INT_TO_FLOAT(params
[3]);
2391 fparam
[0] = (GLfloat
) params
[0];
2392 fparam
[1] = (GLfloat
) params
[1];
2393 fparam
[2] = (GLfloat
) params
[2];
2394 fparam
[3] = (GLfloat
) params
[3];
2396 case GL_SPOT_DIRECTION
:
2397 fparam
[0] = (GLfloat
) params
[0];
2398 fparam
[1] = (GLfloat
) params
[1];
2399 fparam
[2] = (GLfloat
) params
[2];
2401 case GL_SPOT_EXPONENT
:
2402 case GL_SPOT_CUTOFF
:
2403 case GL_CONSTANT_ATTENUATION
:
2404 case GL_LINEAR_ATTENUATION
:
2405 case GL_QUADRATIC_ATTENUATION
:
2406 fparam
[0] = (GLfloat
) params
[0];
2409 /* error will be caught later in gl_Lightfv */
2412 save_Lightfv(light
, pname
, fparam
);
2416 static void GLAPIENTRY
2417 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2421 parray
[1] = parray
[2] = parray
[3] = 0;
2422 save_Lightiv(light
, pname
, parray
);
2426 static void GLAPIENTRY
2427 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2429 GET_CURRENT_CONTEXT(ctx
);
2431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2432 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2440 if (ctx
->ExecuteFlag
) {
2441 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2446 static void GLAPIENTRY
2447 save_LightModelf(GLenum pname
, GLfloat param
)
2451 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2452 save_LightModelfv(pname
, parray
);
2456 static void GLAPIENTRY
2457 save_LightModeliv(GLenum pname
, const GLint
*params
)
2461 case GL_LIGHT_MODEL_AMBIENT
:
2462 fparam
[0] = INT_TO_FLOAT(params
[0]);
2463 fparam
[1] = INT_TO_FLOAT(params
[1]);
2464 fparam
[2] = INT_TO_FLOAT(params
[2]);
2465 fparam
[3] = INT_TO_FLOAT(params
[3]);
2467 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2468 case GL_LIGHT_MODEL_TWO_SIDE
:
2469 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2470 fparam
[0] = (GLfloat
) params
[0];
2476 /* Error will be caught later in gl_LightModelfv */
2477 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2479 save_LightModelfv(pname
, fparam
);
2483 static void GLAPIENTRY
2484 save_LightModeli(GLenum pname
, GLint param
)
2488 parray
[1] = parray
[2] = parray
[3] = 0;
2489 save_LightModeliv(pname
, parray
);
2493 static void GLAPIENTRY
2494 save_LineStipple(GLint factor
, GLushort pattern
)
2496 GET_CURRENT_CONTEXT(ctx
);
2498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2499 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2504 if (ctx
->ExecuteFlag
) {
2505 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2510 static void GLAPIENTRY
2511 save_LineWidth(GLfloat width
)
2513 GET_CURRENT_CONTEXT(ctx
);
2515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2516 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2520 if (ctx
->ExecuteFlag
) {
2521 CALL_LineWidth(ctx
->Exec
, (width
));
2526 static void GLAPIENTRY
2527 save_ListBase(GLuint base
)
2529 GET_CURRENT_CONTEXT(ctx
);
2531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2532 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2536 if (ctx
->ExecuteFlag
) {
2537 CALL_ListBase(ctx
->Exec
, (base
));
2542 static void GLAPIENTRY
2543 save_LoadIdentity(void)
2545 GET_CURRENT_CONTEXT(ctx
);
2546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2547 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2548 if (ctx
->ExecuteFlag
) {
2549 CALL_LoadIdentity(ctx
->Exec
, ());
2554 static void GLAPIENTRY
2555 save_LoadMatrixf(const GLfloat
* m
)
2557 GET_CURRENT_CONTEXT(ctx
);
2559 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2560 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2563 for (i
= 0; i
< 16; i
++) {
2567 if (ctx
->ExecuteFlag
) {
2568 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2573 static void GLAPIENTRY
2574 save_LoadMatrixd(const GLdouble
* m
)
2578 for (i
= 0; i
< 16; i
++) {
2579 f
[i
] = (GLfloat
) m
[i
];
2581 save_LoadMatrixf(f
);
2585 static void GLAPIENTRY
2586 save_LoadName(GLuint name
)
2588 GET_CURRENT_CONTEXT(ctx
);
2590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2591 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2595 if (ctx
->ExecuteFlag
) {
2596 CALL_LoadName(ctx
->Exec
, (name
));
2601 static void GLAPIENTRY
2602 save_LogicOp(GLenum opcode
)
2604 GET_CURRENT_CONTEXT(ctx
);
2606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2607 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2611 if (ctx
->ExecuteFlag
) {
2612 CALL_LogicOp(ctx
->Exec
, (opcode
));
2617 static void GLAPIENTRY
2618 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2619 GLint order
, const GLdouble
* points
)
2621 GET_CURRENT_CONTEXT(ctx
);
2623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2624 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2626 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2628 n
[2].f
= (GLfloat
) u1
;
2629 n
[3].f
= (GLfloat
) u2
;
2630 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2632 save_pointer(&n
[6], pnts
);
2634 if (ctx
->ExecuteFlag
) {
2635 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2639 static void GLAPIENTRY
2640 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2641 GLint order
, const GLfloat
* points
)
2643 GET_CURRENT_CONTEXT(ctx
);
2645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2646 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2648 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2652 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2654 save_pointer(&n
[6], pnts
);
2656 if (ctx
->ExecuteFlag
) {
2657 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2662 static void GLAPIENTRY
2663 save_Map2d(GLenum target
,
2664 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2665 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2666 const GLdouble
* points
)
2668 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2673 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2674 vstride
, vorder
, points
);
2676 n
[2].f
= (GLfloat
) u1
;
2677 n
[3].f
= (GLfloat
) u2
;
2678 n
[4].f
= (GLfloat
) v1
;
2679 n
[5].f
= (GLfloat
) v2
;
2680 /* XXX verify these strides are correct */
2681 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2682 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2685 save_pointer(&n
[10], pnts
);
2687 if (ctx
->ExecuteFlag
) {
2688 CALL_Map2d(ctx
->Exec
, (target
,
2689 u1
, u2
, ustride
, uorder
,
2690 v1
, v2
, vstride
, vorder
, points
));
2695 static void GLAPIENTRY
2696 save_Map2f(GLenum target
,
2697 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2698 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2699 const GLfloat
* points
)
2701 GET_CURRENT_CONTEXT(ctx
);
2703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2704 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2706 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2707 vstride
, vorder
, points
);
2713 /* XXX verify these strides are correct */
2714 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2715 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2718 save_pointer(&n
[10], pnts
);
2720 if (ctx
->ExecuteFlag
) {
2721 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2722 v1
, v2
, vstride
, vorder
, points
));
2727 static void GLAPIENTRY
2728 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2730 GET_CURRENT_CONTEXT(ctx
);
2732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2733 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2739 if (ctx
->ExecuteFlag
) {
2740 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2745 static void GLAPIENTRY
2746 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2748 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2752 static void GLAPIENTRY
2753 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2754 GLint vn
, GLfloat v1
, GLfloat v2
)
2756 GET_CURRENT_CONTEXT(ctx
);
2758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2759 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2768 if (ctx
->ExecuteFlag
) {
2769 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2775 static void GLAPIENTRY
2776 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2777 GLint vn
, GLdouble v1
, GLdouble v2
)
2779 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2780 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2784 static void GLAPIENTRY
2785 save_MatrixMode(GLenum mode
)
2787 GET_CURRENT_CONTEXT(ctx
);
2789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2790 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2794 if (ctx
->ExecuteFlag
) {
2795 CALL_MatrixMode(ctx
->Exec
, (mode
));
2800 static void GLAPIENTRY
2801 save_MultMatrixf(const GLfloat
* m
)
2803 GET_CURRENT_CONTEXT(ctx
);
2805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2806 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2809 for (i
= 0; i
< 16; i
++) {
2813 if (ctx
->ExecuteFlag
) {
2814 CALL_MultMatrixf(ctx
->Exec
, (m
));
2819 static void GLAPIENTRY
2820 save_MultMatrixd(const GLdouble
* m
)
2824 for (i
= 0; i
< 16; i
++) {
2825 f
[i
] = (GLfloat
) m
[i
];
2827 save_MultMatrixf(f
);
2831 static void GLAPIENTRY
2832 save_NewList(GLuint name
, GLenum mode
)
2834 GET_CURRENT_CONTEXT(ctx
);
2835 /* It's an error to call this function while building a display list */
2836 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2843 static void GLAPIENTRY
2844 save_Ortho(GLdouble left
, GLdouble right
,
2845 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2847 GET_CURRENT_CONTEXT(ctx
);
2849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2850 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2852 n
[1].f
= (GLfloat
) left
;
2853 n
[2].f
= (GLfloat
) right
;
2854 n
[3].f
= (GLfloat
) bottom
;
2855 n
[4].f
= (GLfloat
) top
;
2856 n
[5].f
= (GLfloat
) nearval
;
2857 n
[6].f
= (GLfloat
) farval
;
2859 if (ctx
->ExecuteFlag
) {
2860 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2865 static void GLAPIENTRY
2866 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2868 GET_CURRENT_CONTEXT(ctx
);
2870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2871 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2875 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2877 if (ctx
->ExecuteFlag
) {
2878 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2883 static void GLAPIENTRY
2884 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2886 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2888 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2889 for (i
= 0; i
< mapsize
; i
++) {
2890 fvalues
[i
] = (GLfloat
) values
[i
];
2894 for (i
= 0; i
< mapsize
; i
++) {
2895 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2898 save_PixelMapfv(map
, mapsize
, fvalues
);
2902 static void GLAPIENTRY
2903 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2905 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2907 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2908 for (i
= 0; i
< mapsize
; i
++) {
2909 fvalues
[i
] = (GLfloat
) values
[i
];
2913 for (i
= 0; i
< mapsize
; i
++) {
2914 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2917 save_PixelMapfv(map
, mapsize
, fvalues
);
2921 static void GLAPIENTRY
2922 save_PixelTransferf(GLenum pname
, GLfloat param
)
2924 GET_CURRENT_CONTEXT(ctx
);
2926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2927 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2932 if (ctx
->ExecuteFlag
) {
2933 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2938 static void GLAPIENTRY
2939 save_PixelTransferi(GLenum pname
, GLint param
)
2941 save_PixelTransferf(pname
, (GLfloat
) param
);
2945 static void GLAPIENTRY
2946 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2948 GET_CURRENT_CONTEXT(ctx
);
2950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2951 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2956 if (ctx
->ExecuteFlag
) {
2957 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2962 static void GLAPIENTRY
2963 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2965 GET_CURRENT_CONTEXT(ctx
);
2967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2968 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2975 if (ctx
->ExecuteFlag
) {
2976 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2981 static void GLAPIENTRY
2982 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2986 parray
[1] = parray
[2] = 0.0F
;
2987 save_PointParameterfvEXT(pname
, parray
);
2990 static void GLAPIENTRY
2991 save_PointParameteriNV(GLenum pname
, GLint param
)
2994 parray
[0] = (GLfloat
) param
;
2995 parray
[1] = parray
[2] = 0.0F
;
2996 save_PointParameterfvEXT(pname
, parray
);
2999 static void GLAPIENTRY
3000 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3003 parray
[0] = (GLfloat
) param
[0];
3004 parray
[1] = parray
[2] = 0.0F
;
3005 save_PointParameterfvEXT(pname
, parray
);
3009 static void GLAPIENTRY
3010 save_PointSize(GLfloat size
)
3012 GET_CURRENT_CONTEXT(ctx
);
3014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3015 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3019 if (ctx
->ExecuteFlag
) {
3020 CALL_PointSize(ctx
->Exec
, (size
));
3025 static void GLAPIENTRY
3026 save_PolygonMode(GLenum face
, GLenum mode
)
3028 GET_CURRENT_CONTEXT(ctx
);
3030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3031 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3036 if (ctx
->ExecuteFlag
) {
3037 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3042 static void GLAPIENTRY
3043 save_PolygonStipple(const GLubyte
* pattern
)
3045 GET_CURRENT_CONTEXT(ctx
);
3048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3050 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3053 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3054 pattern
, &ctx
->Unpack
));
3056 if (ctx
->ExecuteFlag
) {
3057 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3062 static void GLAPIENTRY
3063 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3065 GET_CURRENT_CONTEXT(ctx
);
3067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3068 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3073 if (ctx
->ExecuteFlag
) {
3074 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3079 static void GLAPIENTRY
3080 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3082 GET_CURRENT_CONTEXT(ctx
);
3083 /* XXX mult by DepthMaxF here??? */
3084 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3088 static void GLAPIENTRY
3089 save_PopAttrib(void)
3091 GET_CURRENT_CONTEXT(ctx
);
3092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3093 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3094 if (ctx
->ExecuteFlag
) {
3095 CALL_PopAttrib(ctx
->Exec
, ());
3100 static void GLAPIENTRY
3101 save_PopMatrix(void)
3103 GET_CURRENT_CONTEXT(ctx
);
3104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3105 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3106 if (ctx
->ExecuteFlag
) {
3107 CALL_PopMatrix(ctx
->Exec
, ());
3112 static void GLAPIENTRY
3115 GET_CURRENT_CONTEXT(ctx
);
3116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3117 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3118 if (ctx
->ExecuteFlag
) {
3119 CALL_PopName(ctx
->Exec
, ());
3124 static void GLAPIENTRY
3125 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3126 const GLclampf
* priorities
)
3128 GET_CURRENT_CONTEXT(ctx
);
3130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3132 for (i
= 0; i
< num
; i
++) {
3134 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3136 n
[1].ui
= textures
[i
];
3137 n
[2].f
= priorities
[i
];
3140 if (ctx
->ExecuteFlag
) {
3141 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3146 static void GLAPIENTRY
3147 save_PushAttrib(GLbitfield mask
)
3149 GET_CURRENT_CONTEXT(ctx
);
3151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3152 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3156 if (ctx
->ExecuteFlag
) {
3157 CALL_PushAttrib(ctx
->Exec
, (mask
));
3162 static void GLAPIENTRY
3163 save_PushMatrix(void)
3165 GET_CURRENT_CONTEXT(ctx
);
3166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3167 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3168 if (ctx
->ExecuteFlag
) {
3169 CALL_PushMatrix(ctx
->Exec
, ());
3174 static void GLAPIENTRY
3175 save_PushName(GLuint name
)
3177 GET_CURRENT_CONTEXT(ctx
);
3179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3180 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3184 if (ctx
->ExecuteFlag
) {
3185 CALL_PushName(ctx
->Exec
, (name
));
3190 static void GLAPIENTRY
3191 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3193 GET_CURRENT_CONTEXT(ctx
);
3195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3196 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3203 if (ctx
->ExecuteFlag
) {
3204 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3208 static void GLAPIENTRY
3209 save_RasterPos2d(GLdouble x
, GLdouble y
)
3211 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3214 static void GLAPIENTRY
3215 save_RasterPos2f(GLfloat x
, GLfloat y
)
3217 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3220 static void GLAPIENTRY
3221 save_RasterPos2i(GLint x
, GLint y
)
3223 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3226 static void GLAPIENTRY
3227 save_RasterPos2s(GLshort x
, GLshort y
)
3229 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3232 static void GLAPIENTRY
3233 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3235 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3238 static void GLAPIENTRY
3239 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3241 save_RasterPos4f(x
, y
, z
, 1.0F
);
3244 static void GLAPIENTRY
3245 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3247 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3250 static void GLAPIENTRY
3251 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3253 save_RasterPos4f(x
, y
, z
, 1.0F
);
3256 static void GLAPIENTRY
3257 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3259 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3262 static void GLAPIENTRY
3263 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3265 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3268 static void GLAPIENTRY
3269 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3271 save_RasterPos4f(x
, y
, z
, w
);
3274 static void GLAPIENTRY
3275 save_RasterPos2dv(const GLdouble
* v
)
3277 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3280 static void GLAPIENTRY
3281 save_RasterPos2fv(const GLfloat
* v
)
3283 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3286 static void GLAPIENTRY
3287 save_RasterPos2iv(const GLint
* v
)
3289 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3292 static void GLAPIENTRY
3293 save_RasterPos2sv(const GLshort
* v
)
3295 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3298 static void GLAPIENTRY
3299 save_RasterPos3dv(const GLdouble
* v
)
3301 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3304 static void GLAPIENTRY
3305 save_RasterPos3fv(const GLfloat
* v
)
3307 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3310 static void GLAPIENTRY
3311 save_RasterPos3iv(const GLint
* v
)
3313 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3316 static void GLAPIENTRY
3317 save_RasterPos3sv(const GLshort
* v
)
3319 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3322 static void GLAPIENTRY
3323 save_RasterPos4dv(const GLdouble
* v
)
3325 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3326 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3329 static void GLAPIENTRY
3330 save_RasterPos4fv(const GLfloat
* v
)
3332 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3335 static void GLAPIENTRY
3336 save_RasterPos4iv(const GLint
* v
)
3338 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3339 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3342 static void GLAPIENTRY
3343 save_RasterPos4sv(const GLshort
* v
)
3345 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3349 static void GLAPIENTRY
3350 save_PassThrough(GLfloat token
)
3352 GET_CURRENT_CONTEXT(ctx
);
3354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3355 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3359 if (ctx
->ExecuteFlag
) {
3360 CALL_PassThrough(ctx
->Exec
, (token
));
3365 static void GLAPIENTRY
3366 save_ReadBuffer(GLenum mode
)
3368 GET_CURRENT_CONTEXT(ctx
);
3370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3371 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3375 if (ctx
->ExecuteFlag
) {
3376 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3381 static void GLAPIENTRY
3382 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3384 GET_CURRENT_CONTEXT(ctx
);
3386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3387 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3394 if (ctx
->ExecuteFlag
) {
3395 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3400 static void GLAPIENTRY
3401 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3403 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3407 static void GLAPIENTRY
3408 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3410 GET_CURRENT_CONTEXT(ctx
);
3412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3413 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3419 if (ctx
->ExecuteFlag
) {
3420 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3425 static void GLAPIENTRY
3426 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3428 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3432 static void GLAPIENTRY
3433 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3435 GET_CURRENT_CONTEXT(ctx
);
3437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3438 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3445 if (ctx
->ExecuteFlag
) {
3446 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3451 static void GLAPIENTRY
3452 save_ShadeModel(GLenum mode
)
3454 GET_CURRENT_CONTEXT(ctx
);
3456 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3458 if (ctx
->ExecuteFlag
) {
3459 CALL_ShadeModel(ctx
->Exec
, (mode
));
3462 /* Don't compile this call if it's a no-op.
3463 * By avoiding this state change we have a better chance of
3464 * coalescing subsequent drawing commands into one batch.
3466 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3469 SAVE_FLUSH_VERTICES(ctx
);
3471 ctx
->ListState
.Current
.ShadeModel
= mode
;
3473 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3480 static void GLAPIENTRY
3481 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3483 GET_CURRENT_CONTEXT(ctx
);
3485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3486 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3492 if (ctx
->ExecuteFlag
) {
3493 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3498 static void GLAPIENTRY
3499 save_StencilMask(GLuint mask
)
3501 GET_CURRENT_CONTEXT(ctx
);
3503 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3504 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3508 if (ctx
->ExecuteFlag
) {
3509 CALL_StencilMask(ctx
->Exec
, (mask
));
3514 static void GLAPIENTRY
3515 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3517 GET_CURRENT_CONTEXT(ctx
);
3519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3520 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3526 if (ctx
->ExecuteFlag
) {
3527 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3532 static void GLAPIENTRY
3533 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3535 GET_CURRENT_CONTEXT(ctx
);
3537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3538 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3545 if (ctx
->ExecuteFlag
) {
3546 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3551 static void GLAPIENTRY
3552 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3555 GET_CURRENT_CONTEXT(ctx
);
3557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3559 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3567 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3574 if (ctx
->ExecuteFlag
) {
3575 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3576 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3581 static void GLAPIENTRY
3582 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3584 GET_CURRENT_CONTEXT(ctx
);
3586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3587 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3592 if (ctx
->ExecuteFlag
) {
3593 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3598 static void GLAPIENTRY
3599 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3601 GET_CURRENT_CONTEXT(ctx
);
3603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3604 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3611 if (ctx
->ExecuteFlag
) {
3612 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3617 static void GLAPIENTRY
3618 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3620 GET_CURRENT_CONTEXT(ctx
);
3622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3623 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3627 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3635 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3638 if (ctx
->ExecuteFlag
) {
3639 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3644 static void GLAPIENTRY
3645 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3648 parray
[0] = (GLfloat
) param
;
3649 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3650 save_TexEnvfv(target
, pname
, parray
);
3654 static void GLAPIENTRY
3655 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3658 p
[0] = (GLfloat
) param
;
3659 p
[1] = p
[2] = p
[3] = 0.0F
;
3660 save_TexEnvfv(target
, pname
, p
);
3664 static void GLAPIENTRY
3665 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3668 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3669 p
[0] = INT_TO_FLOAT(param
[0]);
3670 p
[1] = INT_TO_FLOAT(param
[1]);
3671 p
[2] = INT_TO_FLOAT(param
[2]);
3672 p
[3] = INT_TO_FLOAT(param
[3]);
3675 p
[0] = (GLfloat
) param
[0];
3676 p
[1] = p
[2] = p
[3] = 0.0F
;
3678 save_TexEnvfv(target
, pname
, p
);
3682 static void GLAPIENTRY
3683 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3685 GET_CURRENT_CONTEXT(ctx
);
3687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3688 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3697 if (ctx
->ExecuteFlag
) {
3698 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3703 static void GLAPIENTRY
3704 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3707 p
[0] = (GLfloat
) params
[0];
3708 p
[1] = (GLfloat
) params
[1];
3709 p
[2] = (GLfloat
) params
[2];
3710 p
[3] = (GLfloat
) params
[3];
3711 save_TexGenfv(coord
, pname
, p
);
3715 static void GLAPIENTRY
3716 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3719 parray
[0] = (GLfloat
) param
;
3720 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3721 save_TexGenfv(coord
, pname
, parray
);
3725 static void GLAPIENTRY
3726 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3729 p
[0] = (GLfloat
) params
[0];
3730 p
[1] = (GLfloat
) params
[1];
3731 p
[2] = (GLfloat
) params
[2];
3732 p
[3] = (GLfloat
) params
[3];
3733 save_TexGenfv(coord
, pname
, p
);
3737 static void GLAPIENTRY
3738 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3742 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3743 save_TexGenfv(coord
, pname
, parray
);
3747 static void GLAPIENTRY
3748 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3752 parray
[1] = parray
[2] = parray
[3] = 0;
3753 save_TexGeniv(coord
, pname
, parray
);
3757 static void GLAPIENTRY
3758 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3760 GET_CURRENT_CONTEXT(ctx
);
3762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3763 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3772 if (ctx
->ExecuteFlag
) {
3773 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3778 static void GLAPIENTRY
3779 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3783 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3784 save_TexParameterfv(target
, pname
, parray
);
3788 static void GLAPIENTRY
3789 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3792 fparam
[0] = (GLfloat
) param
;
3793 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3794 save_TexParameterfv(target
, pname
, fparam
);
3798 static void GLAPIENTRY
3799 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3802 fparam
[0] = (GLfloat
) params
[0];
3803 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3804 save_TexParameterfv(target
, pname
, fparam
);
3808 static void GLAPIENTRY
3809 save_TexImage1D(GLenum target
,
3810 GLint level
, GLint components
,
3811 GLsizei width
, GLint border
,
3812 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3814 GET_CURRENT_CONTEXT(ctx
);
3815 if (target
== GL_PROXY_TEXTURE_1D
) {
3816 /* don't compile, execute immediately */
3817 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3818 border
, format
, type
, pixels
));
3822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3823 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3827 n
[3].i
= components
;
3828 n
[4].i
= (GLint
) width
;
3833 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3834 pixels
, &ctx
->Unpack
));
3836 if (ctx
->ExecuteFlag
) {
3837 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3838 border
, format
, type
, pixels
));
3844 static void GLAPIENTRY
3845 save_TexImage2D(GLenum target
,
3846 GLint level
, GLint components
,
3847 GLsizei width
, GLsizei height
, GLint border
,
3848 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3850 GET_CURRENT_CONTEXT(ctx
);
3851 if (target
== GL_PROXY_TEXTURE_2D
) {
3852 /* don't compile, execute immediately */
3853 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3854 height
, border
, format
, type
, pixels
));
3858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3859 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3863 n
[3].i
= components
;
3864 n
[4].i
= (GLint
) width
;
3865 n
[5].i
= (GLint
) height
;
3870 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3871 pixels
, &ctx
->Unpack
));
3873 if (ctx
->ExecuteFlag
) {
3874 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3875 height
, border
, format
, type
, pixels
));
3881 static void GLAPIENTRY
3882 save_TexImage3D(GLenum target
,
3883 GLint level
, GLint internalFormat
,
3884 GLsizei width
, GLsizei height
, GLsizei depth
,
3886 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3888 GET_CURRENT_CONTEXT(ctx
);
3889 if (target
== GL_PROXY_TEXTURE_3D
) {
3890 /* don't compile, execute immediately */
3891 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3892 height
, depth
, border
, format
, type
,
3897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3898 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3902 n
[3].i
= (GLint
) internalFormat
;
3903 n
[4].i
= (GLint
) width
;
3904 n
[5].i
= (GLint
) height
;
3905 n
[6].i
= (GLint
) depth
;
3909 save_pointer(&n
[10],
3910 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3911 pixels
, &ctx
->Unpack
));
3913 if (ctx
->ExecuteFlag
) {
3914 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3915 height
, depth
, border
, format
, type
,
3922 static void GLAPIENTRY
3923 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3924 GLsizei width
, GLenum format
, GLenum type
,
3925 const GLvoid
* pixels
)
3927 GET_CURRENT_CONTEXT(ctx
);
3930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3932 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
3937 n
[4].i
= (GLint
) width
;
3941 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3942 pixels
, &ctx
->Unpack
));
3944 if (ctx
->ExecuteFlag
) {
3945 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3946 format
, type
, pixels
));
3951 static void GLAPIENTRY
3952 save_TexSubImage2D(GLenum target
, GLint level
,
3953 GLint xoffset
, GLint yoffset
,
3954 GLsizei width
, GLsizei height
,
3955 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3957 GET_CURRENT_CONTEXT(ctx
);
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3962 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
3968 n
[5].i
= (GLint
) width
;
3969 n
[6].i
= (GLint
) height
;
3973 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3974 pixels
, &ctx
->Unpack
));
3976 if (ctx
->ExecuteFlag
) {
3977 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3978 width
, height
, format
, type
, pixels
));
3983 static void GLAPIENTRY
3984 save_TexSubImage3D(GLenum target
, GLint level
,
3985 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3986 GLsizei width
, GLsizei height
, GLsizei depth
,
3987 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3989 GET_CURRENT_CONTEXT(ctx
);
3992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3994 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4001 n
[6].i
= (GLint
) width
;
4002 n
[7].i
= (GLint
) height
;
4003 n
[8].i
= (GLint
) depth
;
4006 save_pointer(&n
[11],
4007 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4008 pixels
, &ctx
->Unpack
));
4010 if (ctx
->ExecuteFlag
) {
4011 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4012 xoffset
, yoffset
, zoffset
,
4013 width
, height
, depth
, format
, type
,
4019 static void GLAPIENTRY
4020 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4022 GET_CURRENT_CONTEXT(ctx
);
4024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4025 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4031 if (ctx
->ExecuteFlag
) {
4032 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4037 static void GLAPIENTRY
4038 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4040 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4045 static void GLAPIENTRY
4046 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4048 GET_CURRENT_CONTEXT(ctx
);
4050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4051 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4055 n
[3].i
= (GLint
) width
;
4056 n
[4].i
= (GLint
) height
;
4058 if (ctx
->ExecuteFlag
) {
4059 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4064 static void GLAPIENTRY
4065 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4067 GET_CURRENT_CONTEXT(ctx
);
4069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4070 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4077 if (ctx
->ExecuteFlag
) {
4078 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4082 static void GLAPIENTRY
4083 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4085 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4088 static void GLAPIENTRY
4089 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4091 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4094 static void GLAPIENTRY
4095 save_WindowPos2iMESA(GLint x
, GLint y
)
4097 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4100 static void GLAPIENTRY
4101 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4103 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4106 static void GLAPIENTRY
4107 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4109 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4112 static void GLAPIENTRY
4113 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4115 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4118 static void GLAPIENTRY
4119 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4121 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4124 static void GLAPIENTRY
4125 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4127 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4130 static void GLAPIENTRY
4131 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4133 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4136 static void GLAPIENTRY
4137 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4139 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4142 static void GLAPIENTRY
4143 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4145 save_WindowPos4fMESA(x
, y
, z
, w
);
4148 static void GLAPIENTRY
4149 save_WindowPos2dvMESA(const GLdouble
* v
)
4151 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4154 static void GLAPIENTRY
4155 save_WindowPos2fvMESA(const GLfloat
* v
)
4157 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4160 static void GLAPIENTRY
4161 save_WindowPos2ivMESA(const GLint
* v
)
4163 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4166 static void GLAPIENTRY
4167 save_WindowPos2svMESA(const GLshort
* v
)
4169 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4172 static void GLAPIENTRY
4173 save_WindowPos3dvMESA(const GLdouble
* v
)
4175 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4178 static void GLAPIENTRY
4179 save_WindowPos3fvMESA(const GLfloat
* v
)
4181 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4184 static void GLAPIENTRY
4185 save_WindowPos3ivMESA(const GLint
* v
)
4187 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4190 static void GLAPIENTRY
4191 save_WindowPos3svMESA(const GLshort
* v
)
4193 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4196 static void GLAPIENTRY
4197 save_WindowPos4dvMESA(const GLdouble
* v
)
4199 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4200 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4203 static void GLAPIENTRY
4204 save_WindowPos4fvMESA(const GLfloat
* v
)
4206 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4209 static void GLAPIENTRY
4210 save_WindowPos4ivMESA(const GLint
* v
)
4212 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4213 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4216 static void GLAPIENTRY
4217 save_WindowPos4svMESA(const GLshort
* v
)
4219 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4224 /* GL_ARB_multitexture */
4225 static void GLAPIENTRY
4226 save_ActiveTextureARB(GLenum target
)
4228 GET_CURRENT_CONTEXT(ctx
);
4230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4231 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4235 if (ctx
->ExecuteFlag
) {
4236 CALL_ActiveTexture(ctx
->Exec
, (target
));
4241 /* GL_ARB_transpose_matrix */
4243 static void GLAPIENTRY
4244 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4247 _math_transposefd(tm
, m
);
4248 save_LoadMatrixf(tm
);
4252 static void GLAPIENTRY
4253 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4256 _math_transposef(tm
, m
);
4257 save_LoadMatrixf(tm
);
4261 static void GLAPIENTRY
4262 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4265 _math_transposefd(tm
, m
);
4266 save_MultMatrixf(tm
);
4270 static void GLAPIENTRY
4271 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4274 _math_transposef(tm
, m
);
4275 save_MultMatrixf(tm
);
4278 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4280 GET_CURRENT_CONTEXT(ctx
);
4286 image
= malloc(size
);
4288 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4291 memcpy(image
, data
, size
);
4297 /* GL_ARB_texture_compression */
4298 static void GLAPIENTRY
4299 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4300 GLenum internalFormat
, GLsizei width
,
4301 GLint border
, GLsizei imageSize
,
4302 const GLvoid
* data
)
4304 GET_CURRENT_CONTEXT(ctx
);
4305 if (target
== GL_PROXY_TEXTURE_1D
) {
4306 /* don't compile, execute immediately */
4307 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4308 width
, border
, imageSize
,
4313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4315 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4316 6 + POINTER_DWORDS
);
4320 n
[3].e
= internalFormat
;
4321 n
[4].i
= (GLint
) width
;
4325 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4327 if (ctx
->ExecuteFlag
) {
4328 CALL_CompressedTexImage1D(ctx
->Exec
,
4329 (target
, level
, internalFormat
, width
,
4330 border
, imageSize
, data
));
4336 static void GLAPIENTRY
4337 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4338 GLenum internalFormat
, GLsizei width
,
4339 GLsizei height
, GLint border
, GLsizei imageSize
,
4340 const GLvoid
* data
)
4342 GET_CURRENT_CONTEXT(ctx
);
4343 if (target
== GL_PROXY_TEXTURE_2D
) {
4344 /* don't compile, execute immediately */
4345 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4346 width
, height
, border
,
4351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4353 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4354 7 + POINTER_DWORDS
);
4358 n
[3].e
= internalFormat
;
4359 n
[4].i
= (GLint
) width
;
4360 n
[5].i
= (GLint
) height
;
4364 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4366 if (ctx
->ExecuteFlag
) {
4367 CALL_CompressedTexImage2D(ctx
->Exec
,
4368 (target
, level
, internalFormat
, width
,
4369 height
, border
, imageSize
, data
));
4375 static void GLAPIENTRY
4376 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4377 GLenum internalFormat
, GLsizei width
,
4378 GLsizei height
, GLsizei depth
, GLint border
,
4379 GLsizei imageSize
, const GLvoid
* data
)
4381 GET_CURRENT_CONTEXT(ctx
);
4382 if (target
== GL_PROXY_TEXTURE_3D
) {
4383 /* don't compile, execute immediately */
4384 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4385 width
, height
, depth
, border
,
4390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4392 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4393 8 + POINTER_DWORDS
);
4397 n
[3].e
= internalFormat
;
4398 n
[4].i
= (GLint
) width
;
4399 n
[5].i
= (GLint
) height
;
4400 n
[6].i
= (GLint
) depth
;
4404 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4406 if (ctx
->ExecuteFlag
) {
4407 CALL_CompressedTexImage3D(ctx
->Exec
,
4408 (target
, level
, internalFormat
, width
,
4409 height
, depth
, border
, imageSize
,
4416 static void GLAPIENTRY
4417 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4418 GLsizei width
, GLenum format
,
4419 GLsizei imageSize
, const GLvoid
* data
)
4422 GET_CURRENT_CONTEXT(ctx
);
4423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4425 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4426 6 + POINTER_DWORDS
);
4431 n
[4].i
= (GLint
) width
;
4435 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4437 if (ctx
->ExecuteFlag
) {
4438 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4439 width
, format
, imageSize
,
4445 static void GLAPIENTRY
4446 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4447 GLint yoffset
, GLsizei width
, GLsizei height
,
4448 GLenum format
, GLsizei imageSize
,
4449 const GLvoid
* data
)
4452 GET_CURRENT_CONTEXT(ctx
);
4453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4455 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4456 8 + POINTER_DWORDS
);
4462 n
[5].i
= (GLint
) width
;
4463 n
[6].i
= (GLint
) height
;
4467 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4469 if (ctx
->ExecuteFlag
) {
4470 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4471 (target
, level
, xoffset
, yoffset
, width
,
4472 height
, format
, imageSize
, data
));
4477 static void GLAPIENTRY
4478 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4479 GLint yoffset
, GLint zoffset
, GLsizei width
,
4480 GLsizei height
, GLsizei depth
, GLenum format
,
4481 GLsizei imageSize
, const GLvoid
* data
)
4484 GET_CURRENT_CONTEXT(ctx
);
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4487 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4488 10 + POINTER_DWORDS
);
4495 n
[6].i
= (GLint
) width
;
4496 n
[7].i
= (GLint
) height
;
4497 n
[8].i
= (GLint
) depth
;
4499 n
[10].i
= imageSize
;
4500 save_pointer(&n
[11],
4501 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4503 if (ctx
->ExecuteFlag
) {
4504 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4505 (target
, level
, xoffset
, yoffset
,
4506 zoffset
, width
, height
, depth
, format
,
4512 /* GL_ARB_multisample */
4513 static void GLAPIENTRY
4514 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4516 GET_CURRENT_CONTEXT(ctx
);
4518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4519 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4524 if (ctx
->ExecuteFlag
) {
4525 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4531 * GL_NV_fragment_program
4533 static void GLAPIENTRY
4534 save_BindProgramNV(GLenum target
, GLuint id
)
4536 GET_CURRENT_CONTEXT(ctx
);
4538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4539 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4544 if (ctx
->ExecuteFlag
) {
4545 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4549 static void GLAPIENTRY
4550 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4551 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4553 GET_CURRENT_CONTEXT(ctx
);
4555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4556 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4565 if (ctx
->ExecuteFlag
) {
4566 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4571 static void GLAPIENTRY
4572 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4573 const GLfloat
*params
)
4575 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4576 params
[2], params
[3]);
4580 static void GLAPIENTRY
4581 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4582 const GLfloat
* params
)
4584 GET_CURRENT_CONTEXT(ctx
);
4586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4590 const GLfloat
* p
= params
;
4592 for (i
= 0 ; i
< count
; i
++) {
4593 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4606 if (ctx
->ExecuteFlag
) {
4607 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4612 static void GLAPIENTRY
4613 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4614 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4616 save_ProgramEnvParameter4fARB(target
, index
,
4618 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4622 static void GLAPIENTRY
4623 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4624 const GLdouble
*params
)
4626 save_ProgramEnvParameter4fARB(target
, index
,
4627 (GLfloat
) params
[0],
4628 (GLfloat
) params
[1],
4629 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4633 static void GLAPIENTRY
4634 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4635 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4637 GET_CURRENT_CONTEXT(ctx
);
4639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4640 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4649 if (ctx
->ExecuteFlag
) {
4650 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4655 static void GLAPIENTRY
4656 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4657 const GLfloat
*params
)
4659 GET_CURRENT_CONTEXT(ctx
);
4661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4662 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4671 if (ctx
->ExecuteFlag
) {
4672 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4677 static void GLAPIENTRY
4678 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4679 const GLfloat
*params
)
4681 GET_CURRENT_CONTEXT(ctx
);
4683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4687 const GLfloat
* p
= params
;
4689 for (i
= 0 ; i
< count
; i
++) {
4690 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4703 if (ctx
->ExecuteFlag
) {
4704 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4709 static void GLAPIENTRY
4710 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4711 GLdouble x
, GLdouble y
,
4712 GLdouble z
, GLdouble w
)
4714 GET_CURRENT_CONTEXT(ctx
);
4716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4717 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4721 n
[3].f
= (GLfloat
) x
;
4722 n
[4].f
= (GLfloat
) y
;
4723 n
[5].f
= (GLfloat
) z
;
4724 n
[6].f
= (GLfloat
) w
;
4726 if (ctx
->ExecuteFlag
) {
4727 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4732 static void GLAPIENTRY
4733 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4734 const GLdouble
*params
)
4736 GET_CURRENT_CONTEXT(ctx
);
4738 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4739 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4743 n
[3].f
= (GLfloat
) params
[0];
4744 n
[4].f
= (GLfloat
) params
[1];
4745 n
[5].f
= (GLfloat
) params
[2];
4746 n
[6].f
= (GLfloat
) params
[3];
4748 if (ctx
->ExecuteFlag
) {
4749 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4754 /* GL_EXT_stencil_two_side */
4755 static void GLAPIENTRY
4756 save_ActiveStencilFaceEXT(GLenum face
)
4758 GET_CURRENT_CONTEXT(ctx
);
4760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4761 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4765 if (ctx
->ExecuteFlag
) {
4766 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4771 /* GL_EXT_depth_bounds_test */
4772 static void GLAPIENTRY
4773 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4775 GET_CURRENT_CONTEXT(ctx
);
4777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4778 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4780 n
[1].f
= (GLfloat
) zmin
;
4781 n
[2].f
= (GLfloat
) zmax
;
4783 if (ctx
->ExecuteFlag
) {
4784 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4790 static void GLAPIENTRY
4791 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4792 const GLvoid
* string
)
4794 GET_CURRENT_CONTEXT(ctx
);
4797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4799 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4801 GLubyte
*programCopy
= malloc(len
);
4803 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4806 memcpy(programCopy
, string
, len
);
4810 save_pointer(&n
[4], programCopy
);
4812 if (ctx
->ExecuteFlag
) {
4813 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4818 static void GLAPIENTRY
4819 save_BeginQueryARB(GLenum target
, GLuint id
)
4821 GET_CURRENT_CONTEXT(ctx
);
4823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4824 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4829 if (ctx
->ExecuteFlag
) {
4830 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4834 static void GLAPIENTRY
4835 save_EndQueryARB(GLenum target
)
4837 GET_CURRENT_CONTEXT(ctx
);
4839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4840 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4844 if (ctx
->ExecuteFlag
) {
4845 CALL_EndQuery(ctx
->Exec
, (target
));
4849 static void GLAPIENTRY
4850 save_QueryCounter(GLuint id
, GLenum target
)
4852 GET_CURRENT_CONTEXT(ctx
);
4854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4855 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4860 if (ctx
->ExecuteFlag
) {
4861 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4865 static void GLAPIENTRY
4866 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4868 GET_CURRENT_CONTEXT(ctx
);
4870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4871 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4877 if (ctx
->ExecuteFlag
) {
4878 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4882 static void GLAPIENTRY
4883 save_EndQueryIndexed(GLenum target
, GLuint index
)
4885 GET_CURRENT_CONTEXT(ctx
);
4887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4888 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4893 if (ctx
->ExecuteFlag
) {
4894 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4899 static void GLAPIENTRY
4900 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4902 GET_CURRENT_CONTEXT(ctx
);
4904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4905 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4909 if (count
> MAX_DRAW_BUFFERS
)
4910 count
= MAX_DRAW_BUFFERS
;
4911 for (i
= 0; i
< count
; i
++) {
4912 n
[2 + i
].e
= buffers
[i
];
4915 if (ctx
->ExecuteFlag
) {
4916 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4920 static void GLAPIENTRY
4921 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4923 GET_CURRENT_CONTEXT(ctx
);
4926 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4934 if (ctx
->ExecuteFlag
) {
4935 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4939 static void GLAPIENTRY
4940 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4943 p
[0] = INT_TO_FLOAT(param
[0]);
4944 p
[1] = INT_TO_FLOAT(param
[1]);
4945 p
[2] = INT_TO_FLOAT(param
[2]);
4946 p
[3] = INT_TO_FLOAT(param
[3]);
4947 save_TexBumpParameterfvATI(pname
, p
);
4950 static void GLAPIENTRY
4951 save_BindFragmentShaderATI(GLuint id
)
4953 GET_CURRENT_CONTEXT(ctx
);
4956 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4960 if (ctx
->ExecuteFlag
) {
4961 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4965 static void GLAPIENTRY
4966 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4968 GET_CURRENT_CONTEXT(ctx
);
4971 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4979 if (ctx
->ExecuteFlag
) {
4980 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4984 static void GLAPIENTRY
4985 save_Attr1fNV(GLenum attr
, GLfloat x
)
4987 GET_CURRENT_CONTEXT(ctx
);
4989 SAVE_FLUSH_VERTICES(ctx
);
4990 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4996 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4997 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4998 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5000 if (ctx
->ExecuteFlag
) {
5001 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5005 static void GLAPIENTRY
5006 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5008 GET_CURRENT_CONTEXT(ctx
);
5010 SAVE_FLUSH_VERTICES(ctx
);
5011 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5018 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5019 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5020 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5022 if (ctx
->ExecuteFlag
) {
5023 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5027 static void GLAPIENTRY
5028 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5030 GET_CURRENT_CONTEXT(ctx
);
5032 SAVE_FLUSH_VERTICES(ctx
);
5033 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5041 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5042 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5043 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5045 if (ctx
->ExecuteFlag
) {
5046 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5050 static void GLAPIENTRY
5051 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5053 GET_CURRENT_CONTEXT(ctx
);
5055 SAVE_FLUSH_VERTICES(ctx
);
5056 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5065 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5066 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5067 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5069 if (ctx
->ExecuteFlag
) {
5070 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5075 static void GLAPIENTRY
5076 save_Attr1fARB(GLenum attr
, GLfloat x
)
5078 GET_CURRENT_CONTEXT(ctx
);
5080 SAVE_FLUSH_VERTICES(ctx
);
5081 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5087 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5088 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5089 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5091 if (ctx
->ExecuteFlag
) {
5092 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5096 static void GLAPIENTRY
5097 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5099 GET_CURRENT_CONTEXT(ctx
);
5101 SAVE_FLUSH_VERTICES(ctx
);
5102 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5109 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5110 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5111 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5113 if (ctx
->ExecuteFlag
) {
5114 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5118 static void GLAPIENTRY
5119 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5121 GET_CURRENT_CONTEXT(ctx
);
5123 SAVE_FLUSH_VERTICES(ctx
);
5124 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5132 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5133 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5134 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5136 if (ctx
->ExecuteFlag
) {
5137 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5141 static void GLAPIENTRY
5142 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5144 GET_CURRENT_CONTEXT(ctx
);
5146 SAVE_FLUSH_VERTICES(ctx
);
5147 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5156 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5157 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5158 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5160 if (ctx
->ExecuteFlag
) {
5161 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5166 static void GLAPIENTRY
5167 save_EvalCoord1f(GLfloat x
)
5169 GET_CURRENT_CONTEXT(ctx
);
5171 SAVE_FLUSH_VERTICES(ctx
);
5172 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5176 if (ctx
->ExecuteFlag
) {
5177 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5181 static void GLAPIENTRY
5182 save_EvalCoord1fv(const GLfloat
* v
)
5184 save_EvalCoord1f(v
[0]);
5187 static void GLAPIENTRY
5188 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5190 GET_CURRENT_CONTEXT(ctx
);
5192 SAVE_FLUSH_VERTICES(ctx
);
5193 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5198 if (ctx
->ExecuteFlag
) {
5199 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5203 static void GLAPIENTRY
5204 save_EvalCoord2fv(const GLfloat
* v
)
5206 save_EvalCoord2f(v
[0], v
[1]);
5210 static void GLAPIENTRY
5211 save_EvalPoint1(GLint x
)
5213 GET_CURRENT_CONTEXT(ctx
);
5215 SAVE_FLUSH_VERTICES(ctx
);
5216 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5220 if (ctx
->ExecuteFlag
) {
5221 CALL_EvalPoint1(ctx
->Exec
, (x
));
5225 static void GLAPIENTRY
5226 save_EvalPoint2(GLint x
, GLint y
)
5228 GET_CURRENT_CONTEXT(ctx
);
5230 SAVE_FLUSH_VERTICES(ctx
);
5231 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5236 if (ctx
->ExecuteFlag
) {
5237 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5241 static void GLAPIENTRY
5242 save_Indexf(GLfloat x
)
5244 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5247 static void GLAPIENTRY
5248 save_Indexfv(const GLfloat
* v
)
5250 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5253 static void GLAPIENTRY
5254 save_EdgeFlag(GLboolean x
)
5256 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5261 * Compare 'count' elements of vectors 'a' and 'b'.
5262 * \return GL_TRUE if equal, GL_FALSE if different.
5264 static inline GLboolean
5265 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5267 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5272 * This glMaterial function is used for glMaterial calls that are outside
5273 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5275 static void GLAPIENTRY
5276 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5278 GET_CURRENT_CONTEXT(ctx
);
5286 case GL_FRONT_AND_BACK
:
5289 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5298 case GL_AMBIENT_AND_DIFFUSE
:
5304 case GL_COLOR_INDEXES
:
5308 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5312 if (ctx
->ExecuteFlag
) {
5313 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5316 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5318 /* Try to eliminate redundant statechanges. Because it is legal to
5319 * call glMaterial even inside begin/end calls, don't need to worry
5320 * about ctx->Driver.CurrentSavePrimitive here.
5322 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5323 if (bitmask
& (1 << i
)) {
5324 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5325 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5326 /* no change in material value */
5327 bitmask
&= ~(1 << i
);
5330 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5331 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5336 /* If this call has no effect, return early */
5340 SAVE_FLUSH_VERTICES(ctx
);
5342 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5346 for (i
= 0; i
< args
; i
++)
5347 n
[3 + i
].f
= param
[i
];
5351 static void GLAPIENTRY
5352 save_Begin(GLenum mode
)
5354 GET_CURRENT_CONTEXT(ctx
);
5356 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5357 /* compile this error into the display list */
5358 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5360 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5361 /* compile this error into the display list */
5362 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5367 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5369 /* Give the driver an opportunity to hook in an optimized
5370 * display list compiler.
5372 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5375 SAVE_FLUSH_VERTICES(ctx
);
5376 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5381 if (ctx
->ExecuteFlag
) {
5382 CALL_Begin(ctx
->Exec
, (mode
));
5387 static void GLAPIENTRY
5390 GET_CURRENT_CONTEXT(ctx
);
5391 SAVE_FLUSH_VERTICES(ctx
);
5392 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5393 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5394 if (ctx
->ExecuteFlag
) {
5395 CALL_End(ctx
->Exec
, ());
5399 static void GLAPIENTRY
5400 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5402 GET_CURRENT_CONTEXT(ctx
);
5404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5405 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5412 if (ctx
->ExecuteFlag
) {
5413 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5418 static void GLAPIENTRY
5419 save_Vertex2f(GLfloat x
, GLfloat y
)
5421 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5424 static void GLAPIENTRY
5425 save_Vertex2fv(const GLfloat
* v
)
5427 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5430 static void GLAPIENTRY
5431 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5433 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5436 static void GLAPIENTRY
5437 save_Vertex3fv(const GLfloat
* v
)
5439 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5442 static void GLAPIENTRY
5443 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5445 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5448 static void GLAPIENTRY
5449 save_Vertex4fv(const GLfloat
* v
)
5451 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5454 static void GLAPIENTRY
5455 save_TexCoord1f(GLfloat x
)
5457 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5460 static void GLAPIENTRY
5461 save_TexCoord1fv(const GLfloat
* v
)
5463 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5466 static void GLAPIENTRY
5467 save_TexCoord2f(GLfloat x
, GLfloat y
)
5469 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5472 static void GLAPIENTRY
5473 save_TexCoord2fv(const GLfloat
* v
)
5475 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5478 static void GLAPIENTRY
5479 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5481 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5484 static void GLAPIENTRY
5485 save_TexCoord3fv(const GLfloat
* v
)
5487 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5490 static void GLAPIENTRY
5491 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5493 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5496 static void GLAPIENTRY
5497 save_TexCoord4fv(const GLfloat
* v
)
5499 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5502 static void GLAPIENTRY
5503 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5505 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5508 static void GLAPIENTRY
5509 save_Normal3fv(const GLfloat
* v
)
5511 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5514 static void GLAPIENTRY
5515 save_FogCoordfEXT(GLfloat x
)
5517 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5520 static void GLAPIENTRY
5521 save_FogCoordfvEXT(const GLfloat
* v
)
5523 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5526 static void GLAPIENTRY
5527 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5529 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5532 static void GLAPIENTRY
5533 save_Color3fv(const GLfloat
* v
)
5535 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5538 static void GLAPIENTRY
5539 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5541 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5544 static void GLAPIENTRY
5545 save_Color4fv(const GLfloat
* v
)
5547 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5550 static void GLAPIENTRY
5551 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5553 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5556 static void GLAPIENTRY
5557 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5559 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5563 /* Just call the respective ATTR for texcoord
5565 static void GLAPIENTRY
5566 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5568 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5569 save_Attr1fNV(attr
, x
);
5572 static void GLAPIENTRY
5573 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5575 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5576 save_Attr1fNV(attr
, v
[0]);
5579 static void GLAPIENTRY
5580 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5582 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5583 save_Attr2fNV(attr
, x
, y
);
5586 static void GLAPIENTRY
5587 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5589 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5590 save_Attr2fNV(attr
, v
[0], v
[1]);
5593 static void GLAPIENTRY
5594 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5596 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5597 save_Attr3fNV(attr
, x
, y
, z
);
5600 static void GLAPIENTRY
5601 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5603 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5604 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5607 static void GLAPIENTRY
5608 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5609 GLfloat z
, GLfloat w
)
5611 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5612 save_Attr4fNV(attr
, x
, y
, z
, w
);
5615 static void GLAPIENTRY
5616 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5618 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5619 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5624 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5630 GET_CURRENT_CONTEXT(ctx
);
5631 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5636 static void GLAPIENTRY
5637 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5639 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5640 save_Attr1fARB(index
, x
);
5645 static void GLAPIENTRY
5646 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5648 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5649 save_Attr1fARB(index
, v
[0]);
5654 static void GLAPIENTRY
5655 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5657 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5658 save_Attr2fARB(index
, x
, y
);
5663 static void GLAPIENTRY
5664 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5666 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5667 save_Attr2fARB(index
, v
[0], v
[1]);
5672 static void GLAPIENTRY
5673 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5675 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5676 save_Attr3fARB(index
, x
, y
, z
);
5681 static void GLAPIENTRY
5682 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5684 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5685 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5690 static void GLAPIENTRY
5691 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5694 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5695 save_Attr4fARB(index
, x
, y
, z
, w
);
5700 static void GLAPIENTRY
5701 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5703 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5704 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5709 static void GLAPIENTRY
5710 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5711 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5712 GLbitfield mask
, GLenum filter
)
5714 GET_CURRENT_CONTEXT(ctx
);
5716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5717 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5730 if (ctx
->ExecuteFlag
) {
5731 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5732 dstX0
, dstY0
, dstX1
, dstY1
,
5738 /** GL_EXT_provoking_vertex */
5739 static void GLAPIENTRY
5740 save_ProvokingVertexEXT(GLenum mode
)
5742 GET_CURRENT_CONTEXT(ctx
);
5744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5745 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5749 if (ctx
->ExecuteFlag
) {
5750 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5751 _mesa_ProvokingVertex(mode
);
5756 /** GL_EXT_transform_feedback */
5757 static void GLAPIENTRY
5758 save_BeginTransformFeedback(GLenum mode
)
5760 GET_CURRENT_CONTEXT(ctx
);
5762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5763 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5767 if (ctx
->ExecuteFlag
) {
5768 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5773 /** GL_EXT_transform_feedback */
5774 static void GLAPIENTRY
5775 save_EndTransformFeedback(void)
5777 GET_CURRENT_CONTEXT(ctx
);
5778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5779 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5780 if (ctx
->ExecuteFlag
) {
5781 CALL_EndTransformFeedback(ctx
->Exec
, ());
5785 static void GLAPIENTRY
5786 save_BindTransformFeedback(GLenum target
, GLuint name
)
5788 GET_CURRENT_CONTEXT(ctx
);
5790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5791 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5796 if (ctx
->ExecuteFlag
) {
5797 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5801 static void GLAPIENTRY
5802 save_PauseTransformFeedback(void)
5804 GET_CURRENT_CONTEXT(ctx
);
5805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5806 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5807 if (ctx
->ExecuteFlag
) {
5808 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5812 static void GLAPIENTRY
5813 save_ResumeTransformFeedback(void)
5815 GET_CURRENT_CONTEXT(ctx
);
5816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5817 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5818 if (ctx
->ExecuteFlag
) {
5819 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5823 static void GLAPIENTRY
5824 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5826 GET_CURRENT_CONTEXT(ctx
);
5828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5829 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5834 if (ctx
->ExecuteFlag
) {
5835 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5839 static void GLAPIENTRY
5840 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5842 GET_CURRENT_CONTEXT(ctx
);
5844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5845 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5851 if (ctx
->ExecuteFlag
) {
5852 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5856 static void GLAPIENTRY
5857 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5860 GET_CURRENT_CONTEXT(ctx
);
5862 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5863 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5867 n
[3].si
= primcount
;
5869 if (ctx
->ExecuteFlag
) {
5870 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5874 static void GLAPIENTRY
5875 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5876 GLuint stream
, GLsizei primcount
)
5878 GET_CURRENT_CONTEXT(ctx
);
5880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5881 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5886 n
[4].si
= primcount
;
5888 if (ctx
->ExecuteFlag
) {
5889 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5894 /* aka UseProgram() */
5895 static void GLAPIENTRY
5896 save_UseProgramObjectARB(GLhandleARB program
)
5898 GET_CURRENT_CONTEXT(ctx
);
5900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5901 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5905 if (ctx
->ExecuteFlag
) {
5906 CALL_UseProgram(ctx
->Exec
, (program
));
5911 static void GLAPIENTRY
5912 save_Uniform1fARB(GLint location
, GLfloat x
)
5914 GET_CURRENT_CONTEXT(ctx
);
5916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5917 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5922 if (ctx
->ExecuteFlag
) {
5923 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5928 static void GLAPIENTRY
5929 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5931 GET_CURRENT_CONTEXT(ctx
);
5933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5934 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5940 if (ctx
->ExecuteFlag
) {
5941 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5946 static void GLAPIENTRY
5947 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5949 GET_CURRENT_CONTEXT(ctx
);
5951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5952 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5959 if (ctx
->ExecuteFlag
) {
5960 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5965 static void GLAPIENTRY
5966 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5968 GET_CURRENT_CONTEXT(ctx
);
5970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5971 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5979 if (ctx
->ExecuteFlag
) {
5980 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5985 static void GLAPIENTRY
5986 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5988 GET_CURRENT_CONTEXT(ctx
);
5990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5991 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
5995 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
5997 if (ctx
->ExecuteFlag
) {
5998 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6002 static void GLAPIENTRY
6003 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6005 GET_CURRENT_CONTEXT(ctx
);
6007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6008 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6012 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6014 if (ctx
->ExecuteFlag
) {
6015 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6019 static void GLAPIENTRY
6020 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6022 GET_CURRENT_CONTEXT(ctx
);
6024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6025 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6029 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6031 if (ctx
->ExecuteFlag
) {
6032 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6036 static void GLAPIENTRY
6037 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6039 GET_CURRENT_CONTEXT(ctx
);
6041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6042 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6046 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6048 if (ctx
->ExecuteFlag
) {
6049 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6054 static void GLAPIENTRY
6055 save_Uniform1iARB(GLint location
, GLint x
)
6057 GET_CURRENT_CONTEXT(ctx
);
6059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6060 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6065 if (ctx
->ExecuteFlag
) {
6066 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6070 static void GLAPIENTRY
6071 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6073 GET_CURRENT_CONTEXT(ctx
);
6075 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6076 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6082 if (ctx
->ExecuteFlag
) {
6083 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6087 static void GLAPIENTRY
6088 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6090 GET_CURRENT_CONTEXT(ctx
);
6092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6093 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6100 if (ctx
->ExecuteFlag
) {
6101 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6105 static void GLAPIENTRY
6106 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6108 GET_CURRENT_CONTEXT(ctx
);
6110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6111 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6119 if (ctx
->ExecuteFlag
) {
6120 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6126 static void GLAPIENTRY
6127 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6129 GET_CURRENT_CONTEXT(ctx
);
6131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6132 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6136 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6138 if (ctx
->ExecuteFlag
) {
6139 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6143 static void GLAPIENTRY
6144 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6146 GET_CURRENT_CONTEXT(ctx
);
6148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6149 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6153 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6155 if (ctx
->ExecuteFlag
) {
6156 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6160 static void GLAPIENTRY
6161 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6163 GET_CURRENT_CONTEXT(ctx
);
6165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6166 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6170 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6172 if (ctx
->ExecuteFlag
) {
6173 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6177 static void GLAPIENTRY
6178 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6180 GET_CURRENT_CONTEXT(ctx
);
6182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6183 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6187 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6189 if (ctx
->ExecuteFlag
) {
6190 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6196 static void GLAPIENTRY
6197 save_Uniform1ui(GLint location
, GLuint x
)
6199 GET_CURRENT_CONTEXT(ctx
);
6201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6202 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6207 if (ctx
->ExecuteFlag
) {
6208 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6212 static void GLAPIENTRY
6213 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6215 GET_CURRENT_CONTEXT(ctx
);
6217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6218 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6224 if (ctx
->ExecuteFlag
) {
6225 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6229 static void GLAPIENTRY
6230 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6232 GET_CURRENT_CONTEXT(ctx
);
6234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6235 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6242 if (ctx
->ExecuteFlag
) {
6243 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6247 static void GLAPIENTRY
6248 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6250 GET_CURRENT_CONTEXT(ctx
);
6252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6253 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6261 if (ctx
->ExecuteFlag
) {
6262 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6268 static void GLAPIENTRY
6269 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6271 GET_CURRENT_CONTEXT(ctx
);
6273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6274 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6278 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6280 if (ctx
->ExecuteFlag
) {
6281 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6285 static void GLAPIENTRY
6286 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6288 GET_CURRENT_CONTEXT(ctx
);
6290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6291 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6295 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6297 if (ctx
->ExecuteFlag
) {
6298 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6302 static void GLAPIENTRY
6303 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6305 GET_CURRENT_CONTEXT(ctx
);
6307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6308 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6312 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6314 if (ctx
->ExecuteFlag
) {
6315 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6319 static void GLAPIENTRY
6320 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6322 GET_CURRENT_CONTEXT(ctx
);
6324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6325 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6329 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6331 if (ctx
->ExecuteFlag
) {
6332 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6338 static void GLAPIENTRY
6339 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6342 GET_CURRENT_CONTEXT(ctx
);
6344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6345 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6350 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6352 if (ctx
->ExecuteFlag
) {
6353 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6357 static void GLAPIENTRY
6358 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6361 GET_CURRENT_CONTEXT(ctx
);
6363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6364 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6369 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6371 if (ctx
->ExecuteFlag
) {
6372 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6376 static void GLAPIENTRY
6377 save_UniformMatrix4fvARB(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_MATRIX44
, 3 + POINTER_DWORDS
);
6388 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6390 if (ctx
->ExecuteFlag
) {
6391 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6396 static void GLAPIENTRY
6397 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6400 GET_CURRENT_CONTEXT(ctx
);
6402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6403 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6408 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6410 if (ctx
->ExecuteFlag
) {
6411 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6415 static void GLAPIENTRY
6416 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6419 GET_CURRENT_CONTEXT(ctx
);
6421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6422 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6427 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6429 if (ctx
->ExecuteFlag
) {
6430 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6435 static void GLAPIENTRY
6436 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6439 GET_CURRENT_CONTEXT(ctx
);
6441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6442 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6447 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6454 static void GLAPIENTRY
6455 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6458 GET_CURRENT_CONTEXT(ctx
);
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6461 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6466 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6468 if (ctx
->ExecuteFlag
) {
6469 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6474 static void GLAPIENTRY
6475 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6478 GET_CURRENT_CONTEXT(ctx
);
6480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6481 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6486 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6488 if (ctx
->ExecuteFlag
) {
6489 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6493 static void GLAPIENTRY
6494 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6497 GET_CURRENT_CONTEXT(ctx
);
6499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6500 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6505 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6507 if (ctx
->ExecuteFlag
) {
6508 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6512 static void GLAPIENTRY
6513 save_ClampColorARB(GLenum target
, GLenum clamp
)
6515 GET_CURRENT_CONTEXT(ctx
);
6517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6518 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6523 if (ctx
->ExecuteFlag
) {
6524 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6528 static void GLAPIENTRY
6529 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6531 GET_CURRENT_CONTEXT(ctx
);
6533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6534 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6539 if (ctx
->ExecuteFlag
) {
6540 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6544 static void GLAPIENTRY
6545 save_ActiveProgramEXT(GLuint program
)
6547 GET_CURRENT_CONTEXT(ctx
);
6549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6550 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6554 if (ctx
->ExecuteFlag
) {
6555 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6559 /** GL_EXT_texture_integer */
6560 static void GLAPIENTRY
6561 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6563 GET_CURRENT_CONTEXT(ctx
);
6565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6566 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6573 if (ctx
->ExecuteFlag
) {
6574 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6578 /** GL_EXT_texture_integer */
6579 static void GLAPIENTRY
6580 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6582 GET_CURRENT_CONTEXT(ctx
);
6584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6585 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6592 if (ctx
->ExecuteFlag
) {
6593 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6597 /** GL_EXT_texture_integer */
6598 static void GLAPIENTRY
6599 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6601 GET_CURRENT_CONTEXT(ctx
);
6603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6604 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6613 if (ctx
->ExecuteFlag
) {
6614 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6618 /** GL_EXT_texture_integer */
6619 static void GLAPIENTRY
6620 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6622 GET_CURRENT_CONTEXT(ctx
);
6624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6625 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6629 n
[3].ui
= params
[0];
6630 n
[4].ui
= params
[1];
6631 n
[5].ui
= params
[2];
6632 n
[6].ui
= params
[3];
6634 if (ctx
->ExecuteFlag
) {
6635 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6639 /* GL_ARB_instanced_arrays */
6640 static void GLAPIENTRY
6641 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6643 GET_CURRENT_CONTEXT(ctx
);
6645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6646 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6651 if (ctx
->ExecuteFlag
) {
6652 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6657 /* GL_NV_texture_barrier */
6658 static void GLAPIENTRY
6659 save_TextureBarrierNV(void)
6661 GET_CURRENT_CONTEXT(ctx
);
6662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6663 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6664 if (ctx
->ExecuteFlag
) {
6665 CALL_TextureBarrierNV(ctx
->Exec
, ());
6670 /* GL_ARB_sampler_objects */
6671 static void GLAPIENTRY
6672 save_BindSampler(GLuint unit
, GLuint sampler
)
6675 GET_CURRENT_CONTEXT(ctx
);
6676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6677 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6682 if (ctx
->ExecuteFlag
) {
6683 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6687 static void GLAPIENTRY
6688 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6691 GET_CURRENT_CONTEXT(ctx
);
6692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6693 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6698 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6704 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6707 if (ctx
->ExecuteFlag
) {
6708 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6712 static void GLAPIENTRY
6713 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6717 parray
[1] = parray
[2] = parray
[3] = 0;
6718 save_SamplerParameteriv(sampler
, pname
, parray
);
6721 static void GLAPIENTRY
6722 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6725 GET_CURRENT_CONTEXT(ctx
);
6726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6727 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6732 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6738 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6741 if (ctx
->ExecuteFlag
) {
6742 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6746 static void GLAPIENTRY
6747 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6751 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6752 save_SamplerParameterfv(sampler
, pname
, parray
);
6755 static void GLAPIENTRY
6756 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6759 GET_CURRENT_CONTEXT(ctx
);
6760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6761 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6766 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6772 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6775 if (ctx
->ExecuteFlag
) {
6776 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6780 static void GLAPIENTRY
6781 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6784 GET_CURRENT_CONTEXT(ctx
);
6785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6786 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6790 n
[3].ui
= params
[0];
6791 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6792 n
[4].ui
= params
[1];
6793 n
[5].ui
= params
[2];
6794 n
[6].ui
= params
[3];
6797 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6800 if (ctx
->ExecuteFlag
) {
6801 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6805 /* GL_ARB_geometry_shader4 */
6806 static void GLAPIENTRY
6807 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6810 GET_CURRENT_CONTEXT(ctx
);
6811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6812 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6818 if (ctx
->ExecuteFlag
) {
6819 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6823 static void GLAPIENTRY
6824 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6825 GLuint texture
, GLint level
)
6828 GET_CURRENT_CONTEXT(ctx
);
6829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6830 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6833 n
[2].e
= attachment
;
6837 if (ctx
->ExecuteFlag
) {
6838 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6842 static void GLAPIENTRY
6843 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6844 GLuint texture
, GLint level
, GLenum face
)
6847 GET_CURRENT_CONTEXT(ctx
);
6848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6849 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6852 n
[2].e
= attachment
;
6857 if (ctx
->ExecuteFlag
) {
6858 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6865 static void GLAPIENTRY
6866 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6869 GET_CURRENT_CONTEXT(ctx
);
6870 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6871 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6873 union uint64_pair p
;
6876 n
[2].ui
= p
.uint32
[0];
6877 n
[3].ui
= p
.uint32
[1];
6878 save_pointer(&n
[4], sync
);
6880 if (ctx
->ExecuteFlag
) {
6881 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6886 /** GL_NV_conditional_render */
6887 static void GLAPIENTRY
6888 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6890 GET_CURRENT_CONTEXT(ctx
);
6892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6893 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6898 if (ctx
->ExecuteFlag
) {
6899 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6903 static void GLAPIENTRY
6904 save_EndConditionalRender(void)
6906 GET_CURRENT_CONTEXT(ctx
);
6907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6908 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6909 if (ctx
->ExecuteFlag
) {
6910 CALL_EndConditionalRender(ctx
->Exec
, ());
6914 static void GLAPIENTRY
6915 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6917 GET_CURRENT_CONTEXT(ctx
);
6919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6920 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6926 if (ctx
->ExecuteFlag
) {
6927 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6933 * Save an error-generating command into display list.
6935 * KW: Will appear in the list before the vertex buffer containing the
6936 * command that provoked the error. I don't see this as a problem.
6939 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6942 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
6945 save_pointer(&n
[2], (void *) s
);
6946 /* note: the data/string here doesn't have to be freed in
6947 * _mesa_delete_list() since the string is never dynamically
6955 * Compile an error into current display list.
6958 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6960 if (ctx
->CompileFlag
)
6961 save_error(ctx
, error
, s
);
6962 if (ctx
->ExecuteFlag
)
6963 _mesa_error(ctx
, error
, "%s", s
);
6968 * Test if ID names a display list.
6971 islist(struct gl_context
*ctx
, GLuint list
)
6973 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6983 /**********************************************************************/
6984 /* Display list execution */
6985 /**********************************************************************/
6989 * Execute a display list. Note that the ListBase offset must have already
6990 * been added before calling this function. I.e. the list argument is
6991 * the absolute list number, not relative to ListBase.
6992 * \param list - display list number
6995 execute_list(struct gl_context
*ctx
, GLuint list
)
6997 struct gl_display_list
*dlist
;
7001 if (list
== 0 || !islist(ctx
, list
))
7004 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7005 /* raise an error? */
7009 dlist
= _mesa_lookup_list(ctx
, list
);
7013 ctx
->ListState
.CallDepth
++;
7015 if (ctx
->Driver
.BeginCallList
)
7016 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7022 const OpCode opcode
= n
[0].opcode
;
7024 if (is_ext_opcode(opcode
)) {
7025 n
+= ext_opcode_execute(ctx
, n
);
7030 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7033 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7035 case OPCODE_ALPHA_FUNC
:
7036 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7038 case OPCODE_BIND_TEXTURE
:
7039 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7043 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7044 ctx
->Unpack
= ctx
->DefaultPacking
;
7045 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7046 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7047 get_pointer(&n
[7])));
7048 ctx
->Unpack
= save
; /* restore */
7051 case OPCODE_BLEND_COLOR
:
7052 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7054 case OPCODE_BLEND_EQUATION
:
7055 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7057 case OPCODE_BLEND_EQUATION_SEPARATE
:
7058 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7060 case OPCODE_BLEND_FUNC_SEPARATE
:
7061 CALL_BlendFuncSeparate(ctx
->Exec
,
7062 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7065 case OPCODE_BLEND_FUNC_I
:
7066 /* GL_ARB_draw_buffers_blend */
7067 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7069 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7070 /* GL_ARB_draw_buffers_blend */
7071 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7074 case OPCODE_BLEND_EQUATION_I
:
7075 /* GL_ARB_draw_buffers_blend */
7076 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7078 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7079 /* GL_ARB_draw_buffers_blend */
7080 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7081 (n
[1].ui
, n
[2].e
, n
[3].e
));
7084 case OPCODE_CALL_LIST
:
7085 /* Generated by glCallList(), don't add ListBase */
7086 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7087 execute_list(ctx
, n
[1].ui
);
7090 case OPCODE_CALL_LIST_OFFSET
:
7091 /* Generated by glCallLists() so we must add ListBase */
7093 /* user specified a bad data type at compile time */
7094 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7096 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7097 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7098 execute_list(ctx
, list
);
7102 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7104 case OPCODE_CLEAR_BUFFER_IV
:
7111 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7114 case OPCODE_CLEAR_BUFFER_UIV
:
7121 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7124 case OPCODE_CLEAR_BUFFER_FV
:
7131 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7134 case OPCODE_CLEAR_BUFFER_FI
:
7135 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7137 case OPCODE_CLEAR_COLOR
:
7138 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7140 case OPCODE_CLEAR_ACCUM
:
7141 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7143 case OPCODE_CLEAR_DEPTH
:
7144 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7146 case OPCODE_CLEAR_INDEX
:
7147 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7149 case OPCODE_CLEAR_STENCIL
:
7150 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7152 case OPCODE_CLIP_PLANE
:
7159 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7162 case OPCODE_COLOR_MASK
:
7163 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7165 case OPCODE_COLOR_MASK_INDEXED
:
7166 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7169 case OPCODE_COLOR_MATERIAL
:
7170 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7172 case OPCODE_COPY_PIXELS
:
7173 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7174 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7177 case OPCODE_COPY_TEX_IMAGE1D
:
7178 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7179 n
[5].i
, n
[6].i
, n
[7].i
));
7181 case OPCODE_COPY_TEX_IMAGE2D
:
7182 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7183 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7185 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7186 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7187 n
[4].i
, n
[5].i
, n
[6].i
));
7189 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7190 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7191 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7194 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7195 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7196 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7199 case OPCODE_CULL_FACE
:
7200 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7202 case OPCODE_DEPTH_FUNC
:
7203 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7205 case OPCODE_DEPTH_MASK
:
7206 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7208 case OPCODE_DEPTH_RANGE
:
7209 CALL_DepthRange(ctx
->Exec
,
7210 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7212 case OPCODE_DISABLE
:
7213 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7215 case OPCODE_DISABLE_INDEXED
:
7216 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7218 case OPCODE_DRAW_BUFFER
:
7219 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7221 case OPCODE_DRAW_PIXELS
:
7223 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7224 ctx
->Unpack
= ctx
->DefaultPacking
;
7225 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7226 get_pointer(&n
[5])));
7227 ctx
->Unpack
= save
; /* restore */
7231 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7233 case OPCODE_ENABLE_INDEXED
:
7234 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7236 case OPCODE_EVALMESH1
:
7237 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7239 case OPCODE_EVALMESH2
:
7240 CALL_EvalMesh2(ctx
->Exec
,
7241 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7250 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7253 case OPCODE_FRONT_FACE
:
7254 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7256 case OPCODE_FRUSTUM
:
7257 CALL_Frustum(ctx
->Exec
,
7258 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7261 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7263 case OPCODE_INDEX_MASK
:
7264 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7266 case OPCODE_INIT_NAMES
:
7267 CALL_InitNames(ctx
->Exec
, ());
7276 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7279 case OPCODE_LIGHT_MODEL
:
7286 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7289 case OPCODE_LINE_STIPPLE
:
7290 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7292 case OPCODE_LINE_WIDTH
:
7293 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7295 case OPCODE_LIST_BASE
:
7296 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7298 case OPCODE_LOAD_IDENTITY
:
7299 CALL_LoadIdentity(ctx
->Exec
, ());
7301 case OPCODE_LOAD_MATRIX
:
7302 if (sizeof(Node
) == sizeof(GLfloat
)) {
7303 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7308 for (i
= 0; i
< 16; i
++) {
7311 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7314 case OPCODE_LOAD_NAME
:
7315 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7317 case OPCODE_LOGIC_OP
:
7318 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7322 GLenum target
= n
[1].e
;
7323 GLint ustride
= _mesa_evaluator_components(target
);
7324 GLint uorder
= n
[5].i
;
7325 GLfloat u1
= n
[2].f
;
7326 GLfloat u2
= n
[3].f
;
7327 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7328 (GLfloat
*) get_pointer(&n
[6])));
7333 GLenum target
= n
[1].e
;
7334 GLfloat u1
= n
[2].f
;
7335 GLfloat u2
= n
[3].f
;
7336 GLfloat v1
= n
[4].f
;
7337 GLfloat v2
= n
[5].f
;
7338 GLint ustride
= n
[6].i
;
7339 GLint vstride
= n
[7].i
;
7340 GLint uorder
= n
[8].i
;
7341 GLint vorder
= n
[9].i
;
7342 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7343 v1
, v2
, vstride
, vorder
,
7344 (GLfloat
*) get_pointer(&n
[10])));
7347 case OPCODE_MAPGRID1
:
7348 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7350 case OPCODE_MAPGRID2
:
7351 CALL_MapGrid2f(ctx
->Exec
,
7352 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7354 case OPCODE_MATRIX_MODE
:
7355 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7357 case OPCODE_MULT_MATRIX
:
7358 if (sizeof(Node
) == sizeof(GLfloat
)) {
7359 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7364 for (i
= 0; i
< 16; i
++) {
7367 CALL_MultMatrixf(ctx
->Exec
, (m
));
7371 CALL_Ortho(ctx
->Exec
,
7372 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7374 case OPCODE_PASSTHROUGH
:
7375 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7377 case OPCODE_PIXEL_MAP
:
7378 CALL_PixelMapfv(ctx
->Exec
,
7379 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
7381 case OPCODE_PIXEL_TRANSFER
:
7382 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7384 case OPCODE_PIXEL_ZOOM
:
7385 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7387 case OPCODE_POINT_SIZE
:
7388 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7390 case OPCODE_POINT_PARAMETERS
:
7396 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7399 case OPCODE_POLYGON_MODE
:
7400 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7402 case OPCODE_POLYGON_STIPPLE
:
7404 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7405 ctx
->Unpack
= ctx
->DefaultPacking
;
7406 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
7407 ctx
->Unpack
= save
; /* restore */
7410 case OPCODE_POLYGON_OFFSET
:
7411 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7413 case OPCODE_POP_ATTRIB
:
7414 CALL_PopAttrib(ctx
->Exec
, ());
7416 case OPCODE_POP_MATRIX
:
7417 CALL_PopMatrix(ctx
->Exec
, ());
7419 case OPCODE_POP_NAME
:
7420 CALL_PopName(ctx
->Exec
, ());
7422 case OPCODE_PRIORITIZE_TEXTURE
:
7423 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7425 case OPCODE_PUSH_ATTRIB
:
7426 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7428 case OPCODE_PUSH_MATRIX
:
7429 CALL_PushMatrix(ctx
->Exec
, ());
7431 case OPCODE_PUSH_NAME
:
7432 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7434 case OPCODE_RASTER_POS
:
7435 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7437 case OPCODE_READ_BUFFER
:
7438 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7441 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7444 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7446 case OPCODE_SCISSOR
:
7447 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7449 case OPCODE_SHADE_MODEL
:
7450 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7452 case OPCODE_PROVOKING_VERTEX
:
7453 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7455 case OPCODE_STENCIL_FUNC
:
7456 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7458 case OPCODE_STENCIL_MASK
:
7459 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7461 case OPCODE_STENCIL_OP
:
7462 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7464 case OPCODE_STENCIL_FUNC_SEPARATE
:
7465 CALL_StencilFuncSeparate(ctx
->Exec
,
7466 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7468 case OPCODE_STENCIL_MASK_SEPARATE
:
7469 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7471 case OPCODE_STENCIL_OP_SEPARATE
:
7472 CALL_StencilOpSeparate(ctx
->Exec
,
7473 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7482 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7492 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7495 case OPCODE_TEXPARAMETER
:
7502 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7505 case OPCODE_TEX_IMAGE1D
:
7507 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7508 ctx
->Unpack
= ctx
->DefaultPacking
;
7509 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7511 n
[3].i
, /* components */
7513 n
[5].e
, /* border */
7514 n
[6].e
, /* format */
7516 get_pointer(&n
[8])));
7517 ctx
->Unpack
= save
; /* restore */
7520 case OPCODE_TEX_IMAGE2D
:
7522 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7523 ctx
->Unpack
= ctx
->DefaultPacking
;
7524 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7526 n
[3].i
, /* components */
7528 n
[5].i
, /* height */
7529 n
[6].e
, /* border */
7530 n
[7].e
, /* format */
7532 get_pointer(&n
[9])));
7533 ctx
->Unpack
= save
; /* restore */
7536 case OPCODE_TEX_IMAGE3D
:
7538 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7539 ctx
->Unpack
= ctx
->DefaultPacking
;
7540 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7542 n
[3].i
, /* components */
7544 n
[5].i
, /* height */
7546 n
[7].e
, /* border */
7547 n
[8].e
, /* format */
7549 get_pointer(&n
[10])));
7550 ctx
->Unpack
= save
; /* restore */
7553 case OPCODE_TEX_SUB_IMAGE1D
:
7555 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7556 ctx
->Unpack
= ctx
->DefaultPacking
;
7557 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7559 n
[6].e
, get_pointer(&n
[7])));
7560 ctx
->Unpack
= save
; /* restore */
7563 case OPCODE_TEX_SUB_IMAGE2D
:
7565 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7566 ctx
->Unpack
= ctx
->DefaultPacking
;
7567 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7569 n
[6].i
, n
[7].e
, n
[8].e
,
7570 get_pointer(&n
[9])));
7571 ctx
->Unpack
= save
; /* restore */
7574 case OPCODE_TEX_SUB_IMAGE3D
:
7576 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7577 ctx
->Unpack
= ctx
->DefaultPacking
;
7578 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7579 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7580 n
[8].i
, n
[9].e
, n
[10].e
,
7581 get_pointer(&n
[11])));
7582 ctx
->Unpack
= save
; /* restore */
7585 case OPCODE_TRANSLATE
:
7586 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7588 case OPCODE_VIEWPORT
:
7589 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7590 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7592 case OPCODE_WINDOW_POS
:
7593 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7595 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7596 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7598 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7599 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7600 n
[4].i
, n
[5].i
, n
[6].i
,
7601 get_pointer(&n
[7])));
7603 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7604 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7605 n
[4].i
, n
[5].i
, n
[6].i
,
7606 n
[7].i
, get_pointer(&n
[8])));
7608 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7609 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7610 n
[4].i
, n
[5].i
, n
[6].i
,
7612 get_pointer(&n
[9])));
7614 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7615 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7616 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7618 get_pointer(&n
[7])));
7620 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7621 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7622 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7623 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7624 get_pointer(&n
[9])));
7626 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7627 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7628 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7629 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7631 get_pointer(&n
[11])));
7633 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7634 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7636 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7637 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7639 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7640 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7642 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7643 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7644 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7647 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7648 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7650 case OPCODE_DEPTH_BOUNDS_EXT
:
7651 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7653 case OPCODE_PROGRAM_STRING_ARB
:
7654 CALL_ProgramStringARB(ctx
->Exec
,
7655 (n
[1].e
, n
[2].e
, n
[3].i
,
7656 get_pointer(&n
[4])));
7658 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7659 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7663 case OPCODE_BEGIN_QUERY_ARB
:
7664 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7666 case OPCODE_END_QUERY_ARB
:
7667 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7669 case OPCODE_QUERY_COUNTER
:
7670 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7672 case OPCODE_BEGIN_QUERY_INDEXED
:
7673 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7675 case OPCODE_END_QUERY_INDEXED
:
7676 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7678 case OPCODE_DRAW_BUFFERS_ARB
:
7680 GLenum buffers
[MAX_DRAW_BUFFERS
];
7681 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7682 for (i
= 0; i
< count
; i
++)
7683 buffers
[i
] = n
[2 + i
].e
;
7684 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7687 case OPCODE_BLIT_FRAMEBUFFER
:
7688 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7689 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7692 case OPCODE_USE_PROGRAM
:
7693 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7695 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7696 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7698 case OPCODE_ACTIVE_PROGRAM_EXT
:
7699 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7701 case OPCODE_UNIFORM_1F
:
7702 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7704 case OPCODE_UNIFORM_2F
:
7705 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7707 case OPCODE_UNIFORM_3F
:
7708 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7710 case OPCODE_UNIFORM_4F
:
7711 CALL_Uniform4f(ctx
->Exec
,
7712 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7714 case OPCODE_UNIFORM_1FV
:
7715 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7717 case OPCODE_UNIFORM_2FV
:
7718 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7720 case OPCODE_UNIFORM_3FV
:
7721 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7723 case OPCODE_UNIFORM_4FV
:
7724 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7726 case OPCODE_UNIFORM_1I
:
7727 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7729 case OPCODE_UNIFORM_2I
:
7730 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7732 case OPCODE_UNIFORM_3I
:
7733 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7735 case OPCODE_UNIFORM_4I
:
7736 CALL_Uniform4i(ctx
->Exec
,
7737 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7739 case OPCODE_UNIFORM_1IV
:
7740 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7742 case OPCODE_UNIFORM_2IV
:
7743 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7745 case OPCODE_UNIFORM_3IV
:
7746 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7748 case OPCODE_UNIFORM_4IV
:
7749 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7751 case OPCODE_UNIFORM_1UI
:
7752 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7754 case OPCODE_UNIFORM_2UI
:
7755 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7757 case OPCODE_UNIFORM_3UI
:
7758 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7760 case OPCODE_UNIFORM_4UI
:
7761 /*CALL_Uniform4uiARB(ctx->Exec,
7762 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7765 case OPCODE_UNIFORM_1UIV
:
7766 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
7767 get_pointer(&n[3])));*/
7769 case OPCODE_UNIFORM_2UIV
:
7770 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
7771 get_pointer(&n[3])));*/
7773 case OPCODE_UNIFORM_3UIV
:
7774 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
7775 get_pointer(&n[3])));*/
7777 case OPCODE_UNIFORM_4UIV
:
7778 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
7779 get_pointer(&n[3])));*/
7781 case OPCODE_UNIFORM_MATRIX22
:
7782 CALL_UniformMatrix2fv(ctx
->Exec
,
7783 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7785 case OPCODE_UNIFORM_MATRIX33
:
7786 CALL_UniformMatrix3fv(ctx
->Exec
,
7787 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7789 case OPCODE_UNIFORM_MATRIX44
:
7790 CALL_UniformMatrix4fv(ctx
->Exec
,
7791 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7793 case OPCODE_UNIFORM_MATRIX23
:
7794 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7795 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7797 case OPCODE_UNIFORM_MATRIX32
:
7798 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7799 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7801 case OPCODE_UNIFORM_MATRIX24
:
7802 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7803 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7805 case OPCODE_UNIFORM_MATRIX42
:
7806 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7807 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7809 case OPCODE_UNIFORM_MATRIX34
:
7810 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7811 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7813 case OPCODE_UNIFORM_MATRIX43
:
7814 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7815 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7818 case OPCODE_CLAMP_COLOR
:
7819 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7822 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7825 GLuint i
, pname
= n
[1].ui
;
7827 for (i
= 0; i
< 4; i
++)
7828 values
[i
] = n
[1 + i
].f
;
7829 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7832 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7833 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7835 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7838 GLuint i
, dst
= n
[1].ui
;
7840 for (i
= 0; i
< 4; i
++)
7841 values
[i
] = n
[1 + i
].f
;
7842 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7845 case OPCODE_ATTR_1F_NV
:
7846 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7848 case OPCODE_ATTR_2F_NV
:
7849 /* Really shouldn't have to do this - the Node structure
7850 * is convenient, but it would be better to store the data
7851 * packed appropriately so that it can be sent directly
7852 * on. With x86_64 becoming common, this will start to
7855 if (sizeof(Node
) == sizeof(GLfloat
))
7856 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7858 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7860 case OPCODE_ATTR_3F_NV
:
7861 if (sizeof(Node
) == sizeof(GLfloat
))
7862 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7864 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7867 case OPCODE_ATTR_4F_NV
:
7868 if (sizeof(Node
) == sizeof(GLfloat
))
7869 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7871 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7874 case OPCODE_ATTR_1F_ARB
:
7875 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7877 case OPCODE_ATTR_2F_ARB
:
7878 /* Really shouldn't have to do this - the Node structure
7879 * is convenient, but it would be better to store the data
7880 * packed appropriately so that it can be sent directly
7881 * on. With x86_64 becoming common, this will start to
7884 if (sizeof(Node
) == sizeof(GLfloat
))
7885 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7887 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7889 case OPCODE_ATTR_3F_ARB
:
7890 if (sizeof(Node
) == sizeof(GLfloat
))
7891 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7893 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7896 case OPCODE_ATTR_4F_ARB
:
7897 if (sizeof(Node
) == sizeof(GLfloat
))
7898 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7900 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7903 case OPCODE_MATERIAL
:
7904 if (sizeof(Node
) == sizeof(GLfloat
))
7905 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7912 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7916 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7919 CALL_End(ctx
->Exec
, ());
7922 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7924 case OPCODE_EVAL_C1
:
7925 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7927 case OPCODE_EVAL_C2
:
7928 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7930 case OPCODE_EVAL_P1
:
7931 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7933 case OPCODE_EVAL_P2
:
7934 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7937 /* GL_EXT_texture_integer */
7938 case OPCODE_CLEARCOLOR_I
:
7939 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7941 case OPCODE_CLEARCOLOR_UI
:
7942 CALL_ClearColorIuiEXT(ctx
->Exec
,
7943 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7945 case OPCODE_TEXPARAMETER_I
:
7952 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7955 case OPCODE_TEXPARAMETER_UI
:
7958 params
[0] = n
[3].ui
;
7959 params
[1] = n
[4].ui
;
7960 params
[2] = n
[5].ui
;
7961 params
[3] = n
[6].ui
;
7962 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7966 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7967 /* GL_ARB_instanced_arrays */
7968 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7971 case OPCODE_TEXTURE_BARRIER_NV
:
7972 CALL_TextureBarrierNV(ctx
->Exec
, ());
7975 /* GL_EXT/ARB_transform_feedback */
7976 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7977 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7979 case OPCODE_END_TRANSFORM_FEEDBACK
:
7980 CALL_EndTransformFeedback(ctx
->Exec
, ());
7982 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7983 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7985 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7986 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7988 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7989 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7991 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7992 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7994 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7995 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7996 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7998 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7999 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8000 (n
[1].e
, n
[2].ui
, n
[3].si
));
8002 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8003 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8004 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8008 case OPCODE_BIND_SAMPLER
:
8009 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8011 case OPCODE_SAMPLER_PARAMETERIV
:
8018 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8021 case OPCODE_SAMPLER_PARAMETERFV
:
8028 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8031 case OPCODE_SAMPLER_PARAMETERIIV
:
8038 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8041 case OPCODE_SAMPLER_PARAMETERUIV
:
8044 params
[0] = n
[3].ui
;
8045 params
[1] = n
[4].ui
;
8046 params
[2] = n
[5].ui
;
8047 params
[3] = n
[6].ui
;
8048 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8052 /* GL_ARB_geometry_shader4 */
8053 case OPCODE_PROGRAM_PARAMETERI
:
8054 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8056 case OPCODE_FRAMEBUFFER_TEXTURE
:
8057 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8060 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8061 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8062 n
[3].ui
, n
[4].i
, n
[5].e
));
8066 case OPCODE_WAIT_SYNC
:
8068 union uint64_pair p
;
8069 p
.uint32
[0] = n
[2].ui
;
8070 p
.uint32
[1] = n
[3].ui
;
8071 CALL_WaitSync(ctx
->Exec
,
8072 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8076 /* GL_NV_conditional_render */
8077 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8078 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8080 case OPCODE_END_CONDITIONAL_RENDER
:
8081 CALL_EndConditionalRender(ctx
->Exec
, ());
8084 case OPCODE_UNIFORM_BLOCK_BINDING
:
8085 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8088 case OPCODE_CONTINUE
:
8089 n
= (Node
*) get_pointer(&n
[1]);
8091 case OPCODE_END_OF_LIST
:
8097 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8099 _mesa_problem(ctx
, "%s", msg
);
8104 /* increment n to point to next compiled command */
8105 if (opcode
!= OPCODE_CONTINUE
) {
8106 n
+= InstSize
[opcode
];
8111 if (ctx
->Driver
.EndCallList
)
8112 ctx
->Driver
.EndCallList(ctx
);
8114 ctx
->ListState
.CallDepth
--;
8119 /**********************************************************************/
8121 /**********************************************************************/
8124 * Test if a display list number is valid.
8126 GLboolean GLAPIENTRY
8127 _mesa_IsList(GLuint list
)
8129 GET_CURRENT_CONTEXT(ctx
);
8130 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8131 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8132 return islist(ctx
, list
);
8137 * Delete a sequence of consecutive display lists.
8140 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8142 GET_CURRENT_CONTEXT(ctx
);
8144 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8145 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8148 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8151 for (i
= list
; i
< list
+ range
; i
++) {
8152 destroy_list(ctx
, i
);
8158 * Return a display list number, n, such that lists n through n+range-1
8162 _mesa_GenLists(GLsizei range
)
8164 GET_CURRENT_CONTEXT(ctx
);
8166 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8167 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8170 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8178 * Make this an atomic operation
8180 mtx_lock(&ctx
->Shared
->Mutex
);
8182 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8184 /* reserve the list IDs by with empty/dummy lists */
8186 for (i
= 0; i
< range
; i
++) {
8187 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8188 make_list(base
+ i
, 1));
8192 mtx_unlock(&ctx
->Shared
->Mutex
);
8199 * Begin a new display list.
8202 _mesa_NewList(GLuint name
, GLenum mode
)
8204 GET_CURRENT_CONTEXT(ctx
);
8206 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8207 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8209 if (MESA_VERBOSE
& VERBOSE_API
)
8210 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8211 _mesa_lookup_enum_by_nr(mode
));
8214 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8218 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8219 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8223 if (ctx
->ListState
.CurrentList
) {
8224 /* already compiling a display list */
8225 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8229 ctx
->CompileFlag
= GL_TRUE
;
8230 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8232 /* Reset accumulated list state */
8233 invalidate_saved_current_state( ctx
);
8235 /* Allocate new display list */
8236 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8237 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8238 ctx
->ListState
.CurrentPos
= 0;
8240 ctx
->Driver
.NewList(ctx
, name
, mode
);
8242 ctx
->CurrentDispatch
= ctx
->Save
;
8243 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8248 * End definition of current display list.
8253 GET_CURRENT_CONTEXT(ctx
);
8254 SAVE_FLUSH_VERTICES(ctx
);
8255 FLUSH_VERTICES(ctx
, 0);
8257 if (MESA_VERBOSE
& VERBOSE_API
)
8258 _mesa_debug(ctx
, "glEndList\n");
8260 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8261 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8262 "glEndList() called inside glBegin/End");
8265 /* Check that a list is under construction */
8266 if (!ctx
->ListState
.CurrentList
) {
8267 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8271 /* Call before emitting END_OF_LIST, in case the driver wants to
8272 * emit opcodes itself.
8274 ctx
->Driver
.EndList(ctx
);
8276 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8280 /* Destroy old list, if any */
8281 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8283 /* Install the new list */
8284 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8285 ctx
->ListState
.CurrentList
->Name
,
8286 ctx
->ListState
.CurrentList
);
8289 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8290 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8292 ctx
->ListState
.CurrentList
= NULL
;
8293 ctx
->ListState
.CurrentBlock
= NULL
;
8294 ctx
->ListState
.CurrentPos
= 0;
8295 ctx
->ExecuteFlag
= GL_TRUE
;
8296 ctx
->CompileFlag
= GL_FALSE
;
8298 ctx
->CurrentDispatch
= ctx
->Exec
;
8299 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8304 _mesa_CallList(GLuint list
)
8306 GLboolean save_compile_flag
;
8307 GET_CURRENT_CONTEXT(ctx
);
8308 FLUSH_CURRENT(ctx
, 0);
8310 if (MESA_VERBOSE
& VERBOSE_API
)
8311 _mesa_debug(ctx
, "glCallList %d\n", list
);
8314 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8319 mesa_print_display_list( list
);
8321 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8322 * execute the display list, and restore the CompileFlag.
8324 save_compile_flag
= ctx
->CompileFlag
;
8325 if (save_compile_flag
) {
8326 ctx
->CompileFlag
= GL_FALSE
;
8329 execute_list(ctx
, list
);
8330 ctx
->CompileFlag
= save_compile_flag
;
8332 /* also restore API function pointers to point to "save" versions */
8333 if (save_compile_flag
) {
8334 ctx
->CurrentDispatch
= ctx
->Save
;
8335 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8341 * Execute glCallLists: call multiple display lists.
8344 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8346 GET_CURRENT_CONTEXT(ctx
);
8348 GLboolean save_compile_flag
;
8350 if (MESA_VERBOSE
& VERBOSE_API
)
8351 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8355 case GL_UNSIGNED_BYTE
:
8357 case GL_UNSIGNED_SHORT
:
8359 case GL_UNSIGNED_INT
:
8367 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8371 /* Save the CompileFlag status, turn it off, execute display list,
8372 * and restore the CompileFlag.
8374 save_compile_flag
= ctx
->CompileFlag
;
8375 ctx
->CompileFlag
= GL_FALSE
;
8377 for (i
= 0; i
< n
; i
++) {
8378 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8379 execute_list(ctx
, list
);
8382 ctx
->CompileFlag
= save_compile_flag
;
8384 /* also restore API function pointers to point to "save" versions */
8385 if (save_compile_flag
) {
8386 ctx
->CurrentDispatch
= ctx
->Save
;
8387 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8393 * Set the offset added to list numbers in glCallLists.
8396 _mesa_ListBase(GLuint base
)
8398 GET_CURRENT_CONTEXT(ctx
);
8399 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8400 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8401 ctx
->List
.ListBase
= base
;
8405 * Setup the given dispatch table to point to Mesa's display list
8406 * building functions.
8408 * This does not include any of the tnl functions - they are
8409 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8413 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8415 struct _glapi_table
*table
= ctx
->Save
;
8416 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8418 /* Initially populate the dispatch table with the contents of the
8419 * normal-execution dispatch table. This lets us skip populating functions
8420 * that should be called directly instead of compiled into display lists.
8422 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8424 _mesa_loopback_init_api_table(ctx
, table
);
8427 vbo_initialize_save_dispatch(ctx
, table
);
8430 SET_Accum(table
, save_Accum
);
8431 SET_AlphaFunc(table
, save_AlphaFunc
);
8432 SET_Bitmap(table
, save_Bitmap
);
8433 SET_BlendFunc(table
, save_BlendFunc
);
8434 SET_CallList(table
, save_CallList
);
8435 SET_CallLists(table
, save_CallLists
);
8436 SET_Clear(table
, save_Clear
);
8437 SET_ClearAccum(table
, save_ClearAccum
);
8438 SET_ClearColor(table
, save_ClearColor
);
8439 SET_ClearDepth(table
, save_ClearDepth
);
8440 SET_ClearIndex(table
, save_ClearIndex
);
8441 SET_ClearStencil(table
, save_ClearStencil
);
8442 SET_ClipPlane(table
, save_ClipPlane
);
8443 SET_ColorMask(table
, save_ColorMask
);
8444 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8445 SET_ColorMaterial(table
, save_ColorMaterial
);
8446 SET_CopyPixels(table
, save_CopyPixels
);
8447 SET_CullFace(table
, save_CullFace
);
8448 SET_DepthFunc(table
, save_DepthFunc
);
8449 SET_DepthMask(table
, save_DepthMask
);
8450 SET_DepthRange(table
, save_DepthRange
);
8451 SET_Disable(table
, save_Disable
);
8452 SET_Disablei(table
, save_DisableIndexed
);
8453 SET_DrawBuffer(table
, save_DrawBuffer
);
8454 SET_DrawPixels(table
, save_DrawPixels
);
8455 SET_Enable(table
, save_Enable
);
8456 SET_Enablei(table
, save_EnableIndexed
);
8457 SET_EvalMesh1(table
, save_EvalMesh1
);
8458 SET_EvalMesh2(table
, save_EvalMesh2
);
8459 SET_Fogf(table
, save_Fogf
);
8460 SET_Fogfv(table
, save_Fogfv
);
8461 SET_Fogi(table
, save_Fogi
);
8462 SET_Fogiv(table
, save_Fogiv
);
8463 SET_FrontFace(table
, save_FrontFace
);
8464 SET_Frustum(table
, save_Frustum
);
8465 SET_Hint(table
, save_Hint
);
8466 SET_IndexMask(table
, save_IndexMask
);
8467 SET_InitNames(table
, save_InitNames
);
8468 SET_LightModelf(table
, save_LightModelf
);
8469 SET_LightModelfv(table
, save_LightModelfv
);
8470 SET_LightModeli(table
, save_LightModeli
);
8471 SET_LightModeliv(table
, save_LightModeliv
);
8472 SET_Lightf(table
, save_Lightf
);
8473 SET_Lightfv(table
, save_Lightfv
);
8474 SET_Lighti(table
, save_Lighti
);
8475 SET_Lightiv(table
, save_Lightiv
);
8476 SET_LineStipple(table
, save_LineStipple
);
8477 SET_LineWidth(table
, save_LineWidth
);
8478 SET_ListBase(table
, save_ListBase
);
8479 SET_LoadIdentity(table
, save_LoadIdentity
);
8480 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8481 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8482 SET_LoadName(table
, save_LoadName
);
8483 SET_LogicOp(table
, save_LogicOp
);
8484 SET_Map1d(table
, save_Map1d
);
8485 SET_Map1f(table
, save_Map1f
);
8486 SET_Map2d(table
, save_Map2d
);
8487 SET_Map2f(table
, save_Map2f
);
8488 SET_MapGrid1d(table
, save_MapGrid1d
);
8489 SET_MapGrid1f(table
, save_MapGrid1f
);
8490 SET_MapGrid2d(table
, save_MapGrid2d
);
8491 SET_MapGrid2f(table
, save_MapGrid2f
);
8492 SET_MatrixMode(table
, save_MatrixMode
);
8493 SET_MultMatrixd(table
, save_MultMatrixd
);
8494 SET_MultMatrixf(table
, save_MultMatrixf
);
8495 SET_NewList(table
, save_NewList
);
8496 SET_Ortho(table
, save_Ortho
);
8497 SET_PassThrough(table
, save_PassThrough
);
8498 SET_PixelMapfv(table
, save_PixelMapfv
);
8499 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8500 SET_PixelMapusv(table
, save_PixelMapusv
);
8501 SET_PixelTransferf(table
, save_PixelTransferf
);
8502 SET_PixelTransferi(table
, save_PixelTransferi
);
8503 SET_PixelZoom(table
, save_PixelZoom
);
8504 SET_PointSize(table
, save_PointSize
);
8505 SET_PolygonMode(table
, save_PolygonMode
);
8506 SET_PolygonOffset(table
, save_PolygonOffset
);
8507 SET_PolygonStipple(table
, save_PolygonStipple
);
8508 SET_PopAttrib(table
, save_PopAttrib
);
8509 SET_PopMatrix(table
, save_PopMatrix
);
8510 SET_PopName(table
, save_PopName
);
8511 SET_PushAttrib(table
, save_PushAttrib
);
8512 SET_PushMatrix(table
, save_PushMatrix
);
8513 SET_PushName(table
, save_PushName
);
8514 SET_RasterPos2d(table
, save_RasterPos2d
);
8515 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8516 SET_RasterPos2f(table
, save_RasterPos2f
);
8517 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8518 SET_RasterPos2i(table
, save_RasterPos2i
);
8519 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8520 SET_RasterPos2s(table
, save_RasterPos2s
);
8521 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8522 SET_RasterPos3d(table
, save_RasterPos3d
);
8523 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8524 SET_RasterPos3f(table
, save_RasterPos3f
);
8525 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8526 SET_RasterPos3i(table
, save_RasterPos3i
);
8527 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8528 SET_RasterPos3s(table
, save_RasterPos3s
);
8529 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8530 SET_RasterPos4d(table
, save_RasterPos4d
);
8531 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8532 SET_RasterPos4f(table
, save_RasterPos4f
);
8533 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8534 SET_RasterPos4i(table
, save_RasterPos4i
);
8535 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8536 SET_RasterPos4s(table
, save_RasterPos4s
);
8537 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8538 SET_ReadBuffer(table
, save_ReadBuffer
);
8539 SET_Rectf(table
, save_Rectf
);
8540 SET_Rotated(table
, save_Rotated
);
8541 SET_Rotatef(table
, save_Rotatef
);
8542 SET_Scaled(table
, save_Scaled
);
8543 SET_Scalef(table
, save_Scalef
);
8544 SET_Scissor(table
, save_Scissor
);
8545 SET_ShadeModel(table
, save_ShadeModel
);
8546 SET_StencilFunc(table
, save_StencilFunc
);
8547 SET_StencilMask(table
, save_StencilMask
);
8548 SET_StencilOp(table
, save_StencilOp
);
8549 SET_TexEnvf(table
, save_TexEnvf
);
8550 SET_TexEnvfv(table
, save_TexEnvfv
);
8551 SET_TexEnvi(table
, save_TexEnvi
);
8552 SET_TexEnviv(table
, save_TexEnviv
);
8553 SET_TexGend(table
, save_TexGend
);
8554 SET_TexGendv(table
, save_TexGendv
);
8555 SET_TexGenf(table
, save_TexGenf
);
8556 SET_TexGenfv(table
, save_TexGenfv
);
8557 SET_TexGeni(table
, save_TexGeni
);
8558 SET_TexGeniv(table
, save_TexGeniv
);
8559 SET_TexImage1D(table
, save_TexImage1D
);
8560 SET_TexImage2D(table
, save_TexImage2D
);
8561 SET_TexParameterf(table
, save_TexParameterf
);
8562 SET_TexParameterfv(table
, save_TexParameterfv
);
8563 SET_TexParameteri(table
, save_TexParameteri
);
8564 SET_TexParameteriv(table
, save_TexParameteriv
);
8565 SET_Translated(table
, save_Translated
);
8566 SET_Translatef(table
, save_Translatef
);
8567 SET_Viewport(table
, save_Viewport
);
8570 SET_BindTexture(table
, save_BindTexture
);
8571 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8572 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8573 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8574 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8575 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8576 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8577 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8580 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8581 SET_TexImage3D(table
, save_TexImage3D
);
8582 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8585 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8586 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8587 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8589 /* ATI_separate_stencil */
8590 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8592 /* GL_ARB_imaging */
8593 /* Not all are supported */
8594 SET_BlendColor(table
, save_BlendColor
);
8595 SET_BlendEquation(table
, save_BlendEquation
);
8597 /* 2. GL_EXT_blend_color */
8599 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8602 /* 3. GL_EXT_polygon_offset */
8603 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8605 /* 6. GL_EXT_texture3d */
8607 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8608 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8609 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8612 /* 37. GL_EXT_blend_minmax */
8614 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8617 /* 54. GL_EXT_point_parameters */
8618 SET_PointParameterf(table
, save_PointParameterfEXT
);
8619 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8621 /* 173. GL_EXT_blend_func_separate */
8622 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8624 /* 197. GL_MESA_window_pos */
8625 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8626 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8627 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8628 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8629 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8630 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8631 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8632 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8633 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8634 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8635 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8636 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8637 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8638 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8639 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8640 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8641 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8642 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8643 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8644 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8645 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8646 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8647 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8648 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8650 /* 233. GL_NV_vertex_program */
8651 /* The following commands DO NOT go into display lists:
8652 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8653 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8655 SET_BindProgramARB(table
, save_BindProgramNV
);
8657 /* 244. GL_ATI_envmap_bumpmap */
8658 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8659 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8661 /* 245. GL_ATI_fragment_shader */
8662 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8663 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8665 /* 262. GL_NV_point_sprite */
8666 SET_PointParameteri(table
, save_PointParameteriNV
);
8667 SET_PointParameteriv(table
, save_PointParameterivNV
);
8669 /* 268. GL_EXT_stencil_two_side */
8670 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8672 /* ???. GL_EXT_depth_bounds_test */
8673 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8675 /* ARB 1. GL_ARB_multitexture */
8676 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8678 /* ARB 3. GL_ARB_transpose_matrix */
8679 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8680 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8681 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8682 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8684 /* ARB 5. GL_ARB_multisample */
8685 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8687 /* ARB 12. GL_ARB_texture_compression */
8688 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8689 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8690 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8691 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8692 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8693 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8695 /* ARB 14. GL_ARB_point_parameters */
8696 /* aliased with EXT_point_parameters functions */
8698 /* ARB 25. GL_ARB_window_pos */
8699 /* aliased with MESA_window_pos functions */
8701 /* ARB 26. GL_ARB_vertex_program */
8702 /* ARB 27. GL_ARB_fragment_program */
8703 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8704 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8705 SET_BindProgramARB(table
, save_BindProgramNV
);
8706 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8707 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8708 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8709 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8710 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8711 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8712 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8713 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8715 SET_BeginQuery(table
, save_BeginQueryARB
);
8716 SET_EndQuery(table
, save_EndQueryARB
);
8717 SET_QueryCounter(table
, save_QueryCounter
);
8719 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8721 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8723 SET_UseProgram(table
, save_UseProgramObjectARB
);
8724 SET_Uniform1f(table
, save_Uniform1fARB
);
8725 SET_Uniform2f(table
, save_Uniform2fARB
);
8726 SET_Uniform3f(table
, save_Uniform3fARB
);
8727 SET_Uniform4f(table
, save_Uniform4fARB
);
8728 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8729 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8730 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8731 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8732 SET_Uniform1i(table
, save_Uniform1iARB
);
8733 SET_Uniform2i(table
, save_Uniform2iARB
);
8734 SET_Uniform3i(table
, save_Uniform3iARB
);
8735 SET_Uniform4i(table
, save_Uniform4iARB
);
8736 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8737 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8738 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8739 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8740 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8741 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8742 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8743 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8744 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8745 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8746 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8747 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8748 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8750 /* 299. GL_EXT_blend_equation_separate */
8751 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8753 /* GL_EXT_gpu_program_parameters */
8754 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8755 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8757 /* 364. GL_EXT_provoking_vertex */
8758 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8760 /* GL_EXT_texture_integer */
8761 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8762 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8763 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8764 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8766 /* 377. GL_EXT_separate_shader_objects */
8767 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8768 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8770 /* GL_ARB_color_buffer_float */
8771 SET_ClampColor(table
, save_ClampColorARB
);
8774 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8775 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8776 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8777 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8779 SET_Uniform1ui(table
, save_Uniform1ui
);
8780 SET_Uniform2ui(table
, save_Uniform2ui
);
8781 SET_Uniform3ui(table
, save_Uniform3ui
);
8782 SET_Uniform4ui(table
, save_Uniform4ui
);
8783 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8784 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8785 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8786 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8788 (void) save_Uniform1ui
;
8789 (void) save_Uniform2ui
;
8790 (void) save_Uniform3ui
;
8791 (void) save_Uniform4ui
;
8792 (void) save_Uniform1uiv
;
8793 (void) save_Uniform2uiv
;
8794 (void) save_Uniform3uiv
;
8795 (void) save_Uniform4uiv
;
8799 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8800 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8801 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8802 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8803 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8804 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8805 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8806 SET_DrawTransformFeedbackInstanced(table
,
8807 save_DrawTransformFeedbackInstanced
);
8808 SET_DrawTransformFeedbackStreamInstanced(table
,
8809 save_DrawTransformFeedbackStreamInstanced
);
8810 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8811 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8813 /* GL_ARB_instanced_arrays */
8814 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8816 /* GL_NV_texture_barrier */
8817 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8819 SET_BindSampler(table
, save_BindSampler
);
8820 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8821 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8822 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8823 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8824 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8825 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8827 /* GL_ARB_draw_buffer_blend */
8828 SET_BlendFunciARB(table
, save_BlendFunci
);
8829 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8830 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8831 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8833 /* GL_ARB_geometry_shader4 */
8834 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8835 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8836 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8838 /* GL_NV_conditional_render */
8839 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8840 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8843 SET_WaitSync(table
, save_WaitSync
);
8845 /* GL_ARB_uniform_buffer_object */
8846 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8848 /* GL_ARB_draw_instanced */
8849 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8850 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8852 /* GL_ARB_draw_elements_base_vertex */
8853 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8855 /* GL_ARB_base_instance */
8856 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8857 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8858 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8864 enum_string(GLenum k
)
8866 return _mesa_lookup_enum_by_nr(k
);
8871 * Print the commands in a display list. For debugging only.
8872 * TODO: many commands aren't handled yet.
8874 static void GLAPIENTRY
8875 print_list(struct gl_context
*ctx
, GLuint list
)
8877 struct gl_display_list
*dlist
;
8881 if (!islist(ctx
, list
)) {
8882 printf("%u is not a display list ID\n", list
);
8886 dlist
= _mesa_lookup_list(ctx
, list
);
8892 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8894 done
= n
? GL_FALSE
: GL_TRUE
;
8896 const OpCode opcode
= n
[0].opcode
;
8898 if (is_ext_opcode(opcode
)) {
8899 n
+= ext_opcode_print(ctx
, n
);
8904 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8907 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8908 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8909 get_pointer(&n
[7]));
8911 case OPCODE_CALL_LIST
:
8912 printf("CallList %d\n", (int) n
[1].ui
);
8914 case OPCODE_CALL_LIST_OFFSET
:
8915 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8916 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8918 case OPCODE_DISABLE
:
8919 printf("Disable %s\n", enum_string(n
[1].e
));
8922 printf("Enable %s\n", enum_string(n
[1].e
));
8924 case OPCODE_FRUSTUM
:
8925 printf("Frustum %g %g %g %g %g %g\n",
8926 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8928 case OPCODE_LINE_STIPPLE
:
8929 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8931 case OPCODE_LOAD_IDENTITY
:
8932 printf("LoadIdentity\n");
8934 case OPCODE_LOAD_MATRIX
:
8935 printf("LoadMatrix\n");
8936 printf(" %8f %8f %8f %8f\n",
8937 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8938 printf(" %8f %8f %8f %8f\n",
8939 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8940 printf(" %8f %8f %8f %8f\n",
8941 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8942 printf(" %8f %8f %8f %8f\n",
8943 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8945 case OPCODE_MULT_MATRIX
:
8946 printf("MultMatrix (or Rotate)\n");
8947 printf(" %8f %8f %8f %8f\n",
8948 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8949 printf(" %8f %8f %8f %8f\n",
8950 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8951 printf(" %8f %8f %8f %8f\n",
8952 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8953 printf(" %8f %8f %8f %8f\n",
8954 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8957 printf("Ortho %g %g %g %g %g %g\n",
8958 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8960 case OPCODE_POP_ATTRIB
:
8961 printf("PopAttrib\n");
8963 case OPCODE_POP_MATRIX
:
8964 printf("PopMatrix\n");
8966 case OPCODE_POP_NAME
:
8967 printf("PopName\n");
8969 case OPCODE_PUSH_ATTRIB
:
8970 printf("PushAttrib %x\n", n
[1].bf
);
8972 case OPCODE_PUSH_MATRIX
:
8973 printf("PushMatrix\n");
8975 case OPCODE_PUSH_NAME
:
8976 printf("PushName %d\n", (int) n
[1].ui
);
8978 case OPCODE_RASTER_POS
:
8979 printf("RasterPos %g %g %g %g\n",
8980 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8983 printf("Rotate %g %g %g %g\n",
8984 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8987 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8989 case OPCODE_TRANSLATE
:
8990 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8992 case OPCODE_BIND_TEXTURE
:
8993 printf("BindTexture %s %d\n",
8994 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8996 case OPCODE_SHADE_MODEL
:
8997 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9000 printf("Map1 %s %.3f %.3f %d %d\n",
9001 _mesa_lookup_enum_by_nr(n
[1].ui
),
9002 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9005 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9006 _mesa_lookup_enum_by_nr(n
[1].ui
),
9007 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9008 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9010 case OPCODE_MAPGRID1
:
9011 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9013 case OPCODE_MAPGRID2
:
9014 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9015 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9017 case OPCODE_EVALMESH1
:
9018 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9020 case OPCODE_EVALMESH2
:
9021 printf("EvalMesh2 %d %d %d %d\n",
9022 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9025 case OPCODE_ATTR_1F_NV
:
9026 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9028 case OPCODE_ATTR_2F_NV
:
9029 printf("ATTR_2F_NV attr %d: %f %f\n",
9030 n
[1].i
, n
[2].f
, n
[3].f
);
9032 case OPCODE_ATTR_3F_NV
:
9033 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9034 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9036 case OPCODE_ATTR_4F_NV
:
9037 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9038 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9040 case OPCODE_ATTR_1F_ARB
:
9041 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9043 case OPCODE_ATTR_2F_ARB
:
9044 printf("ATTR_2F_ARB attr %d: %f %f\n",
9045 n
[1].i
, n
[2].f
, n
[3].f
);
9047 case OPCODE_ATTR_3F_ARB
:
9048 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9049 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9051 case OPCODE_ATTR_4F_ARB
:
9052 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9053 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9056 case OPCODE_MATERIAL
:
9057 printf("MATERIAL %x %x: %f %f %f %f\n",
9058 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9061 printf("BEGIN %x\n", n
[1].i
);
9067 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9070 case OPCODE_EVAL_C1
:
9071 printf("EVAL_C1 %f\n", n
[1].f
);
9073 case OPCODE_EVAL_C2
:
9074 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9076 case OPCODE_EVAL_P1
:
9077 printf("EVAL_P1 %d\n", n
[1].i
);
9079 case OPCODE_EVAL_P2
:
9080 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9083 case OPCODE_PROVOKING_VERTEX
:
9084 printf("ProvokingVertex %s\n",
9085 _mesa_lookup_enum_by_nr(n
[1].ui
));
9089 * meta opcodes/commands
9092 printf("Error: %s %s\n", enum_string(n
[1].e
),
9093 (const char *) get_pointer(&n
[2]));
9095 case OPCODE_CONTINUE
:
9096 printf("DISPLAY-LIST-CONTINUE\n");
9097 n
= (Node
*) get_pointer(&n
[1]);
9099 case OPCODE_END_OF_LIST
:
9100 printf("END-LIST %u\n", list
);
9104 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9106 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9107 opcode
, (void *) n
);
9111 printf("command %d, %u operands\n", opcode
,
9115 /* increment n to point to next compiled command */
9116 if (opcode
!= OPCODE_CONTINUE
) {
9117 n
+= InstSize
[opcode
];
9126 * Clients may call this function to help debug display list problems.
9127 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9128 * changed, or break in the future without notice.
9131 mesa_print_display_list(GLuint list
)
9133 GET_CURRENT_CONTEXT(ctx
);
9134 print_list(ctx
, list
);
9138 /**********************************************************************/
9139 /***** Initialization *****/
9140 /**********************************************************************/
9143 save_vtxfmt_init(GLvertexformat
* vfmt
)
9145 vfmt
->ArrayElement
= _ae_ArrayElement
;
9147 vfmt
->Begin
= save_Begin
;
9149 vfmt
->CallList
= save_CallList
;
9150 vfmt
->CallLists
= save_CallLists
;
9152 vfmt
->Color3f
= save_Color3f
;
9153 vfmt
->Color3fv
= save_Color3fv
;
9154 vfmt
->Color4f
= save_Color4f
;
9155 vfmt
->Color4fv
= save_Color4fv
;
9156 vfmt
->EdgeFlag
= save_EdgeFlag
;
9157 vfmt
->End
= save_End
;
9159 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9160 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9161 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9162 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9163 vfmt
->EvalPoint1
= save_EvalPoint1
;
9164 vfmt
->EvalPoint2
= save_EvalPoint2
;
9166 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9167 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9168 vfmt
->Indexf
= save_Indexf
;
9169 vfmt
->Indexfv
= save_Indexfv
;
9170 vfmt
->Materialfv
= save_Materialfv
;
9171 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9172 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9173 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9174 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9175 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9176 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9177 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9178 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9179 vfmt
->Normal3f
= save_Normal3f
;
9180 vfmt
->Normal3fv
= save_Normal3fv
;
9181 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9182 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9183 vfmt
->TexCoord1f
= save_TexCoord1f
;
9184 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9185 vfmt
->TexCoord2f
= save_TexCoord2f
;
9186 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9187 vfmt
->TexCoord3f
= save_TexCoord3f
;
9188 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9189 vfmt
->TexCoord4f
= save_TexCoord4f
;
9190 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9191 vfmt
->Vertex2f
= save_Vertex2f
;
9192 vfmt
->Vertex2fv
= save_Vertex2fv
;
9193 vfmt
->Vertex3f
= save_Vertex3f
;
9194 vfmt
->Vertex3fv
= save_Vertex3fv
;
9195 vfmt
->Vertex4f
= save_Vertex4f
;
9196 vfmt
->Vertex4fv
= save_Vertex4fv
;
9197 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9198 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9199 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9200 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9201 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9202 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9203 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9204 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9209 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9210 const GLvertexformat
*vfmt
)
9212 SET_CallList(disp
, vfmt
->CallList
);
9213 SET_CallLists(disp
, vfmt
->CallLists
);
9218 * Initialize display list state for given context.
9221 _mesa_init_display_list(struct gl_context
*ctx
)
9223 static GLboolean tableInitialized
= GL_FALSE
;
9225 /* zero-out the instruction size table, just once */
9226 if (!tableInitialized
) {
9227 memset(InstSize
, 0, sizeof(InstSize
));
9228 tableInitialized
= GL_TRUE
;
9231 /* extension info */
9232 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9235 ctx
->ListState
.CallDepth
= 0;
9236 ctx
->ExecuteFlag
= GL_TRUE
;
9237 ctx
->CompileFlag
= GL_FALSE
;
9238 ctx
->ListState
.CurrentBlock
= NULL
;
9239 ctx
->ListState
.CurrentPos
= 0;
9241 /* Display List group */
9242 ctx
->List
.ListBase
= 0;
9244 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9249 _mesa_free_display_list_data(struct gl_context
*ctx
)
9252 ctx
->ListExt
= NULL
;