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
);
919 /* unable to map src buffer! */
920 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
924 src
= ADD_POINTERS(map
, pixels
);
925 if (type
== GL_BITMAP
)
926 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
928 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
929 format
, type
, src
, unpack
);
931 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
934 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
940 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
945 /** Return copy of memory */
947 memdup(const void *src
, GLsizei bytes
)
949 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
951 memcpy(b
, src
, bytes
);
957 * Allocate space for a display list instruction (opcode + payload space).
958 * \param opcode the instruction opcode (OPCODE_* value)
959 * \param bytes instruction payload size (not counting opcode)
960 * \return pointer to allocated memory (the opcode space)
963 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
965 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
966 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
969 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
970 if (InstSize
[opcode
] == 0) {
971 /* save instruction size now */
972 InstSize
[opcode
] = numNodes
;
975 /* make sure instruction size agrees */
976 ASSERT(numNodes
== InstSize
[opcode
]);
980 if (ctx
->ListState
.CurrentPos
+ numNodes
+ contNodes
> BLOCK_SIZE
) {
981 /* This block is full. Allocate a new block and chain to it */
983 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
984 n
[0].opcode
= OPCODE_CONTINUE
;
985 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
987 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
990 save_pointer(&n
[1], newblock
);
991 ctx
->ListState
.CurrentBlock
= newblock
;
992 ctx
->ListState
.CurrentPos
= 0;
995 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
996 ctx
->ListState
.CurrentPos
+= numNodes
;
998 n
[0].opcode
= opcode
;
1006 * Allocate space for a display list instruction. Used by callers outside
1007 * this file for things like VBO vertex data.
1009 * \param opcode the instruction opcode (OPCODE_* value)
1010 * \param bytes instruction size in bytes, not counting opcode.
1011 * \return pointer to the usable data area (not including the internal
1015 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1017 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
1019 return n
+ 1; /* return pointer to payload area, after opcode */
1026 * This function allows modules and drivers to get their own opcodes
1027 * for extending display list functionality.
1028 * \param ctx the rendering context
1029 * \param size number of bytes for storing the new display list command
1030 * \param execute function to execute the new display list command
1031 * \param destroy function to destroy the new display list command
1032 * \param print function to print the new display list command
1033 * \return the new opcode number or -1 if error
1036 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1038 void (*execute
) (struct gl_context
*, void *),
1039 void (*destroy
) (struct gl_context
*, void *),
1040 void (*print
) (struct gl_context
*, void *))
1042 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1043 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1044 ctx
->ListExt
->Opcode
[i
].Size
=
1045 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1046 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1047 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1048 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1049 return i
+ OPCODE_EXT_0
;
1056 * Allocate space for a display list instruction. The space is basically
1057 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1058 * function parameter, node[2] is the second parameter, etc.
1060 * \param opcode one of OPCODE_x
1061 * \param nparams number of function parameters
1062 * \return pointer to start of instruction space
1064 static inline Node
*
1065 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1067 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1072 * Called by EndList to try to reduce memory used for the list.
1075 trim_list(struct gl_context
*ctx
)
1077 /* If the list we're ending only has one allocated block of nodes/tokens
1078 * and its size isn't a full block size, realloc the block to use less
1079 * memory. This is important for apps that create many small display
1080 * lists and apps that use glXUseXFont (many lists each containing one
1082 * Note: we currently only trim display lists that allocated one block
1083 * of tokens. That hits the short list case which is what we're mainly
1084 * concerned with. Trimming longer lists would involve traversing the
1085 * linked list of blocks.
1087 struct gl_dlist_state
*list
= &ctx
->ListState
;
1089 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1090 (list
->CurrentPos
< BLOCK_SIZE
)) {
1091 /* There's only one block and it's not full, so realloc */
1092 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1093 list
->CurrentList
->Head
=
1094 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1095 if (!list
->CurrentBlock
) {
1096 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1104 * Display List compilation functions
1106 static void GLAPIENTRY
1107 save_Accum(GLenum op
, GLfloat value
)
1109 GET_CURRENT_CONTEXT(ctx
);
1111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1112 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1117 if (ctx
->ExecuteFlag
) {
1118 CALL_Accum(ctx
->Exec
, (op
, value
));
1123 static void GLAPIENTRY
1124 save_AlphaFunc(GLenum func
, GLclampf ref
)
1126 GET_CURRENT_CONTEXT(ctx
);
1128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1129 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1132 n
[2].f
= (GLfloat
) ref
;
1134 if (ctx
->ExecuteFlag
) {
1135 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1140 static void GLAPIENTRY
1141 save_BindTexture(GLenum target
, GLuint texture
)
1143 GET_CURRENT_CONTEXT(ctx
);
1145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1146 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1151 if (ctx
->ExecuteFlag
) {
1152 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1157 static void GLAPIENTRY
1158 save_Bitmap(GLsizei width
, GLsizei height
,
1159 GLfloat xorig
, GLfloat yorig
,
1160 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1162 GET_CURRENT_CONTEXT(ctx
);
1164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1165 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1167 n
[1].i
= (GLint
) width
;
1168 n
[2].i
= (GLint
) height
;
1174 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1175 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1177 if (ctx
->ExecuteFlag
) {
1178 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1179 xorig
, yorig
, xmove
, ymove
, pixels
));
1184 static void GLAPIENTRY
1185 save_BlendEquation(GLenum mode
)
1187 GET_CURRENT_CONTEXT(ctx
);
1189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1190 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1194 if (ctx
->ExecuteFlag
) {
1195 CALL_BlendEquation(ctx
->Exec
, (mode
));
1200 static void GLAPIENTRY
1201 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1203 GET_CURRENT_CONTEXT(ctx
);
1205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1206 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1211 if (ctx
->ExecuteFlag
) {
1212 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1217 static void GLAPIENTRY
1218 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1219 GLenum sfactorA
, GLenum dfactorA
)
1221 GET_CURRENT_CONTEXT(ctx
);
1223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1224 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1226 n
[1].e
= sfactorRGB
;
1227 n
[2].e
= dfactorRGB
;
1231 if (ctx
->ExecuteFlag
) {
1232 CALL_BlendFuncSeparate(ctx
->Exec
,
1233 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1238 static void GLAPIENTRY
1239 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1241 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1245 static void GLAPIENTRY
1246 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1248 GET_CURRENT_CONTEXT(ctx
);
1250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1251 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1258 if (ctx
->ExecuteFlag
) {
1259 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1263 /* GL_ARB_draw_buffers_blend */
1264 static void GLAPIENTRY
1265 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1266 GLenum sfactorA
, GLenum dfactorA
)
1268 GET_CURRENT_CONTEXT(ctx
);
1270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1271 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1274 n
[2].e
= sfactorRGB
;
1275 n
[3].e
= dfactorRGB
;
1279 if (ctx
->ExecuteFlag
) {
1280 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1281 sfactorA
, dfactorA
));
1285 /* GL_ARB_draw_buffers_blend */
1286 static void GLAPIENTRY
1287 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1289 GET_CURRENT_CONTEXT(ctx
);
1291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1292 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1298 if (ctx
->ExecuteFlag
) {
1299 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1303 /* GL_ARB_draw_buffers_blend */
1304 static void GLAPIENTRY
1305 save_BlendEquationi(GLuint buf
, GLenum mode
)
1307 GET_CURRENT_CONTEXT(ctx
);
1309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1310 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1315 if (ctx
->ExecuteFlag
) {
1316 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1320 /* GL_ARB_draw_buffers_blend */
1321 static void GLAPIENTRY
1322 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1324 GET_CURRENT_CONTEXT(ctx
);
1326 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1327 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1333 if (ctx
->ExecuteFlag
) {
1334 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1339 /* GL_ARB_draw_instanced. */
1340 static void GLAPIENTRY
1341 save_DrawArraysInstancedARB(GLenum mode
,
1346 GET_CURRENT_CONTEXT(ctx
);
1347 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1348 "glDrawArraysInstanced() during display list compile");
1351 static void GLAPIENTRY
1352 save_DrawElementsInstancedARB(GLenum mode
,
1355 const GLvoid
*indices
,
1358 GET_CURRENT_CONTEXT(ctx
);
1359 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1360 "glDrawElementsInstanced() during display list compile");
1363 static void GLAPIENTRY
1364 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1367 const GLvoid
*indices
,
1371 GET_CURRENT_CONTEXT(ctx
);
1372 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1373 "glDrawElementsInstancedBaseVertex() during display list compile");
1376 /* GL_ARB_base_instance. */
1377 static void GLAPIENTRY
1378 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1382 GLuint baseinstance
)
1384 GET_CURRENT_CONTEXT(ctx
);
1385 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1386 "glDrawArraysInstancedBaseInstance() during display list compile");
1389 static void APIENTRY
1390 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1393 const void *indices
,
1395 GLuint baseinstance
)
1397 GET_CURRENT_CONTEXT(ctx
);
1398 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1399 "glDrawElementsInstancedBaseInstance() during display list compile");
1402 static void APIENTRY
1403 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1406 const void *indices
,
1409 GLuint baseinstance
)
1411 GET_CURRENT_CONTEXT(ctx
);
1412 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1413 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1418 * While building a display list we cache some OpenGL state.
1419 * Under some circumstances we need to invalidate that state (immediately
1420 * when we start compiling a list, or after glCallList(s)).
1423 invalidate_saved_current_state(struct gl_context
*ctx
)
1427 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1428 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1430 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1431 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1433 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1435 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1439 static void GLAPIENTRY
1440 save_CallList(GLuint list
)
1442 GET_CURRENT_CONTEXT(ctx
);
1444 SAVE_FLUSH_VERTICES(ctx
);
1446 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1451 /* After this, we don't know what state we're in. Invalidate all
1452 * cached information previously gathered:
1454 invalidate_saved_current_state( ctx
);
1456 if (ctx
->ExecuteFlag
) {
1457 _mesa_CallList(list
);
1462 static void GLAPIENTRY
1463 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1465 GET_CURRENT_CONTEXT(ctx
);
1467 GLboolean typeErrorFlag
;
1469 SAVE_FLUSH_VERTICES(ctx
);
1473 case GL_UNSIGNED_BYTE
:
1475 case GL_UNSIGNED_SHORT
:
1477 case GL_UNSIGNED_INT
:
1482 typeErrorFlag
= GL_FALSE
;
1485 typeErrorFlag
= GL_TRUE
;
1488 for (i
= 0; i
< num
; i
++) {
1489 GLint list
= translate_id(i
, type
, lists
);
1490 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1493 n
[2].b
= typeErrorFlag
;
1497 /* After this, we don't know what state we're in. Invalidate all
1498 * cached information previously gathered:
1500 invalidate_saved_current_state( ctx
);
1502 if (ctx
->ExecuteFlag
) {
1503 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1508 static void GLAPIENTRY
1509 save_Clear(GLbitfield mask
)
1511 GET_CURRENT_CONTEXT(ctx
);
1513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1514 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1518 if (ctx
->ExecuteFlag
) {
1519 CALL_Clear(ctx
->Exec
, (mask
));
1524 static void GLAPIENTRY
1525 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1527 GET_CURRENT_CONTEXT(ctx
);
1529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1530 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1533 n
[2].i
= drawbuffer
;
1535 if (buffer
== GL_COLOR
) {
1546 if (ctx
->ExecuteFlag
) {
1547 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1552 static void GLAPIENTRY
1553 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1555 GET_CURRENT_CONTEXT(ctx
);
1557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1558 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1561 n
[2].i
= drawbuffer
;
1563 if (buffer
== GL_COLOR
) {
1574 if (ctx
->ExecuteFlag
) {
1575 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1580 static void GLAPIENTRY
1581 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1583 GET_CURRENT_CONTEXT(ctx
);
1585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1586 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1589 n
[2].i
= drawbuffer
;
1591 if (buffer
== GL_COLOR
) {
1602 if (ctx
->ExecuteFlag
) {
1603 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1608 static void GLAPIENTRY
1609 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1610 GLfloat depth
, GLint stencil
)
1612 GET_CURRENT_CONTEXT(ctx
);
1614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1615 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1618 n
[2].i
= drawbuffer
;
1622 if (ctx
->ExecuteFlag
) {
1623 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1628 static void GLAPIENTRY
1629 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1631 GET_CURRENT_CONTEXT(ctx
);
1633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1634 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1641 if (ctx
->ExecuteFlag
) {
1642 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1647 static void GLAPIENTRY
1648 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1650 GET_CURRENT_CONTEXT(ctx
);
1652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1653 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1660 if (ctx
->ExecuteFlag
) {
1661 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1666 static void GLAPIENTRY
1667 save_ClearDepth(GLclampd depth
)
1669 GET_CURRENT_CONTEXT(ctx
);
1671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1672 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1674 n
[1].f
= (GLfloat
) depth
;
1676 if (ctx
->ExecuteFlag
) {
1677 CALL_ClearDepth(ctx
->Exec
, (depth
));
1682 static void GLAPIENTRY
1683 save_ClearIndex(GLfloat c
)
1685 GET_CURRENT_CONTEXT(ctx
);
1687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1688 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1692 if (ctx
->ExecuteFlag
) {
1693 CALL_ClearIndex(ctx
->Exec
, (c
));
1698 static void GLAPIENTRY
1699 save_ClearStencil(GLint s
)
1701 GET_CURRENT_CONTEXT(ctx
);
1703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1704 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1708 if (ctx
->ExecuteFlag
) {
1709 CALL_ClearStencil(ctx
->Exec
, (s
));
1714 static void GLAPIENTRY
1715 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1717 GET_CURRENT_CONTEXT(ctx
);
1719 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1720 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1723 n
[2].f
= (GLfloat
) equ
[0];
1724 n
[3].f
= (GLfloat
) equ
[1];
1725 n
[4].f
= (GLfloat
) equ
[2];
1726 n
[5].f
= (GLfloat
) equ
[3];
1728 if (ctx
->ExecuteFlag
) {
1729 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1735 static void GLAPIENTRY
1736 save_ColorMask(GLboolean red
, GLboolean green
,
1737 GLboolean blue
, GLboolean alpha
)
1739 GET_CURRENT_CONTEXT(ctx
);
1741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1742 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1749 if (ctx
->ExecuteFlag
) {
1750 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1755 static void GLAPIENTRY
1756 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1757 GLboolean blue
, GLboolean alpha
)
1759 GET_CURRENT_CONTEXT(ctx
);
1761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1762 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1770 if (ctx
->ExecuteFlag
) {
1771 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1776 static void GLAPIENTRY
1777 save_ColorMaterial(GLenum face
, GLenum mode
)
1779 GET_CURRENT_CONTEXT(ctx
);
1781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1783 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1788 if (ctx
->ExecuteFlag
) {
1789 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1794 static void GLAPIENTRY
1795 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1797 GET_CURRENT_CONTEXT(ctx
);
1799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1800 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1804 n
[3].i
= (GLint
) width
;
1805 n
[4].i
= (GLint
) height
;
1808 if (ctx
->ExecuteFlag
) {
1809 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1815 static void GLAPIENTRY
1816 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1817 GLint x
, GLint y
, GLsizei width
, GLint border
)
1819 GET_CURRENT_CONTEXT(ctx
);
1821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1822 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1826 n
[3].e
= internalformat
;
1832 if (ctx
->ExecuteFlag
) {
1833 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1834 x
, y
, width
, border
));
1839 static void GLAPIENTRY
1840 save_CopyTexImage2D(GLenum target
, GLint level
,
1841 GLenum internalformat
,
1842 GLint x
, GLint y
, GLsizei width
,
1843 GLsizei height
, GLint border
)
1845 GET_CURRENT_CONTEXT(ctx
);
1847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1848 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1852 n
[3].e
= internalformat
;
1859 if (ctx
->ExecuteFlag
) {
1860 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1861 x
, y
, width
, height
, border
));
1867 static void GLAPIENTRY
1868 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1869 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1871 GET_CURRENT_CONTEXT(ctx
);
1873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1874 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1883 if (ctx
->ExecuteFlag
) {
1884 CALL_CopyTexSubImage1D(ctx
->Exec
,
1885 (target
, level
, xoffset
, x
, y
, width
));
1890 static void GLAPIENTRY
1891 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1892 GLint xoffset
, GLint yoffset
,
1893 GLint x
, GLint y
, GLsizei width
, GLint height
)
1895 GET_CURRENT_CONTEXT(ctx
);
1897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1898 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1909 if (ctx
->ExecuteFlag
) {
1910 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1911 x
, y
, width
, height
));
1916 static void GLAPIENTRY
1917 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1918 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1919 GLint x
, GLint y
, GLsizei width
, GLint height
)
1921 GET_CURRENT_CONTEXT(ctx
);
1923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1936 if (ctx
->ExecuteFlag
) {
1937 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1938 xoffset
, yoffset
, zoffset
,
1939 x
, y
, width
, height
));
1944 static void GLAPIENTRY
1945 save_CullFace(GLenum mode
)
1947 GET_CURRENT_CONTEXT(ctx
);
1949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1950 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1954 if (ctx
->ExecuteFlag
) {
1955 CALL_CullFace(ctx
->Exec
, (mode
));
1960 static void GLAPIENTRY
1961 save_DepthFunc(GLenum func
)
1963 GET_CURRENT_CONTEXT(ctx
);
1965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1966 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1970 if (ctx
->ExecuteFlag
) {
1971 CALL_DepthFunc(ctx
->Exec
, (func
));
1976 static void GLAPIENTRY
1977 save_DepthMask(GLboolean mask
)
1979 GET_CURRENT_CONTEXT(ctx
);
1981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1982 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1986 if (ctx
->ExecuteFlag
) {
1987 CALL_DepthMask(ctx
->Exec
, (mask
));
1992 static void GLAPIENTRY
1993 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1995 GET_CURRENT_CONTEXT(ctx
);
1997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1998 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2000 n
[1].f
= (GLfloat
) nearval
;
2001 n
[2].f
= (GLfloat
) farval
;
2003 if (ctx
->ExecuteFlag
) {
2004 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2009 static void GLAPIENTRY
2010 save_Disable(GLenum cap
)
2012 GET_CURRENT_CONTEXT(ctx
);
2014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2015 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2019 if (ctx
->ExecuteFlag
) {
2020 CALL_Disable(ctx
->Exec
, (cap
));
2025 static void GLAPIENTRY
2026 save_DisableIndexed(GLuint index
, GLenum cap
)
2028 GET_CURRENT_CONTEXT(ctx
);
2030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2031 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2036 if (ctx
->ExecuteFlag
) {
2037 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2042 static void GLAPIENTRY
2043 save_DrawBuffer(GLenum mode
)
2045 GET_CURRENT_CONTEXT(ctx
);
2047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2048 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2052 if (ctx
->ExecuteFlag
) {
2053 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2058 static void GLAPIENTRY
2059 save_DrawPixels(GLsizei width
, GLsizei height
,
2060 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2062 GET_CURRENT_CONTEXT(ctx
);
2065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2067 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2074 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2075 pixels
, &ctx
->Unpack
));
2077 if (ctx
->ExecuteFlag
) {
2078 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2084 static void GLAPIENTRY
2085 save_Enable(GLenum cap
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2090 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2094 if (ctx
->ExecuteFlag
) {
2095 CALL_Enable(ctx
->Exec
, (cap
));
2101 static void GLAPIENTRY
2102 save_EnableIndexed(GLuint index
, GLenum cap
)
2104 GET_CURRENT_CONTEXT(ctx
);
2106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2107 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2112 if (ctx
->ExecuteFlag
) {
2113 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2119 static void GLAPIENTRY
2120 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2122 GET_CURRENT_CONTEXT(ctx
);
2124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2125 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2131 if (ctx
->ExecuteFlag
) {
2132 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2137 static void GLAPIENTRY
2138 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2140 GET_CURRENT_CONTEXT(ctx
);
2142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2143 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2151 if (ctx
->ExecuteFlag
) {
2152 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2159 static void GLAPIENTRY
2160 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2162 GET_CURRENT_CONTEXT(ctx
);
2164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2165 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2173 if (ctx
->ExecuteFlag
) {
2174 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2179 static void GLAPIENTRY
2180 save_Fogf(GLenum pname
, GLfloat param
)
2184 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2185 save_Fogfv(pname
, parray
);
2189 static void GLAPIENTRY
2190 save_Fogiv(GLenum pname
, const GLint
*params
)
2195 case GL_FOG_DENSITY
:
2199 p
[0] = (GLfloat
) *params
;
2205 p
[0] = INT_TO_FLOAT(params
[0]);
2206 p
[1] = INT_TO_FLOAT(params
[1]);
2207 p
[2] = INT_TO_FLOAT(params
[2]);
2208 p
[3] = INT_TO_FLOAT(params
[3]);
2211 /* Error will be caught later in gl_Fogfv */
2212 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2214 save_Fogfv(pname
, p
);
2218 static void GLAPIENTRY
2219 save_Fogi(GLenum pname
, GLint param
)
2223 parray
[1] = parray
[2] = parray
[3] = 0;
2224 save_Fogiv(pname
, parray
);
2228 static void GLAPIENTRY
2229 save_FrontFace(GLenum mode
)
2231 GET_CURRENT_CONTEXT(ctx
);
2233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2234 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2238 if (ctx
->ExecuteFlag
) {
2239 CALL_FrontFace(ctx
->Exec
, (mode
));
2244 static void GLAPIENTRY
2245 save_Frustum(GLdouble left
, GLdouble right
,
2246 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2248 GET_CURRENT_CONTEXT(ctx
);
2250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2251 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2253 n
[1].f
= (GLfloat
) left
;
2254 n
[2].f
= (GLfloat
) right
;
2255 n
[3].f
= (GLfloat
) bottom
;
2256 n
[4].f
= (GLfloat
) top
;
2257 n
[5].f
= (GLfloat
) nearval
;
2258 n
[6].f
= (GLfloat
) farval
;
2260 if (ctx
->ExecuteFlag
) {
2261 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2266 static void GLAPIENTRY
2267 save_Hint(GLenum target
, GLenum mode
)
2269 GET_CURRENT_CONTEXT(ctx
);
2271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2272 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2277 if (ctx
->ExecuteFlag
) {
2278 CALL_Hint(ctx
->Exec
, (target
, mode
));
2283 static void GLAPIENTRY
2284 save_IndexMask(GLuint mask
)
2286 GET_CURRENT_CONTEXT(ctx
);
2288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2289 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2293 if (ctx
->ExecuteFlag
) {
2294 CALL_IndexMask(ctx
->Exec
, (mask
));
2299 static void GLAPIENTRY
2300 save_InitNames(void)
2302 GET_CURRENT_CONTEXT(ctx
);
2303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2304 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2305 if (ctx
->ExecuteFlag
) {
2306 CALL_InitNames(ctx
->Exec
, ());
2311 static void GLAPIENTRY
2312 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2314 GET_CURRENT_CONTEXT(ctx
);
2316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2317 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2335 case GL_SPOT_DIRECTION
:
2338 case GL_SPOT_EXPONENT
:
2341 case GL_SPOT_CUTOFF
:
2344 case GL_CONSTANT_ATTENUATION
:
2347 case GL_LINEAR_ATTENUATION
:
2350 case GL_QUADRATIC_ATTENUATION
:
2356 for (i
= 0; i
< nParams
; i
++) {
2357 n
[3 + i
].f
= params
[i
];
2360 if (ctx
->ExecuteFlag
) {
2361 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2366 static void GLAPIENTRY
2367 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2371 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2372 save_Lightfv(light
, pname
, parray
);
2376 static void GLAPIENTRY
2377 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2384 fparam
[0] = INT_TO_FLOAT(params
[0]);
2385 fparam
[1] = INT_TO_FLOAT(params
[1]);
2386 fparam
[2] = INT_TO_FLOAT(params
[2]);
2387 fparam
[3] = INT_TO_FLOAT(params
[3]);
2390 fparam
[0] = (GLfloat
) params
[0];
2391 fparam
[1] = (GLfloat
) params
[1];
2392 fparam
[2] = (GLfloat
) params
[2];
2393 fparam
[3] = (GLfloat
) params
[3];
2395 case GL_SPOT_DIRECTION
:
2396 fparam
[0] = (GLfloat
) params
[0];
2397 fparam
[1] = (GLfloat
) params
[1];
2398 fparam
[2] = (GLfloat
) params
[2];
2400 case GL_SPOT_EXPONENT
:
2401 case GL_SPOT_CUTOFF
:
2402 case GL_CONSTANT_ATTENUATION
:
2403 case GL_LINEAR_ATTENUATION
:
2404 case GL_QUADRATIC_ATTENUATION
:
2405 fparam
[0] = (GLfloat
) params
[0];
2408 /* error will be caught later in gl_Lightfv */
2411 save_Lightfv(light
, pname
, fparam
);
2415 static void GLAPIENTRY
2416 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2420 parray
[1] = parray
[2] = parray
[3] = 0;
2421 save_Lightiv(light
, pname
, parray
);
2425 static void GLAPIENTRY
2426 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2428 GET_CURRENT_CONTEXT(ctx
);
2430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2431 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2439 if (ctx
->ExecuteFlag
) {
2440 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2445 static void GLAPIENTRY
2446 save_LightModelf(GLenum pname
, GLfloat param
)
2450 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2451 save_LightModelfv(pname
, parray
);
2455 static void GLAPIENTRY
2456 save_LightModeliv(GLenum pname
, const GLint
*params
)
2460 case GL_LIGHT_MODEL_AMBIENT
:
2461 fparam
[0] = INT_TO_FLOAT(params
[0]);
2462 fparam
[1] = INT_TO_FLOAT(params
[1]);
2463 fparam
[2] = INT_TO_FLOAT(params
[2]);
2464 fparam
[3] = INT_TO_FLOAT(params
[3]);
2466 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2467 case GL_LIGHT_MODEL_TWO_SIDE
:
2468 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2469 fparam
[0] = (GLfloat
) params
[0];
2475 /* Error will be caught later in gl_LightModelfv */
2476 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2478 save_LightModelfv(pname
, fparam
);
2482 static void GLAPIENTRY
2483 save_LightModeli(GLenum pname
, GLint param
)
2487 parray
[1] = parray
[2] = parray
[3] = 0;
2488 save_LightModeliv(pname
, parray
);
2492 static void GLAPIENTRY
2493 save_LineStipple(GLint factor
, GLushort pattern
)
2495 GET_CURRENT_CONTEXT(ctx
);
2497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2498 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2503 if (ctx
->ExecuteFlag
) {
2504 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2509 static void GLAPIENTRY
2510 save_LineWidth(GLfloat width
)
2512 GET_CURRENT_CONTEXT(ctx
);
2514 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2515 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2519 if (ctx
->ExecuteFlag
) {
2520 CALL_LineWidth(ctx
->Exec
, (width
));
2525 static void GLAPIENTRY
2526 save_ListBase(GLuint base
)
2528 GET_CURRENT_CONTEXT(ctx
);
2530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2531 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2535 if (ctx
->ExecuteFlag
) {
2536 CALL_ListBase(ctx
->Exec
, (base
));
2541 static void GLAPIENTRY
2542 save_LoadIdentity(void)
2544 GET_CURRENT_CONTEXT(ctx
);
2545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2546 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2547 if (ctx
->ExecuteFlag
) {
2548 CALL_LoadIdentity(ctx
->Exec
, ());
2553 static void GLAPIENTRY
2554 save_LoadMatrixf(const GLfloat
* m
)
2556 GET_CURRENT_CONTEXT(ctx
);
2558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2559 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2562 for (i
= 0; i
< 16; i
++) {
2566 if (ctx
->ExecuteFlag
) {
2567 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2572 static void GLAPIENTRY
2573 save_LoadMatrixd(const GLdouble
* m
)
2577 for (i
= 0; i
< 16; i
++) {
2578 f
[i
] = (GLfloat
) m
[i
];
2580 save_LoadMatrixf(f
);
2584 static void GLAPIENTRY
2585 save_LoadName(GLuint name
)
2587 GET_CURRENT_CONTEXT(ctx
);
2589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2590 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2594 if (ctx
->ExecuteFlag
) {
2595 CALL_LoadName(ctx
->Exec
, (name
));
2600 static void GLAPIENTRY
2601 save_LogicOp(GLenum opcode
)
2603 GET_CURRENT_CONTEXT(ctx
);
2605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2606 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2610 if (ctx
->ExecuteFlag
) {
2611 CALL_LogicOp(ctx
->Exec
, (opcode
));
2616 static void GLAPIENTRY
2617 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2618 GLint order
, const GLdouble
* points
)
2620 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2625 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2627 n
[2].f
= (GLfloat
) u1
;
2628 n
[3].f
= (GLfloat
) u2
;
2629 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2631 save_pointer(&n
[6], pnts
);
2633 if (ctx
->ExecuteFlag
) {
2634 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2638 static void GLAPIENTRY
2639 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2640 GLint order
, const GLfloat
* points
)
2642 GET_CURRENT_CONTEXT(ctx
);
2644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2645 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2647 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2651 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2653 save_pointer(&n
[6], pnts
);
2655 if (ctx
->ExecuteFlag
) {
2656 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2661 static void GLAPIENTRY
2662 save_Map2d(GLenum target
,
2663 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2664 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2665 const GLdouble
* points
)
2667 GET_CURRENT_CONTEXT(ctx
);
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2670 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2672 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2673 vstride
, vorder
, points
);
2675 n
[2].f
= (GLfloat
) u1
;
2676 n
[3].f
= (GLfloat
) u2
;
2677 n
[4].f
= (GLfloat
) v1
;
2678 n
[5].f
= (GLfloat
) v2
;
2679 /* XXX verify these strides are correct */
2680 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2681 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2684 save_pointer(&n
[10], pnts
);
2686 if (ctx
->ExecuteFlag
) {
2687 CALL_Map2d(ctx
->Exec
, (target
,
2688 u1
, u2
, ustride
, uorder
,
2689 v1
, v2
, vstride
, vorder
, points
));
2694 static void GLAPIENTRY
2695 save_Map2f(GLenum target
,
2696 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2697 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2698 const GLfloat
* points
)
2700 GET_CURRENT_CONTEXT(ctx
);
2702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2703 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2705 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2706 vstride
, vorder
, points
);
2712 /* XXX verify these strides are correct */
2713 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2714 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2717 save_pointer(&n
[10], pnts
);
2719 if (ctx
->ExecuteFlag
) {
2720 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2721 v1
, v2
, vstride
, vorder
, points
));
2726 static void GLAPIENTRY
2727 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2729 GET_CURRENT_CONTEXT(ctx
);
2731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2732 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2738 if (ctx
->ExecuteFlag
) {
2739 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2744 static void GLAPIENTRY
2745 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2747 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2751 static void GLAPIENTRY
2752 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2753 GLint vn
, GLfloat v1
, GLfloat v2
)
2755 GET_CURRENT_CONTEXT(ctx
);
2757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2758 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2767 if (ctx
->ExecuteFlag
) {
2768 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2774 static void GLAPIENTRY
2775 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2776 GLint vn
, GLdouble v1
, GLdouble v2
)
2778 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2779 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2783 static void GLAPIENTRY
2784 save_MatrixMode(GLenum mode
)
2786 GET_CURRENT_CONTEXT(ctx
);
2788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2789 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2793 if (ctx
->ExecuteFlag
) {
2794 CALL_MatrixMode(ctx
->Exec
, (mode
));
2799 static void GLAPIENTRY
2800 save_MultMatrixf(const GLfloat
* m
)
2802 GET_CURRENT_CONTEXT(ctx
);
2804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2805 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2808 for (i
= 0; i
< 16; i
++) {
2812 if (ctx
->ExecuteFlag
) {
2813 CALL_MultMatrixf(ctx
->Exec
, (m
));
2818 static void GLAPIENTRY
2819 save_MultMatrixd(const GLdouble
* m
)
2823 for (i
= 0; i
< 16; i
++) {
2824 f
[i
] = (GLfloat
) m
[i
];
2826 save_MultMatrixf(f
);
2830 static void GLAPIENTRY
2831 save_NewList(GLuint name
, GLenum mode
)
2833 GET_CURRENT_CONTEXT(ctx
);
2834 /* It's an error to call this function while building a display list */
2835 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2842 static void GLAPIENTRY
2843 save_Ortho(GLdouble left
, GLdouble right
,
2844 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2846 GET_CURRENT_CONTEXT(ctx
);
2848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2849 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2851 n
[1].f
= (GLfloat
) left
;
2852 n
[2].f
= (GLfloat
) right
;
2853 n
[3].f
= (GLfloat
) bottom
;
2854 n
[4].f
= (GLfloat
) top
;
2855 n
[5].f
= (GLfloat
) nearval
;
2856 n
[6].f
= (GLfloat
) farval
;
2858 if (ctx
->ExecuteFlag
) {
2859 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2864 static void GLAPIENTRY
2865 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2867 GET_CURRENT_CONTEXT(ctx
);
2869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2870 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2874 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2876 if (ctx
->ExecuteFlag
) {
2877 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2882 static void GLAPIENTRY
2883 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2885 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2887 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2888 for (i
= 0; i
< mapsize
; i
++) {
2889 fvalues
[i
] = (GLfloat
) values
[i
];
2893 for (i
= 0; i
< mapsize
; i
++) {
2894 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2897 save_PixelMapfv(map
, mapsize
, fvalues
);
2901 static void GLAPIENTRY
2902 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2904 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2906 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2907 for (i
= 0; i
< mapsize
; i
++) {
2908 fvalues
[i
] = (GLfloat
) values
[i
];
2912 for (i
= 0; i
< mapsize
; i
++) {
2913 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2916 save_PixelMapfv(map
, mapsize
, fvalues
);
2920 static void GLAPIENTRY
2921 save_PixelTransferf(GLenum pname
, GLfloat param
)
2923 GET_CURRENT_CONTEXT(ctx
);
2925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2926 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2931 if (ctx
->ExecuteFlag
) {
2932 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2937 static void GLAPIENTRY
2938 save_PixelTransferi(GLenum pname
, GLint param
)
2940 save_PixelTransferf(pname
, (GLfloat
) param
);
2944 static void GLAPIENTRY
2945 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2947 GET_CURRENT_CONTEXT(ctx
);
2949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2950 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2955 if (ctx
->ExecuteFlag
) {
2956 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2961 static void GLAPIENTRY
2962 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2964 GET_CURRENT_CONTEXT(ctx
);
2966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2967 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2974 if (ctx
->ExecuteFlag
) {
2975 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2980 static void GLAPIENTRY
2981 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2985 parray
[1] = parray
[2] = 0.0F
;
2986 save_PointParameterfvEXT(pname
, parray
);
2989 static void GLAPIENTRY
2990 save_PointParameteriNV(GLenum pname
, GLint param
)
2993 parray
[0] = (GLfloat
) param
;
2994 parray
[1] = parray
[2] = 0.0F
;
2995 save_PointParameterfvEXT(pname
, parray
);
2998 static void GLAPIENTRY
2999 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3002 parray
[0] = (GLfloat
) param
[0];
3003 parray
[1] = parray
[2] = 0.0F
;
3004 save_PointParameterfvEXT(pname
, parray
);
3008 static void GLAPIENTRY
3009 save_PointSize(GLfloat size
)
3011 GET_CURRENT_CONTEXT(ctx
);
3013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3014 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3018 if (ctx
->ExecuteFlag
) {
3019 CALL_PointSize(ctx
->Exec
, (size
));
3024 static void GLAPIENTRY
3025 save_PolygonMode(GLenum face
, GLenum mode
)
3027 GET_CURRENT_CONTEXT(ctx
);
3029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3030 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3035 if (ctx
->ExecuteFlag
) {
3036 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3041 static void GLAPIENTRY
3042 save_PolygonStipple(const GLubyte
* pattern
)
3044 GET_CURRENT_CONTEXT(ctx
);
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3049 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3052 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3053 pattern
, &ctx
->Unpack
));
3055 if (ctx
->ExecuteFlag
) {
3056 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3061 static void GLAPIENTRY
3062 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3064 GET_CURRENT_CONTEXT(ctx
);
3066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3067 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3072 if (ctx
->ExecuteFlag
) {
3073 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3078 static void GLAPIENTRY
3079 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3081 GET_CURRENT_CONTEXT(ctx
);
3082 /* XXX mult by DepthMaxF here??? */
3083 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3087 static void GLAPIENTRY
3088 save_PopAttrib(void)
3090 GET_CURRENT_CONTEXT(ctx
);
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3092 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3093 if (ctx
->ExecuteFlag
) {
3094 CALL_PopAttrib(ctx
->Exec
, ());
3099 static void GLAPIENTRY
3100 save_PopMatrix(void)
3102 GET_CURRENT_CONTEXT(ctx
);
3103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3104 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3105 if (ctx
->ExecuteFlag
) {
3106 CALL_PopMatrix(ctx
->Exec
, ());
3111 static void GLAPIENTRY
3114 GET_CURRENT_CONTEXT(ctx
);
3115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3116 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3117 if (ctx
->ExecuteFlag
) {
3118 CALL_PopName(ctx
->Exec
, ());
3123 static void GLAPIENTRY
3124 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3125 const GLclampf
* priorities
)
3127 GET_CURRENT_CONTEXT(ctx
);
3129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3131 for (i
= 0; i
< num
; i
++) {
3133 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3135 n
[1].ui
= textures
[i
];
3136 n
[2].f
= priorities
[i
];
3139 if (ctx
->ExecuteFlag
) {
3140 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3145 static void GLAPIENTRY
3146 save_PushAttrib(GLbitfield mask
)
3148 GET_CURRENT_CONTEXT(ctx
);
3150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3151 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3155 if (ctx
->ExecuteFlag
) {
3156 CALL_PushAttrib(ctx
->Exec
, (mask
));
3161 static void GLAPIENTRY
3162 save_PushMatrix(void)
3164 GET_CURRENT_CONTEXT(ctx
);
3165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3166 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3167 if (ctx
->ExecuteFlag
) {
3168 CALL_PushMatrix(ctx
->Exec
, ());
3173 static void GLAPIENTRY
3174 save_PushName(GLuint name
)
3176 GET_CURRENT_CONTEXT(ctx
);
3178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3179 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3183 if (ctx
->ExecuteFlag
) {
3184 CALL_PushName(ctx
->Exec
, (name
));
3189 static void GLAPIENTRY
3190 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3192 GET_CURRENT_CONTEXT(ctx
);
3194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3195 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3202 if (ctx
->ExecuteFlag
) {
3203 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3207 static void GLAPIENTRY
3208 save_RasterPos2d(GLdouble x
, GLdouble y
)
3210 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3213 static void GLAPIENTRY
3214 save_RasterPos2f(GLfloat x
, GLfloat y
)
3216 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3219 static void GLAPIENTRY
3220 save_RasterPos2i(GLint x
, GLint y
)
3222 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3225 static void GLAPIENTRY
3226 save_RasterPos2s(GLshort x
, GLshort y
)
3228 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3231 static void GLAPIENTRY
3232 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3234 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3237 static void GLAPIENTRY
3238 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3240 save_RasterPos4f(x
, y
, z
, 1.0F
);
3243 static void GLAPIENTRY
3244 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3246 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3249 static void GLAPIENTRY
3250 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3252 save_RasterPos4f(x
, y
, z
, 1.0F
);
3255 static void GLAPIENTRY
3256 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3258 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3261 static void GLAPIENTRY
3262 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3264 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3267 static void GLAPIENTRY
3268 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3270 save_RasterPos4f(x
, y
, z
, w
);
3273 static void GLAPIENTRY
3274 save_RasterPos2dv(const GLdouble
* v
)
3276 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3279 static void GLAPIENTRY
3280 save_RasterPos2fv(const GLfloat
* v
)
3282 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3285 static void GLAPIENTRY
3286 save_RasterPos2iv(const GLint
* v
)
3288 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3291 static void GLAPIENTRY
3292 save_RasterPos2sv(const GLshort
* v
)
3294 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3297 static void GLAPIENTRY
3298 save_RasterPos3dv(const GLdouble
* v
)
3300 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3303 static void GLAPIENTRY
3304 save_RasterPos3fv(const GLfloat
* v
)
3306 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3309 static void GLAPIENTRY
3310 save_RasterPos3iv(const GLint
* v
)
3312 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3315 static void GLAPIENTRY
3316 save_RasterPos3sv(const GLshort
* v
)
3318 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3321 static void GLAPIENTRY
3322 save_RasterPos4dv(const GLdouble
* v
)
3324 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3325 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3328 static void GLAPIENTRY
3329 save_RasterPos4fv(const GLfloat
* v
)
3331 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3334 static void GLAPIENTRY
3335 save_RasterPos4iv(const GLint
* v
)
3337 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3338 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3341 static void GLAPIENTRY
3342 save_RasterPos4sv(const GLshort
* v
)
3344 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3348 static void GLAPIENTRY
3349 save_PassThrough(GLfloat token
)
3351 GET_CURRENT_CONTEXT(ctx
);
3353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3354 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3358 if (ctx
->ExecuteFlag
) {
3359 CALL_PassThrough(ctx
->Exec
, (token
));
3364 static void GLAPIENTRY
3365 save_ReadBuffer(GLenum mode
)
3367 GET_CURRENT_CONTEXT(ctx
);
3369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3370 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3374 if (ctx
->ExecuteFlag
) {
3375 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3380 static void GLAPIENTRY
3381 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3383 GET_CURRENT_CONTEXT(ctx
);
3385 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3386 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3393 if (ctx
->ExecuteFlag
) {
3394 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3399 static void GLAPIENTRY
3400 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3402 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3406 static void GLAPIENTRY
3407 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3409 GET_CURRENT_CONTEXT(ctx
);
3411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3412 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3418 if (ctx
->ExecuteFlag
) {
3419 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3424 static void GLAPIENTRY
3425 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3427 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3431 static void GLAPIENTRY
3432 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3434 GET_CURRENT_CONTEXT(ctx
);
3436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3437 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3444 if (ctx
->ExecuteFlag
) {
3445 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3450 static void GLAPIENTRY
3451 save_ShadeModel(GLenum mode
)
3453 GET_CURRENT_CONTEXT(ctx
);
3455 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3457 if (ctx
->ExecuteFlag
) {
3458 CALL_ShadeModel(ctx
->Exec
, (mode
));
3461 /* Don't compile this call if it's a no-op.
3462 * By avoiding this state change we have a better chance of
3463 * coalescing subsequent drawing commands into one batch.
3465 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3468 SAVE_FLUSH_VERTICES(ctx
);
3470 ctx
->ListState
.Current
.ShadeModel
= mode
;
3472 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3479 static void GLAPIENTRY
3480 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3482 GET_CURRENT_CONTEXT(ctx
);
3484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3485 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3491 if (ctx
->ExecuteFlag
) {
3492 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3497 static void GLAPIENTRY
3498 save_StencilMask(GLuint mask
)
3500 GET_CURRENT_CONTEXT(ctx
);
3502 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3503 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3507 if (ctx
->ExecuteFlag
) {
3508 CALL_StencilMask(ctx
->Exec
, (mask
));
3513 static void GLAPIENTRY
3514 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3516 GET_CURRENT_CONTEXT(ctx
);
3518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3519 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3525 if (ctx
->ExecuteFlag
) {
3526 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3531 static void GLAPIENTRY
3532 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3534 GET_CURRENT_CONTEXT(ctx
);
3536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3537 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3544 if (ctx
->ExecuteFlag
) {
3545 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3550 static void GLAPIENTRY
3551 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3554 GET_CURRENT_CONTEXT(ctx
);
3556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3558 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3566 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3573 if (ctx
->ExecuteFlag
) {
3574 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3575 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3580 static void GLAPIENTRY
3581 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3583 GET_CURRENT_CONTEXT(ctx
);
3585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3586 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3591 if (ctx
->ExecuteFlag
) {
3592 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3597 static void GLAPIENTRY
3598 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3600 GET_CURRENT_CONTEXT(ctx
);
3602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3603 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3610 if (ctx
->ExecuteFlag
) {
3611 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3616 static void GLAPIENTRY
3617 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3619 GET_CURRENT_CONTEXT(ctx
);
3621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3622 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3626 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3634 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3637 if (ctx
->ExecuteFlag
) {
3638 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3643 static void GLAPIENTRY
3644 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3647 parray
[0] = (GLfloat
) param
;
3648 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3649 save_TexEnvfv(target
, pname
, parray
);
3653 static void GLAPIENTRY
3654 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3657 p
[0] = (GLfloat
) param
;
3658 p
[1] = p
[2] = p
[3] = 0.0F
;
3659 save_TexEnvfv(target
, pname
, p
);
3663 static void GLAPIENTRY
3664 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3667 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3668 p
[0] = INT_TO_FLOAT(param
[0]);
3669 p
[1] = INT_TO_FLOAT(param
[1]);
3670 p
[2] = INT_TO_FLOAT(param
[2]);
3671 p
[3] = INT_TO_FLOAT(param
[3]);
3674 p
[0] = (GLfloat
) param
[0];
3675 p
[1] = p
[2] = p
[3] = 0.0F
;
3677 save_TexEnvfv(target
, pname
, p
);
3681 static void GLAPIENTRY
3682 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3684 GET_CURRENT_CONTEXT(ctx
);
3686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3687 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3696 if (ctx
->ExecuteFlag
) {
3697 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3702 static void GLAPIENTRY
3703 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3706 p
[0] = (GLfloat
) params
[0];
3707 p
[1] = (GLfloat
) params
[1];
3708 p
[2] = (GLfloat
) params
[2];
3709 p
[3] = (GLfloat
) params
[3];
3710 save_TexGenfv(coord
, pname
, p
);
3714 static void GLAPIENTRY
3715 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3718 parray
[0] = (GLfloat
) param
;
3719 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3720 save_TexGenfv(coord
, pname
, parray
);
3724 static void GLAPIENTRY
3725 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3728 p
[0] = (GLfloat
) params
[0];
3729 p
[1] = (GLfloat
) params
[1];
3730 p
[2] = (GLfloat
) params
[2];
3731 p
[3] = (GLfloat
) params
[3];
3732 save_TexGenfv(coord
, pname
, p
);
3736 static void GLAPIENTRY
3737 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3741 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3742 save_TexGenfv(coord
, pname
, parray
);
3746 static void GLAPIENTRY
3747 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3751 parray
[1] = parray
[2] = parray
[3] = 0;
3752 save_TexGeniv(coord
, pname
, parray
);
3756 static void GLAPIENTRY
3757 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3759 GET_CURRENT_CONTEXT(ctx
);
3761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3762 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3771 if (ctx
->ExecuteFlag
) {
3772 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3777 static void GLAPIENTRY
3778 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3782 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3783 save_TexParameterfv(target
, pname
, parray
);
3787 static void GLAPIENTRY
3788 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3791 fparam
[0] = (GLfloat
) param
;
3792 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3793 save_TexParameterfv(target
, pname
, fparam
);
3797 static void GLAPIENTRY
3798 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3801 fparam
[0] = (GLfloat
) params
[0];
3802 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3803 save_TexParameterfv(target
, pname
, fparam
);
3807 static void GLAPIENTRY
3808 save_TexImage1D(GLenum target
,
3809 GLint level
, GLint components
,
3810 GLsizei width
, GLint border
,
3811 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3813 GET_CURRENT_CONTEXT(ctx
);
3814 if (target
== GL_PROXY_TEXTURE_1D
) {
3815 /* don't compile, execute immediately */
3816 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3817 border
, format
, type
, pixels
));
3821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3822 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3826 n
[3].i
= components
;
3827 n
[4].i
= (GLint
) width
;
3832 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3833 pixels
, &ctx
->Unpack
));
3835 if (ctx
->ExecuteFlag
) {
3836 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3837 border
, format
, type
, pixels
));
3843 static void GLAPIENTRY
3844 save_TexImage2D(GLenum target
,
3845 GLint level
, GLint components
,
3846 GLsizei width
, GLsizei height
, GLint border
,
3847 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3849 GET_CURRENT_CONTEXT(ctx
);
3850 if (target
== GL_PROXY_TEXTURE_2D
) {
3851 /* don't compile, execute immediately */
3852 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3853 height
, border
, format
, type
, pixels
));
3857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3858 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3862 n
[3].i
= components
;
3863 n
[4].i
= (GLint
) width
;
3864 n
[5].i
= (GLint
) height
;
3869 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3870 pixels
, &ctx
->Unpack
));
3872 if (ctx
->ExecuteFlag
) {
3873 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3874 height
, border
, format
, type
, pixels
));
3880 static void GLAPIENTRY
3881 save_TexImage3D(GLenum target
,
3882 GLint level
, GLint internalFormat
,
3883 GLsizei width
, GLsizei height
, GLsizei depth
,
3885 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3887 GET_CURRENT_CONTEXT(ctx
);
3888 if (target
== GL_PROXY_TEXTURE_3D
) {
3889 /* don't compile, execute immediately */
3890 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3891 height
, depth
, border
, format
, type
,
3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3897 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3901 n
[3].i
= (GLint
) internalFormat
;
3902 n
[4].i
= (GLint
) width
;
3903 n
[5].i
= (GLint
) height
;
3904 n
[6].i
= (GLint
) depth
;
3908 save_pointer(&n
[10],
3909 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3910 pixels
, &ctx
->Unpack
));
3912 if (ctx
->ExecuteFlag
) {
3913 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3914 height
, depth
, border
, format
, type
,
3921 static void GLAPIENTRY
3922 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3923 GLsizei width
, GLenum format
, GLenum type
,
3924 const GLvoid
* pixels
)
3926 GET_CURRENT_CONTEXT(ctx
);
3929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3931 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
3936 n
[4].i
= (GLint
) width
;
3940 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3941 pixels
, &ctx
->Unpack
));
3943 if (ctx
->ExecuteFlag
) {
3944 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3945 format
, type
, pixels
));
3950 static void GLAPIENTRY
3951 save_TexSubImage2D(GLenum target
, GLint level
,
3952 GLint xoffset
, GLint yoffset
,
3953 GLsizei width
, GLsizei height
,
3954 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3956 GET_CURRENT_CONTEXT(ctx
);
3959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3961 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
3967 n
[5].i
= (GLint
) width
;
3968 n
[6].i
= (GLint
) height
;
3972 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3973 pixels
, &ctx
->Unpack
));
3975 if (ctx
->ExecuteFlag
) {
3976 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3977 width
, height
, format
, type
, pixels
));
3982 static void GLAPIENTRY
3983 save_TexSubImage3D(GLenum target
, GLint level
,
3984 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3985 GLsizei width
, GLsizei height
, GLsizei depth
,
3986 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3988 GET_CURRENT_CONTEXT(ctx
);
3991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3993 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4000 n
[6].i
= (GLint
) width
;
4001 n
[7].i
= (GLint
) height
;
4002 n
[8].i
= (GLint
) depth
;
4005 save_pointer(&n
[11],
4006 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4007 pixels
, &ctx
->Unpack
));
4009 if (ctx
->ExecuteFlag
) {
4010 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4011 xoffset
, yoffset
, zoffset
,
4012 width
, height
, depth
, format
, type
,
4018 static void GLAPIENTRY
4019 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4021 GET_CURRENT_CONTEXT(ctx
);
4023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4024 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4030 if (ctx
->ExecuteFlag
) {
4031 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4036 static void GLAPIENTRY
4037 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4039 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4044 static void GLAPIENTRY
4045 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4047 GET_CURRENT_CONTEXT(ctx
);
4049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4050 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4054 n
[3].i
= (GLint
) width
;
4055 n
[4].i
= (GLint
) height
;
4057 if (ctx
->ExecuteFlag
) {
4058 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4063 static void GLAPIENTRY
4064 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4066 GET_CURRENT_CONTEXT(ctx
);
4068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4069 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4076 if (ctx
->ExecuteFlag
) {
4077 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4081 static void GLAPIENTRY
4082 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4084 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4087 static void GLAPIENTRY
4088 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4090 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4093 static void GLAPIENTRY
4094 save_WindowPos2iMESA(GLint x
, GLint y
)
4096 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4099 static void GLAPIENTRY
4100 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4102 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4105 static void GLAPIENTRY
4106 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4108 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4111 static void GLAPIENTRY
4112 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4114 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4117 static void GLAPIENTRY
4118 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4120 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4123 static void GLAPIENTRY
4124 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4126 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4129 static void GLAPIENTRY
4130 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4132 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4135 static void GLAPIENTRY
4136 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4138 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4141 static void GLAPIENTRY
4142 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4144 save_WindowPos4fMESA(x
, y
, z
, w
);
4147 static void GLAPIENTRY
4148 save_WindowPos2dvMESA(const GLdouble
* v
)
4150 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4153 static void GLAPIENTRY
4154 save_WindowPos2fvMESA(const GLfloat
* v
)
4156 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4159 static void GLAPIENTRY
4160 save_WindowPos2ivMESA(const GLint
* v
)
4162 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4165 static void GLAPIENTRY
4166 save_WindowPos2svMESA(const GLshort
* v
)
4168 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4171 static void GLAPIENTRY
4172 save_WindowPos3dvMESA(const GLdouble
* v
)
4174 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4177 static void GLAPIENTRY
4178 save_WindowPos3fvMESA(const GLfloat
* v
)
4180 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4183 static void GLAPIENTRY
4184 save_WindowPos3ivMESA(const GLint
* v
)
4186 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4189 static void GLAPIENTRY
4190 save_WindowPos3svMESA(const GLshort
* v
)
4192 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4195 static void GLAPIENTRY
4196 save_WindowPos4dvMESA(const GLdouble
* v
)
4198 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4199 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4202 static void GLAPIENTRY
4203 save_WindowPos4fvMESA(const GLfloat
* v
)
4205 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4208 static void GLAPIENTRY
4209 save_WindowPos4ivMESA(const GLint
* v
)
4211 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4212 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4215 static void GLAPIENTRY
4216 save_WindowPos4svMESA(const GLshort
* v
)
4218 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4223 /* GL_ARB_multitexture */
4224 static void GLAPIENTRY
4225 save_ActiveTextureARB(GLenum target
)
4227 GET_CURRENT_CONTEXT(ctx
);
4229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4230 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4234 if (ctx
->ExecuteFlag
) {
4235 CALL_ActiveTexture(ctx
->Exec
, (target
));
4240 /* GL_ARB_transpose_matrix */
4242 static void GLAPIENTRY
4243 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4246 _math_transposefd(tm
, m
);
4247 save_LoadMatrixf(tm
);
4251 static void GLAPIENTRY
4252 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4255 _math_transposef(tm
, m
);
4256 save_LoadMatrixf(tm
);
4260 static void GLAPIENTRY
4261 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4264 _math_transposefd(tm
, m
);
4265 save_MultMatrixf(tm
);
4269 static void GLAPIENTRY
4270 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4273 _math_transposef(tm
, m
);
4274 save_MultMatrixf(tm
);
4277 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4279 GET_CURRENT_CONTEXT(ctx
);
4285 image
= malloc(size
);
4287 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4290 memcpy(image
, data
, size
);
4296 /* GL_ARB_texture_compression */
4297 static void GLAPIENTRY
4298 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4299 GLenum internalFormat
, GLsizei width
,
4300 GLint border
, GLsizei imageSize
,
4301 const GLvoid
* data
)
4303 GET_CURRENT_CONTEXT(ctx
);
4304 if (target
== GL_PROXY_TEXTURE_1D
) {
4305 /* don't compile, execute immediately */
4306 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4307 width
, border
, imageSize
,
4312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4314 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4315 6 + POINTER_DWORDS
);
4319 n
[3].e
= internalFormat
;
4320 n
[4].i
= (GLint
) width
;
4324 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4326 if (ctx
->ExecuteFlag
) {
4327 CALL_CompressedTexImage1D(ctx
->Exec
,
4328 (target
, level
, internalFormat
, width
,
4329 border
, imageSize
, data
));
4335 static void GLAPIENTRY
4336 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4337 GLenum internalFormat
, GLsizei width
,
4338 GLsizei height
, GLint border
, GLsizei imageSize
,
4339 const GLvoid
* data
)
4341 GET_CURRENT_CONTEXT(ctx
);
4342 if (target
== GL_PROXY_TEXTURE_2D
) {
4343 /* don't compile, execute immediately */
4344 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4345 width
, height
, border
,
4350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4352 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4353 7 + POINTER_DWORDS
);
4357 n
[3].e
= internalFormat
;
4358 n
[4].i
= (GLint
) width
;
4359 n
[5].i
= (GLint
) height
;
4363 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4365 if (ctx
->ExecuteFlag
) {
4366 CALL_CompressedTexImage2D(ctx
->Exec
,
4367 (target
, level
, internalFormat
, width
,
4368 height
, border
, imageSize
, data
));
4374 static void GLAPIENTRY
4375 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4376 GLenum internalFormat
, GLsizei width
,
4377 GLsizei height
, GLsizei depth
, GLint border
,
4378 GLsizei imageSize
, const GLvoid
* data
)
4380 GET_CURRENT_CONTEXT(ctx
);
4381 if (target
== GL_PROXY_TEXTURE_3D
) {
4382 /* don't compile, execute immediately */
4383 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4384 width
, height
, depth
, border
,
4389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4391 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4392 8 + POINTER_DWORDS
);
4396 n
[3].e
= internalFormat
;
4397 n
[4].i
= (GLint
) width
;
4398 n
[5].i
= (GLint
) height
;
4399 n
[6].i
= (GLint
) depth
;
4403 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4405 if (ctx
->ExecuteFlag
) {
4406 CALL_CompressedTexImage3D(ctx
->Exec
,
4407 (target
, level
, internalFormat
, width
,
4408 height
, depth
, border
, imageSize
,
4415 static void GLAPIENTRY
4416 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4417 GLsizei width
, GLenum format
,
4418 GLsizei imageSize
, const GLvoid
* data
)
4421 GET_CURRENT_CONTEXT(ctx
);
4422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4424 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4425 6 + POINTER_DWORDS
);
4430 n
[4].i
= (GLint
) width
;
4434 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4436 if (ctx
->ExecuteFlag
) {
4437 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4438 width
, format
, imageSize
,
4444 static void GLAPIENTRY
4445 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4446 GLint yoffset
, GLsizei width
, GLsizei height
,
4447 GLenum format
, GLsizei imageSize
,
4448 const GLvoid
* data
)
4451 GET_CURRENT_CONTEXT(ctx
);
4452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4454 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4455 8 + POINTER_DWORDS
);
4461 n
[5].i
= (GLint
) width
;
4462 n
[6].i
= (GLint
) height
;
4466 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4468 if (ctx
->ExecuteFlag
) {
4469 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4470 (target
, level
, xoffset
, yoffset
, width
,
4471 height
, format
, imageSize
, data
));
4476 static void GLAPIENTRY
4477 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4478 GLint yoffset
, GLint zoffset
, GLsizei width
,
4479 GLsizei height
, GLsizei depth
, GLenum format
,
4480 GLsizei imageSize
, const GLvoid
* data
)
4483 GET_CURRENT_CONTEXT(ctx
);
4484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4486 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4487 10 + POINTER_DWORDS
);
4494 n
[6].i
= (GLint
) width
;
4495 n
[7].i
= (GLint
) height
;
4496 n
[8].i
= (GLint
) depth
;
4498 n
[10].i
= imageSize
;
4499 save_pointer(&n
[11],
4500 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4502 if (ctx
->ExecuteFlag
) {
4503 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4504 (target
, level
, xoffset
, yoffset
,
4505 zoffset
, width
, height
, depth
, format
,
4511 /* GL_ARB_multisample */
4512 static void GLAPIENTRY
4513 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4515 GET_CURRENT_CONTEXT(ctx
);
4517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4518 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4523 if (ctx
->ExecuteFlag
) {
4524 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4530 * GL_NV_fragment_program
4532 static void GLAPIENTRY
4533 save_BindProgramNV(GLenum target
, GLuint id
)
4535 GET_CURRENT_CONTEXT(ctx
);
4537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4538 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4543 if (ctx
->ExecuteFlag
) {
4544 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4548 static void GLAPIENTRY
4549 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4550 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4552 GET_CURRENT_CONTEXT(ctx
);
4554 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4555 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4564 if (ctx
->ExecuteFlag
) {
4565 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4570 static void GLAPIENTRY
4571 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4572 const GLfloat
*params
)
4574 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4575 params
[2], params
[3]);
4579 static void GLAPIENTRY
4580 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4581 const GLfloat
* params
)
4583 GET_CURRENT_CONTEXT(ctx
);
4585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4589 const GLfloat
* p
= params
;
4591 for (i
= 0 ; i
< count
; i
++) {
4592 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4605 if (ctx
->ExecuteFlag
) {
4606 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4611 static void GLAPIENTRY
4612 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4613 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4615 save_ProgramEnvParameter4fARB(target
, index
,
4617 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4621 static void GLAPIENTRY
4622 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4623 const GLdouble
*params
)
4625 save_ProgramEnvParameter4fARB(target
, index
,
4626 (GLfloat
) params
[0],
4627 (GLfloat
) params
[1],
4628 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4632 static void GLAPIENTRY
4633 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4634 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4636 GET_CURRENT_CONTEXT(ctx
);
4638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4639 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4648 if (ctx
->ExecuteFlag
) {
4649 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4654 static void GLAPIENTRY
4655 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4656 const GLfloat
*params
)
4658 GET_CURRENT_CONTEXT(ctx
);
4660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4661 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4670 if (ctx
->ExecuteFlag
) {
4671 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4676 static void GLAPIENTRY
4677 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4678 const GLfloat
*params
)
4680 GET_CURRENT_CONTEXT(ctx
);
4682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4686 const GLfloat
* p
= params
;
4688 for (i
= 0 ; i
< count
; i
++) {
4689 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4702 if (ctx
->ExecuteFlag
) {
4703 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4708 static void GLAPIENTRY
4709 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4710 GLdouble x
, GLdouble y
,
4711 GLdouble z
, GLdouble w
)
4713 GET_CURRENT_CONTEXT(ctx
);
4715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4716 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4720 n
[3].f
= (GLfloat
) x
;
4721 n
[4].f
= (GLfloat
) y
;
4722 n
[5].f
= (GLfloat
) z
;
4723 n
[6].f
= (GLfloat
) w
;
4725 if (ctx
->ExecuteFlag
) {
4726 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4731 static void GLAPIENTRY
4732 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4733 const GLdouble
*params
)
4735 GET_CURRENT_CONTEXT(ctx
);
4737 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4738 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4742 n
[3].f
= (GLfloat
) params
[0];
4743 n
[4].f
= (GLfloat
) params
[1];
4744 n
[5].f
= (GLfloat
) params
[2];
4745 n
[6].f
= (GLfloat
) params
[3];
4747 if (ctx
->ExecuteFlag
) {
4748 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4753 /* GL_EXT_stencil_two_side */
4754 static void GLAPIENTRY
4755 save_ActiveStencilFaceEXT(GLenum face
)
4757 GET_CURRENT_CONTEXT(ctx
);
4759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4760 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4764 if (ctx
->ExecuteFlag
) {
4765 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4770 /* GL_EXT_depth_bounds_test */
4771 static void GLAPIENTRY
4772 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4774 GET_CURRENT_CONTEXT(ctx
);
4776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4777 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4779 n
[1].f
= (GLfloat
) zmin
;
4780 n
[2].f
= (GLfloat
) zmax
;
4782 if (ctx
->ExecuteFlag
) {
4783 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4789 static void GLAPIENTRY
4790 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4791 const GLvoid
* string
)
4793 GET_CURRENT_CONTEXT(ctx
);
4796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4798 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4800 GLubyte
*programCopy
= malloc(len
);
4802 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4805 memcpy(programCopy
, string
, len
);
4809 save_pointer(&n
[4], programCopy
);
4811 if (ctx
->ExecuteFlag
) {
4812 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4817 static void GLAPIENTRY
4818 save_BeginQueryARB(GLenum target
, GLuint id
)
4820 GET_CURRENT_CONTEXT(ctx
);
4822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4823 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4828 if (ctx
->ExecuteFlag
) {
4829 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4833 static void GLAPIENTRY
4834 save_EndQueryARB(GLenum target
)
4836 GET_CURRENT_CONTEXT(ctx
);
4838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4839 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4843 if (ctx
->ExecuteFlag
) {
4844 CALL_EndQuery(ctx
->Exec
, (target
));
4848 static void GLAPIENTRY
4849 save_QueryCounter(GLuint id
, GLenum target
)
4851 GET_CURRENT_CONTEXT(ctx
);
4853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4854 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4859 if (ctx
->ExecuteFlag
) {
4860 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4864 static void GLAPIENTRY
4865 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4867 GET_CURRENT_CONTEXT(ctx
);
4869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4870 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4876 if (ctx
->ExecuteFlag
) {
4877 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4881 static void GLAPIENTRY
4882 save_EndQueryIndexed(GLenum target
, GLuint index
)
4884 GET_CURRENT_CONTEXT(ctx
);
4886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4887 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4892 if (ctx
->ExecuteFlag
) {
4893 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4898 static void GLAPIENTRY
4899 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4901 GET_CURRENT_CONTEXT(ctx
);
4903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4904 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4908 if (count
> MAX_DRAW_BUFFERS
)
4909 count
= MAX_DRAW_BUFFERS
;
4910 for (i
= 0; i
< count
; i
++) {
4911 n
[2 + i
].e
= buffers
[i
];
4914 if (ctx
->ExecuteFlag
) {
4915 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4919 static void GLAPIENTRY
4920 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4922 GET_CURRENT_CONTEXT(ctx
);
4925 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4933 if (ctx
->ExecuteFlag
) {
4934 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4938 static void GLAPIENTRY
4939 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4942 p
[0] = INT_TO_FLOAT(param
[0]);
4943 p
[1] = INT_TO_FLOAT(param
[1]);
4944 p
[2] = INT_TO_FLOAT(param
[2]);
4945 p
[3] = INT_TO_FLOAT(param
[3]);
4946 save_TexBumpParameterfvATI(pname
, p
);
4949 static void GLAPIENTRY
4950 save_BindFragmentShaderATI(GLuint id
)
4952 GET_CURRENT_CONTEXT(ctx
);
4955 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4959 if (ctx
->ExecuteFlag
) {
4960 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4964 static void GLAPIENTRY
4965 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4967 GET_CURRENT_CONTEXT(ctx
);
4970 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4978 if (ctx
->ExecuteFlag
) {
4979 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4983 static void GLAPIENTRY
4984 save_Attr1fNV(GLenum attr
, GLfloat x
)
4986 GET_CURRENT_CONTEXT(ctx
);
4988 SAVE_FLUSH_VERTICES(ctx
);
4989 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4995 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4996 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4997 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4999 if (ctx
->ExecuteFlag
) {
5000 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5004 static void GLAPIENTRY
5005 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5007 GET_CURRENT_CONTEXT(ctx
);
5009 SAVE_FLUSH_VERTICES(ctx
);
5010 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5017 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5018 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5019 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5021 if (ctx
->ExecuteFlag
) {
5022 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5026 static void GLAPIENTRY
5027 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5029 GET_CURRENT_CONTEXT(ctx
);
5031 SAVE_FLUSH_VERTICES(ctx
);
5032 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5040 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5041 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5042 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5044 if (ctx
->ExecuteFlag
) {
5045 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5049 static void GLAPIENTRY
5050 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5052 GET_CURRENT_CONTEXT(ctx
);
5054 SAVE_FLUSH_VERTICES(ctx
);
5055 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5064 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5065 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5066 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5068 if (ctx
->ExecuteFlag
) {
5069 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5074 static void GLAPIENTRY
5075 save_Attr1fARB(GLenum attr
, GLfloat x
)
5077 GET_CURRENT_CONTEXT(ctx
);
5079 SAVE_FLUSH_VERTICES(ctx
);
5080 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5086 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5087 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5088 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5090 if (ctx
->ExecuteFlag
) {
5091 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5095 static void GLAPIENTRY
5096 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5098 GET_CURRENT_CONTEXT(ctx
);
5100 SAVE_FLUSH_VERTICES(ctx
);
5101 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5108 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5109 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5110 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5112 if (ctx
->ExecuteFlag
) {
5113 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5117 static void GLAPIENTRY
5118 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5120 GET_CURRENT_CONTEXT(ctx
);
5122 SAVE_FLUSH_VERTICES(ctx
);
5123 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5131 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5132 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5133 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5135 if (ctx
->ExecuteFlag
) {
5136 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5140 static void GLAPIENTRY
5141 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5143 GET_CURRENT_CONTEXT(ctx
);
5145 SAVE_FLUSH_VERTICES(ctx
);
5146 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5155 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5156 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5157 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5159 if (ctx
->ExecuteFlag
) {
5160 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5165 static void GLAPIENTRY
5166 save_EvalCoord1f(GLfloat x
)
5168 GET_CURRENT_CONTEXT(ctx
);
5170 SAVE_FLUSH_VERTICES(ctx
);
5171 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5175 if (ctx
->ExecuteFlag
) {
5176 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5180 static void GLAPIENTRY
5181 save_EvalCoord1fv(const GLfloat
* v
)
5183 save_EvalCoord1f(v
[0]);
5186 static void GLAPIENTRY
5187 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5189 GET_CURRENT_CONTEXT(ctx
);
5191 SAVE_FLUSH_VERTICES(ctx
);
5192 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5197 if (ctx
->ExecuteFlag
) {
5198 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5202 static void GLAPIENTRY
5203 save_EvalCoord2fv(const GLfloat
* v
)
5205 save_EvalCoord2f(v
[0], v
[1]);
5209 static void GLAPIENTRY
5210 save_EvalPoint1(GLint x
)
5212 GET_CURRENT_CONTEXT(ctx
);
5214 SAVE_FLUSH_VERTICES(ctx
);
5215 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5219 if (ctx
->ExecuteFlag
) {
5220 CALL_EvalPoint1(ctx
->Exec
, (x
));
5224 static void GLAPIENTRY
5225 save_EvalPoint2(GLint x
, GLint y
)
5227 GET_CURRENT_CONTEXT(ctx
);
5229 SAVE_FLUSH_VERTICES(ctx
);
5230 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5235 if (ctx
->ExecuteFlag
) {
5236 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5240 static void GLAPIENTRY
5241 save_Indexf(GLfloat x
)
5243 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5246 static void GLAPIENTRY
5247 save_Indexfv(const GLfloat
* v
)
5249 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5252 static void GLAPIENTRY
5253 save_EdgeFlag(GLboolean x
)
5255 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5260 * Compare 'count' elements of vectors 'a' and 'b'.
5261 * \return GL_TRUE if equal, GL_FALSE if different.
5263 static inline GLboolean
5264 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5266 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5271 * This glMaterial function is used for glMaterial calls that are outside
5272 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5274 static void GLAPIENTRY
5275 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5277 GET_CURRENT_CONTEXT(ctx
);
5285 case GL_FRONT_AND_BACK
:
5288 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5297 case GL_AMBIENT_AND_DIFFUSE
:
5303 case GL_COLOR_INDEXES
:
5307 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5311 if (ctx
->ExecuteFlag
) {
5312 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5315 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5317 /* Try to eliminate redundant statechanges. Because it is legal to
5318 * call glMaterial even inside begin/end calls, don't need to worry
5319 * about ctx->Driver.CurrentSavePrimitive here.
5321 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5322 if (bitmask
& (1 << i
)) {
5323 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5324 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5325 /* no change in material value */
5326 bitmask
&= ~(1 << i
);
5329 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5330 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5335 /* If this call has no effect, return early */
5339 SAVE_FLUSH_VERTICES(ctx
);
5341 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5345 for (i
= 0; i
< args
; i
++)
5346 n
[3 + i
].f
= param
[i
];
5350 static void GLAPIENTRY
5351 save_Begin(GLenum mode
)
5353 GET_CURRENT_CONTEXT(ctx
);
5355 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5356 /* compile this error into the display list */
5357 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5359 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5360 /* compile this error into the display list */
5361 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5366 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5368 /* Give the driver an opportunity to hook in an optimized
5369 * display list compiler.
5371 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5374 SAVE_FLUSH_VERTICES(ctx
);
5375 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5380 if (ctx
->ExecuteFlag
) {
5381 CALL_Begin(ctx
->Exec
, (mode
));
5386 static void GLAPIENTRY
5389 GET_CURRENT_CONTEXT(ctx
);
5390 SAVE_FLUSH_VERTICES(ctx
);
5391 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5392 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5393 if (ctx
->ExecuteFlag
) {
5394 CALL_End(ctx
->Exec
, ());
5398 static void GLAPIENTRY
5399 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5401 GET_CURRENT_CONTEXT(ctx
);
5403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5404 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5411 if (ctx
->ExecuteFlag
) {
5412 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5417 static void GLAPIENTRY
5418 save_Vertex2f(GLfloat x
, GLfloat y
)
5420 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5423 static void GLAPIENTRY
5424 save_Vertex2fv(const GLfloat
* v
)
5426 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5429 static void GLAPIENTRY
5430 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5432 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5435 static void GLAPIENTRY
5436 save_Vertex3fv(const GLfloat
* v
)
5438 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5441 static void GLAPIENTRY
5442 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5444 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5447 static void GLAPIENTRY
5448 save_Vertex4fv(const GLfloat
* v
)
5450 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5453 static void GLAPIENTRY
5454 save_TexCoord1f(GLfloat x
)
5456 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5459 static void GLAPIENTRY
5460 save_TexCoord1fv(const GLfloat
* v
)
5462 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5465 static void GLAPIENTRY
5466 save_TexCoord2f(GLfloat x
, GLfloat y
)
5468 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5471 static void GLAPIENTRY
5472 save_TexCoord2fv(const GLfloat
* v
)
5474 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5477 static void GLAPIENTRY
5478 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5480 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5483 static void GLAPIENTRY
5484 save_TexCoord3fv(const GLfloat
* v
)
5486 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5489 static void GLAPIENTRY
5490 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5492 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5495 static void GLAPIENTRY
5496 save_TexCoord4fv(const GLfloat
* v
)
5498 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5501 static void GLAPIENTRY
5502 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5504 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5507 static void GLAPIENTRY
5508 save_Normal3fv(const GLfloat
* v
)
5510 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5513 static void GLAPIENTRY
5514 save_FogCoordfEXT(GLfloat x
)
5516 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5519 static void GLAPIENTRY
5520 save_FogCoordfvEXT(const GLfloat
* v
)
5522 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5525 static void GLAPIENTRY
5526 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5528 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5531 static void GLAPIENTRY
5532 save_Color3fv(const GLfloat
* v
)
5534 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5537 static void GLAPIENTRY
5538 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5540 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5543 static void GLAPIENTRY
5544 save_Color4fv(const GLfloat
* v
)
5546 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5549 static void GLAPIENTRY
5550 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5552 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5555 static void GLAPIENTRY
5556 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5558 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5562 /* Just call the respective ATTR for texcoord
5564 static void GLAPIENTRY
5565 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5567 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5568 save_Attr1fNV(attr
, x
);
5571 static void GLAPIENTRY
5572 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5574 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5575 save_Attr1fNV(attr
, v
[0]);
5578 static void GLAPIENTRY
5579 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5581 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5582 save_Attr2fNV(attr
, x
, y
);
5585 static void GLAPIENTRY
5586 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5588 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5589 save_Attr2fNV(attr
, v
[0], v
[1]);
5592 static void GLAPIENTRY
5593 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5595 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5596 save_Attr3fNV(attr
, x
, y
, z
);
5599 static void GLAPIENTRY
5600 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5602 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5603 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5606 static void GLAPIENTRY
5607 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5608 GLfloat z
, GLfloat w
)
5610 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5611 save_Attr4fNV(attr
, x
, y
, z
, w
);
5614 static void GLAPIENTRY
5615 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5617 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5618 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5623 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5629 GET_CURRENT_CONTEXT(ctx
);
5630 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5635 static void GLAPIENTRY
5636 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5638 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5639 save_Attr1fARB(index
, x
);
5644 static void GLAPIENTRY
5645 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5647 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5648 save_Attr1fARB(index
, v
[0]);
5653 static void GLAPIENTRY
5654 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5656 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5657 save_Attr2fARB(index
, x
, y
);
5662 static void GLAPIENTRY
5663 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5665 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5666 save_Attr2fARB(index
, v
[0], v
[1]);
5671 static void GLAPIENTRY
5672 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5674 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5675 save_Attr3fARB(index
, x
, y
, z
);
5680 static void GLAPIENTRY
5681 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5683 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5684 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5689 static void GLAPIENTRY
5690 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5693 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5694 save_Attr4fARB(index
, x
, y
, z
, w
);
5699 static void GLAPIENTRY
5700 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5702 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5703 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5708 static void GLAPIENTRY
5709 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5710 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5711 GLbitfield mask
, GLenum filter
)
5713 GET_CURRENT_CONTEXT(ctx
);
5715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5716 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5729 if (ctx
->ExecuteFlag
) {
5730 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5731 dstX0
, dstY0
, dstX1
, dstY1
,
5737 /** GL_EXT_provoking_vertex */
5738 static void GLAPIENTRY
5739 save_ProvokingVertexEXT(GLenum mode
)
5741 GET_CURRENT_CONTEXT(ctx
);
5743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5744 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5748 if (ctx
->ExecuteFlag
) {
5749 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5750 _mesa_ProvokingVertex(mode
);
5755 /** GL_EXT_transform_feedback */
5756 static void GLAPIENTRY
5757 save_BeginTransformFeedback(GLenum mode
)
5759 GET_CURRENT_CONTEXT(ctx
);
5761 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5762 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5766 if (ctx
->ExecuteFlag
) {
5767 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5772 /** GL_EXT_transform_feedback */
5773 static void GLAPIENTRY
5774 save_EndTransformFeedback(void)
5776 GET_CURRENT_CONTEXT(ctx
);
5777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5778 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5779 if (ctx
->ExecuteFlag
) {
5780 CALL_EndTransformFeedback(ctx
->Exec
, ());
5784 static void GLAPIENTRY
5785 save_BindTransformFeedback(GLenum target
, GLuint name
)
5787 GET_CURRENT_CONTEXT(ctx
);
5789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5790 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5795 if (ctx
->ExecuteFlag
) {
5796 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5800 static void GLAPIENTRY
5801 save_PauseTransformFeedback(void)
5803 GET_CURRENT_CONTEXT(ctx
);
5804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5805 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5806 if (ctx
->ExecuteFlag
) {
5807 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5811 static void GLAPIENTRY
5812 save_ResumeTransformFeedback(void)
5814 GET_CURRENT_CONTEXT(ctx
);
5815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5816 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5817 if (ctx
->ExecuteFlag
) {
5818 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5822 static void GLAPIENTRY
5823 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5825 GET_CURRENT_CONTEXT(ctx
);
5827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5828 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5833 if (ctx
->ExecuteFlag
) {
5834 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5838 static void GLAPIENTRY
5839 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5841 GET_CURRENT_CONTEXT(ctx
);
5843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5844 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5850 if (ctx
->ExecuteFlag
) {
5851 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5855 static void GLAPIENTRY
5856 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5859 GET_CURRENT_CONTEXT(ctx
);
5861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5862 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5866 n
[3].si
= primcount
;
5868 if (ctx
->ExecuteFlag
) {
5869 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5873 static void GLAPIENTRY
5874 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5875 GLuint stream
, GLsizei primcount
)
5877 GET_CURRENT_CONTEXT(ctx
);
5879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5880 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5885 n
[4].si
= primcount
;
5887 if (ctx
->ExecuteFlag
) {
5888 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5893 /* aka UseProgram() */
5894 static void GLAPIENTRY
5895 save_UseProgramObjectARB(GLhandleARB program
)
5897 GET_CURRENT_CONTEXT(ctx
);
5899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5900 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5904 if (ctx
->ExecuteFlag
) {
5905 CALL_UseProgram(ctx
->Exec
, (program
));
5910 static void GLAPIENTRY
5911 save_Uniform1fARB(GLint location
, GLfloat x
)
5913 GET_CURRENT_CONTEXT(ctx
);
5915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5916 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5921 if (ctx
->ExecuteFlag
) {
5922 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5927 static void GLAPIENTRY
5928 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5930 GET_CURRENT_CONTEXT(ctx
);
5932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5933 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5939 if (ctx
->ExecuteFlag
) {
5940 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5945 static void GLAPIENTRY
5946 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5948 GET_CURRENT_CONTEXT(ctx
);
5950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5951 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5958 if (ctx
->ExecuteFlag
) {
5959 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5964 static void GLAPIENTRY
5965 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5967 GET_CURRENT_CONTEXT(ctx
);
5969 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5970 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5978 if (ctx
->ExecuteFlag
) {
5979 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5984 static void GLAPIENTRY
5985 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5987 GET_CURRENT_CONTEXT(ctx
);
5989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5990 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
5994 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
5996 if (ctx
->ExecuteFlag
) {
5997 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6001 static void GLAPIENTRY
6002 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6004 GET_CURRENT_CONTEXT(ctx
);
6006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6007 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6011 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6013 if (ctx
->ExecuteFlag
) {
6014 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6018 static void GLAPIENTRY
6019 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6021 GET_CURRENT_CONTEXT(ctx
);
6023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6024 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6028 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6030 if (ctx
->ExecuteFlag
) {
6031 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6035 static void GLAPIENTRY
6036 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6038 GET_CURRENT_CONTEXT(ctx
);
6040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6041 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6045 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6047 if (ctx
->ExecuteFlag
) {
6048 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6053 static void GLAPIENTRY
6054 save_Uniform1iARB(GLint location
, GLint x
)
6056 GET_CURRENT_CONTEXT(ctx
);
6058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6059 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6064 if (ctx
->ExecuteFlag
) {
6065 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6069 static void GLAPIENTRY
6070 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6072 GET_CURRENT_CONTEXT(ctx
);
6074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6075 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6081 if (ctx
->ExecuteFlag
) {
6082 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6086 static void GLAPIENTRY
6087 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6089 GET_CURRENT_CONTEXT(ctx
);
6091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6092 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6099 if (ctx
->ExecuteFlag
) {
6100 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6104 static void GLAPIENTRY
6105 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6107 GET_CURRENT_CONTEXT(ctx
);
6109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6110 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6118 if (ctx
->ExecuteFlag
) {
6119 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6125 static void GLAPIENTRY
6126 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6128 GET_CURRENT_CONTEXT(ctx
);
6130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6131 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6135 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6137 if (ctx
->ExecuteFlag
) {
6138 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6142 static void GLAPIENTRY
6143 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6145 GET_CURRENT_CONTEXT(ctx
);
6147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6148 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6152 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6154 if (ctx
->ExecuteFlag
) {
6155 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6159 static void GLAPIENTRY
6160 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6162 GET_CURRENT_CONTEXT(ctx
);
6164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6165 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6169 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6171 if (ctx
->ExecuteFlag
) {
6172 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6176 static void GLAPIENTRY
6177 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6179 GET_CURRENT_CONTEXT(ctx
);
6181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6182 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6186 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6188 if (ctx
->ExecuteFlag
) {
6189 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6195 static void GLAPIENTRY
6196 save_Uniform1ui(GLint location
, GLuint x
)
6198 GET_CURRENT_CONTEXT(ctx
);
6200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6201 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6206 if (ctx
->ExecuteFlag
) {
6207 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6211 static void GLAPIENTRY
6212 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6214 GET_CURRENT_CONTEXT(ctx
);
6216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6217 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6223 if (ctx
->ExecuteFlag
) {
6224 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6228 static void GLAPIENTRY
6229 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6231 GET_CURRENT_CONTEXT(ctx
);
6233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6234 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6241 if (ctx
->ExecuteFlag
) {
6242 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6246 static void GLAPIENTRY
6247 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6249 GET_CURRENT_CONTEXT(ctx
);
6251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6252 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6260 if (ctx
->ExecuteFlag
) {
6261 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6267 static void GLAPIENTRY
6268 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6270 GET_CURRENT_CONTEXT(ctx
);
6272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6273 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6277 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6279 if (ctx
->ExecuteFlag
) {
6280 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6284 static void GLAPIENTRY
6285 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6287 GET_CURRENT_CONTEXT(ctx
);
6289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6290 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6294 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6296 if (ctx
->ExecuteFlag
) {
6297 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6301 static void GLAPIENTRY
6302 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6304 GET_CURRENT_CONTEXT(ctx
);
6306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6307 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6311 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6313 if (ctx
->ExecuteFlag
) {
6314 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6318 static void GLAPIENTRY
6319 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6321 GET_CURRENT_CONTEXT(ctx
);
6323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6324 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6328 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6330 if (ctx
->ExecuteFlag
) {
6331 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6337 static void GLAPIENTRY
6338 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6341 GET_CURRENT_CONTEXT(ctx
);
6343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6344 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6349 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6351 if (ctx
->ExecuteFlag
) {
6352 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6356 static void GLAPIENTRY
6357 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6360 GET_CURRENT_CONTEXT(ctx
);
6362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6363 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6368 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6370 if (ctx
->ExecuteFlag
) {
6371 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6375 static void GLAPIENTRY
6376 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6379 GET_CURRENT_CONTEXT(ctx
);
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6382 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6387 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6389 if (ctx
->ExecuteFlag
) {
6390 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6395 static void GLAPIENTRY
6396 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6399 GET_CURRENT_CONTEXT(ctx
);
6401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6402 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6407 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6409 if (ctx
->ExecuteFlag
) {
6410 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6414 static void GLAPIENTRY
6415 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6418 GET_CURRENT_CONTEXT(ctx
);
6420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6421 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6426 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6428 if (ctx
->ExecuteFlag
) {
6429 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6434 static void GLAPIENTRY
6435 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6438 GET_CURRENT_CONTEXT(ctx
);
6440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6441 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6446 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6448 if (ctx
->ExecuteFlag
) {
6449 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6453 static void GLAPIENTRY
6454 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6457 GET_CURRENT_CONTEXT(ctx
);
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6460 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6465 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6467 if (ctx
->ExecuteFlag
) {
6468 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6473 static void GLAPIENTRY
6474 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6477 GET_CURRENT_CONTEXT(ctx
);
6479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6480 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6485 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6487 if (ctx
->ExecuteFlag
) {
6488 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6492 static void GLAPIENTRY
6493 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6496 GET_CURRENT_CONTEXT(ctx
);
6498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6499 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6504 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6506 if (ctx
->ExecuteFlag
) {
6507 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6511 static void GLAPIENTRY
6512 save_ClampColorARB(GLenum target
, GLenum clamp
)
6514 GET_CURRENT_CONTEXT(ctx
);
6516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6517 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6522 if (ctx
->ExecuteFlag
) {
6523 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6527 static void GLAPIENTRY
6528 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6530 GET_CURRENT_CONTEXT(ctx
);
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6533 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6538 if (ctx
->ExecuteFlag
) {
6539 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6543 static void GLAPIENTRY
6544 save_ActiveProgramEXT(GLuint program
)
6546 GET_CURRENT_CONTEXT(ctx
);
6548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6549 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6553 if (ctx
->ExecuteFlag
) {
6554 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6558 /** GL_EXT_texture_integer */
6559 static void GLAPIENTRY
6560 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6562 GET_CURRENT_CONTEXT(ctx
);
6564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6565 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6572 if (ctx
->ExecuteFlag
) {
6573 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6577 /** GL_EXT_texture_integer */
6578 static void GLAPIENTRY
6579 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6581 GET_CURRENT_CONTEXT(ctx
);
6583 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6584 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6591 if (ctx
->ExecuteFlag
) {
6592 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6596 /** GL_EXT_texture_integer */
6597 static void GLAPIENTRY
6598 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6600 GET_CURRENT_CONTEXT(ctx
);
6602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6603 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6612 if (ctx
->ExecuteFlag
) {
6613 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6617 /** GL_EXT_texture_integer */
6618 static void GLAPIENTRY
6619 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6621 GET_CURRENT_CONTEXT(ctx
);
6623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6624 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6628 n
[3].ui
= params
[0];
6629 n
[4].ui
= params
[1];
6630 n
[5].ui
= params
[2];
6631 n
[6].ui
= params
[3];
6633 if (ctx
->ExecuteFlag
) {
6634 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6638 /* GL_ARB_instanced_arrays */
6639 static void GLAPIENTRY
6640 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6642 GET_CURRENT_CONTEXT(ctx
);
6644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6645 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6650 if (ctx
->ExecuteFlag
) {
6651 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6656 /* GL_NV_texture_barrier */
6657 static void GLAPIENTRY
6658 save_TextureBarrierNV(void)
6660 GET_CURRENT_CONTEXT(ctx
);
6661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6662 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6663 if (ctx
->ExecuteFlag
) {
6664 CALL_TextureBarrierNV(ctx
->Exec
, ());
6669 /* GL_ARB_sampler_objects */
6670 static void GLAPIENTRY
6671 save_BindSampler(GLuint unit
, GLuint sampler
)
6674 GET_CURRENT_CONTEXT(ctx
);
6675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6676 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6681 if (ctx
->ExecuteFlag
) {
6682 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6686 static void GLAPIENTRY
6687 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6690 GET_CURRENT_CONTEXT(ctx
);
6691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6692 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6697 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6703 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6706 if (ctx
->ExecuteFlag
) {
6707 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6711 static void GLAPIENTRY
6712 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6716 parray
[1] = parray
[2] = parray
[3] = 0;
6717 save_SamplerParameteriv(sampler
, pname
, parray
);
6720 static void GLAPIENTRY
6721 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6724 GET_CURRENT_CONTEXT(ctx
);
6725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6726 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6731 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6737 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6740 if (ctx
->ExecuteFlag
) {
6741 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6745 static void GLAPIENTRY
6746 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6750 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6751 save_SamplerParameterfv(sampler
, pname
, parray
);
6754 static void GLAPIENTRY
6755 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6758 GET_CURRENT_CONTEXT(ctx
);
6759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6760 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6765 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6771 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6774 if (ctx
->ExecuteFlag
) {
6775 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6779 static void GLAPIENTRY
6780 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6783 GET_CURRENT_CONTEXT(ctx
);
6784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6785 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6789 n
[3].ui
= params
[0];
6790 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6791 n
[4].ui
= params
[1];
6792 n
[5].ui
= params
[2];
6793 n
[6].ui
= params
[3];
6796 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6799 if (ctx
->ExecuteFlag
) {
6800 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6804 /* GL_ARB_geometry_shader4 */
6805 static void GLAPIENTRY
6806 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6809 GET_CURRENT_CONTEXT(ctx
);
6810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6811 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6817 if (ctx
->ExecuteFlag
) {
6818 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6822 static void GLAPIENTRY
6823 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6824 GLuint texture
, GLint level
)
6827 GET_CURRENT_CONTEXT(ctx
);
6828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6829 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6832 n
[2].e
= attachment
;
6836 if (ctx
->ExecuteFlag
) {
6837 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6841 static void GLAPIENTRY
6842 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6843 GLuint texture
, GLint level
, GLenum face
)
6846 GET_CURRENT_CONTEXT(ctx
);
6847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6848 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6851 n
[2].e
= attachment
;
6856 if (ctx
->ExecuteFlag
) {
6857 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6864 static void GLAPIENTRY
6865 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6868 GET_CURRENT_CONTEXT(ctx
);
6869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6870 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6872 union uint64_pair p
;
6875 n
[2].ui
= p
.uint32
[0];
6876 n
[3].ui
= p
.uint32
[1];
6877 save_pointer(&n
[4], sync
);
6879 if (ctx
->ExecuteFlag
) {
6880 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6885 /** GL_NV_conditional_render */
6886 static void GLAPIENTRY
6887 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6889 GET_CURRENT_CONTEXT(ctx
);
6891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6892 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6897 if (ctx
->ExecuteFlag
) {
6898 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6902 static void GLAPIENTRY
6903 save_EndConditionalRender(void)
6905 GET_CURRENT_CONTEXT(ctx
);
6906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6907 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6908 if (ctx
->ExecuteFlag
) {
6909 CALL_EndConditionalRender(ctx
->Exec
, ());
6913 static void GLAPIENTRY
6914 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6916 GET_CURRENT_CONTEXT(ctx
);
6918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6919 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6925 if (ctx
->ExecuteFlag
) {
6926 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6932 * Save an error-generating command into display list.
6934 * KW: Will appear in the list before the vertex buffer containing the
6935 * command that provoked the error. I don't see this as a problem.
6938 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6941 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
6944 save_pointer(&n
[2], (void *) s
);
6945 /* note: the data/string here doesn't have to be freed in
6946 * _mesa_delete_list() since the string is never dynamically
6954 * Compile an error into current display list.
6957 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6959 if (ctx
->CompileFlag
)
6960 save_error(ctx
, error
, s
);
6961 if (ctx
->ExecuteFlag
)
6962 _mesa_error(ctx
, error
, "%s", s
);
6967 * Test if ID names a display list.
6970 islist(struct gl_context
*ctx
, GLuint list
)
6972 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6982 /**********************************************************************/
6983 /* Display list execution */
6984 /**********************************************************************/
6988 * Execute a display list. Note that the ListBase offset must have already
6989 * been added before calling this function. I.e. the list argument is
6990 * the absolute list number, not relative to ListBase.
6991 * \param list - display list number
6994 execute_list(struct gl_context
*ctx
, GLuint list
)
6996 struct gl_display_list
*dlist
;
7000 if (list
== 0 || !islist(ctx
, list
))
7003 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7004 /* raise an error? */
7008 dlist
= _mesa_lookup_list(ctx
, list
);
7012 ctx
->ListState
.CallDepth
++;
7014 if (ctx
->Driver
.BeginCallList
)
7015 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7021 const OpCode opcode
= n
[0].opcode
;
7023 if (is_ext_opcode(opcode
)) {
7024 n
+= ext_opcode_execute(ctx
, n
);
7029 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7032 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7034 case OPCODE_ALPHA_FUNC
:
7035 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7037 case OPCODE_BIND_TEXTURE
:
7038 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7042 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7043 ctx
->Unpack
= ctx
->DefaultPacking
;
7044 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7045 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7046 get_pointer(&n
[7])));
7047 ctx
->Unpack
= save
; /* restore */
7050 case OPCODE_BLEND_COLOR
:
7051 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7053 case OPCODE_BLEND_EQUATION
:
7054 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7056 case OPCODE_BLEND_EQUATION_SEPARATE
:
7057 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7059 case OPCODE_BLEND_FUNC_SEPARATE
:
7060 CALL_BlendFuncSeparate(ctx
->Exec
,
7061 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7064 case OPCODE_BLEND_FUNC_I
:
7065 /* GL_ARB_draw_buffers_blend */
7066 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7068 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7069 /* GL_ARB_draw_buffers_blend */
7070 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7073 case OPCODE_BLEND_EQUATION_I
:
7074 /* GL_ARB_draw_buffers_blend */
7075 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7077 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7078 /* GL_ARB_draw_buffers_blend */
7079 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7080 (n
[1].ui
, n
[2].e
, n
[3].e
));
7083 case OPCODE_CALL_LIST
:
7084 /* Generated by glCallList(), don't add ListBase */
7085 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7086 execute_list(ctx
, n
[1].ui
);
7089 case OPCODE_CALL_LIST_OFFSET
:
7090 /* Generated by glCallLists() so we must add ListBase */
7092 /* user specified a bad data type at compile time */
7093 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7095 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7096 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7097 execute_list(ctx
, list
);
7101 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7103 case OPCODE_CLEAR_BUFFER_IV
:
7110 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7113 case OPCODE_CLEAR_BUFFER_UIV
:
7120 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7123 case OPCODE_CLEAR_BUFFER_FV
:
7130 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7133 case OPCODE_CLEAR_BUFFER_FI
:
7134 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7136 case OPCODE_CLEAR_COLOR
:
7137 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7139 case OPCODE_CLEAR_ACCUM
:
7140 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7142 case OPCODE_CLEAR_DEPTH
:
7143 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7145 case OPCODE_CLEAR_INDEX
:
7146 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7148 case OPCODE_CLEAR_STENCIL
:
7149 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7151 case OPCODE_CLIP_PLANE
:
7158 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7161 case OPCODE_COLOR_MASK
:
7162 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7164 case OPCODE_COLOR_MASK_INDEXED
:
7165 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7168 case OPCODE_COLOR_MATERIAL
:
7169 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7171 case OPCODE_COPY_PIXELS
:
7172 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7173 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7176 case OPCODE_COPY_TEX_IMAGE1D
:
7177 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7178 n
[5].i
, n
[6].i
, n
[7].i
));
7180 case OPCODE_COPY_TEX_IMAGE2D
:
7181 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7182 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7184 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7185 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7186 n
[4].i
, n
[5].i
, n
[6].i
));
7188 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7189 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7190 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7193 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7194 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7195 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7198 case OPCODE_CULL_FACE
:
7199 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7201 case OPCODE_DEPTH_FUNC
:
7202 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7204 case OPCODE_DEPTH_MASK
:
7205 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7207 case OPCODE_DEPTH_RANGE
:
7208 CALL_DepthRange(ctx
->Exec
,
7209 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7211 case OPCODE_DISABLE
:
7212 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7214 case OPCODE_DISABLE_INDEXED
:
7215 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7217 case OPCODE_DRAW_BUFFER
:
7218 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7220 case OPCODE_DRAW_PIXELS
:
7222 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7223 ctx
->Unpack
= ctx
->DefaultPacking
;
7224 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7225 get_pointer(&n
[5])));
7226 ctx
->Unpack
= save
; /* restore */
7230 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7232 case OPCODE_ENABLE_INDEXED
:
7233 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7235 case OPCODE_EVALMESH1
:
7236 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7238 case OPCODE_EVALMESH2
:
7239 CALL_EvalMesh2(ctx
->Exec
,
7240 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7249 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7252 case OPCODE_FRONT_FACE
:
7253 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7255 case OPCODE_FRUSTUM
:
7256 CALL_Frustum(ctx
->Exec
,
7257 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7260 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7262 case OPCODE_INDEX_MASK
:
7263 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7265 case OPCODE_INIT_NAMES
:
7266 CALL_InitNames(ctx
->Exec
, ());
7275 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7278 case OPCODE_LIGHT_MODEL
:
7285 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7288 case OPCODE_LINE_STIPPLE
:
7289 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7291 case OPCODE_LINE_WIDTH
:
7292 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7294 case OPCODE_LIST_BASE
:
7295 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7297 case OPCODE_LOAD_IDENTITY
:
7298 CALL_LoadIdentity(ctx
->Exec
, ());
7300 case OPCODE_LOAD_MATRIX
:
7301 if (sizeof(Node
) == sizeof(GLfloat
)) {
7302 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7307 for (i
= 0; i
< 16; i
++) {
7310 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7313 case OPCODE_LOAD_NAME
:
7314 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7316 case OPCODE_LOGIC_OP
:
7317 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7321 GLenum target
= n
[1].e
;
7322 GLint ustride
= _mesa_evaluator_components(target
);
7323 GLint uorder
= n
[5].i
;
7324 GLfloat u1
= n
[2].f
;
7325 GLfloat u2
= n
[3].f
;
7326 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7327 (GLfloat
*) get_pointer(&n
[6])));
7332 GLenum target
= n
[1].e
;
7333 GLfloat u1
= n
[2].f
;
7334 GLfloat u2
= n
[3].f
;
7335 GLfloat v1
= n
[4].f
;
7336 GLfloat v2
= n
[5].f
;
7337 GLint ustride
= n
[6].i
;
7338 GLint vstride
= n
[7].i
;
7339 GLint uorder
= n
[8].i
;
7340 GLint vorder
= n
[9].i
;
7341 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7342 v1
, v2
, vstride
, vorder
,
7343 (GLfloat
*) get_pointer(&n
[10])));
7346 case OPCODE_MAPGRID1
:
7347 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7349 case OPCODE_MAPGRID2
:
7350 CALL_MapGrid2f(ctx
->Exec
,
7351 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7353 case OPCODE_MATRIX_MODE
:
7354 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7356 case OPCODE_MULT_MATRIX
:
7357 if (sizeof(Node
) == sizeof(GLfloat
)) {
7358 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7363 for (i
= 0; i
< 16; i
++) {
7366 CALL_MultMatrixf(ctx
->Exec
, (m
));
7370 CALL_Ortho(ctx
->Exec
,
7371 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7373 case OPCODE_PASSTHROUGH
:
7374 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7376 case OPCODE_PIXEL_MAP
:
7377 CALL_PixelMapfv(ctx
->Exec
,
7378 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
7380 case OPCODE_PIXEL_TRANSFER
:
7381 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7383 case OPCODE_PIXEL_ZOOM
:
7384 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7386 case OPCODE_POINT_SIZE
:
7387 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7389 case OPCODE_POINT_PARAMETERS
:
7395 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7398 case OPCODE_POLYGON_MODE
:
7399 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7401 case OPCODE_POLYGON_STIPPLE
:
7403 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7404 ctx
->Unpack
= ctx
->DefaultPacking
;
7405 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
7406 ctx
->Unpack
= save
; /* restore */
7409 case OPCODE_POLYGON_OFFSET
:
7410 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7412 case OPCODE_POP_ATTRIB
:
7413 CALL_PopAttrib(ctx
->Exec
, ());
7415 case OPCODE_POP_MATRIX
:
7416 CALL_PopMatrix(ctx
->Exec
, ());
7418 case OPCODE_POP_NAME
:
7419 CALL_PopName(ctx
->Exec
, ());
7421 case OPCODE_PRIORITIZE_TEXTURE
:
7422 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7424 case OPCODE_PUSH_ATTRIB
:
7425 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7427 case OPCODE_PUSH_MATRIX
:
7428 CALL_PushMatrix(ctx
->Exec
, ());
7430 case OPCODE_PUSH_NAME
:
7431 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7433 case OPCODE_RASTER_POS
:
7434 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7436 case OPCODE_READ_BUFFER
:
7437 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7440 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7443 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7445 case OPCODE_SCISSOR
:
7446 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7448 case OPCODE_SHADE_MODEL
:
7449 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7451 case OPCODE_PROVOKING_VERTEX
:
7452 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7454 case OPCODE_STENCIL_FUNC
:
7455 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7457 case OPCODE_STENCIL_MASK
:
7458 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7460 case OPCODE_STENCIL_OP
:
7461 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7463 case OPCODE_STENCIL_FUNC_SEPARATE
:
7464 CALL_StencilFuncSeparate(ctx
->Exec
,
7465 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7467 case OPCODE_STENCIL_MASK_SEPARATE
:
7468 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7470 case OPCODE_STENCIL_OP_SEPARATE
:
7471 CALL_StencilOpSeparate(ctx
->Exec
,
7472 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7481 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7491 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7494 case OPCODE_TEXPARAMETER
:
7501 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7504 case OPCODE_TEX_IMAGE1D
:
7506 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7507 ctx
->Unpack
= ctx
->DefaultPacking
;
7508 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7510 n
[3].i
, /* components */
7512 n
[5].e
, /* border */
7513 n
[6].e
, /* format */
7515 get_pointer(&n
[8])));
7516 ctx
->Unpack
= save
; /* restore */
7519 case OPCODE_TEX_IMAGE2D
:
7521 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7522 ctx
->Unpack
= ctx
->DefaultPacking
;
7523 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7525 n
[3].i
, /* components */
7527 n
[5].i
, /* height */
7528 n
[6].e
, /* border */
7529 n
[7].e
, /* format */
7531 get_pointer(&n
[9])));
7532 ctx
->Unpack
= save
; /* restore */
7535 case OPCODE_TEX_IMAGE3D
:
7537 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7538 ctx
->Unpack
= ctx
->DefaultPacking
;
7539 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7541 n
[3].i
, /* components */
7543 n
[5].i
, /* height */
7545 n
[7].e
, /* border */
7546 n
[8].e
, /* format */
7548 get_pointer(&n
[10])));
7549 ctx
->Unpack
= save
; /* restore */
7552 case OPCODE_TEX_SUB_IMAGE1D
:
7554 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7555 ctx
->Unpack
= ctx
->DefaultPacking
;
7556 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7558 n
[6].e
, get_pointer(&n
[7])));
7559 ctx
->Unpack
= save
; /* restore */
7562 case OPCODE_TEX_SUB_IMAGE2D
:
7564 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7565 ctx
->Unpack
= ctx
->DefaultPacking
;
7566 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7568 n
[6].i
, n
[7].e
, n
[8].e
,
7569 get_pointer(&n
[9])));
7570 ctx
->Unpack
= save
; /* restore */
7573 case OPCODE_TEX_SUB_IMAGE3D
:
7575 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7576 ctx
->Unpack
= ctx
->DefaultPacking
;
7577 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7578 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7579 n
[8].i
, n
[9].e
, n
[10].e
,
7580 get_pointer(&n
[11])));
7581 ctx
->Unpack
= save
; /* restore */
7584 case OPCODE_TRANSLATE
:
7585 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7587 case OPCODE_VIEWPORT
:
7588 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7589 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7591 case OPCODE_WINDOW_POS
:
7592 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7594 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7595 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7597 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7598 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7599 n
[4].i
, n
[5].i
, n
[6].i
,
7600 get_pointer(&n
[7])));
7602 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7603 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7604 n
[4].i
, n
[5].i
, n
[6].i
,
7605 n
[7].i
, get_pointer(&n
[8])));
7607 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7608 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7609 n
[4].i
, n
[5].i
, n
[6].i
,
7611 get_pointer(&n
[9])));
7613 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7614 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7615 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7617 get_pointer(&n
[7])));
7619 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7620 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7621 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7622 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7623 get_pointer(&n
[9])));
7625 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7626 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7627 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7628 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7630 get_pointer(&n
[11])));
7632 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7633 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7635 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7636 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7638 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7639 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7641 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7642 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7643 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7646 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7647 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7649 case OPCODE_DEPTH_BOUNDS_EXT
:
7650 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7652 case OPCODE_PROGRAM_STRING_ARB
:
7653 CALL_ProgramStringARB(ctx
->Exec
,
7654 (n
[1].e
, n
[2].e
, n
[3].i
,
7655 get_pointer(&n
[4])));
7657 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7658 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7662 case OPCODE_BEGIN_QUERY_ARB
:
7663 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7665 case OPCODE_END_QUERY_ARB
:
7666 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7668 case OPCODE_QUERY_COUNTER
:
7669 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7671 case OPCODE_BEGIN_QUERY_INDEXED
:
7672 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7674 case OPCODE_END_QUERY_INDEXED
:
7675 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7677 case OPCODE_DRAW_BUFFERS_ARB
:
7679 GLenum buffers
[MAX_DRAW_BUFFERS
];
7680 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7681 for (i
= 0; i
< count
; i
++)
7682 buffers
[i
] = n
[2 + i
].e
;
7683 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7686 case OPCODE_BLIT_FRAMEBUFFER
:
7687 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7688 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7691 case OPCODE_USE_PROGRAM
:
7692 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7694 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7695 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7697 case OPCODE_ACTIVE_PROGRAM_EXT
:
7698 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7700 case OPCODE_UNIFORM_1F
:
7701 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7703 case OPCODE_UNIFORM_2F
:
7704 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7706 case OPCODE_UNIFORM_3F
:
7707 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7709 case OPCODE_UNIFORM_4F
:
7710 CALL_Uniform4f(ctx
->Exec
,
7711 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7713 case OPCODE_UNIFORM_1FV
:
7714 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7716 case OPCODE_UNIFORM_2FV
:
7717 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7719 case OPCODE_UNIFORM_3FV
:
7720 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7722 case OPCODE_UNIFORM_4FV
:
7723 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7725 case OPCODE_UNIFORM_1I
:
7726 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7728 case OPCODE_UNIFORM_2I
:
7729 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7731 case OPCODE_UNIFORM_3I
:
7732 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7734 case OPCODE_UNIFORM_4I
:
7735 CALL_Uniform4i(ctx
->Exec
,
7736 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7738 case OPCODE_UNIFORM_1IV
:
7739 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7741 case OPCODE_UNIFORM_2IV
:
7742 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7744 case OPCODE_UNIFORM_3IV
:
7745 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7747 case OPCODE_UNIFORM_4IV
:
7748 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7750 case OPCODE_UNIFORM_1UI
:
7751 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7753 case OPCODE_UNIFORM_2UI
:
7754 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7756 case OPCODE_UNIFORM_3UI
:
7757 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7759 case OPCODE_UNIFORM_4UI
:
7760 /*CALL_Uniform4uiARB(ctx->Exec,
7761 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7764 case OPCODE_UNIFORM_1UIV
:
7765 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
7766 get_pointer(&n[3])));*/
7768 case OPCODE_UNIFORM_2UIV
:
7769 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
7770 get_pointer(&n[3])));*/
7772 case OPCODE_UNIFORM_3UIV
:
7773 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
7774 get_pointer(&n[3])));*/
7776 case OPCODE_UNIFORM_4UIV
:
7777 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
7778 get_pointer(&n[3])));*/
7780 case OPCODE_UNIFORM_MATRIX22
:
7781 CALL_UniformMatrix2fv(ctx
->Exec
,
7782 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7784 case OPCODE_UNIFORM_MATRIX33
:
7785 CALL_UniformMatrix3fv(ctx
->Exec
,
7786 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7788 case OPCODE_UNIFORM_MATRIX44
:
7789 CALL_UniformMatrix4fv(ctx
->Exec
,
7790 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7792 case OPCODE_UNIFORM_MATRIX23
:
7793 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7794 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7796 case OPCODE_UNIFORM_MATRIX32
:
7797 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7798 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7800 case OPCODE_UNIFORM_MATRIX24
:
7801 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7802 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7804 case OPCODE_UNIFORM_MATRIX42
:
7805 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7806 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7808 case OPCODE_UNIFORM_MATRIX34
:
7809 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7810 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7812 case OPCODE_UNIFORM_MATRIX43
:
7813 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7814 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7817 case OPCODE_CLAMP_COLOR
:
7818 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7821 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7824 GLuint i
, pname
= n
[1].ui
;
7826 for (i
= 0; i
< 4; i
++)
7827 values
[i
] = n
[1 + i
].f
;
7828 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7831 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7832 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7834 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7837 GLuint i
, dst
= n
[1].ui
;
7839 for (i
= 0; i
< 4; i
++)
7840 values
[i
] = n
[1 + i
].f
;
7841 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7844 case OPCODE_ATTR_1F_NV
:
7845 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7847 case OPCODE_ATTR_2F_NV
:
7848 /* Really shouldn't have to do this - the Node structure
7849 * is convenient, but it would be better to store the data
7850 * packed appropriately so that it can be sent directly
7851 * on. With x86_64 becoming common, this will start to
7854 if (sizeof(Node
) == sizeof(GLfloat
))
7855 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7857 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7859 case OPCODE_ATTR_3F_NV
:
7860 if (sizeof(Node
) == sizeof(GLfloat
))
7861 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7863 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7866 case OPCODE_ATTR_4F_NV
:
7867 if (sizeof(Node
) == sizeof(GLfloat
))
7868 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7870 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7873 case OPCODE_ATTR_1F_ARB
:
7874 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7876 case OPCODE_ATTR_2F_ARB
:
7877 /* Really shouldn't have to do this - the Node structure
7878 * is convenient, but it would be better to store the data
7879 * packed appropriately so that it can be sent directly
7880 * on. With x86_64 becoming common, this will start to
7883 if (sizeof(Node
) == sizeof(GLfloat
))
7884 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7886 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7888 case OPCODE_ATTR_3F_ARB
:
7889 if (sizeof(Node
) == sizeof(GLfloat
))
7890 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7892 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7895 case OPCODE_ATTR_4F_ARB
:
7896 if (sizeof(Node
) == sizeof(GLfloat
))
7897 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7899 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7902 case OPCODE_MATERIAL
:
7903 if (sizeof(Node
) == sizeof(GLfloat
))
7904 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7911 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7915 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7918 CALL_End(ctx
->Exec
, ());
7921 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7923 case OPCODE_EVAL_C1
:
7924 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7926 case OPCODE_EVAL_C2
:
7927 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7929 case OPCODE_EVAL_P1
:
7930 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7932 case OPCODE_EVAL_P2
:
7933 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7936 /* GL_EXT_texture_integer */
7937 case OPCODE_CLEARCOLOR_I
:
7938 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7940 case OPCODE_CLEARCOLOR_UI
:
7941 CALL_ClearColorIuiEXT(ctx
->Exec
,
7942 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7944 case OPCODE_TEXPARAMETER_I
:
7951 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7954 case OPCODE_TEXPARAMETER_UI
:
7957 params
[0] = n
[3].ui
;
7958 params
[1] = n
[4].ui
;
7959 params
[2] = n
[5].ui
;
7960 params
[3] = n
[6].ui
;
7961 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7965 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7966 /* GL_ARB_instanced_arrays */
7967 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7970 case OPCODE_TEXTURE_BARRIER_NV
:
7971 CALL_TextureBarrierNV(ctx
->Exec
, ());
7974 /* GL_EXT/ARB_transform_feedback */
7975 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7976 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7978 case OPCODE_END_TRANSFORM_FEEDBACK
:
7979 CALL_EndTransformFeedback(ctx
->Exec
, ());
7981 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7982 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7984 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7985 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7987 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7988 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7990 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7991 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7993 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7994 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7995 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7997 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7998 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
7999 (n
[1].e
, n
[2].ui
, n
[3].si
));
8001 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8002 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8003 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8007 case OPCODE_BIND_SAMPLER
:
8008 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8010 case OPCODE_SAMPLER_PARAMETERIV
:
8017 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8020 case OPCODE_SAMPLER_PARAMETERFV
:
8027 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8030 case OPCODE_SAMPLER_PARAMETERIIV
:
8037 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8040 case OPCODE_SAMPLER_PARAMETERUIV
:
8043 params
[0] = n
[3].ui
;
8044 params
[1] = n
[4].ui
;
8045 params
[2] = n
[5].ui
;
8046 params
[3] = n
[6].ui
;
8047 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8051 /* GL_ARB_geometry_shader4 */
8052 case OPCODE_PROGRAM_PARAMETERI
:
8053 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8055 case OPCODE_FRAMEBUFFER_TEXTURE
:
8056 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8059 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8060 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8061 n
[3].ui
, n
[4].i
, n
[5].e
));
8065 case OPCODE_WAIT_SYNC
:
8067 union uint64_pair p
;
8068 p
.uint32
[0] = n
[2].ui
;
8069 p
.uint32
[1] = n
[3].ui
;
8070 CALL_WaitSync(ctx
->Exec
,
8071 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8075 /* GL_NV_conditional_render */
8076 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8077 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8079 case OPCODE_END_CONDITIONAL_RENDER
:
8080 CALL_EndConditionalRender(ctx
->Exec
, ());
8083 case OPCODE_UNIFORM_BLOCK_BINDING
:
8084 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8087 case OPCODE_CONTINUE
:
8088 n
= (Node
*) get_pointer(&n
[1]);
8090 case OPCODE_END_OF_LIST
:
8096 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8098 _mesa_problem(ctx
, "%s", msg
);
8103 /* increment n to point to next compiled command */
8104 if (opcode
!= OPCODE_CONTINUE
) {
8105 n
+= InstSize
[opcode
];
8110 if (ctx
->Driver
.EndCallList
)
8111 ctx
->Driver
.EndCallList(ctx
);
8113 ctx
->ListState
.CallDepth
--;
8118 /**********************************************************************/
8120 /**********************************************************************/
8123 * Test if a display list number is valid.
8125 GLboolean GLAPIENTRY
8126 _mesa_IsList(GLuint list
)
8128 GET_CURRENT_CONTEXT(ctx
);
8129 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8130 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8131 return islist(ctx
, list
);
8136 * Delete a sequence of consecutive display lists.
8139 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8141 GET_CURRENT_CONTEXT(ctx
);
8143 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8144 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8147 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8150 for (i
= list
; i
< list
+ range
; i
++) {
8151 destroy_list(ctx
, i
);
8157 * Return a display list number, n, such that lists n through n+range-1
8161 _mesa_GenLists(GLsizei range
)
8163 GET_CURRENT_CONTEXT(ctx
);
8165 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8166 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8169 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8177 * Make this an atomic operation
8179 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8181 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8183 /* reserve the list IDs by with empty/dummy lists */
8185 for (i
= 0; i
< range
; i
++) {
8186 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8187 make_list(base
+ i
, 1));
8191 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8198 * Begin a new display list.
8201 _mesa_NewList(GLuint name
, GLenum mode
)
8203 GET_CURRENT_CONTEXT(ctx
);
8205 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8206 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8208 if (MESA_VERBOSE
& VERBOSE_API
)
8209 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8210 _mesa_lookup_enum_by_nr(mode
));
8213 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8217 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8218 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8222 if (ctx
->ListState
.CurrentList
) {
8223 /* already compiling a display list */
8224 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8228 ctx
->CompileFlag
= GL_TRUE
;
8229 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8231 /* Reset accumulated list state */
8232 invalidate_saved_current_state( ctx
);
8234 /* Allocate new display list */
8235 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8236 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8237 ctx
->ListState
.CurrentPos
= 0;
8239 ctx
->Driver
.NewList(ctx
, name
, mode
);
8241 ctx
->CurrentDispatch
= ctx
->Save
;
8242 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8247 * End definition of current display list.
8252 GET_CURRENT_CONTEXT(ctx
);
8253 SAVE_FLUSH_VERTICES(ctx
);
8254 FLUSH_VERTICES(ctx
, 0);
8256 if (MESA_VERBOSE
& VERBOSE_API
)
8257 _mesa_debug(ctx
, "glEndList\n");
8259 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8260 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8261 "glEndList() called inside glBegin/End");
8264 /* Check that a list is under construction */
8265 if (!ctx
->ListState
.CurrentList
) {
8266 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8270 /* Call before emitting END_OF_LIST, in case the driver wants to
8271 * emit opcodes itself.
8273 ctx
->Driver
.EndList(ctx
);
8275 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8279 /* Destroy old list, if any */
8280 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8282 /* Install the new list */
8283 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8284 ctx
->ListState
.CurrentList
->Name
,
8285 ctx
->ListState
.CurrentList
);
8288 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8289 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8291 ctx
->ListState
.CurrentList
= NULL
;
8292 ctx
->ListState
.CurrentBlock
= NULL
;
8293 ctx
->ListState
.CurrentPos
= 0;
8294 ctx
->ExecuteFlag
= GL_TRUE
;
8295 ctx
->CompileFlag
= GL_FALSE
;
8297 ctx
->CurrentDispatch
= ctx
->Exec
;
8298 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8303 _mesa_CallList(GLuint list
)
8305 GLboolean save_compile_flag
;
8306 GET_CURRENT_CONTEXT(ctx
);
8307 FLUSH_CURRENT(ctx
, 0);
8309 if (MESA_VERBOSE
& VERBOSE_API
)
8310 _mesa_debug(ctx
, "glCallList %d\n", list
);
8313 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8318 mesa_print_display_list( list
);
8320 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8321 * execute the display list, and restore the CompileFlag.
8323 save_compile_flag
= ctx
->CompileFlag
;
8324 if (save_compile_flag
) {
8325 ctx
->CompileFlag
= GL_FALSE
;
8328 execute_list(ctx
, list
);
8329 ctx
->CompileFlag
= save_compile_flag
;
8331 /* also restore API function pointers to point to "save" versions */
8332 if (save_compile_flag
) {
8333 ctx
->CurrentDispatch
= ctx
->Save
;
8334 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8340 * Execute glCallLists: call multiple display lists.
8343 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8345 GET_CURRENT_CONTEXT(ctx
);
8347 GLboolean save_compile_flag
;
8349 if (MESA_VERBOSE
& VERBOSE_API
)
8350 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8354 case GL_UNSIGNED_BYTE
:
8356 case GL_UNSIGNED_SHORT
:
8358 case GL_UNSIGNED_INT
:
8366 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8370 /* Save the CompileFlag status, turn it off, execute display list,
8371 * and restore the CompileFlag.
8373 save_compile_flag
= ctx
->CompileFlag
;
8374 ctx
->CompileFlag
= GL_FALSE
;
8376 for (i
= 0; i
< n
; i
++) {
8377 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8378 execute_list(ctx
, list
);
8381 ctx
->CompileFlag
= save_compile_flag
;
8383 /* also restore API function pointers to point to "save" versions */
8384 if (save_compile_flag
) {
8385 ctx
->CurrentDispatch
= ctx
->Save
;
8386 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8392 * Set the offset added to list numbers in glCallLists.
8395 _mesa_ListBase(GLuint base
)
8397 GET_CURRENT_CONTEXT(ctx
);
8398 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8399 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8400 ctx
->List
.ListBase
= base
;
8404 * Setup the given dispatch table to point to Mesa's display list
8405 * building functions.
8407 * This does not include any of the tnl functions - they are
8408 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8412 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8414 struct _glapi_table
*table
= ctx
->Save
;
8415 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8417 /* Initially populate the dispatch table with the contents of the
8418 * normal-execution dispatch table. This lets us skip populating functions
8419 * that should be called directly instead of compiled into display lists.
8421 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8423 _mesa_loopback_init_api_table(ctx
, table
);
8426 vbo_initialize_save_dispatch(ctx
, table
);
8429 SET_Accum(table
, save_Accum
);
8430 SET_AlphaFunc(table
, save_AlphaFunc
);
8431 SET_Bitmap(table
, save_Bitmap
);
8432 SET_BlendFunc(table
, save_BlendFunc
);
8433 SET_CallList(table
, save_CallList
);
8434 SET_CallLists(table
, save_CallLists
);
8435 SET_Clear(table
, save_Clear
);
8436 SET_ClearAccum(table
, save_ClearAccum
);
8437 SET_ClearColor(table
, save_ClearColor
);
8438 SET_ClearDepth(table
, save_ClearDepth
);
8439 SET_ClearIndex(table
, save_ClearIndex
);
8440 SET_ClearStencil(table
, save_ClearStencil
);
8441 SET_ClipPlane(table
, save_ClipPlane
);
8442 SET_ColorMask(table
, save_ColorMask
);
8443 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8444 SET_ColorMaterial(table
, save_ColorMaterial
);
8445 SET_CopyPixels(table
, save_CopyPixels
);
8446 SET_CullFace(table
, save_CullFace
);
8447 SET_DepthFunc(table
, save_DepthFunc
);
8448 SET_DepthMask(table
, save_DepthMask
);
8449 SET_DepthRange(table
, save_DepthRange
);
8450 SET_Disable(table
, save_Disable
);
8451 SET_Disablei(table
, save_DisableIndexed
);
8452 SET_DrawBuffer(table
, save_DrawBuffer
);
8453 SET_DrawPixels(table
, save_DrawPixels
);
8454 SET_Enable(table
, save_Enable
);
8455 SET_Enablei(table
, save_EnableIndexed
);
8456 SET_EvalMesh1(table
, save_EvalMesh1
);
8457 SET_EvalMesh2(table
, save_EvalMesh2
);
8458 SET_Fogf(table
, save_Fogf
);
8459 SET_Fogfv(table
, save_Fogfv
);
8460 SET_Fogi(table
, save_Fogi
);
8461 SET_Fogiv(table
, save_Fogiv
);
8462 SET_FrontFace(table
, save_FrontFace
);
8463 SET_Frustum(table
, save_Frustum
);
8464 SET_Hint(table
, save_Hint
);
8465 SET_IndexMask(table
, save_IndexMask
);
8466 SET_InitNames(table
, save_InitNames
);
8467 SET_LightModelf(table
, save_LightModelf
);
8468 SET_LightModelfv(table
, save_LightModelfv
);
8469 SET_LightModeli(table
, save_LightModeli
);
8470 SET_LightModeliv(table
, save_LightModeliv
);
8471 SET_Lightf(table
, save_Lightf
);
8472 SET_Lightfv(table
, save_Lightfv
);
8473 SET_Lighti(table
, save_Lighti
);
8474 SET_Lightiv(table
, save_Lightiv
);
8475 SET_LineStipple(table
, save_LineStipple
);
8476 SET_LineWidth(table
, save_LineWidth
);
8477 SET_ListBase(table
, save_ListBase
);
8478 SET_LoadIdentity(table
, save_LoadIdentity
);
8479 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8480 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8481 SET_LoadName(table
, save_LoadName
);
8482 SET_LogicOp(table
, save_LogicOp
);
8483 SET_Map1d(table
, save_Map1d
);
8484 SET_Map1f(table
, save_Map1f
);
8485 SET_Map2d(table
, save_Map2d
);
8486 SET_Map2f(table
, save_Map2f
);
8487 SET_MapGrid1d(table
, save_MapGrid1d
);
8488 SET_MapGrid1f(table
, save_MapGrid1f
);
8489 SET_MapGrid2d(table
, save_MapGrid2d
);
8490 SET_MapGrid2f(table
, save_MapGrid2f
);
8491 SET_MatrixMode(table
, save_MatrixMode
);
8492 SET_MultMatrixd(table
, save_MultMatrixd
);
8493 SET_MultMatrixf(table
, save_MultMatrixf
);
8494 SET_NewList(table
, save_NewList
);
8495 SET_Ortho(table
, save_Ortho
);
8496 SET_PassThrough(table
, save_PassThrough
);
8497 SET_PixelMapfv(table
, save_PixelMapfv
);
8498 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8499 SET_PixelMapusv(table
, save_PixelMapusv
);
8500 SET_PixelTransferf(table
, save_PixelTransferf
);
8501 SET_PixelTransferi(table
, save_PixelTransferi
);
8502 SET_PixelZoom(table
, save_PixelZoom
);
8503 SET_PointSize(table
, save_PointSize
);
8504 SET_PolygonMode(table
, save_PolygonMode
);
8505 SET_PolygonOffset(table
, save_PolygonOffset
);
8506 SET_PolygonStipple(table
, save_PolygonStipple
);
8507 SET_PopAttrib(table
, save_PopAttrib
);
8508 SET_PopMatrix(table
, save_PopMatrix
);
8509 SET_PopName(table
, save_PopName
);
8510 SET_PushAttrib(table
, save_PushAttrib
);
8511 SET_PushMatrix(table
, save_PushMatrix
);
8512 SET_PushName(table
, save_PushName
);
8513 SET_RasterPos2d(table
, save_RasterPos2d
);
8514 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8515 SET_RasterPos2f(table
, save_RasterPos2f
);
8516 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8517 SET_RasterPos2i(table
, save_RasterPos2i
);
8518 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8519 SET_RasterPos2s(table
, save_RasterPos2s
);
8520 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8521 SET_RasterPos3d(table
, save_RasterPos3d
);
8522 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8523 SET_RasterPos3f(table
, save_RasterPos3f
);
8524 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8525 SET_RasterPos3i(table
, save_RasterPos3i
);
8526 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8527 SET_RasterPos3s(table
, save_RasterPos3s
);
8528 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8529 SET_RasterPos4d(table
, save_RasterPos4d
);
8530 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8531 SET_RasterPos4f(table
, save_RasterPos4f
);
8532 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8533 SET_RasterPos4i(table
, save_RasterPos4i
);
8534 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8535 SET_RasterPos4s(table
, save_RasterPos4s
);
8536 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8537 SET_ReadBuffer(table
, save_ReadBuffer
);
8538 SET_Rectf(table
, save_Rectf
);
8539 SET_Rotated(table
, save_Rotated
);
8540 SET_Rotatef(table
, save_Rotatef
);
8541 SET_Scaled(table
, save_Scaled
);
8542 SET_Scalef(table
, save_Scalef
);
8543 SET_Scissor(table
, save_Scissor
);
8544 SET_ShadeModel(table
, save_ShadeModel
);
8545 SET_StencilFunc(table
, save_StencilFunc
);
8546 SET_StencilMask(table
, save_StencilMask
);
8547 SET_StencilOp(table
, save_StencilOp
);
8548 SET_TexEnvf(table
, save_TexEnvf
);
8549 SET_TexEnvfv(table
, save_TexEnvfv
);
8550 SET_TexEnvi(table
, save_TexEnvi
);
8551 SET_TexEnviv(table
, save_TexEnviv
);
8552 SET_TexGend(table
, save_TexGend
);
8553 SET_TexGendv(table
, save_TexGendv
);
8554 SET_TexGenf(table
, save_TexGenf
);
8555 SET_TexGenfv(table
, save_TexGenfv
);
8556 SET_TexGeni(table
, save_TexGeni
);
8557 SET_TexGeniv(table
, save_TexGeniv
);
8558 SET_TexImage1D(table
, save_TexImage1D
);
8559 SET_TexImage2D(table
, save_TexImage2D
);
8560 SET_TexParameterf(table
, save_TexParameterf
);
8561 SET_TexParameterfv(table
, save_TexParameterfv
);
8562 SET_TexParameteri(table
, save_TexParameteri
);
8563 SET_TexParameteriv(table
, save_TexParameteriv
);
8564 SET_Translated(table
, save_Translated
);
8565 SET_Translatef(table
, save_Translatef
);
8566 SET_Viewport(table
, save_Viewport
);
8569 SET_BindTexture(table
, save_BindTexture
);
8570 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8571 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8572 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8573 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8574 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8575 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8576 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8579 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8580 SET_TexImage3D(table
, save_TexImage3D
);
8581 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8584 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8585 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8586 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8588 /* ATI_separate_stencil */
8589 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8591 /* GL_ARB_imaging */
8592 /* Not all are supported */
8593 SET_BlendColor(table
, save_BlendColor
);
8594 SET_BlendEquation(table
, save_BlendEquation
);
8596 /* 2. GL_EXT_blend_color */
8598 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8601 /* 3. GL_EXT_polygon_offset */
8602 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8604 /* 6. GL_EXT_texture3d */
8606 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8607 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8608 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8611 /* 37. GL_EXT_blend_minmax */
8613 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8616 /* 54. GL_EXT_point_parameters */
8617 SET_PointParameterf(table
, save_PointParameterfEXT
);
8618 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8620 /* 173. GL_EXT_blend_func_separate */
8621 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8623 /* 197. GL_MESA_window_pos */
8624 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8625 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8626 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8627 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8628 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8629 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8630 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8631 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8632 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8633 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8634 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8635 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8636 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8637 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8638 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8639 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8640 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8641 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8642 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8643 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8644 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8645 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8646 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8647 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8649 /* 233. GL_NV_vertex_program */
8650 /* The following commands DO NOT go into display lists:
8651 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8652 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8654 SET_BindProgramARB(table
, save_BindProgramNV
);
8656 /* 244. GL_ATI_envmap_bumpmap */
8657 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8658 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8660 /* 245. GL_ATI_fragment_shader */
8661 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8662 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8664 /* 262. GL_NV_point_sprite */
8665 SET_PointParameteri(table
, save_PointParameteriNV
);
8666 SET_PointParameteriv(table
, save_PointParameterivNV
);
8668 /* 268. GL_EXT_stencil_two_side */
8669 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8671 /* ???. GL_EXT_depth_bounds_test */
8672 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8674 /* ARB 1. GL_ARB_multitexture */
8675 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8677 /* ARB 3. GL_ARB_transpose_matrix */
8678 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8679 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8680 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8681 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8683 /* ARB 5. GL_ARB_multisample */
8684 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8686 /* ARB 12. GL_ARB_texture_compression */
8687 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8688 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8689 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8690 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8691 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8692 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8694 /* ARB 14. GL_ARB_point_parameters */
8695 /* aliased with EXT_point_parameters functions */
8697 /* ARB 25. GL_ARB_window_pos */
8698 /* aliased with MESA_window_pos functions */
8700 /* ARB 26. GL_ARB_vertex_program */
8701 /* ARB 27. GL_ARB_fragment_program */
8702 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8703 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8704 SET_BindProgramARB(table
, save_BindProgramNV
);
8705 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8706 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8707 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8708 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8709 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8710 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8711 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8712 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8714 SET_BeginQuery(table
, save_BeginQueryARB
);
8715 SET_EndQuery(table
, save_EndQueryARB
);
8716 SET_QueryCounter(table
, save_QueryCounter
);
8718 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8720 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8722 SET_UseProgram(table
, save_UseProgramObjectARB
);
8723 SET_Uniform1f(table
, save_Uniform1fARB
);
8724 SET_Uniform2f(table
, save_Uniform2fARB
);
8725 SET_Uniform3f(table
, save_Uniform3fARB
);
8726 SET_Uniform4f(table
, save_Uniform4fARB
);
8727 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8728 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8729 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8730 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8731 SET_Uniform1i(table
, save_Uniform1iARB
);
8732 SET_Uniform2i(table
, save_Uniform2iARB
);
8733 SET_Uniform3i(table
, save_Uniform3iARB
);
8734 SET_Uniform4i(table
, save_Uniform4iARB
);
8735 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8736 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8737 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8738 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8739 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8740 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8741 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8742 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8743 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8744 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8745 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8746 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8747 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8749 /* 299. GL_EXT_blend_equation_separate */
8750 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8752 /* GL_EXT_gpu_program_parameters */
8753 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8754 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8756 /* 364. GL_EXT_provoking_vertex */
8757 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8759 /* GL_EXT_texture_integer */
8760 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8761 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8762 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8763 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8765 /* 377. GL_EXT_separate_shader_objects */
8766 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8767 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8769 /* GL_ARB_color_buffer_float */
8770 SET_ClampColor(table
, save_ClampColorARB
);
8773 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8774 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8775 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8776 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8778 SET_Uniform1ui(table
, save_Uniform1ui
);
8779 SET_Uniform2ui(table
, save_Uniform2ui
);
8780 SET_Uniform3ui(table
, save_Uniform3ui
);
8781 SET_Uniform4ui(table
, save_Uniform4ui
);
8782 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8783 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8784 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8785 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8787 (void) save_Uniform1ui
;
8788 (void) save_Uniform2ui
;
8789 (void) save_Uniform3ui
;
8790 (void) save_Uniform4ui
;
8791 (void) save_Uniform1uiv
;
8792 (void) save_Uniform2uiv
;
8793 (void) save_Uniform3uiv
;
8794 (void) save_Uniform4uiv
;
8798 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8799 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8800 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8801 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8802 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8803 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8804 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8805 SET_DrawTransformFeedbackInstanced(table
,
8806 save_DrawTransformFeedbackInstanced
);
8807 SET_DrawTransformFeedbackStreamInstanced(table
,
8808 save_DrawTransformFeedbackStreamInstanced
);
8809 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8810 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8812 /* GL_ARB_instanced_arrays */
8813 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8815 /* GL_NV_texture_barrier */
8816 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8818 SET_BindSampler(table
, save_BindSampler
);
8819 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8820 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8821 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8822 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8823 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8824 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8826 /* GL_ARB_draw_buffer_blend */
8827 SET_BlendFunciARB(table
, save_BlendFunci
);
8828 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8829 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8830 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8832 /* GL_ARB_geometry_shader4 */
8833 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8834 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8835 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8837 /* GL_NV_conditional_render */
8838 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8839 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8842 SET_WaitSync(table
, save_WaitSync
);
8844 /* GL_ARB_uniform_buffer_object */
8845 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8847 /* GL_ARB_draw_instanced */
8848 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8849 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8851 /* GL_ARB_draw_elements_base_vertex */
8852 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8854 /* GL_ARB_base_instance */
8855 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8856 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8857 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8863 enum_string(GLenum k
)
8865 return _mesa_lookup_enum_by_nr(k
);
8870 * Print the commands in a display list. For debugging only.
8871 * TODO: many commands aren't handled yet.
8873 static void GLAPIENTRY
8874 print_list(struct gl_context
*ctx
, GLuint list
)
8876 struct gl_display_list
*dlist
;
8880 if (!islist(ctx
, list
)) {
8881 printf("%u is not a display list ID\n", list
);
8885 dlist
= _mesa_lookup_list(ctx
, list
);
8891 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8893 done
= n
? GL_FALSE
: GL_TRUE
;
8895 const OpCode opcode
= n
[0].opcode
;
8897 if (is_ext_opcode(opcode
)) {
8898 n
+= ext_opcode_print(ctx
, n
);
8903 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8906 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8907 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8908 get_pointer(&n
[7]));
8910 case OPCODE_CALL_LIST
:
8911 printf("CallList %d\n", (int) n
[1].ui
);
8913 case OPCODE_CALL_LIST_OFFSET
:
8914 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8915 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8917 case OPCODE_DISABLE
:
8918 printf("Disable %s\n", enum_string(n
[1].e
));
8921 printf("Enable %s\n", enum_string(n
[1].e
));
8923 case OPCODE_FRUSTUM
:
8924 printf("Frustum %g %g %g %g %g %g\n",
8925 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8927 case OPCODE_LINE_STIPPLE
:
8928 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8930 case OPCODE_LOAD_IDENTITY
:
8931 printf("LoadIdentity\n");
8933 case OPCODE_LOAD_MATRIX
:
8934 printf("LoadMatrix\n");
8935 printf(" %8f %8f %8f %8f\n",
8936 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8937 printf(" %8f %8f %8f %8f\n",
8938 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8939 printf(" %8f %8f %8f %8f\n",
8940 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8941 printf(" %8f %8f %8f %8f\n",
8942 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8944 case OPCODE_MULT_MATRIX
:
8945 printf("MultMatrix (or Rotate)\n");
8946 printf(" %8f %8f %8f %8f\n",
8947 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8948 printf(" %8f %8f %8f %8f\n",
8949 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8950 printf(" %8f %8f %8f %8f\n",
8951 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8952 printf(" %8f %8f %8f %8f\n",
8953 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8956 printf("Ortho %g %g %g %g %g %g\n",
8957 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8959 case OPCODE_POP_ATTRIB
:
8960 printf("PopAttrib\n");
8962 case OPCODE_POP_MATRIX
:
8963 printf("PopMatrix\n");
8965 case OPCODE_POP_NAME
:
8966 printf("PopName\n");
8968 case OPCODE_PUSH_ATTRIB
:
8969 printf("PushAttrib %x\n", n
[1].bf
);
8971 case OPCODE_PUSH_MATRIX
:
8972 printf("PushMatrix\n");
8974 case OPCODE_PUSH_NAME
:
8975 printf("PushName %d\n", (int) n
[1].ui
);
8977 case OPCODE_RASTER_POS
:
8978 printf("RasterPos %g %g %g %g\n",
8979 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8982 printf("Rotate %g %g %g %g\n",
8983 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8986 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8988 case OPCODE_TRANSLATE
:
8989 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8991 case OPCODE_BIND_TEXTURE
:
8992 printf("BindTexture %s %d\n",
8993 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8995 case OPCODE_SHADE_MODEL
:
8996 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8999 printf("Map1 %s %.3f %.3f %d %d\n",
9000 _mesa_lookup_enum_by_nr(n
[1].ui
),
9001 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9004 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9005 _mesa_lookup_enum_by_nr(n
[1].ui
),
9006 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9007 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9009 case OPCODE_MAPGRID1
:
9010 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9012 case OPCODE_MAPGRID2
:
9013 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9014 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9016 case OPCODE_EVALMESH1
:
9017 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9019 case OPCODE_EVALMESH2
:
9020 printf("EvalMesh2 %d %d %d %d\n",
9021 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9024 case OPCODE_ATTR_1F_NV
:
9025 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9027 case OPCODE_ATTR_2F_NV
:
9028 printf("ATTR_2F_NV attr %d: %f %f\n",
9029 n
[1].i
, n
[2].f
, n
[3].f
);
9031 case OPCODE_ATTR_3F_NV
:
9032 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9033 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9035 case OPCODE_ATTR_4F_NV
:
9036 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9037 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9039 case OPCODE_ATTR_1F_ARB
:
9040 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9042 case OPCODE_ATTR_2F_ARB
:
9043 printf("ATTR_2F_ARB attr %d: %f %f\n",
9044 n
[1].i
, n
[2].f
, n
[3].f
);
9046 case OPCODE_ATTR_3F_ARB
:
9047 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9048 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9050 case OPCODE_ATTR_4F_ARB
:
9051 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9052 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9055 case OPCODE_MATERIAL
:
9056 printf("MATERIAL %x %x: %f %f %f %f\n",
9057 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9060 printf("BEGIN %x\n", n
[1].i
);
9066 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9069 case OPCODE_EVAL_C1
:
9070 printf("EVAL_C1 %f\n", n
[1].f
);
9072 case OPCODE_EVAL_C2
:
9073 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9075 case OPCODE_EVAL_P1
:
9076 printf("EVAL_P1 %d\n", n
[1].i
);
9078 case OPCODE_EVAL_P2
:
9079 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9082 case OPCODE_PROVOKING_VERTEX
:
9083 printf("ProvokingVertex %s\n",
9084 _mesa_lookup_enum_by_nr(n
[1].ui
));
9088 * meta opcodes/commands
9091 printf("Error: %s %s\n", enum_string(n
[1].e
),
9092 (const char *) get_pointer(&n
[2]));
9094 case OPCODE_CONTINUE
:
9095 printf("DISPLAY-LIST-CONTINUE\n");
9096 n
= (Node
*) get_pointer(&n
[1]);
9098 case OPCODE_END_OF_LIST
:
9099 printf("END-LIST %u\n", list
);
9103 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9105 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9106 opcode
, (void *) n
);
9110 printf("command %d, %u operands\n", opcode
,
9114 /* increment n to point to next compiled command */
9115 if (opcode
!= OPCODE_CONTINUE
) {
9116 n
+= InstSize
[opcode
];
9125 * Clients may call this function to help debug display list problems.
9126 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9127 * changed, or break in the future without notice.
9130 mesa_print_display_list(GLuint list
)
9132 GET_CURRENT_CONTEXT(ctx
);
9133 print_list(ctx
, list
);
9137 /**********************************************************************/
9138 /***** Initialization *****/
9139 /**********************************************************************/
9142 save_vtxfmt_init(GLvertexformat
* vfmt
)
9144 vfmt
->ArrayElement
= _ae_ArrayElement
;
9146 vfmt
->Begin
= save_Begin
;
9148 vfmt
->CallList
= save_CallList
;
9149 vfmt
->CallLists
= save_CallLists
;
9151 vfmt
->Color3f
= save_Color3f
;
9152 vfmt
->Color3fv
= save_Color3fv
;
9153 vfmt
->Color4f
= save_Color4f
;
9154 vfmt
->Color4fv
= save_Color4fv
;
9155 vfmt
->EdgeFlag
= save_EdgeFlag
;
9156 vfmt
->End
= save_End
;
9158 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9159 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9160 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9161 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9162 vfmt
->EvalPoint1
= save_EvalPoint1
;
9163 vfmt
->EvalPoint2
= save_EvalPoint2
;
9165 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9166 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9167 vfmt
->Indexf
= save_Indexf
;
9168 vfmt
->Indexfv
= save_Indexfv
;
9169 vfmt
->Materialfv
= save_Materialfv
;
9170 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9171 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9172 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9173 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9174 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9175 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9176 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9177 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9178 vfmt
->Normal3f
= save_Normal3f
;
9179 vfmt
->Normal3fv
= save_Normal3fv
;
9180 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9181 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9182 vfmt
->TexCoord1f
= save_TexCoord1f
;
9183 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9184 vfmt
->TexCoord2f
= save_TexCoord2f
;
9185 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9186 vfmt
->TexCoord3f
= save_TexCoord3f
;
9187 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9188 vfmt
->TexCoord4f
= save_TexCoord4f
;
9189 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9190 vfmt
->Vertex2f
= save_Vertex2f
;
9191 vfmt
->Vertex2fv
= save_Vertex2fv
;
9192 vfmt
->Vertex3f
= save_Vertex3f
;
9193 vfmt
->Vertex3fv
= save_Vertex3fv
;
9194 vfmt
->Vertex4f
= save_Vertex4f
;
9195 vfmt
->Vertex4fv
= save_Vertex4fv
;
9196 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9197 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9198 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9199 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9200 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9201 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9202 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9203 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9208 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9209 const GLvertexformat
*vfmt
)
9211 SET_CallList(disp
, vfmt
->CallList
);
9212 SET_CallLists(disp
, vfmt
->CallLists
);
9217 * Initialize display list state for given context.
9220 _mesa_init_display_list(struct gl_context
*ctx
)
9222 static GLboolean tableInitialized
= GL_FALSE
;
9224 /* zero-out the instruction size table, just once */
9225 if (!tableInitialized
) {
9226 memset(InstSize
, 0, sizeof(InstSize
));
9227 tableInitialized
= GL_TRUE
;
9230 /* extension info */
9231 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9234 ctx
->ListState
.CallDepth
= 0;
9235 ctx
->ExecuteFlag
= GL_TRUE
;
9236 ctx
->CompileFlag
= GL_FALSE
;
9237 ctx
->ListState
.CurrentBlock
= NULL
;
9238 ctx
->ListState
.CurrentPos
= 0;
9240 /* Display List group */
9241 ctx
->List
.ListBase
= 0;
9243 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9248 _mesa_free_display_list_data(struct gl_context
*ctx
)
9251 ctx
->ListExt
= NULL
;