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]));
772 case OPCODE_CONTINUE
:
773 n
= (Node
*) get_pointer(&n
[1]);
777 case OPCODE_END_OF_LIST
:
782 /* Most frequent case */
783 n
+= InstSize
[n
[0].opcode
];
795 * Destroy a display list and remove from hash table.
796 * \param list - display list number
799 destroy_list(struct gl_context
*ctx
, GLuint list
)
801 struct gl_display_list
*dlist
;
806 dlist
= _mesa_lookup_list(ctx
, list
);
810 _mesa_delete_list(ctx
, dlist
);
811 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
816 * Translate the nth element of list from <type> to GLint.
819 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
831 bptr
= (GLbyte
*) list
;
832 return (GLint
) bptr
[n
];
833 case GL_UNSIGNED_BYTE
:
834 ubptr
= (GLubyte
*) list
;
835 return (GLint
) ubptr
[n
];
837 sptr
= (GLshort
*) list
;
838 return (GLint
) sptr
[n
];
839 case GL_UNSIGNED_SHORT
:
840 usptr
= (GLushort
*) list
;
841 return (GLint
) usptr
[n
];
843 iptr
= (GLint
*) list
;
845 case GL_UNSIGNED_INT
:
846 uiptr
= (GLuint
*) list
;
847 return (GLint
) uiptr
[n
];
849 fptr
= (GLfloat
*) list
;
850 return (GLint
) FLOORF(fptr
[n
]);
852 ubptr
= ((GLubyte
*) list
) + 2 * n
;
853 return (GLint
) ubptr
[0] * 256
856 ubptr
= ((GLubyte
*) list
) + 3 * n
;
857 return (GLint
) ubptr
[0] * 65536
858 + (GLint
) ubptr
[1] * 256
861 ubptr
= ((GLubyte
*) list
) + 4 * n
;
862 return (GLint
) ubptr
[0] * 16777216
863 + (GLint
) ubptr
[1] * 65536
864 + (GLint
) ubptr
[2] * 256
873 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
874 * If width < 0 or height < 0 or format or type are invalid we'll just
875 * return NULL. We will not generate an error since OpenGL command
876 * arguments aren't error-checked until the command is actually executed
877 * (not when they're compiled).
878 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
881 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
882 GLsizei width
, GLsizei height
, GLsizei depth
,
883 GLenum format
, GLenum type
, const GLvoid
* pixels
,
884 const struct gl_pixelstore_attrib
*unpack
)
886 if (width
<= 0 || height
<= 0) {
890 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
891 /* bad format and/or type */
895 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
899 if (type
== GL_BITMAP
)
900 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
902 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
903 format
, type
, pixels
, unpack
);
904 if (pixels
&& !image
) {
905 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
909 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
910 depth
, format
, type
, INT_MAX
, pixels
)) {
911 const GLubyte
*map
, *src
;
915 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
916 GL_MAP_READ_BIT
, unpack
->BufferObj
);
918 /* unable to map src buffer! */
919 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
923 src
= ADD_POINTERS(map
, pixels
);
924 if (type
== GL_BITMAP
)
925 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
927 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
928 format
, type
, src
, unpack
);
930 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
933 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
939 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
944 /** Return copy of memory */
946 memdup(const void *src
, GLsizei bytes
)
948 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
950 memcpy(b
, src
, bytes
);
956 * Allocate space for a display list instruction (opcode + payload space).
957 * \param opcode the instruction opcode (OPCODE_* value)
958 * \param bytes instruction payload size (not counting opcode)
959 * \return pointer to allocated memory (the opcode space)
962 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
964 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
965 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
968 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
969 if (InstSize
[opcode
] == 0) {
970 /* save instruction size now */
971 InstSize
[opcode
] = numNodes
;
974 /* make sure instruction size agrees */
975 ASSERT(numNodes
== InstSize
[opcode
]);
979 if (ctx
->ListState
.CurrentPos
+ numNodes
+ contNodes
> BLOCK_SIZE
) {
980 /* This block is full. Allocate a new block and chain to it */
982 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
983 n
[0].opcode
= OPCODE_CONTINUE
;
984 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
986 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
989 save_pointer(&n
[1], newblock
);
990 ctx
->ListState
.CurrentBlock
= newblock
;
991 ctx
->ListState
.CurrentPos
= 0;
994 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
995 ctx
->ListState
.CurrentPos
+= numNodes
;
997 n
[0].opcode
= opcode
;
1005 * Allocate space for a display list instruction. Used by callers outside
1006 * this file for things like VBO vertex data.
1008 * \param opcode the instruction opcode (OPCODE_* value)
1009 * \param bytes instruction size in bytes, not counting opcode.
1010 * \return pointer to the usable data area (not including the internal
1014 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1016 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
1018 return n
+ 1; /* return pointer to payload area, after opcode */
1025 * This function allows modules and drivers to get their own opcodes
1026 * for extending display list functionality.
1027 * \param ctx the rendering context
1028 * \param size number of bytes for storing the new display list command
1029 * \param execute function to execute the new display list command
1030 * \param destroy function to destroy the new display list command
1031 * \param print function to print the new display list command
1032 * \return the new opcode number or -1 if error
1035 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1037 void (*execute
) (struct gl_context
*, void *),
1038 void (*destroy
) (struct gl_context
*, void *),
1039 void (*print
) (struct gl_context
*, void *))
1041 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1042 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1043 ctx
->ListExt
->Opcode
[i
].Size
=
1044 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1045 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1046 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1047 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1048 return i
+ OPCODE_EXT_0
;
1055 * Allocate space for a display list instruction. The space is basically
1056 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1057 * function parameter, node[2] is the second parameter, etc.
1059 * \param opcode one of OPCODE_x
1060 * \param nparams number of function parameters
1061 * \return pointer to start of instruction space
1063 static inline Node
*
1064 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1066 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1072 * Display List compilation functions
1074 static void GLAPIENTRY
1075 save_Accum(GLenum op
, GLfloat value
)
1077 GET_CURRENT_CONTEXT(ctx
);
1079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1080 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1085 if (ctx
->ExecuteFlag
) {
1086 CALL_Accum(ctx
->Exec
, (op
, value
));
1091 static void GLAPIENTRY
1092 save_AlphaFunc(GLenum func
, GLclampf ref
)
1094 GET_CURRENT_CONTEXT(ctx
);
1096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1097 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1100 n
[2].f
= (GLfloat
) ref
;
1102 if (ctx
->ExecuteFlag
) {
1103 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1108 static void GLAPIENTRY
1109 save_BindTexture(GLenum target
, GLuint texture
)
1111 GET_CURRENT_CONTEXT(ctx
);
1113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1114 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1119 if (ctx
->ExecuteFlag
) {
1120 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1125 static void GLAPIENTRY
1126 save_Bitmap(GLsizei width
, GLsizei height
,
1127 GLfloat xorig
, GLfloat yorig
,
1128 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1130 GET_CURRENT_CONTEXT(ctx
);
1132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1133 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1135 n
[1].i
= (GLint
) width
;
1136 n
[2].i
= (GLint
) height
;
1142 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1143 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1145 if (ctx
->ExecuteFlag
) {
1146 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1147 xorig
, yorig
, xmove
, ymove
, pixels
));
1152 static void GLAPIENTRY
1153 save_BlendEquation(GLenum mode
)
1155 GET_CURRENT_CONTEXT(ctx
);
1157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1158 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1162 if (ctx
->ExecuteFlag
) {
1163 CALL_BlendEquation(ctx
->Exec
, (mode
));
1168 static void GLAPIENTRY
1169 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1171 GET_CURRENT_CONTEXT(ctx
);
1173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1174 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1179 if (ctx
->ExecuteFlag
) {
1180 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1185 static void GLAPIENTRY
1186 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1187 GLenum sfactorA
, GLenum dfactorA
)
1189 GET_CURRENT_CONTEXT(ctx
);
1191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1192 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1194 n
[1].e
= sfactorRGB
;
1195 n
[2].e
= dfactorRGB
;
1199 if (ctx
->ExecuteFlag
) {
1200 CALL_BlendFuncSeparate(ctx
->Exec
,
1201 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1206 static void GLAPIENTRY
1207 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1209 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1213 static void GLAPIENTRY
1214 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1216 GET_CURRENT_CONTEXT(ctx
);
1218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1219 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1226 if (ctx
->ExecuteFlag
) {
1227 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1231 /* GL_ARB_draw_buffers_blend */
1232 static void GLAPIENTRY
1233 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1234 GLenum sfactorA
, GLenum dfactorA
)
1236 GET_CURRENT_CONTEXT(ctx
);
1238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1239 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1242 n
[2].e
= sfactorRGB
;
1243 n
[3].e
= dfactorRGB
;
1247 if (ctx
->ExecuteFlag
) {
1248 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1249 sfactorA
, dfactorA
));
1253 /* GL_ARB_draw_buffers_blend */
1254 static void GLAPIENTRY
1255 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1257 GET_CURRENT_CONTEXT(ctx
);
1259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1260 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1266 if (ctx
->ExecuteFlag
) {
1267 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1271 /* GL_ARB_draw_buffers_blend */
1272 static void GLAPIENTRY
1273 save_BlendEquationi(GLuint buf
, GLenum mode
)
1275 GET_CURRENT_CONTEXT(ctx
);
1277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1278 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1283 if (ctx
->ExecuteFlag
) {
1284 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1288 /* GL_ARB_draw_buffers_blend */
1289 static void GLAPIENTRY
1290 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1292 GET_CURRENT_CONTEXT(ctx
);
1294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1295 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1301 if (ctx
->ExecuteFlag
) {
1302 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1307 /* GL_ARB_draw_instanced. */
1308 static void GLAPIENTRY
1309 save_DrawArraysInstancedARB(GLenum mode
,
1314 GET_CURRENT_CONTEXT(ctx
);
1315 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1316 "glDrawArraysInstanced() during display list compile");
1319 static void GLAPIENTRY
1320 save_DrawElementsInstancedARB(GLenum mode
,
1323 const GLvoid
*indices
,
1326 GET_CURRENT_CONTEXT(ctx
);
1327 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1328 "glDrawElementsInstanced() during display list compile");
1331 static void GLAPIENTRY
1332 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1335 const GLvoid
*indices
,
1339 GET_CURRENT_CONTEXT(ctx
);
1340 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1341 "glDrawElementsInstancedBaseVertex() during display list compile");
1344 /* GL_ARB_base_instance. */
1345 static void GLAPIENTRY
1346 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1350 GLuint baseinstance
)
1352 GET_CURRENT_CONTEXT(ctx
);
1353 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1354 "glDrawArraysInstancedBaseInstance() during display list compile");
1357 static void APIENTRY
1358 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1361 const void *indices
,
1363 GLuint baseinstance
)
1365 GET_CURRENT_CONTEXT(ctx
);
1366 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1367 "glDrawElementsInstancedBaseInstance() during display list compile");
1370 static void APIENTRY
1371 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1374 const void *indices
,
1377 GLuint baseinstance
)
1379 GET_CURRENT_CONTEXT(ctx
);
1380 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1381 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1386 * While building a display list we cache some OpenGL state.
1387 * Under some circumstances we need to invalidate that state (immediately
1388 * when we start compiling a list, or after glCallList(s)).
1391 invalidate_saved_current_state(struct gl_context
*ctx
)
1395 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1396 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1398 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1399 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1401 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1403 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1407 static void GLAPIENTRY
1408 save_CallList(GLuint list
)
1410 GET_CURRENT_CONTEXT(ctx
);
1412 SAVE_FLUSH_VERTICES(ctx
);
1414 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1419 /* After this, we don't know what state we're in. Invalidate all
1420 * cached information previously gathered:
1422 invalidate_saved_current_state( ctx
);
1424 if (ctx
->ExecuteFlag
) {
1425 _mesa_CallList(list
);
1430 static void GLAPIENTRY
1431 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1433 GET_CURRENT_CONTEXT(ctx
);
1435 GLboolean typeErrorFlag
;
1437 SAVE_FLUSH_VERTICES(ctx
);
1441 case GL_UNSIGNED_BYTE
:
1443 case GL_UNSIGNED_SHORT
:
1445 case GL_UNSIGNED_INT
:
1450 typeErrorFlag
= GL_FALSE
;
1453 typeErrorFlag
= GL_TRUE
;
1456 for (i
= 0; i
< num
; i
++) {
1457 GLint list
= translate_id(i
, type
, lists
);
1458 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1461 n
[2].b
= typeErrorFlag
;
1465 /* After this, we don't know what state we're in. Invalidate all
1466 * cached information previously gathered:
1468 invalidate_saved_current_state( ctx
);
1470 if (ctx
->ExecuteFlag
) {
1471 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1476 static void GLAPIENTRY
1477 save_Clear(GLbitfield mask
)
1479 GET_CURRENT_CONTEXT(ctx
);
1481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1482 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1486 if (ctx
->ExecuteFlag
) {
1487 CALL_Clear(ctx
->Exec
, (mask
));
1492 static void GLAPIENTRY
1493 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1495 GET_CURRENT_CONTEXT(ctx
);
1497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1498 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1501 n
[2].i
= drawbuffer
;
1503 if (buffer
== GL_COLOR
) {
1514 if (ctx
->ExecuteFlag
) {
1515 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1520 static void GLAPIENTRY
1521 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1523 GET_CURRENT_CONTEXT(ctx
);
1525 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1526 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1529 n
[2].i
= drawbuffer
;
1531 if (buffer
== GL_COLOR
) {
1542 if (ctx
->ExecuteFlag
) {
1543 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1548 static void GLAPIENTRY
1549 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1551 GET_CURRENT_CONTEXT(ctx
);
1553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1554 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1557 n
[2].i
= drawbuffer
;
1559 if (buffer
== GL_COLOR
) {
1570 if (ctx
->ExecuteFlag
) {
1571 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1576 static void GLAPIENTRY
1577 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1578 GLfloat depth
, GLint stencil
)
1580 GET_CURRENT_CONTEXT(ctx
);
1582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1583 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1586 n
[2].i
= drawbuffer
;
1590 if (ctx
->ExecuteFlag
) {
1591 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1596 static void GLAPIENTRY
1597 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1599 GET_CURRENT_CONTEXT(ctx
);
1601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1602 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1609 if (ctx
->ExecuteFlag
) {
1610 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1615 static void GLAPIENTRY
1616 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1618 GET_CURRENT_CONTEXT(ctx
);
1620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1621 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1628 if (ctx
->ExecuteFlag
) {
1629 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1634 static void GLAPIENTRY
1635 save_ClearDepth(GLclampd depth
)
1637 GET_CURRENT_CONTEXT(ctx
);
1639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1640 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1642 n
[1].f
= (GLfloat
) depth
;
1644 if (ctx
->ExecuteFlag
) {
1645 CALL_ClearDepth(ctx
->Exec
, (depth
));
1650 static void GLAPIENTRY
1651 save_ClearIndex(GLfloat c
)
1653 GET_CURRENT_CONTEXT(ctx
);
1655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1656 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1660 if (ctx
->ExecuteFlag
) {
1661 CALL_ClearIndex(ctx
->Exec
, (c
));
1666 static void GLAPIENTRY
1667 save_ClearStencil(GLint s
)
1669 GET_CURRENT_CONTEXT(ctx
);
1671 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1672 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1676 if (ctx
->ExecuteFlag
) {
1677 CALL_ClearStencil(ctx
->Exec
, (s
));
1682 static void GLAPIENTRY
1683 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1685 GET_CURRENT_CONTEXT(ctx
);
1687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1688 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1691 n
[2].f
= (GLfloat
) equ
[0];
1692 n
[3].f
= (GLfloat
) equ
[1];
1693 n
[4].f
= (GLfloat
) equ
[2];
1694 n
[5].f
= (GLfloat
) equ
[3];
1696 if (ctx
->ExecuteFlag
) {
1697 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1703 static void GLAPIENTRY
1704 save_ColorMask(GLboolean red
, GLboolean green
,
1705 GLboolean blue
, GLboolean alpha
)
1707 GET_CURRENT_CONTEXT(ctx
);
1709 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1710 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1717 if (ctx
->ExecuteFlag
) {
1718 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1723 static void GLAPIENTRY
1724 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1725 GLboolean blue
, GLboolean alpha
)
1727 GET_CURRENT_CONTEXT(ctx
);
1729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1730 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1738 if (ctx
->ExecuteFlag
) {
1739 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1744 static void GLAPIENTRY
1745 save_ColorMaterial(GLenum face
, GLenum mode
)
1747 GET_CURRENT_CONTEXT(ctx
);
1749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1751 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1756 if (ctx
->ExecuteFlag
) {
1757 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1762 static void GLAPIENTRY
1763 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1765 GET_CURRENT_CONTEXT(ctx
);
1767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1768 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1772 n
[3].i
= (GLint
) width
;
1773 n
[4].i
= (GLint
) height
;
1776 if (ctx
->ExecuteFlag
) {
1777 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1783 static void GLAPIENTRY
1784 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1785 GLint x
, GLint y
, GLsizei width
, GLint border
)
1787 GET_CURRENT_CONTEXT(ctx
);
1789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1790 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1794 n
[3].e
= internalformat
;
1800 if (ctx
->ExecuteFlag
) {
1801 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1802 x
, y
, width
, border
));
1807 static void GLAPIENTRY
1808 save_CopyTexImage2D(GLenum target
, GLint level
,
1809 GLenum internalformat
,
1810 GLint x
, GLint y
, GLsizei width
,
1811 GLsizei height
, GLint border
)
1813 GET_CURRENT_CONTEXT(ctx
);
1815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1816 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1820 n
[3].e
= internalformat
;
1827 if (ctx
->ExecuteFlag
) {
1828 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1829 x
, y
, width
, height
, border
));
1835 static void GLAPIENTRY
1836 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1837 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1839 GET_CURRENT_CONTEXT(ctx
);
1841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1842 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1851 if (ctx
->ExecuteFlag
) {
1852 CALL_CopyTexSubImage1D(ctx
->Exec
,
1853 (target
, level
, xoffset
, x
, y
, width
));
1858 static void GLAPIENTRY
1859 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1860 GLint xoffset
, GLint yoffset
,
1861 GLint x
, GLint y
, GLsizei width
, GLint height
)
1863 GET_CURRENT_CONTEXT(ctx
);
1865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1866 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1877 if (ctx
->ExecuteFlag
) {
1878 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1879 x
, y
, width
, height
));
1884 static void GLAPIENTRY
1885 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1886 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1887 GLint x
, GLint y
, GLsizei width
, GLint height
)
1889 GET_CURRENT_CONTEXT(ctx
);
1891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1892 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1904 if (ctx
->ExecuteFlag
) {
1905 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1906 xoffset
, yoffset
, zoffset
,
1907 x
, y
, width
, height
));
1912 static void GLAPIENTRY
1913 save_CullFace(GLenum mode
)
1915 GET_CURRENT_CONTEXT(ctx
);
1917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1918 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1922 if (ctx
->ExecuteFlag
) {
1923 CALL_CullFace(ctx
->Exec
, (mode
));
1928 static void GLAPIENTRY
1929 save_DepthFunc(GLenum func
)
1931 GET_CURRENT_CONTEXT(ctx
);
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1934 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1938 if (ctx
->ExecuteFlag
) {
1939 CALL_DepthFunc(ctx
->Exec
, (func
));
1944 static void GLAPIENTRY
1945 save_DepthMask(GLboolean mask
)
1947 GET_CURRENT_CONTEXT(ctx
);
1949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1950 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1954 if (ctx
->ExecuteFlag
) {
1955 CALL_DepthMask(ctx
->Exec
, (mask
));
1960 static void GLAPIENTRY
1961 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1963 GET_CURRENT_CONTEXT(ctx
);
1965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1966 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1968 n
[1].f
= (GLfloat
) nearval
;
1969 n
[2].f
= (GLfloat
) farval
;
1971 if (ctx
->ExecuteFlag
) {
1972 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
1977 static void GLAPIENTRY
1978 save_Disable(GLenum cap
)
1980 GET_CURRENT_CONTEXT(ctx
);
1982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1983 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
1987 if (ctx
->ExecuteFlag
) {
1988 CALL_Disable(ctx
->Exec
, (cap
));
1993 static void GLAPIENTRY
1994 save_DisableIndexed(GLuint index
, GLenum cap
)
1996 GET_CURRENT_CONTEXT(ctx
);
1998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1999 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2004 if (ctx
->ExecuteFlag
) {
2005 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2010 static void GLAPIENTRY
2011 save_DrawBuffer(GLenum mode
)
2013 GET_CURRENT_CONTEXT(ctx
);
2015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2016 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2020 if (ctx
->ExecuteFlag
) {
2021 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2026 static void GLAPIENTRY
2027 save_DrawPixels(GLsizei width
, GLsizei height
,
2028 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2030 GET_CURRENT_CONTEXT(ctx
);
2033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2035 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2042 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2043 pixels
, &ctx
->Unpack
));
2045 if (ctx
->ExecuteFlag
) {
2046 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2052 static void GLAPIENTRY
2053 save_Enable(GLenum cap
)
2055 GET_CURRENT_CONTEXT(ctx
);
2057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2058 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2062 if (ctx
->ExecuteFlag
) {
2063 CALL_Enable(ctx
->Exec
, (cap
));
2069 static void GLAPIENTRY
2070 save_EnableIndexed(GLuint index
, GLenum cap
)
2072 GET_CURRENT_CONTEXT(ctx
);
2074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2075 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2080 if (ctx
->ExecuteFlag
) {
2081 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2087 static void GLAPIENTRY
2088 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2090 GET_CURRENT_CONTEXT(ctx
);
2092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2093 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2099 if (ctx
->ExecuteFlag
) {
2100 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2105 static void GLAPIENTRY
2106 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2108 GET_CURRENT_CONTEXT(ctx
);
2110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2111 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2119 if (ctx
->ExecuteFlag
) {
2120 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2127 static void GLAPIENTRY
2128 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2130 GET_CURRENT_CONTEXT(ctx
);
2132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2133 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2141 if (ctx
->ExecuteFlag
) {
2142 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2147 static void GLAPIENTRY
2148 save_Fogf(GLenum pname
, GLfloat param
)
2152 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2153 save_Fogfv(pname
, parray
);
2157 static void GLAPIENTRY
2158 save_Fogiv(GLenum pname
, const GLint
*params
)
2163 case GL_FOG_DENSITY
:
2167 p
[0] = (GLfloat
) *params
;
2173 p
[0] = INT_TO_FLOAT(params
[0]);
2174 p
[1] = INT_TO_FLOAT(params
[1]);
2175 p
[2] = INT_TO_FLOAT(params
[2]);
2176 p
[3] = INT_TO_FLOAT(params
[3]);
2179 /* Error will be caught later in gl_Fogfv */
2180 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2182 save_Fogfv(pname
, p
);
2186 static void GLAPIENTRY
2187 save_Fogi(GLenum pname
, GLint param
)
2191 parray
[1] = parray
[2] = parray
[3] = 0;
2192 save_Fogiv(pname
, parray
);
2196 static void GLAPIENTRY
2197 save_FrontFace(GLenum mode
)
2199 GET_CURRENT_CONTEXT(ctx
);
2201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2202 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2206 if (ctx
->ExecuteFlag
) {
2207 CALL_FrontFace(ctx
->Exec
, (mode
));
2212 static void GLAPIENTRY
2213 save_Frustum(GLdouble left
, GLdouble right
,
2214 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2216 GET_CURRENT_CONTEXT(ctx
);
2218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2219 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2221 n
[1].f
= (GLfloat
) left
;
2222 n
[2].f
= (GLfloat
) right
;
2223 n
[3].f
= (GLfloat
) bottom
;
2224 n
[4].f
= (GLfloat
) top
;
2225 n
[5].f
= (GLfloat
) nearval
;
2226 n
[6].f
= (GLfloat
) farval
;
2228 if (ctx
->ExecuteFlag
) {
2229 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2234 static void GLAPIENTRY
2235 save_Hint(GLenum target
, GLenum mode
)
2237 GET_CURRENT_CONTEXT(ctx
);
2239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2240 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2245 if (ctx
->ExecuteFlag
) {
2246 CALL_Hint(ctx
->Exec
, (target
, mode
));
2251 static void GLAPIENTRY
2252 save_IndexMask(GLuint mask
)
2254 GET_CURRENT_CONTEXT(ctx
);
2256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2257 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2261 if (ctx
->ExecuteFlag
) {
2262 CALL_IndexMask(ctx
->Exec
, (mask
));
2267 static void GLAPIENTRY
2268 save_InitNames(void)
2270 GET_CURRENT_CONTEXT(ctx
);
2271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2272 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2273 if (ctx
->ExecuteFlag
) {
2274 CALL_InitNames(ctx
->Exec
, ());
2279 static void GLAPIENTRY
2280 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2282 GET_CURRENT_CONTEXT(ctx
);
2284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2285 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2303 case GL_SPOT_DIRECTION
:
2306 case GL_SPOT_EXPONENT
:
2309 case GL_SPOT_CUTOFF
:
2312 case GL_CONSTANT_ATTENUATION
:
2315 case GL_LINEAR_ATTENUATION
:
2318 case GL_QUADRATIC_ATTENUATION
:
2324 for (i
= 0; i
< nParams
; i
++) {
2325 n
[3 + i
].f
= params
[i
];
2328 if (ctx
->ExecuteFlag
) {
2329 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2334 static void GLAPIENTRY
2335 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2339 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2340 save_Lightfv(light
, pname
, parray
);
2344 static void GLAPIENTRY
2345 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2352 fparam
[0] = INT_TO_FLOAT(params
[0]);
2353 fparam
[1] = INT_TO_FLOAT(params
[1]);
2354 fparam
[2] = INT_TO_FLOAT(params
[2]);
2355 fparam
[3] = INT_TO_FLOAT(params
[3]);
2358 fparam
[0] = (GLfloat
) params
[0];
2359 fparam
[1] = (GLfloat
) params
[1];
2360 fparam
[2] = (GLfloat
) params
[2];
2361 fparam
[3] = (GLfloat
) params
[3];
2363 case GL_SPOT_DIRECTION
:
2364 fparam
[0] = (GLfloat
) params
[0];
2365 fparam
[1] = (GLfloat
) params
[1];
2366 fparam
[2] = (GLfloat
) params
[2];
2368 case GL_SPOT_EXPONENT
:
2369 case GL_SPOT_CUTOFF
:
2370 case GL_CONSTANT_ATTENUATION
:
2371 case GL_LINEAR_ATTENUATION
:
2372 case GL_QUADRATIC_ATTENUATION
:
2373 fparam
[0] = (GLfloat
) params
[0];
2376 /* error will be caught later in gl_Lightfv */
2379 save_Lightfv(light
, pname
, fparam
);
2383 static void GLAPIENTRY
2384 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2388 parray
[1] = parray
[2] = parray
[3] = 0;
2389 save_Lightiv(light
, pname
, parray
);
2393 static void GLAPIENTRY
2394 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2396 GET_CURRENT_CONTEXT(ctx
);
2398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2399 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2407 if (ctx
->ExecuteFlag
) {
2408 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2413 static void GLAPIENTRY
2414 save_LightModelf(GLenum pname
, GLfloat param
)
2418 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2419 save_LightModelfv(pname
, parray
);
2423 static void GLAPIENTRY
2424 save_LightModeliv(GLenum pname
, const GLint
*params
)
2428 case GL_LIGHT_MODEL_AMBIENT
:
2429 fparam
[0] = INT_TO_FLOAT(params
[0]);
2430 fparam
[1] = INT_TO_FLOAT(params
[1]);
2431 fparam
[2] = INT_TO_FLOAT(params
[2]);
2432 fparam
[3] = INT_TO_FLOAT(params
[3]);
2434 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2435 case GL_LIGHT_MODEL_TWO_SIDE
:
2436 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2437 fparam
[0] = (GLfloat
) params
[0];
2443 /* Error will be caught later in gl_LightModelfv */
2444 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2446 save_LightModelfv(pname
, fparam
);
2450 static void GLAPIENTRY
2451 save_LightModeli(GLenum pname
, GLint param
)
2455 parray
[1] = parray
[2] = parray
[3] = 0;
2456 save_LightModeliv(pname
, parray
);
2460 static void GLAPIENTRY
2461 save_LineStipple(GLint factor
, GLushort pattern
)
2463 GET_CURRENT_CONTEXT(ctx
);
2465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2466 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2471 if (ctx
->ExecuteFlag
) {
2472 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2477 static void GLAPIENTRY
2478 save_LineWidth(GLfloat width
)
2480 GET_CURRENT_CONTEXT(ctx
);
2482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2483 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2487 if (ctx
->ExecuteFlag
) {
2488 CALL_LineWidth(ctx
->Exec
, (width
));
2493 static void GLAPIENTRY
2494 save_ListBase(GLuint base
)
2496 GET_CURRENT_CONTEXT(ctx
);
2498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2499 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2503 if (ctx
->ExecuteFlag
) {
2504 CALL_ListBase(ctx
->Exec
, (base
));
2509 static void GLAPIENTRY
2510 save_LoadIdentity(void)
2512 GET_CURRENT_CONTEXT(ctx
);
2513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2514 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2515 if (ctx
->ExecuteFlag
) {
2516 CALL_LoadIdentity(ctx
->Exec
, ());
2521 static void GLAPIENTRY
2522 save_LoadMatrixf(const GLfloat
* m
)
2524 GET_CURRENT_CONTEXT(ctx
);
2526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2527 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2530 for (i
= 0; i
< 16; i
++) {
2534 if (ctx
->ExecuteFlag
) {
2535 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2540 static void GLAPIENTRY
2541 save_LoadMatrixd(const GLdouble
* m
)
2545 for (i
= 0; i
< 16; i
++) {
2546 f
[i
] = (GLfloat
) m
[i
];
2548 save_LoadMatrixf(f
);
2552 static void GLAPIENTRY
2553 save_LoadName(GLuint name
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2562 if (ctx
->ExecuteFlag
) {
2563 CALL_LoadName(ctx
->Exec
, (name
));
2568 static void GLAPIENTRY
2569 save_LogicOp(GLenum opcode
)
2571 GET_CURRENT_CONTEXT(ctx
);
2573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2574 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2578 if (ctx
->ExecuteFlag
) {
2579 CALL_LogicOp(ctx
->Exec
, (opcode
));
2584 static void GLAPIENTRY
2585 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2586 GLint order
, const GLdouble
* points
)
2588 GET_CURRENT_CONTEXT(ctx
);
2590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2591 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2593 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2595 n
[2].f
= (GLfloat
) u1
;
2596 n
[3].f
= (GLfloat
) u2
;
2597 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2599 save_pointer(&n
[6], pnts
);
2601 if (ctx
->ExecuteFlag
) {
2602 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2606 static void GLAPIENTRY
2607 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2608 GLint order
, const GLfloat
* points
)
2610 GET_CURRENT_CONTEXT(ctx
);
2612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2613 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2615 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2619 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2621 save_pointer(&n
[6], pnts
);
2623 if (ctx
->ExecuteFlag
) {
2624 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2629 static void GLAPIENTRY
2630 save_Map2d(GLenum target
,
2631 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2632 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2633 const GLdouble
* points
)
2635 GET_CURRENT_CONTEXT(ctx
);
2637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2638 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2640 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2641 vstride
, vorder
, points
);
2643 n
[2].f
= (GLfloat
) u1
;
2644 n
[3].f
= (GLfloat
) u2
;
2645 n
[4].f
= (GLfloat
) v1
;
2646 n
[5].f
= (GLfloat
) v2
;
2647 /* XXX verify these strides are correct */
2648 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2649 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2652 save_pointer(&n
[10], pnts
);
2654 if (ctx
->ExecuteFlag
) {
2655 CALL_Map2d(ctx
->Exec
, (target
,
2656 u1
, u2
, ustride
, uorder
,
2657 v1
, v2
, vstride
, vorder
, points
));
2662 static void GLAPIENTRY
2663 save_Map2f(GLenum target
,
2664 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2665 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2666 const GLfloat
* points
)
2668 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2673 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2674 vstride
, vorder
, points
);
2680 /* XXX verify these strides are correct */
2681 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2682 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2685 save_pointer(&n
[10], pnts
);
2687 if (ctx
->ExecuteFlag
) {
2688 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2689 v1
, v2
, vstride
, vorder
, points
));
2694 static void GLAPIENTRY
2695 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2697 GET_CURRENT_CONTEXT(ctx
);
2699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2700 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2706 if (ctx
->ExecuteFlag
) {
2707 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2712 static void GLAPIENTRY
2713 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2715 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2719 static void GLAPIENTRY
2720 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2721 GLint vn
, GLfloat v1
, GLfloat v2
)
2723 GET_CURRENT_CONTEXT(ctx
);
2725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2726 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2735 if (ctx
->ExecuteFlag
) {
2736 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2742 static void GLAPIENTRY
2743 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2744 GLint vn
, GLdouble v1
, GLdouble v2
)
2746 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2747 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2751 static void GLAPIENTRY
2752 save_MatrixMode(GLenum mode
)
2754 GET_CURRENT_CONTEXT(ctx
);
2756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2757 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2761 if (ctx
->ExecuteFlag
) {
2762 CALL_MatrixMode(ctx
->Exec
, (mode
));
2767 static void GLAPIENTRY
2768 save_MultMatrixf(const GLfloat
* m
)
2770 GET_CURRENT_CONTEXT(ctx
);
2772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2773 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2776 for (i
= 0; i
< 16; i
++) {
2780 if (ctx
->ExecuteFlag
) {
2781 CALL_MultMatrixf(ctx
->Exec
, (m
));
2786 static void GLAPIENTRY
2787 save_MultMatrixd(const GLdouble
* m
)
2791 for (i
= 0; i
< 16; i
++) {
2792 f
[i
] = (GLfloat
) m
[i
];
2794 save_MultMatrixf(f
);
2798 static void GLAPIENTRY
2799 save_NewList(GLuint name
, GLenum mode
)
2801 GET_CURRENT_CONTEXT(ctx
);
2802 /* It's an error to call this function while building a display list */
2803 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2810 static void GLAPIENTRY
2811 save_Ortho(GLdouble left
, GLdouble right
,
2812 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2814 GET_CURRENT_CONTEXT(ctx
);
2816 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2817 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2819 n
[1].f
= (GLfloat
) left
;
2820 n
[2].f
= (GLfloat
) right
;
2821 n
[3].f
= (GLfloat
) bottom
;
2822 n
[4].f
= (GLfloat
) top
;
2823 n
[5].f
= (GLfloat
) nearval
;
2824 n
[6].f
= (GLfloat
) farval
;
2826 if (ctx
->ExecuteFlag
) {
2827 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2832 static void GLAPIENTRY
2833 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2835 GET_CURRENT_CONTEXT(ctx
);
2837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2838 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2842 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2844 if (ctx
->ExecuteFlag
) {
2845 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2850 static void GLAPIENTRY
2851 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2853 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2855 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2856 for (i
= 0; i
< mapsize
; i
++) {
2857 fvalues
[i
] = (GLfloat
) values
[i
];
2861 for (i
= 0; i
< mapsize
; i
++) {
2862 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2865 save_PixelMapfv(map
, mapsize
, fvalues
);
2869 static void GLAPIENTRY
2870 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2872 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2874 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2875 for (i
= 0; i
< mapsize
; i
++) {
2876 fvalues
[i
] = (GLfloat
) values
[i
];
2880 for (i
= 0; i
< mapsize
; i
++) {
2881 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2884 save_PixelMapfv(map
, mapsize
, fvalues
);
2888 static void GLAPIENTRY
2889 save_PixelTransferf(GLenum pname
, GLfloat param
)
2891 GET_CURRENT_CONTEXT(ctx
);
2893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2894 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2899 if (ctx
->ExecuteFlag
) {
2900 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2905 static void GLAPIENTRY
2906 save_PixelTransferi(GLenum pname
, GLint param
)
2908 save_PixelTransferf(pname
, (GLfloat
) param
);
2912 static void GLAPIENTRY
2913 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2915 GET_CURRENT_CONTEXT(ctx
);
2917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2918 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2923 if (ctx
->ExecuteFlag
) {
2924 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2929 static void GLAPIENTRY
2930 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2932 GET_CURRENT_CONTEXT(ctx
);
2934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2935 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2942 if (ctx
->ExecuteFlag
) {
2943 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2948 static void GLAPIENTRY
2949 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2953 parray
[1] = parray
[2] = 0.0F
;
2954 save_PointParameterfvEXT(pname
, parray
);
2957 static void GLAPIENTRY
2958 save_PointParameteriNV(GLenum pname
, GLint param
)
2961 parray
[0] = (GLfloat
) param
;
2962 parray
[1] = parray
[2] = 0.0F
;
2963 save_PointParameterfvEXT(pname
, parray
);
2966 static void GLAPIENTRY
2967 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
2970 parray
[0] = (GLfloat
) param
[0];
2971 parray
[1] = parray
[2] = 0.0F
;
2972 save_PointParameterfvEXT(pname
, parray
);
2976 static void GLAPIENTRY
2977 save_PointSize(GLfloat size
)
2979 GET_CURRENT_CONTEXT(ctx
);
2981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2982 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
2986 if (ctx
->ExecuteFlag
) {
2987 CALL_PointSize(ctx
->Exec
, (size
));
2992 static void GLAPIENTRY
2993 save_PolygonMode(GLenum face
, GLenum mode
)
2995 GET_CURRENT_CONTEXT(ctx
);
2997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2998 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3003 if (ctx
->ExecuteFlag
) {
3004 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3009 static void GLAPIENTRY
3010 save_PolygonStipple(const GLubyte
* pattern
)
3012 GET_CURRENT_CONTEXT(ctx
);
3015 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3017 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3020 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3021 pattern
, &ctx
->Unpack
));
3023 if (ctx
->ExecuteFlag
) {
3024 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3029 static void GLAPIENTRY
3030 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3032 GET_CURRENT_CONTEXT(ctx
);
3034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3035 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3040 if (ctx
->ExecuteFlag
) {
3041 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3046 static void GLAPIENTRY
3047 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3049 GET_CURRENT_CONTEXT(ctx
);
3050 /* XXX mult by DepthMaxF here??? */
3051 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3055 static void GLAPIENTRY
3056 save_PopAttrib(void)
3058 GET_CURRENT_CONTEXT(ctx
);
3059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3060 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3061 if (ctx
->ExecuteFlag
) {
3062 CALL_PopAttrib(ctx
->Exec
, ());
3067 static void GLAPIENTRY
3068 save_PopMatrix(void)
3070 GET_CURRENT_CONTEXT(ctx
);
3071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3072 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3073 if (ctx
->ExecuteFlag
) {
3074 CALL_PopMatrix(ctx
->Exec
, ());
3079 static void GLAPIENTRY
3082 GET_CURRENT_CONTEXT(ctx
);
3083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3084 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3085 if (ctx
->ExecuteFlag
) {
3086 CALL_PopName(ctx
->Exec
, ());
3091 static void GLAPIENTRY
3092 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3093 const GLclampf
* priorities
)
3095 GET_CURRENT_CONTEXT(ctx
);
3097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3099 for (i
= 0; i
< num
; i
++) {
3101 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3103 n
[1].ui
= textures
[i
];
3104 n
[2].f
= priorities
[i
];
3107 if (ctx
->ExecuteFlag
) {
3108 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3113 static void GLAPIENTRY
3114 save_PushAttrib(GLbitfield mask
)
3116 GET_CURRENT_CONTEXT(ctx
);
3118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3119 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3123 if (ctx
->ExecuteFlag
) {
3124 CALL_PushAttrib(ctx
->Exec
, (mask
));
3129 static void GLAPIENTRY
3130 save_PushMatrix(void)
3132 GET_CURRENT_CONTEXT(ctx
);
3133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3134 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3135 if (ctx
->ExecuteFlag
) {
3136 CALL_PushMatrix(ctx
->Exec
, ());
3141 static void GLAPIENTRY
3142 save_PushName(GLuint name
)
3144 GET_CURRENT_CONTEXT(ctx
);
3146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3147 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3151 if (ctx
->ExecuteFlag
) {
3152 CALL_PushName(ctx
->Exec
, (name
));
3157 static void GLAPIENTRY
3158 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3160 GET_CURRENT_CONTEXT(ctx
);
3162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3163 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3170 if (ctx
->ExecuteFlag
) {
3171 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3175 static void GLAPIENTRY
3176 save_RasterPos2d(GLdouble x
, GLdouble y
)
3178 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3181 static void GLAPIENTRY
3182 save_RasterPos2f(GLfloat x
, GLfloat y
)
3184 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3187 static void GLAPIENTRY
3188 save_RasterPos2i(GLint x
, GLint y
)
3190 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3193 static void GLAPIENTRY
3194 save_RasterPos2s(GLshort x
, GLshort y
)
3196 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3199 static void GLAPIENTRY
3200 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3202 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3205 static void GLAPIENTRY
3206 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3208 save_RasterPos4f(x
, y
, z
, 1.0F
);
3211 static void GLAPIENTRY
3212 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3214 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3217 static void GLAPIENTRY
3218 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3220 save_RasterPos4f(x
, y
, z
, 1.0F
);
3223 static void GLAPIENTRY
3224 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3226 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3229 static void GLAPIENTRY
3230 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3232 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3235 static void GLAPIENTRY
3236 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3238 save_RasterPos4f(x
, y
, z
, w
);
3241 static void GLAPIENTRY
3242 save_RasterPos2dv(const GLdouble
* v
)
3244 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3247 static void GLAPIENTRY
3248 save_RasterPos2fv(const GLfloat
* v
)
3250 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3253 static void GLAPIENTRY
3254 save_RasterPos2iv(const GLint
* v
)
3256 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3259 static void GLAPIENTRY
3260 save_RasterPos2sv(const GLshort
* v
)
3262 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3265 static void GLAPIENTRY
3266 save_RasterPos3dv(const GLdouble
* v
)
3268 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3271 static void GLAPIENTRY
3272 save_RasterPos3fv(const GLfloat
* v
)
3274 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3277 static void GLAPIENTRY
3278 save_RasterPos3iv(const GLint
* v
)
3280 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3283 static void GLAPIENTRY
3284 save_RasterPos3sv(const GLshort
* v
)
3286 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3289 static void GLAPIENTRY
3290 save_RasterPos4dv(const GLdouble
* v
)
3292 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3293 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3296 static void GLAPIENTRY
3297 save_RasterPos4fv(const GLfloat
* v
)
3299 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3302 static void GLAPIENTRY
3303 save_RasterPos4iv(const GLint
* v
)
3305 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3306 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3309 static void GLAPIENTRY
3310 save_RasterPos4sv(const GLshort
* v
)
3312 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3316 static void GLAPIENTRY
3317 save_PassThrough(GLfloat token
)
3319 GET_CURRENT_CONTEXT(ctx
);
3321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3322 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3326 if (ctx
->ExecuteFlag
) {
3327 CALL_PassThrough(ctx
->Exec
, (token
));
3332 static void GLAPIENTRY
3333 save_ReadBuffer(GLenum mode
)
3335 GET_CURRENT_CONTEXT(ctx
);
3337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3338 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3342 if (ctx
->ExecuteFlag
) {
3343 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3348 static void GLAPIENTRY
3349 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3351 GET_CURRENT_CONTEXT(ctx
);
3353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3354 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3361 if (ctx
->ExecuteFlag
) {
3362 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3367 static void GLAPIENTRY
3368 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3370 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3374 static void GLAPIENTRY
3375 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3377 GET_CURRENT_CONTEXT(ctx
);
3379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3380 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3386 if (ctx
->ExecuteFlag
) {
3387 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3392 static void GLAPIENTRY
3393 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3395 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3399 static void GLAPIENTRY
3400 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3402 GET_CURRENT_CONTEXT(ctx
);
3404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3405 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3412 if (ctx
->ExecuteFlag
) {
3413 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3418 static void GLAPIENTRY
3419 save_ShadeModel(GLenum mode
)
3421 GET_CURRENT_CONTEXT(ctx
);
3423 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3425 if (ctx
->ExecuteFlag
) {
3426 CALL_ShadeModel(ctx
->Exec
, (mode
));
3429 /* Don't compile this call if it's a no-op.
3430 * By avoiding this state change we have a better chance of
3431 * coalescing subsequent drawing commands into one batch.
3433 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3436 SAVE_FLUSH_VERTICES(ctx
);
3438 ctx
->ListState
.Current
.ShadeModel
= mode
;
3440 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3447 static void GLAPIENTRY
3448 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3450 GET_CURRENT_CONTEXT(ctx
);
3452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3453 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3459 if (ctx
->ExecuteFlag
) {
3460 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3465 static void GLAPIENTRY
3466 save_StencilMask(GLuint mask
)
3468 GET_CURRENT_CONTEXT(ctx
);
3470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3471 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3475 if (ctx
->ExecuteFlag
) {
3476 CALL_StencilMask(ctx
->Exec
, (mask
));
3481 static void GLAPIENTRY
3482 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3484 GET_CURRENT_CONTEXT(ctx
);
3486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3487 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3493 if (ctx
->ExecuteFlag
) {
3494 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3499 static void GLAPIENTRY
3500 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3502 GET_CURRENT_CONTEXT(ctx
);
3504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3505 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3512 if (ctx
->ExecuteFlag
) {
3513 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3518 static void GLAPIENTRY
3519 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3522 GET_CURRENT_CONTEXT(ctx
);
3524 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3526 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3534 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3541 if (ctx
->ExecuteFlag
) {
3542 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3543 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3548 static void GLAPIENTRY
3549 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3551 GET_CURRENT_CONTEXT(ctx
);
3553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3554 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3559 if (ctx
->ExecuteFlag
) {
3560 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3565 static void GLAPIENTRY
3566 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3568 GET_CURRENT_CONTEXT(ctx
);
3570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3571 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3578 if (ctx
->ExecuteFlag
) {
3579 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3584 static void GLAPIENTRY
3585 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3587 GET_CURRENT_CONTEXT(ctx
);
3589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3590 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3594 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3602 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3605 if (ctx
->ExecuteFlag
) {
3606 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3611 static void GLAPIENTRY
3612 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3615 parray
[0] = (GLfloat
) param
;
3616 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3617 save_TexEnvfv(target
, pname
, parray
);
3621 static void GLAPIENTRY
3622 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3625 p
[0] = (GLfloat
) param
;
3626 p
[1] = p
[2] = p
[3] = 0.0F
;
3627 save_TexEnvfv(target
, pname
, p
);
3631 static void GLAPIENTRY
3632 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3635 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3636 p
[0] = INT_TO_FLOAT(param
[0]);
3637 p
[1] = INT_TO_FLOAT(param
[1]);
3638 p
[2] = INT_TO_FLOAT(param
[2]);
3639 p
[3] = INT_TO_FLOAT(param
[3]);
3642 p
[0] = (GLfloat
) param
[0];
3643 p
[1] = p
[2] = p
[3] = 0.0F
;
3645 save_TexEnvfv(target
, pname
, p
);
3649 static void GLAPIENTRY
3650 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3652 GET_CURRENT_CONTEXT(ctx
);
3654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3655 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3664 if (ctx
->ExecuteFlag
) {
3665 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3670 static void GLAPIENTRY
3671 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3674 p
[0] = (GLfloat
) params
[0];
3675 p
[1] = (GLfloat
) params
[1];
3676 p
[2] = (GLfloat
) params
[2];
3677 p
[3] = (GLfloat
) params
[3];
3678 save_TexGenfv(coord
, pname
, p
);
3682 static void GLAPIENTRY
3683 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3686 parray
[0] = (GLfloat
) param
;
3687 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3688 save_TexGenfv(coord
, pname
, parray
);
3692 static void GLAPIENTRY
3693 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3696 p
[0] = (GLfloat
) params
[0];
3697 p
[1] = (GLfloat
) params
[1];
3698 p
[2] = (GLfloat
) params
[2];
3699 p
[3] = (GLfloat
) params
[3];
3700 save_TexGenfv(coord
, pname
, p
);
3704 static void GLAPIENTRY
3705 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3709 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3710 save_TexGenfv(coord
, pname
, parray
);
3714 static void GLAPIENTRY
3715 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3719 parray
[1] = parray
[2] = parray
[3] = 0;
3720 save_TexGeniv(coord
, pname
, parray
);
3724 static void GLAPIENTRY
3725 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3727 GET_CURRENT_CONTEXT(ctx
);
3729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3730 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3739 if (ctx
->ExecuteFlag
) {
3740 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3745 static void GLAPIENTRY
3746 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3750 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3751 save_TexParameterfv(target
, pname
, parray
);
3755 static void GLAPIENTRY
3756 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3759 fparam
[0] = (GLfloat
) param
;
3760 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3761 save_TexParameterfv(target
, pname
, fparam
);
3765 static void GLAPIENTRY
3766 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3769 fparam
[0] = (GLfloat
) params
[0];
3770 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3771 save_TexParameterfv(target
, pname
, fparam
);
3775 static void GLAPIENTRY
3776 save_TexImage1D(GLenum target
,
3777 GLint level
, GLint components
,
3778 GLsizei width
, GLint border
,
3779 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3781 GET_CURRENT_CONTEXT(ctx
);
3782 if (target
== GL_PROXY_TEXTURE_1D
) {
3783 /* don't compile, execute immediately */
3784 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3785 border
, format
, type
, pixels
));
3789 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3790 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3794 n
[3].i
= components
;
3795 n
[4].i
= (GLint
) width
;
3800 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3801 pixels
, &ctx
->Unpack
));
3803 if (ctx
->ExecuteFlag
) {
3804 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3805 border
, format
, type
, pixels
));
3811 static void GLAPIENTRY
3812 save_TexImage2D(GLenum target
,
3813 GLint level
, GLint components
,
3814 GLsizei width
, GLsizei height
, GLint border
,
3815 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3817 GET_CURRENT_CONTEXT(ctx
);
3818 if (target
== GL_PROXY_TEXTURE_2D
) {
3819 /* don't compile, execute immediately */
3820 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3821 height
, border
, format
, type
, pixels
));
3825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3826 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3830 n
[3].i
= components
;
3831 n
[4].i
= (GLint
) width
;
3832 n
[5].i
= (GLint
) height
;
3837 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3838 pixels
, &ctx
->Unpack
));
3840 if (ctx
->ExecuteFlag
) {
3841 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3842 height
, border
, format
, type
, pixels
));
3848 static void GLAPIENTRY
3849 save_TexImage3D(GLenum target
,
3850 GLint level
, GLint internalFormat
,
3851 GLsizei width
, GLsizei height
, GLsizei depth
,
3853 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3855 GET_CURRENT_CONTEXT(ctx
);
3856 if (target
== GL_PROXY_TEXTURE_3D
) {
3857 /* don't compile, execute immediately */
3858 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3859 height
, depth
, border
, format
, type
,
3864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3865 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3869 n
[3].i
= (GLint
) internalFormat
;
3870 n
[4].i
= (GLint
) width
;
3871 n
[5].i
= (GLint
) height
;
3872 n
[6].i
= (GLint
) depth
;
3876 save_pointer(&n
[10],
3877 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3878 pixels
, &ctx
->Unpack
));
3880 if (ctx
->ExecuteFlag
) {
3881 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3882 height
, depth
, border
, format
, type
,
3889 static void GLAPIENTRY
3890 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3891 GLsizei width
, GLenum format
, GLenum type
,
3892 const GLvoid
* pixels
)
3894 GET_CURRENT_CONTEXT(ctx
);
3897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3899 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
3904 n
[4].i
= (GLint
) width
;
3908 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3909 pixels
, &ctx
->Unpack
));
3911 if (ctx
->ExecuteFlag
) {
3912 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3913 format
, type
, pixels
));
3918 static void GLAPIENTRY
3919 save_TexSubImage2D(GLenum target
, GLint level
,
3920 GLint xoffset
, GLint yoffset
,
3921 GLsizei width
, GLsizei height
,
3922 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3924 GET_CURRENT_CONTEXT(ctx
);
3927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3929 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
3935 n
[5].i
= (GLint
) width
;
3936 n
[6].i
= (GLint
) height
;
3940 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3941 pixels
, &ctx
->Unpack
));
3943 if (ctx
->ExecuteFlag
) {
3944 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3945 width
, height
, format
, type
, pixels
));
3950 static void GLAPIENTRY
3951 save_TexSubImage3D(GLenum target
, GLint level
,
3952 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3953 GLsizei width
, GLsizei height
, GLsizei depth
,
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_IMAGE3D
, 10 + POINTER_DWORDS
);
3968 n
[6].i
= (GLint
) width
;
3969 n
[7].i
= (GLint
) height
;
3970 n
[8].i
= (GLint
) depth
;
3973 save_pointer(&n
[11],
3974 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3975 pixels
, &ctx
->Unpack
));
3977 if (ctx
->ExecuteFlag
) {
3978 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
3979 xoffset
, yoffset
, zoffset
,
3980 width
, height
, depth
, format
, type
,
3986 static void GLAPIENTRY
3987 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
3989 GET_CURRENT_CONTEXT(ctx
);
3991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3992 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
3998 if (ctx
->ExecuteFlag
) {
3999 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4004 static void GLAPIENTRY
4005 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4007 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4012 static void GLAPIENTRY
4013 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4015 GET_CURRENT_CONTEXT(ctx
);
4017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4018 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4022 n
[3].i
= (GLint
) width
;
4023 n
[4].i
= (GLint
) height
;
4025 if (ctx
->ExecuteFlag
) {
4026 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4031 static void GLAPIENTRY
4032 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4034 GET_CURRENT_CONTEXT(ctx
);
4036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4037 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4044 if (ctx
->ExecuteFlag
) {
4045 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4049 static void GLAPIENTRY
4050 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4052 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4055 static void GLAPIENTRY
4056 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4058 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4061 static void GLAPIENTRY
4062 save_WindowPos2iMESA(GLint x
, GLint y
)
4064 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4067 static void GLAPIENTRY
4068 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4070 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4073 static void GLAPIENTRY
4074 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4076 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4079 static void GLAPIENTRY
4080 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4082 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4085 static void GLAPIENTRY
4086 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4088 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4091 static void GLAPIENTRY
4092 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4094 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4097 static void GLAPIENTRY
4098 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4100 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4103 static void GLAPIENTRY
4104 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4106 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4109 static void GLAPIENTRY
4110 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4112 save_WindowPos4fMESA(x
, y
, z
, w
);
4115 static void GLAPIENTRY
4116 save_WindowPos2dvMESA(const GLdouble
* v
)
4118 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4121 static void GLAPIENTRY
4122 save_WindowPos2fvMESA(const GLfloat
* v
)
4124 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4127 static void GLAPIENTRY
4128 save_WindowPos2ivMESA(const GLint
* v
)
4130 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4133 static void GLAPIENTRY
4134 save_WindowPos2svMESA(const GLshort
* v
)
4136 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4139 static void GLAPIENTRY
4140 save_WindowPos3dvMESA(const GLdouble
* v
)
4142 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4145 static void GLAPIENTRY
4146 save_WindowPos3fvMESA(const GLfloat
* v
)
4148 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4151 static void GLAPIENTRY
4152 save_WindowPos3ivMESA(const GLint
* v
)
4154 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4157 static void GLAPIENTRY
4158 save_WindowPos3svMESA(const GLshort
* v
)
4160 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4163 static void GLAPIENTRY
4164 save_WindowPos4dvMESA(const GLdouble
* v
)
4166 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4167 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4170 static void GLAPIENTRY
4171 save_WindowPos4fvMESA(const GLfloat
* v
)
4173 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4176 static void GLAPIENTRY
4177 save_WindowPos4ivMESA(const GLint
* v
)
4179 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4180 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4183 static void GLAPIENTRY
4184 save_WindowPos4svMESA(const GLshort
* v
)
4186 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4191 /* GL_ARB_multitexture */
4192 static void GLAPIENTRY
4193 save_ActiveTextureARB(GLenum target
)
4195 GET_CURRENT_CONTEXT(ctx
);
4197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4198 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4202 if (ctx
->ExecuteFlag
) {
4203 CALL_ActiveTexture(ctx
->Exec
, (target
));
4208 /* GL_ARB_transpose_matrix */
4210 static void GLAPIENTRY
4211 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4214 _math_transposefd(tm
, m
);
4215 save_LoadMatrixf(tm
);
4219 static void GLAPIENTRY
4220 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4223 _math_transposef(tm
, m
);
4224 save_LoadMatrixf(tm
);
4228 static void GLAPIENTRY
4229 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4232 _math_transposefd(tm
, m
);
4233 save_MultMatrixf(tm
);
4237 static void GLAPIENTRY
4238 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4241 _math_transposef(tm
, m
);
4242 save_MultMatrixf(tm
);
4245 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4247 GET_CURRENT_CONTEXT(ctx
);
4253 image
= malloc(size
);
4255 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4258 memcpy(image
, data
, size
);
4264 /* GL_ARB_texture_compression */
4265 static void GLAPIENTRY
4266 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4267 GLenum internalFormat
, GLsizei width
,
4268 GLint border
, GLsizei imageSize
,
4269 const GLvoid
* data
)
4271 GET_CURRENT_CONTEXT(ctx
);
4272 if (target
== GL_PROXY_TEXTURE_1D
) {
4273 /* don't compile, execute immediately */
4274 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4275 width
, border
, imageSize
,
4280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4282 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4283 6 + POINTER_DWORDS
);
4287 n
[3].e
= internalFormat
;
4288 n
[4].i
= (GLint
) width
;
4292 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4294 if (ctx
->ExecuteFlag
) {
4295 CALL_CompressedTexImage1D(ctx
->Exec
,
4296 (target
, level
, internalFormat
, width
,
4297 border
, imageSize
, data
));
4303 static void GLAPIENTRY
4304 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4305 GLenum internalFormat
, GLsizei width
,
4306 GLsizei height
, GLint border
, GLsizei imageSize
,
4307 const GLvoid
* data
)
4309 GET_CURRENT_CONTEXT(ctx
);
4310 if (target
== GL_PROXY_TEXTURE_2D
) {
4311 /* don't compile, execute immediately */
4312 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4313 width
, height
, border
,
4318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4320 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4321 7 + POINTER_DWORDS
);
4325 n
[3].e
= internalFormat
;
4326 n
[4].i
= (GLint
) width
;
4327 n
[5].i
= (GLint
) height
;
4331 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4333 if (ctx
->ExecuteFlag
) {
4334 CALL_CompressedTexImage2D(ctx
->Exec
,
4335 (target
, level
, internalFormat
, width
,
4336 height
, border
, imageSize
, data
));
4342 static void GLAPIENTRY
4343 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4344 GLenum internalFormat
, GLsizei width
,
4345 GLsizei height
, GLsizei depth
, GLint border
,
4346 GLsizei imageSize
, const GLvoid
* data
)
4348 GET_CURRENT_CONTEXT(ctx
);
4349 if (target
== GL_PROXY_TEXTURE_3D
) {
4350 /* don't compile, execute immediately */
4351 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4352 width
, height
, depth
, border
,
4357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4359 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4360 8 + POINTER_DWORDS
);
4364 n
[3].e
= internalFormat
;
4365 n
[4].i
= (GLint
) width
;
4366 n
[5].i
= (GLint
) height
;
4367 n
[6].i
= (GLint
) depth
;
4371 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4373 if (ctx
->ExecuteFlag
) {
4374 CALL_CompressedTexImage3D(ctx
->Exec
,
4375 (target
, level
, internalFormat
, width
,
4376 height
, depth
, border
, imageSize
,
4383 static void GLAPIENTRY
4384 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4385 GLsizei width
, GLenum format
,
4386 GLsizei imageSize
, const GLvoid
* data
)
4389 GET_CURRENT_CONTEXT(ctx
);
4390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4392 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4393 6 + POINTER_DWORDS
);
4398 n
[4].i
= (GLint
) width
;
4402 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4404 if (ctx
->ExecuteFlag
) {
4405 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4406 width
, format
, imageSize
,
4412 static void GLAPIENTRY
4413 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4414 GLint yoffset
, GLsizei width
, GLsizei height
,
4415 GLenum format
, GLsizei imageSize
,
4416 const GLvoid
* data
)
4419 GET_CURRENT_CONTEXT(ctx
);
4420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4422 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4423 8 + POINTER_DWORDS
);
4429 n
[5].i
= (GLint
) width
;
4430 n
[6].i
= (GLint
) height
;
4434 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4436 if (ctx
->ExecuteFlag
) {
4437 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4438 (target
, level
, xoffset
, yoffset
, width
,
4439 height
, format
, imageSize
, data
));
4444 static void GLAPIENTRY
4445 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4446 GLint yoffset
, GLint zoffset
, GLsizei width
,
4447 GLsizei height
, GLsizei depth
, GLenum format
,
4448 GLsizei imageSize
, 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_3D
,
4455 10 + POINTER_DWORDS
);
4462 n
[6].i
= (GLint
) width
;
4463 n
[7].i
= (GLint
) height
;
4464 n
[8].i
= (GLint
) depth
;
4466 n
[10].i
= imageSize
;
4467 save_pointer(&n
[11],
4468 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4470 if (ctx
->ExecuteFlag
) {
4471 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4472 (target
, level
, xoffset
, yoffset
,
4473 zoffset
, width
, height
, depth
, format
,
4479 /* GL_ARB_multisample */
4480 static void GLAPIENTRY
4481 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4483 GET_CURRENT_CONTEXT(ctx
);
4485 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4486 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4491 if (ctx
->ExecuteFlag
) {
4492 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4498 * GL_NV_fragment_program
4500 static void GLAPIENTRY
4501 save_BindProgramNV(GLenum target
, GLuint id
)
4503 GET_CURRENT_CONTEXT(ctx
);
4505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4506 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4511 if (ctx
->ExecuteFlag
) {
4512 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4516 static void GLAPIENTRY
4517 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4518 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4520 GET_CURRENT_CONTEXT(ctx
);
4522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4523 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4532 if (ctx
->ExecuteFlag
) {
4533 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4538 static void GLAPIENTRY
4539 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4540 const GLfloat
*params
)
4542 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4543 params
[2], params
[3]);
4547 static void GLAPIENTRY
4548 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4549 const GLfloat
* params
)
4551 GET_CURRENT_CONTEXT(ctx
);
4553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4557 const GLfloat
* p
= params
;
4559 for (i
= 0 ; i
< count
; i
++) {
4560 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4573 if (ctx
->ExecuteFlag
) {
4574 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4579 static void GLAPIENTRY
4580 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4581 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4583 save_ProgramEnvParameter4fARB(target
, index
,
4585 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4589 static void GLAPIENTRY
4590 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4591 const GLdouble
*params
)
4593 save_ProgramEnvParameter4fARB(target
, index
,
4594 (GLfloat
) params
[0],
4595 (GLfloat
) params
[1],
4596 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4600 static void GLAPIENTRY
4601 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4602 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4604 GET_CURRENT_CONTEXT(ctx
);
4606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4607 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4616 if (ctx
->ExecuteFlag
) {
4617 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4622 static void GLAPIENTRY
4623 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4624 const GLfloat
*params
)
4626 GET_CURRENT_CONTEXT(ctx
);
4628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4629 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4638 if (ctx
->ExecuteFlag
) {
4639 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4644 static void GLAPIENTRY
4645 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4646 const GLfloat
*params
)
4648 GET_CURRENT_CONTEXT(ctx
);
4650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4654 const GLfloat
* p
= params
;
4656 for (i
= 0 ; i
< count
; i
++) {
4657 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4670 if (ctx
->ExecuteFlag
) {
4671 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4676 static void GLAPIENTRY
4677 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4678 GLdouble x
, GLdouble y
,
4679 GLdouble z
, GLdouble w
)
4681 GET_CURRENT_CONTEXT(ctx
);
4683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4684 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4688 n
[3].f
= (GLfloat
) x
;
4689 n
[4].f
= (GLfloat
) y
;
4690 n
[5].f
= (GLfloat
) z
;
4691 n
[6].f
= (GLfloat
) w
;
4693 if (ctx
->ExecuteFlag
) {
4694 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4699 static void GLAPIENTRY
4700 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4701 const GLdouble
*params
)
4703 GET_CURRENT_CONTEXT(ctx
);
4705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4706 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4710 n
[3].f
= (GLfloat
) params
[0];
4711 n
[4].f
= (GLfloat
) params
[1];
4712 n
[5].f
= (GLfloat
) params
[2];
4713 n
[6].f
= (GLfloat
) params
[3];
4715 if (ctx
->ExecuteFlag
) {
4716 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4721 /* GL_EXT_stencil_two_side */
4722 static void GLAPIENTRY
4723 save_ActiveStencilFaceEXT(GLenum face
)
4725 GET_CURRENT_CONTEXT(ctx
);
4727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4728 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4732 if (ctx
->ExecuteFlag
) {
4733 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4738 /* GL_EXT_depth_bounds_test */
4739 static void GLAPIENTRY
4740 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4742 GET_CURRENT_CONTEXT(ctx
);
4744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4745 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4747 n
[1].f
= (GLfloat
) zmin
;
4748 n
[2].f
= (GLfloat
) zmax
;
4750 if (ctx
->ExecuteFlag
) {
4751 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4757 static void GLAPIENTRY
4758 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4759 const GLvoid
* string
)
4761 GET_CURRENT_CONTEXT(ctx
);
4764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4766 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4768 GLubyte
*programCopy
= malloc(len
);
4770 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4773 memcpy(programCopy
, string
, len
);
4777 save_pointer(&n
[4], programCopy
);
4779 if (ctx
->ExecuteFlag
) {
4780 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4785 static void GLAPIENTRY
4786 save_BeginQueryARB(GLenum target
, GLuint id
)
4788 GET_CURRENT_CONTEXT(ctx
);
4790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4791 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4796 if (ctx
->ExecuteFlag
) {
4797 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4801 static void GLAPIENTRY
4802 save_EndQueryARB(GLenum target
)
4804 GET_CURRENT_CONTEXT(ctx
);
4806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4807 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4811 if (ctx
->ExecuteFlag
) {
4812 CALL_EndQuery(ctx
->Exec
, (target
));
4816 static void GLAPIENTRY
4817 save_QueryCounter(GLuint id
, GLenum target
)
4819 GET_CURRENT_CONTEXT(ctx
);
4821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4822 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4827 if (ctx
->ExecuteFlag
) {
4828 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4832 static void GLAPIENTRY
4833 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4835 GET_CURRENT_CONTEXT(ctx
);
4837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4838 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4844 if (ctx
->ExecuteFlag
) {
4845 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4849 static void GLAPIENTRY
4850 save_EndQueryIndexed(GLenum target
, GLuint index
)
4852 GET_CURRENT_CONTEXT(ctx
);
4854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4855 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4860 if (ctx
->ExecuteFlag
) {
4861 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4866 static void GLAPIENTRY
4867 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4869 GET_CURRENT_CONTEXT(ctx
);
4871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4872 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4876 if (count
> MAX_DRAW_BUFFERS
)
4877 count
= MAX_DRAW_BUFFERS
;
4878 for (i
= 0; i
< count
; i
++) {
4879 n
[2 + i
].e
= buffers
[i
];
4882 if (ctx
->ExecuteFlag
) {
4883 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4887 static void GLAPIENTRY
4888 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4890 GET_CURRENT_CONTEXT(ctx
);
4893 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4901 if (ctx
->ExecuteFlag
) {
4902 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4906 static void GLAPIENTRY
4907 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4910 p
[0] = INT_TO_FLOAT(param
[0]);
4911 p
[1] = INT_TO_FLOAT(param
[1]);
4912 p
[2] = INT_TO_FLOAT(param
[2]);
4913 p
[3] = INT_TO_FLOAT(param
[3]);
4914 save_TexBumpParameterfvATI(pname
, p
);
4917 static void GLAPIENTRY
4918 save_BindFragmentShaderATI(GLuint id
)
4920 GET_CURRENT_CONTEXT(ctx
);
4923 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4927 if (ctx
->ExecuteFlag
) {
4928 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4932 static void GLAPIENTRY
4933 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4935 GET_CURRENT_CONTEXT(ctx
);
4938 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4946 if (ctx
->ExecuteFlag
) {
4947 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4951 static void GLAPIENTRY
4952 save_Attr1fNV(GLenum attr
, GLfloat x
)
4954 GET_CURRENT_CONTEXT(ctx
);
4956 SAVE_FLUSH_VERTICES(ctx
);
4957 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4963 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4964 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4965 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4967 if (ctx
->ExecuteFlag
) {
4968 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
4972 static void GLAPIENTRY
4973 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
4975 GET_CURRENT_CONTEXT(ctx
);
4977 SAVE_FLUSH_VERTICES(ctx
);
4978 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
4985 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4986 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
4987 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
4989 if (ctx
->ExecuteFlag
) {
4990 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
4994 static void GLAPIENTRY
4995 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
4997 GET_CURRENT_CONTEXT(ctx
);
4999 SAVE_FLUSH_VERTICES(ctx
);
5000 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5008 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5009 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5010 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5012 if (ctx
->ExecuteFlag
) {
5013 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5017 static void GLAPIENTRY
5018 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5020 GET_CURRENT_CONTEXT(ctx
);
5022 SAVE_FLUSH_VERTICES(ctx
);
5023 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5032 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5033 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5034 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5036 if (ctx
->ExecuteFlag
) {
5037 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5042 static void GLAPIENTRY
5043 save_Attr1fARB(GLenum attr
, GLfloat x
)
5045 GET_CURRENT_CONTEXT(ctx
);
5047 SAVE_FLUSH_VERTICES(ctx
);
5048 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5054 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5055 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5056 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5058 if (ctx
->ExecuteFlag
) {
5059 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5063 static void GLAPIENTRY
5064 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5066 GET_CURRENT_CONTEXT(ctx
);
5068 SAVE_FLUSH_VERTICES(ctx
);
5069 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5076 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5077 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5078 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5080 if (ctx
->ExecuteFlag
) {
5081 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5085 static void GLAPIENTRY
5086 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5088 GET_CURRENT_CONTEXT(ctx
);
5090 SAVE_FLUSH_VERTICES(ctx
);
5091 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5099 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5100 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5101 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5103 if (ctx
->ExecuteFlag
) {
5104 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5108 static void GLAPIENTRY
5109 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5111 GET_CURRENT_CONTEXT(ctx
);
5113 SAVE_FLUSH_VERTICES(ctx
);
5114 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5123 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5124 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5125 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5127 if (ctx
->ExecuteFlag
) {
5128 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5133 static void GLAPIENTRY
5134 save_EvalCoord1f(GLfloat x
)
5136 GET_CURRENT_CONTEXT(ctx
);
5138 SAVE_FLUSH_VERTICES(ctx
);
5139 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5143 if (ctx
->ExecuteFlag
) {
5144 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5148 static void GLAPIENTRY
5149 save_EvalCoord1fv(const GLfloat
* v
)
5151 save_EvalCoord1f(v
[0]);
5154 static void GLAPIENTRY
5155 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5157 GET_CURRENT_CONTEXT(ctx
);
5159 SAVE_FLUSH_VERTICES(ctx
);
5160 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5165 if (ctx
->ExecuteFlag
) {
5166 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5170 static void GLAPIENTRY
5171 save_EvalCoord2fv(const GLfloat
* v
)
5173 save_EvalCoord2f(v
[0], v
[1]);
5177 static void GLAPIENTRY
5178 save_EvalPoint1(GLint x
)
5180 GET_CURRENT_CONTEXT(ctx
);
5182 SAVE_FLUSH_VERTICES(ctx
);
5183 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5187 if (ctx
->ExecuteFlag
) {
5188 CALL_EvalPoint1(ctx
->Exec
, (x
));
5192 static void GLAPIENTRY
5193 save_EvalPoint2(GLint x
, GLint y
)
5195 GET_CURRENT_CONTEXT(ctx
);
5197 SAVE_FLUSH_VERTICES(ctx
);
5198 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5203 if (ctx
->ExecuteFlag
) {
5204 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5208 static void GLAPIENTRY
5209 save_Indexf(GLfloat x
)
5211 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5214 static void GLAPIENTRY
5215 save_Indexfv(const GLfloat
* v
)
5217 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5220 static void GLAPIENTRY
5221 save_EdgeFlag(GLboolean x
)
5223 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5228 * Compare 'count' elements of vectors 'a' and 'b'.
5229 * \return GL_TRUE if equal, GL_FALSE if different.
5231 static inline GLboolean
5232 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5234 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5239 * This glMaterial function is used for glMaterial calls that are outside
5240 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5242 static void GLAPIENTRY
5243 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5245 GET_CURRENT_CONTEXT(ctx
);
5253 case GL_FRONT_AND_BACK
:
5256 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5265 case GL_AMBIENT_AND_DIFFUSE
:
5271 case GL_COLOR_INDEXES
:
5275 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5283 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5285 /* Try to eliminate redundant statechanges. Because it is legal to
5286 * call glMaterial even inside begin/end calls, don't need to worry
5287 * about ctx->Driver.CurrentSavePrimitive here.
5289 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5290 if (bitmask
& (1 << i
)) {
5291 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5292 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5293 /* no change in material value */
5294 bitmask
&= ~(1 << i
);
5297 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5298 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5303 /* If this call has no effect, return early */
5307 SAVE_FLUSH_VERTICES(ctx
);
5309 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5313 for (i
= 0; i
< args
; i
++)
5314 n
[3 + i
].f
= param
[i
];
5318 static void GLAPIENTRY
5319 save_Begin(GLenum mode
)
5321 GET_CURRENT_CONTEXT(ctx
);
5323 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5324 /* compile this error into the display list */
5325 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5327 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5328 /* compile this error into the display list */
5329 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5334 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5336 /* Give the driver an opportunity to hook in an optimized
5337 * display list compiler.
5339 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5342 SAVE_FLUSH_VERTICES(ctx
);
5343 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5348 if (ctx
->ExecuteFlag
) {
5349 CALL_Begin(ctx
->Exec
, (mode
));
5354 static void GLAPIENTRY
5357 GET_CURRENT_CONTEXT(ctx
);
5358 SAVE_FLUSH_VERTICES(ctx
);
5359 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5360 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5361 if (ctx
->ExecuteFlag
) {
5362 CALL_End(ctx
->Exec
, ());
5366 static void GLAPIENTRY
5367 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5369 GET_CURRENT_CONTEXT(ctx
);
5371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5372 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5379 if (ctx
->ExecuteFlag
) {
5380 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5385 static void GLAPIENTRY
5386 save_Vertex2f(GLfloat x
, GLfloat y
)
5388 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5391 static void GLAPIENTRY
5392 save_Vertex2fv(const GLfloat
* v
)
5394 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5397 static void GLAPIENTRY
5398 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5400 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5403 static void GLAPIENTRY
5404 save_Vertex3fv(const GLfloat
* v
)
5406 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5409 static void GLAPIENTRY
5410 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5412 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5415 static void GLAPIENTRY
5416 save_Vertex4fv(const GLfloat
* v
)
5418 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5421 static void GLAPIENTRY
5422 save_TexCoord1f(GLfloat x
)
5424 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5427 static void GLAPIENTRY
5428 save_TexCoord1fv(const GLfloat
* v
)
5430 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5433 static void GLAPIENTRY
5434 save_TexCoord2f(GLfloat x
, GLfloat y
)
5436 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5439 static void GLAPIENTRY
5440 save_TexCoord2fv(const GLfloat
* v
)
5442 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5445 static void GLAPIENTRY
5446 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5448 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5451 static void GLAPIENTRY
5452 save_TexCoord3fv(const GLfloat
* v
)
5454 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5457 static void GLAPIENTRY
5458 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5460 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5463 static void GLAPIENTRY
5464 save_TexCoord4fv(const GLfloat
* v
)
5466 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5469 static void GLAPIENTRY
5470 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5472 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5475 static void GLAPIENTRY
5476 save_Normal3fv(const GLfloat
* v
)
5478 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5481 static void GLAPIENTRY
5482 save_FogCoordfEXT(GLfloat x
)
5484 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5487 static void GLAPIENTRY
5488 save_FogCoordfvEXT(const GLfloat
* v
)
5490 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5493 static void GLAPIENTRY
5494 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5496 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5499 static void GLAPIENTRY
5500 save_Color3fv(const GLfloat
* v
)
5502 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5505 static void GLAPIENTRY
5506 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5508 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5511 static void GLAPIENTRY
5512 save_Color4fv(const GLfloat
* v
)
5514 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5517 static void GLAPIENTRY
5518 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5520 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5523 static void GLAPIENTRY
5524 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5526 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5530 /* Just call the respective ATTR for texcoord
5532 static void GLAPIENTRY
5533 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5535 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5536 save_Attr1fNV(attr
, x
);
5539 static void GLAPIENTRY
5540 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5542 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5543 save_Attr1fNV(attr
, v
[0]);
5546 static void GLAPIENTRY
5547 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5549 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5550 save_Attr2fNV(attr
, x
, y
);
5553 static void GLAPIENTRY
5554 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5556 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5557 save_Attr2fNV(attr
, v
[0], v
[1]);
5560 static void GLAPIENTRY
5561 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5563 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5564 save_Attr3fNV(attr
, x
, y
, z
);
5567 static void GLAPIENTRY
5568 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5570 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5571 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5574 static void GLAPIENTRY
5575 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5576 GLfloat z
, GLfloat w
)
5578 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5579 save_Attr4fNV(attr
, x
, y
, z
, w
);
5582 static void GLAPIENTRY
5583 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5585 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5586 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5591 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5597 GET_CURRENT_CONTEXT(ctx
);
5598 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5603 static void GLAPIENTRY
5604 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5606 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5607 save_Attr1fARB(index
, x
);
5612 static void GLAPIENTRY
5613 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5615 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5616 save_Attr1fARB(index
, v
[0]);
5621 static void GLAPIENTRY
5622 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5624 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5625 save_Attr2fARB(index
, x
, y
);
5630 static void GLAPIENTRY
5631 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5633 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5634 save_Attr2fARB(index
, v
[0], v
[1]);
5639 static void GLAPIENTRY
5640 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5642 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5643 save_Attr3fARB(index
, x
, y
, z
);
5648 static void GLAPIENTRY
5649 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5651 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5652 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5657 static void GLAPIENTRY
5658 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5661 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5662 save_Attr4fARB(index
, x
, y
, z
, w
);
5667 static void GLAPIENTRY
5668 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5670 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5671 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5676 static void GLAPIENTRY
5677 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5678 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5679 GLbitfield mask
, GLenum filter
)
5681 GET_CURRENT_CONTEXT(ctx
);
5683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5684 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5697 if (ctx
->ExecuteFlag
) {
5698 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5699 dstX0
, dstY0
, dstX1
, dstY1
,
5705 /** GL_EXT_provoking_vertex */
5706 static void GLAPIENTRY
5707 save_ProvokingVertexEXT(GLenum mode
)
5709 GET_CURRENT_CONTEXT(ctx
);
5711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5712 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5716 if (ctx
->ExecuteFlag
) {
5717 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5718 _mesa_ProvokingVertex(mode
);
5723 /** GL_EXT_transform_feedback */
5724 static void GLAPIENTRY
5725 save_BeginTransformFeedback(GLenum mode
)
5727 GET_CURRENT_CONTEXT(ctx
);
5729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5730 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5734 if (ctx
->ExecuteFlag
) {
5735 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5740 /** GL_EXT_transform_feedback */
5741 static void GLAPIENTRY
5742 save_EndTransformFeedback(void)
5744 GET_CURRENT_CONTEXT(ctx
);
5745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5746 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5747 if (ctx
->ExecuteFlag
) {
5748 CALL_EndTransformFeedback(ctx
->Exec
, ());
5752 static void GLAPIENTRY
5753 save_BindTransformFeedback(GLenum target
, GLuint name
)
5755 GET_CURRENT_CONTEXT(ctx
);
5757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5758 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5763 if (ctx
->ExecuteFlag
) {
5764 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5768 static void GLAPIENTRY
5769 save_PauseTransformFeedback(void)
5771 GET_CURRENT_CONTEXT(ctx
);
5772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5773 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5774 if (ctx
->ExecuteFlag
) {
5775 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5779 static void GLAPIENTRY
5780 save_ResumeTransformFeedback(void)
5782 GET_CURRENT_CONTEXT(ctx
);
5783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5784 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5785 if (ctx
->ExecuteFlag
) {
5786 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5790 static void GLAPIENTRY
5791 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5793 GET_CURRENT_CONTEXT(ctx
);
5795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5796 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5801 if (ctx
->ExecuteFlag
) {
5802 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5806 static void GLAPIENTRY
5807 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5809 GET_CURRENT_CONTEXT(ctx
);
5811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5812 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5818 if (ctx
->ExecuteFlag
) {
5819 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5823 static void GLAPIENTRY
5824 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5827 GET_CURRENT_CONTEXT(ctx
);
5829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5830 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5834 n
[3].si
= primcount
;
5836 if (ctx
->ExecuteFlag
) {
5837 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5841 static void GLAPIENTRY
5842 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5843 GLuint stream
, GLsizei primcount
)
5845 GET_CURRENT_CONTEXT(ctx
);
5847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5848 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5853 n
[4].si
= primcount
;
5855 if (ctx
->ExecuteFlag
) {
5856 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5861 /* aka UseProgram() */
5862 static void GLAPIENTRY
5863 save_UseProgramObjectARB(GLhandleARB program
)
5865 GET_CURRENT_CONTEXT(ctx
);
5867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5868 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5872 if (ctx
->ExecuteFlag
) {
5873 CALL_UseProgram(ctx
->Exec
, (program
));
5878 static void GLAPIENTRY
5879 save_Uniform1fARB(GLint location
, GLfloat x
)
5881 GET_CURRENT_CONTEXT(ctx
);
5883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5884 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5889 if (ctx
->ExecuteFlag
) {
5890 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5895 static void GLAPIENTRY
5896 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5898 GET_CURRENT_CONTEXT(ctx
);
5900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5901 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5907 if (ctx
->ExecuteFlag
) {
5908 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5913 static void GLAPIENTRY
5914 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5916 GET_CURRENT_CONTEXT(ctx
);
5918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5919 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5926 if (ctx
->ExecuteFlag
) {
5927 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5932 static void GLAPIENTRY
5933 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5935 GET_CURRENT_CONTEXT(ctx
);
5937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5938 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5946 if (ctx
->ExecuteFlag
) {
5947 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5952 static void GLAPIENTRY
5953 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5955 GET_CURRENT_CONTEXT(ctx
);
5957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5958 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
5962 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
5964 if (ctx
->ExecuteFlag
) {
5965 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
5969 static void GLAPIENTRY
5970 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5972 GET_CURRENT_CONTEXT(ctx
);
5974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5975 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
5979 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
5981 if (ctx
->ExecuteFlag
) {
5982 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
5986 static void GLAPIENTRY
5987 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5989 GET_CURRENT_CONTEXT(ctx
);
5991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5992 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
5996 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
5998 if (ctx
->ExecuteFlag
) {
5999 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6003 static void GLAPIENTRY
6004 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6006 GET_CURRENT_CONTEXT(ctx
);
6008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6009 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6013 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6015 if (ctx
->ExecuteFlag
) {
6016 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6021 static void GLAPIENTRY
6022 save_Uniform1iARB(GLint location
, GLint x
)
6024 GET_CURRENT_CONTEXT(ctx
);
6026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6027 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6032 if (ctx
->ExecuteFlag
) {
6033 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6037 static void GLAPIENTRY
6038 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6040 GET_CURRENT_CONTEXT(ctx
);
6042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6043 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6049 if (ctx
->ExecuteFlag
) {
6050 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6054 static void GLAPIENTRY
6055 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6057 GET_CURRENT_CONTEXT(ctx
);
6059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6060 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6067 if (ctx
->ExecuteFlag
) {
6068 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6072 static void GLAPIENTRY
6073 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6075 GET_CURRENT_CONTEXT(ctx
);
6077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6078 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6086 if (ctx
->ExecuteFlag
) {
6087 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6093 static void GLAPIENTRY
6094 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6096 GET_CURRENT_CONTEXT(ctx
);
6098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6099 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6103 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6105 if (ctx
->ExecuteFlag
) {
6106 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6110 static void GLAPIENTRY
6111 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6113 GET_CURRENT_CONTEXT(ctx
);
6115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6116 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6120 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6122 if (ctx
->ExecuteFlag
) {
6123 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6127 static void GLAPIENTRY
6128 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6130 GET_CURRENT_CONTEXT(ctx
);
6132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6133 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6137 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6139 if (ctx
->ExecuteFlag
) {
6140 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6144 static void GLAPIENTRY
6145 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6147 GET_CURRENT_CONTEXT(ctx
);
6149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6150 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6154 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6156 if (ctx
->ExecuteFlag
) {
6157 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6163 static void GLAPIENTRY
6164 save_Uniform1ui(GLint location
, GLuint x
)
6166 GET_CURRENT_CONTEXT(ctx
);
6168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6169 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6174 if (ctx
->ExecuteFlag
) {
6175 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6179 static void GLAPIENTRY
6180 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6182 GET_CURRENT_CONTEXT(ctx
);
6184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6185 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6191 if (ctx
->ExecuteFlag
) {
6192 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6196 static void GLAPIENTRY
6197 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6199 GET_CURRENT_CONTEXT(ctx
);
6201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6202 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6209 if (ctx
->ExecuteFlag
) {
6210 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6214 static void GLAPIENTRY
6215 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6217 GET_CURRENT_CONTEXT(ctx
);
6219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6220 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6228 if (ctx
->ExecuteFlag
) {
6229 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6235 static void GLAPIENTRY
6236 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6238 GET_CURRENT_CONTEXT(ctx
);
6240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6241 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6245 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6247 if (ctx
->ExecuteFlag
) {
6248 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6252 static void GLAPIENTRY
6253 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6255 GET_CURRENT_CONTEXT(ctx
);
6257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6258 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6262 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6264 if (ctx
->ExecuteFlag
) {
6265 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6269 static void GLAPIENTRY
6270 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6272 GET_CURRENT_CONTEXT(ctx
);
6274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6275 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6279 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6281 if (ctx
->ExecuteFlag
) {
6282 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6286 static void GLAPIENTRY
6287 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6289 GET_CURRENT_CONTEXT(ctx
);
6291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6292 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6296 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6298 if (ctx
->ExecuteFlag
) {
6299 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6305 static void GLAPIENTRY
6306 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6309 GET_CURRENT_CONTEXT(ctx
);
6311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6312 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6317 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6319 if (ctx
->ExecuteFlag
) {
6320 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6324 static void GLAPIENTRY
6325 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6328 GET_CURRENT_CONTEXT(ctx
);
6330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6331 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6336 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6338 if (ctx
->ExecuteFlag
) {
6339 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6343 static void GLAPIENTRY
6344 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6347 GET_CURRENT_CONTEXT(ctx
);
6349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6350 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6355 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6357 if (ctx
->ExecuteFlag
) {
6358 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6363 static void GLAPIENTRY
6364 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6367 GET_CURRENT_CONTEXT(ctx
);
6369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6370 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6375 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6377 if (ctx
->ExecuteFlag
) {
6378 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6382 static void GLAPIENTRY
6383 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6386 GET_CURRENT_CONTEXT(ctx
);
6388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6389 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6394 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6396 if (ctx
->ExecuteFlag
) {
6397 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6402 static void GLAPIENTRY
6403 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6406 GET_CURRENT_CONTEXT(ctx
);
6408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6409 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6414 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6416 if (ctx
->ExecuteFlag
) {
6417 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6421 static void GLAPIENTRY
6422 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6425 GET_CURRENT_CONTEXT(ctx
);
6427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6428 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6433 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6435 if (ctx
->ExecuteFlag
) {
6436 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6441 static void GLAPIENTRY
6442 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6445 GET_CURRENT_CONTEXT(ctx
);
6447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6448 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6453 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6455 if (ctx
->ExecuteFlag
) {
6456 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6460 static void GLAPIENTRY
6461 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6464 GET_CURRENT_CONTEXT(ctx
);
6466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6467 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6472 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6474 if (ctx
->ExecuteFlag
) {
6475 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6479 static void GLAPIENTRY
6480 save_ClampColorARB(GLenum target
, GLenum clamp
)
6482 GET_CURRENT_CONTEXT(ctx
);
6484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6485 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6490 if (ctx
->ExecuteFlag
) {
6491 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6495 static void GLAPIENTRY
6496 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6498 GET_CURRENT_CONTEXT(ctx
);
6500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6501 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6506 if (ctx
->ExecuteFlag
) {
6507 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6511 static void GLAPIENTRY
6512 save_ActiveProgramEXT(GLuint program
)
6514 GET_CURRENT_CONTEXT(ctx
);
6516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6517 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6521 if (ctx
->ExecuteFlag
) {
6522 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6526 /** GL_EXT_texture_integer */
6527 static void GLAPIENTRY
6528 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6530 GET_CURRENT_CONTEXT(ctx
);
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6533 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6540 if (ctx
->ExecuteFlag
) {
6541 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6545 /** GL_EXT_texture_integer */
6546 static void GLAPIENTRY
6547 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6549 GET_CURRENT_CONTEXT(ctx
);
6551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6552 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6559 if (ctx
->ExecuteFlag
) {
6560 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6564 /** GL_EXT_texture_integer */
6565 static void GLAPIENTRY
6566 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6568 GET_CURRENT_CONTEXT(ctx
);
6570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6571 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6580 if (ctx
->ExecuteFlag
) {
6581 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6585 /** GL_EXT_texture_integer */
6586 static void GLAPIENTRY
6587 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6589 GET_CURRENT_CONTEXT(ctx
);
6591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6592 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6596 n
[3].ui
= params
[0];
6597 n
[4].ui
= params
[1];
6598 n
[5].ui
= params
[2];
6599 n
[6].ui
= params
[3];
6601 if (ctx
->ExecuteFlag
) {
6602 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6606 /* GL_ARB_instanced_arrays */
6607 static void GLAPIENTRY
6608 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6610 GET_CURRENT_CONTEXT(ctx
);
6612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6613 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6618 if (ctx
->ExecuteFlag
) {
6619 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6624 /* GL_NV_texture_barrier */
6625 static void GLAPIENTRY
6626 save_TextureBarrierNV(void)
6628 GET_CURRENT_CONTEXT(ctx
);
6629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6630 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6631 if (ctx
->ExecuteFlag
) {
6632 CALL_TextureBarrierNV(ctx
->Exec
, ());
6637 /* GL_ARB_sampler_objects */
6638 static void GLAPIENTRY
6639 save_BindSampler(GLuint unit
, GLuint sampler
)
6642 GET_CURRENT_CONTEXT(ctx
);
6643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6644 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6649 if (ctx
->ExecuteFlag
) {
6650 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6654 static void GLAPIENTRY
6655 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6658 GET_CURRENT_CONTEXT(ctx
);
6659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6660 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6665 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6671 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6674 if (ctx
->ExecuteFlag
) {
6675 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6679 static void GLAPIENTRY
6680 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6684 parray
[1] = parray
[2] = parray
[3] = 0;
6685 save_SamplerParameteriv(sampler
, pname
, parray
);
6688 static void GLAPIENTRY
6689 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6692 GET_CURRENT_CONTEXT(ctx
);
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6694 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6699 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6705 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6708 if (ctx
->ExecuteFlag
) {
6709 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6713 static void GLAPIENTRY
6714 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6718 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6719 save_SamplerParameterfv(sampler
, pname
, parray
);
6722 static void GLAPIENTRY
6723 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6726 GET_CURRENT_CONTEXT(ctx
);
6727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6728 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6733 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6739 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6742 if (ctx
->ExecuteFlag
) {
6743 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6747 static void GLAPIENTRY
6748 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6751 GET_CURRENT_CONTEXT(ctx
);
6752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6753 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6757 n
[3].ui
= params
[0];
6758 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6759 n
[4].ui
= params
[1];
6760 n
[5].ui
= params
[2];
6761 n
[6].ui
= params
[3];
6764 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6767 if (ctx
->ExecuteFlag
) {
6768 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6772 /* GL_ARB_geometry_shader4 */
6773 static void GLAPIENTRY
6774 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6777 GET_CURRENT_CONTEXT(ctx
);
6778 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6779 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6785 if (ctx
->ExecuteFlag
) {
6786 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6790 static void GLAPIENTRY
6791 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6792 GLuint texture
, GLint level
)
6795 GET_CURRENT_CONTEXT(ctx
);
6796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6797 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6800 n
[2].e
= attachment
;
6804 if (ctx
->ExecuteFlag
) {
6805 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6809 static void GLAPIENTRY
6810 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6811 GLuint texture
, GLint level
, GLenum face
)
6814 GET_CURRENT_CONTEXT(ctx
);
6815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6816 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6819 n
[2].e
= attachment
;
6824 if (ctx
->ExecuteFlag
) {
6825 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6832 static void GLAPIENTRY
6833 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6836 GET_CURRENT_CONTEXT(ctx
);
6837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6838 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6840 union uint64_pair p
;
6843 n
[2].ui
= p
.uint32
[0];
6844 n
[3].ui
= p
.uint32
[1];
6845 save_pointer(&n
[4], sync
);
6847 if (ctx
->ExecuteFlag
) {
6848 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6853 /** GL_NV_conditional_render */
6854 static void GLAPIENTRY
6855 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6857 GET_CURRENT_CONTEXT(ctx
);
6859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6860 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6865 if (ctx
->ExecuteFlag
) {
6866 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6870 static void GLAPIENTRY
6871 save_EndConditionalRender(void)
6873 GET_CURRENT_CONTEXT(ctx
);
6874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6875 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6876 if (ctx
->ExecuteFlag
) {
6877 CALL_EndConditionalRender(ctx
->Exec
, ());
6881 static void GLAPIENTRY
6882 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6884 GET_CURRENT_CONTEXT(ctx
);
6886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6887 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6893 if (ctx
->ExecuteFlag
) {
6894 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6900 * Save an error-generating command into display list.
6902 * KW: Will appear in the list before the vertex buffer containing the
6903 * command that provoked the error. I don't see this as a problem.
6906 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6909 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
6912 save_pointer(&n
[2], (void *) s
);
6913 /* note: the data/string here doesn't have to be freed in
6914 * _mesa_delete_list() since the string is never dynamically
6922 * Compile an error into current display list.
6925 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6927 if (ctx
->CompileFlag
)
6928 save_error(ctx
, error
, s
);
6929 if (ctx
->ExecuteFlag
)
6930 _mesa_error(ctx
, error
, "%s", s
);
6935 * Test if ID names a display list.
6938 islist(struct gl_context
*ctx
, GLuint list
)
6940 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6950 /**********************************************************************/
6951 /* Display list execution */
6952 /**********************************************************************/
6956 * Execute a display list. Note that the ListBase offset must have already
6957 * been added before calling this function. I.e. the list argument is
6958 * the absolute list number, not relative to ListBase.
6959 * \param list - display list number
6962 execute_list(struct gl_context
*ctx
, GLuint list
)
6964 struct gl_display_list
*dlist
;
6968 if (list
== 0 || !islist(ctx
, list
))
6971 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
6972 /* raise an error? */
6976 dlist
= _mesa_lookup_list(ctx
, list
);
6980 ctx
->ListState
.CallDepth
++;
6982 if (ctx
->Driver
.BeginCallList
)
6983 ctx
->Driver
.BeginCallList(ctx
, dlist
);
6989 const OpCode opcode
= n
[0].opcode
;
6991 if (is_ext_opcode(opcode
)) {
6992 n
+= ext_opcode_execute(ctx
, n
);
6997 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7000 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7002 case OPCODE_ALPHA_FUNC
:
7003 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7005 case OPCODE_BIND_TEXTURE
:
7006 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7010 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7011 ctx
->Unpack
= ctx
->DefaultPacking
;
7012 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7013 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7014 get_pointer(&n
[7])));
7015 ctx
->Unpack
= save
; /* restore */
7018 case OPCODE_BLEND_COLOR
:
7019 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7021 case OPCODE_BLEND_EQUATION
:
7022 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7024 case OPCODE_BLEND_EQUATION_SEPARATE
:
7025 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7027 case OPCODE_BLEND_FUNC_SEPARATE
:
7028 CALL_BlendFuncSeparate(ctx
->Exec
,
7029 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7032 case OPCODE_BLEND_FUNC_I
:
7033 /* GL_ARB_draw_buffers_blend */
7034 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7036 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7037 /* GL_ARB_draw_buffers_blend */
7038 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7041 case OPCODE_BLEND_EQUATION_I
:
7042 /* GL_ARB_draw_buffers_blend */
7043 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7045 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7046 /* GL_ARB_draw_buffers_blend */
7047 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7048 (n
[1].ui
, n
[2].e
, n
[3].e
));
7051 case OPCODE_CALL_LIST
:
7052 /* Generated by glCallList(), don't add ListBase */
7053 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7054 execute_list(ctx
, n
[1].ui
);
7057 case OPCODE_CALL_LIST_OFFSET
:
7058 /* Generated by glCallLists() so we must add ListBase */
7060 /* user specified a bad data type at compile time */
7061 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7063 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7064 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7065 execute_list(ctx
, list
);
7069 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7071 case OPCODE_CLEAR_BUFFER_IV
:
7078 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7081 case OPCODE_CLEAR_BUFFER_UIV
:
7088 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7091 case OPCODE_CLEAR_BUFFER_FV
:
7098 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7101 case OPCODE_CLEAR_BUFFER_FI
:
7102 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7104 case OPCODE_CLEAR_COLOR
:
7105 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7107 case OPCODE_CLEAR_ACCUM
:
7108 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7110 case OPCODE_CLEAR_DEPTH
:
7111 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7113 case OPCODE_CLEAR_INDEX
:
7114 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7116 case OPCODE_CLEAR_STENCIL
:
7117 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7119 case OPCODE_CLIP_PLANE
:
7126 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7129 case OPCODE_COLOR_MASK
:
7130 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7132 case OPCODE_COLOR_MASK_INDEXED
:
7133 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7136 case OPCODE_COLOR_MATERIAL
:
7137 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7139 case OPCODE_COPY_PIXELS
:
7140 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7141 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7144 case OPCODE_COPY_TEX_IMAGE1D
:
7145 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7146 n
[5].i
, n
[6].i
, n
[7].i
));
7148 case OPCODE_COPY_TEX_IMAGE2D
:
7149 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7150 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7152 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7153 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7154 n
[4].i
, n
[5].i
, n
[6].i
));
7156 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7157 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7158 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7161 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7162 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7163 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7166 case OPCODE_CULL_FACE
:
7167 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7169 case OPCODE_DEPTH_FUNC
:
7170 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7172 case OPCODE_DEPTH_MASK
:
7173 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7175 case OPCODE_DEPTH_RANGE
:
7176 CALL_DepthRange(ctx
->Exec
,
7177 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7179 case OPCODE_DISABLE
:
7180 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7182 case OPCODE_DISABLE_INDEXED
:
7183 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7185 case OPCODE_DRAW_BUFFER
:
7186 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7188 case OPCODE_DRAW_PIXELS
:
7190 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7191 ctx
->Unpack
= ctx
->DefaultPacking
;
7192 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7193 get_pointer(&n
[5])));
7194 ctx
->Unpack
= save
; /* restore */
7198 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7200 case OPCODE_ENABLE_INDEXED
:
7201 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7203 case OPCODE_EVALMESH1
:
7204 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7206 case OPCODE_EVALMESH2
:
7207 CALL_EvalMesh2(ctx
->Exec
,
7208 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7217 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7220 case OPCODE_FRONT_FACE
:
7221 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7223 case OPCODE_FRUSTUM
:
7224 CALL_Frustum(ctx
->Exec
,
7225 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7228 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7230 case OPCODE_INDEX_MASK
:
7231 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7233 case OPCODE_INIT_NAMES
:
7234 CALL_InitNames(ctx
->Exec
, ());
7243 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7246 case OPCODE_LIGHT_MODEL
:
7253 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7256 case OPCODE_LINE_STIPPLE
:
7257 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7259 case OPCODE_LINE_WIDTH
:
7260 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7262 case OPCODE_LIST_BASE
:
7263 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7265 case OPCODE_LOAD_IDENTITY
:
7266 CALL_LoadIdentity(ctx
->Exec
, ());
7268 case OPCODE_LOAD_MATRIX
:
7269 if (sizeof(Node
) == sizeof(GLfloat
)) {
7270 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7275 for (i
= 0; i
< 16; i
++) {
7278 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7281 case OPCODE_LOAD_NAME
:
7282 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7284 case OPCODE_LOGIC_OP
:
7285 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7289 GLenum target
= n
[1].e
;
7290 GLint ustride
= _mesa_evaluator_components(target
);
7291 GLint uorder
= n
[5].i
;
7292 GLfloat u1
= n
[2].f
;
7293 GLfloat u2
= n
[3].f
;
7294 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7295 (GLfloat
*) get_pointer(&n
[6])));
7300 GLenum target
= n
[1].e
;
7301 GLfloat u1
= n
[2].f
;
7302 GLfloat u2
= n
[3].f
;
7303 GLfloat v1
= n
[4].f
;
7304 GLfloat v2
= n
[5].f
;
7305 GLint ustride
= n
[6].i
;
7306 GLint vstride
= n
[7].i
;
7307 GLint uorder
= n
[8].i
;
7308 GLint vorder
= n
[9].i
;
7309 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7310 v1
, v2
, vstride
, vorder
,
7311 (GLfloat
*) get_pointer(&n
[10])));
7314 case OPCODE_MAPGRID1
:
7315 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7317 case OPCODE_MAPGRID2
:
7318 CALL_MapGrid2f(ctx
->Exec
,
7319 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7321 case OPCODE_MATRIX_MODE
:
7322 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7324 case OPCODE_MULT_MATRIX
:
7325 if (sizeof(Node
) == sizeof(GLfloat
)) {
7326 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7331 for (i
= 0; i
< 16; i
++) {
7334 CALL_MultMatrixf(ctx
->Exec
, (m
));
7338 CALL_Ortho(ctx
->Exec
,
7339 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7341 case OPCODE_PASSTHROUGH
:
7342 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7344 case OPCODE_PIXEL_MAP
:
7345 CALL_PixelMapfv(ctx
->Exec
,
7346 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
7348 case OPCODE_PIXEL_TRANSFER
:
7349 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7351 case OPCODE_PIXEL_ZOOM
:
7352 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7354 case OPCODE_POINT_SIZE
:
7355 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7357 case OPCODE_POINT_PARAMETERS
:
7363 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7366 case OPCODE_POLYGON_MODE
:
7367 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7369 case OPCODE_POLYGON_STIPPLE
:
7371 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7372 ctx
->Unpack
= ctx
->DefaultPacking
;
7373 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
7374 ctx
->Unpack
= save
; /* restore */
7377 case OPCODE_POLYGON_OFFSET
:
7378 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7380 case OPCODE_POP_ATTRIB
:
7381 CALL_PopAttrib(ctx
->Exec
, ());
7383 case OPCODE_POP_MATRIX
:
7384 CALL_PopMatrix(ctx
->Exec
, ());
7386 case OPCODE_POP_NAME
:
7387 CALL_PopName(ctx
->Exec
, ());
7389 case OPCODE_PRIORITIZE_TEXTURE
:
7390 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7392 case OPCODE_PUSH_ATTRIB
:
7393 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7395 case OPCODE_PUSH_MATRIX
:
7396 CALL_PushMatrix(ctx
->Exec
, ());
7398 case OPCODE_PUSH_NAME
:
7399 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7401 case OPCODE_RASTER_POS
:
7402 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7404 case OPCODE_READ_BUFFER
:
7405 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7408 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7411 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7413 case OPCODE_SCISSOR
:
7414 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7416 case OPCODE_SHADE_MODEL
:
7417 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7419 case OPCODE_PROVOKING_VERTEX
:
7420 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7422 case OPCODE_STENCIL_FUNC
:
7423 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7425 case OPCODE_STENCIL_MASK
:
7426 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7428 case OPCODE_STENCIL_OP
:
7429 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7431 case OPCODE_STENCIL_FUNC_SEPARATE
:
7432 CALL_StencilFuncSeparate(ctx
->Exec
,
7433 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7435 case OPCODE_STENCIL_MASK_SEPARATE
:
7436 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7438 case OPCODE_STENCIL_OP_SEPARATE
:
7439 CALL_StencilOpSeparate(ctx
->Exec
,
7440 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7449 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7459 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7462 case OPCODE_TEXPARAMETER
:
7469 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7472 case OPCODE_TEX_IMAGE1D
:
7474 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7475 ctx
->Unpack
= ctx
->DefaultPacking
;
7476 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7478 n
[3].i
, /* components */
7480 n
[5].e
, /* border */
7481 n
[6].e
, /* format */
7483 get_pointer(&n
[8])));
7484 ctx
->Unpack
= save
; /* restore */
7487 case OPCODE_TEX_IMAGE2D
:
7489 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7490 ctx
->Unpack
= ctx
->DefaultPacking
;
7491 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7493 n
[3].i
, /* components */
7495 n
[5].i
, /* height */
7496 n
[6].e
, /* border */
7497 n
[7].e
, /* format */
7499 get_pointer(&n
[9])));
7500 ctx
->Unpack
= save
; /* restore */
7503 case OPCODE_TEX_IMAGE3D
:
7505 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7506 ctx
->Unpack
= ctx
->DefaultPacking
;
7507 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7509 n
[3].i
, /* components */
7511 n
[5].i
, /* height */
7513 n
[7].e
, /* border */
7514 n
[8].e
, /* format */
7516 get_pointer(&n
[10])));
7517 ctx
->Unpack
= save
; /* restore */
7520 case OPCODE_TEX_SUB_IMAGE1D
:
7522 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7523 ctx
->Unpack
= ctx
->DefaultPacking
;
7524 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7526 n
[6].e
, get_pointer(&n
[7])));
7527 ctx
->Unpack
= save
; /* restore */
7530 case OPCODE_TEX_SUB_IMAGE2D
:
7532 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7533 ctx
->Unpack
= ctx
->DefaultPacking
;
7534 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7536 n
[6].i
, n
[7].e
, n
[8].e
,
7537 get_pointer(&n
[9])));
7538 ctx
->Unpack
= save
; /* restore */
7541 case OPCODE_TEX_SUB_IMAGE3D
:
7543 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7544 ctx
->Unpack
= ctx
->DefaultPacking
;
7545 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7546 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7547 n
[8].i
, n
[9].e
, n
[10].e
,
7548 get_pointer(&n
[11])));
7549 ctx
->Unpack
= save
; /* restore */
7552 case OPCODE_TRANSLATE
:
7553 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7555 case OPCODE_VIEWPORT
:
7556 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7557 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7559 case OPCODE_WINDOW_POS
:
7560 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7562 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7563 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7565 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7566 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7567 n
[4].i
, n
[5].i
, n
[6].i
,
7568 get_pointer(&n
[7])));
7570 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7571 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7572 n
[4].i
, n
[5].i
, n
[6].i
,
7573 n
[7].i
, get_pointer(&n
[8])));
7575 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7576 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7577 n
[4].i
, n
[5].i
, n
[6].i
,
7579 get_pointer(&n
[9])));
7581 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7582 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7583 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7585 get_pointer(&n
[7])));
7587 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7588 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7589 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7590 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7591 get_pointer(&n
[9])));
7593 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7594 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7595 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7596 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7598 get_pointer(&n
[11])));
7600 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7601 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7603 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7604 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7606 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7607 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7609 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7610 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7611 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7614 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7615 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7617 case OPCODE_DEPTH_BOUNDS_EXT
:
7618 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7620 case OPCODE_PROGRAM_STRING_ARB
:
7621 CALL_ProgramStringARB(ctx
->Exec
,
7622 (n
[1].e
, n
[2].e
, n
[3].i
,
7623 get_pointer(&n
[4])));
7625 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7626 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7630 case OPCODE_BEGIN_QUERY_ARB
:
7631 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7633 case OPCODE_END_QUERY_ARB
:
7634 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7636 case OPCODE_QUERY_COUNTER
:
7637 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7639 case OPCODE_BEGIN_QUERY_INDEXED
:
7640 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7642 case OPCODE_END_QUERY_INDEXED
:
7643 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7645 case OPCODE_DRAW_BUFFERS_ARB
:
7647 GLenum buffers
[MAX_DRAW_BUFFERS
];
7648 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7649 for (i
= 0; i
< count
; i
++)
7650 buffers
[i
] = n
[2 + i
].e
;
7651 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7654 case OPCODE_BLIT_FRAMEBUFFER
:
7655 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7656 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7659 case OPCODE_USE_PROGRAM
:
7660 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7662 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7663 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7665 case OPCODE_ACTIVE_PROGRAM_EXT
:
7666 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7668 case OPCODE_UNIFORM_1F
:
7669 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7671 case OPCODE_UNIFORM_2F
:
7672 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7674 case OPCODE_UNIFORM_3F
:
7675 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7677 case OPCODE_UNIFORM_4F
:
7678 CALL_Uniform4f(ctx
->Exec
,
7679 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7681 case OPCODE_UNIFORM_1FV
:
7682 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7684 case OPCODE_UNIFORM_2FV
:
7685 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7687 case OPCODE_UNIFORM_3FV
:
7688 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7690 case OPCODE_UNIFORM_4FV
:
7691 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7693 case OPCODE_UNIFORM_1I
:
7694 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7696 case OPCODE_UNIFORM_2I
:
7697 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7699 case OPCODE_UNIFORM_3I
:
7700 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7702 case OPCODE_UNIFORM_4I
:
7703 CALL_Uniform4i(ctx
->Exec
,
7704 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7706 case OPCODE_UNIFORM_1IV
:
7707 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7709 case OPCODE_UNIFORM_2IV
:
7710 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7712 case OPCODE_UNIFORM_3IV
:
7713 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7715 case OPCODE_UNIFORM_4IV
:
7716 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7718 case OPCODE_UNIFORM_1UI
:
7719 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7721 case OPCODE_UNIFORM_2UI
:
7722 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7724 case OPCODE_UNIFORM_3UI
:
7725 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7727 case OPCODE_UNIFORM_4UI
:
7728 /*CALL_Uniform4uiARB(ctx->Exec,
7729 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7732 case OPCODE_UNIFORM_1UIV
:
7733 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
7734 get_pointer(&n[3])));*/
7736 case OPCODE_UNIFORM_2UIV
:
7737 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
7738 get_pointer(&n[3])));*/
7740 case OPCODE_UNIFORM_3UIV
:
7741 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
7742 get_pointer(&n[3])));*/
7744 case OPCODE_UNIFORM_4UIV
:
7745 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
7746 get_pointer(&n[3])));*/
7748 case OPCODE_UNIFORM_MATRIX22
:
7749 CALL_UniformMatrix2fv(ctx
->Exec
,
7750 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7752 case OPCODE_UNIFORM_MATRIX33
:
7753 CALL_UniformMatrix3fv(ctx
->Exec
,
7754 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7756 case OPCODE_UNIFORM_MATRIX44
:
7757 CALL_UniformMatrix4fv(ctx
->Exec
,
7758 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7760 case OPCODE_UNIFORM_MATRIX23
:
7761 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7762 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7764 case OPCODE_UNIFORM_MATRIX32
:
7765 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7766 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7768 case OPCODE_UNIFORM_MATRIX24
:
7769 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7770 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7772 case OPCODE_UNIFORM_MATRIX42
:
7773 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7774 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7776 case OPCODE_UNIFORM_MATRIX34
:
7777 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7778 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7780 case OPCODE_UNIFORM_MATRIX43
:
7781 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7782 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7785 case OPCODE_CLAMP_COLOR
:
7786 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7789 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7792 GLuint i
, pname
= n
[1].ui
;
7794 for (i
= 0; i
< 4; i
++)
7795 values
[i
] = n
[1 + i
].f
;
7796 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7799 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7800 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7802 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7805 GLuint i
, dst
= n
[1].ui
;
7807 for (i
= 0; i
< 4; i
++)
7808 values
[i
] = n
[1 + i
].f
;
7809 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7812 case OPCODE_ATTR_1F_NV
:
7813 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7815 case OPCODE_ATTR_2F_NV
:
7816 /* Really shouldn't have to do this - the Node structure
7817 * is convenient, but it would be better to store the data
7818 * packed appropriately so that it can be sent directly
7819 * on. With x86_64 becoming common, this will start to
7822 if (sizeof(Node
) == sizeof(GLfloat
))
7823 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7825 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7827 case OPCODE_ATTR_3F_NV
:
7828 if (sizeof(Node
) == sizeof(GLfloat
))
7829 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7831 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7834 case OPCODE_ATTR_4F_NV
:
7835 if (sizeof(Node
) == sizeof(GLfloat
))
7836 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7838 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7841 case OPCODE_ATTR_1F_ARB
:
7842 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7844 case OPCODE_ATTR_2F_ARB
:
7845 /* Really shouldn't have to do this - the Node structure
7846 * is convenient, but it would be better to store the data
7847 * packed appropriately so that it can be sent directly
7848 * on. With x86_64 becoming common, this will start to
7851 if (sizeof(Node
) == sizeof(GLfloat
))
7852 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7854 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7856 case OPCODE_ATTR_3F_ARB
:
7857 if (sizeof(Node
) == sizeof(GLfloat
))
7858 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7860 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7863 case OPCODE_ATTR_4F_ARB
:
7864 if (sizeof(Node
) == sizeof(GLfloat
))
7865 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7867 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7870 case OPCODE_MATERIAL
:
7871 if (sizeof(Node
) == sizeof(GLfloat
))
7872 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7879 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7883 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7886 CALL_End(ctx
->Exec
, ());
7889 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7891 case OPCODE_EVAL_C1
:
7892 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7894 case OPCODE_EVAL_C2
:
7895 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7897 case OPCODE_EVAL_P1
:
7898 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7900 case OPCODE_EVAL_P2
:
7901 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7904 /* GL_EXT_texture_integer */
7905 case OPCODE_CLEARCOLOR_I
:
7906 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7908 case OPCODE_CLEARCOLOR_UI
:
7909 CALL_ClearColorIuiEXT(ctx
->Exec
,
7910 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7912 case OPCODE_TEXPARAMETER_I
:
7919 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7922 case OPCODE_TEXPARAMETER_UI
:
7925 params
[0] = n
[3].ui
;
7926 params
[1] = n
[4].ui
;
7927 params
[2] = n
[5].ui
;
7928 params
[3] = n
[6].ui
;
7929 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7933 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7934 /* GL_ARB_instanced_arrays */
7935 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7938 case OPCODE_TEXTURE_BARRIER_NV
:
7939 CALL_TextureBarrierNV(ctx
->Exec
, ());
7942 /* GL_EXT/ARB_transform_feedback */
7943 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7944 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7946 case OPCODE_END_TRANSFORM_FEEDBACK
:
7947 CALL_EndTransformFeedback(ctx
->Exec
, ());
7949 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7950 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7952 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7953 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7955 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7956 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7958 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7959 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7961 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7962 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7963 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7965 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7966 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
7967 (n
[1].e
, n
[2].ui
, n
[3].si
));
7969 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
7970 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
7971 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
7975 case OPCODE_BIND_SAMPLER
:
7976 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7978 case OPCODE_SAMPLER_PARAMETERIV
:
7985 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7988 case OPCODE_SAMPLER_PARAMETERFV
:
7995 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
7998 case OPCODE_SAMPLER_PARAMETERIIV
:
8005 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8008 case OPCODE_SAMPLER_PARAMETERUIV
:
8011 params
[0] = n
[3].ui
;
8012 params
[1] = n
[4].ui
;
8013 params
[2] = n
[5].ui
;
8014 params
[3] = n
[6].ui
;
8015 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8019 /* GL_ARB_geometry_shader4 */
8020 case OPCODE_PROGRAM_PARAMETERI
:
8021 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8023 case OPCODE_FRAMEBUFFER_TEXTURE
:
8024 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8027 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8028 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8029 n
[3].ui
, n
[4].i
, n
[5].e
));
8033 case OPCODE_WAIT_SYNC
:
8035 union uint64_pair p
;
8036 p
.uint32
[0] = n
[2].ui
;
8037 p
.uint32
[1] = n
[3].ui
;
8038 CALL_WaitSync(ctx
->Exec
,
8039 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8043 /* GL_NV_conditional_render */
8044 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8045 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8047 case OPCODE_END_CONDITIONAL_RENDER
:
8048 CALL_EndConditionalRender(ctx
->Exec
, ());
8051 case OPCODE_UNIFORM_BLOCK_BINDING
:
8052 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8055 case OPCODE_CONTINUE
:
8056 n
= (Node
*) get_pointer(&n
[1]);
8058 case OPCODE_END_OF_LIST
:
8064 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8066 _mesa_problem(ctx
, "%s", msg
);
8071 /* increment n to point to next compiled command */
8072 if (opcode
!= OPCODE_CONTINUE
) {
8073 n
+= InstSize
[opcode
];
8078 if (ctx
->Driver
.EndCallList
)
8079 ctx
->Driver
.EndCallList(ctx
);
8081 ctx
->ListState
.CallDepth
--;
8086 /**********************************************************************/
8088 /**********************************************************************/
8091 * Test if a display list number is valid.
8093 GLboolean GLAPIENTRY
8094 _mesa_IsList(GLuint list
)
8096 GET_CURRENT_CONTEXT(ctx
);
8097 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8098 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8099 return islist(ctx
, list
);
8104 * Delete a sequence of consecutive display lists.
8107 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8109 GET_CURRENT_CONTEXT(ctx
);
8111 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8112 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8115 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8118 for (i
= list
; i
< list
+ range
; i
++) {
8119 destroy_list(ctx
, i
);
8125 * Return a display list number, n, such that lists n through n+range-1
8129 _mesa_GenLists(GLsizei range
)
8131 GET_CURRENT_CONTEXT(ctx
);
8133 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8134 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8137 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8145 * Make this an atomic operation
8147 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8149 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8151 /* reserve the list IDs by with empty/dummy lists */
8153 for (i
= 0; i
< range
; i
++) {
8154 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8155 make_list(base
+ i
, 1));
8159 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8166 * Begin a new display list.
8169 _mesa_NewList(GLuint name
, GLenum mode
)
8171 GET_CURRENT_CONTEXT(ctx
);
8173 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8174 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8176 if (MESA_VERBOSE
& VERBOSE_API
)
8177 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8178 _mesa_lookup_enum_by_nr(mode
));
8181 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8185 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8186 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8190 if (ctx
->ListState
.CurrentList
) {
8191 /* already compiling a display list */
8192 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8196 ctx
->CompileFlag
= GL_TRUE
;
8197 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8199 /* Reset accumulated list state */
8200 invalidate_saved_current_state( ctx
);
8202 /* Allocate new display list */
8203 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8204 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8205 ctx
->ListState
.CurrentPos
= 0;
8207 ctx
->Driver
.NewList(ctx
, name
, mode
);
8209 ctx
->CurrentDispatch
= ctx
->Save
;
8210 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8215 * End definition of current display list.
8220 GET_CURRENT_CONTEXT(ctx
);
8221 SAVE_FLUSH_VERTICES(ctx
);
8222 FLUSH_VERTICES(ctx
, 0);
8224 if (MESA_VERBOSE
& VERBOSE_API
)
8225 _mesa_debug(ctx
, "glEndList\n");
8227 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8228 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8229 "glEndList() called inside glBegin/End");
8232 /* Check that a list is under construction */
8233 if (!ctx
->ListState
.CurrentList
) {
8234 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8238 /* Call before emitting END_OF_LIST, in case the driver wants to
8239 * emit opcodes itself.
8241 ctx
->Driver
.EndList(ctx
);
8243 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8245 /* Destroy old list, if any */
8246 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8248 /* Install the new list */
8249 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8250 ctx
->ListState
.CurrentList
->Name
,
8251 ctx
->ListState
.CurrentList
);
8254 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8255 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8257 ctx
->ListState
.CurrentList
= NULL
;
8258 ctx
->ExecuteFlag
= GL_TRUE
;
8259 ctx
->CompileFlag
= GL_FALSE
;
8261 ctx
->CurrentDispatch
= ctx
->Exec
;
8262 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8267 _mesa_CallList(GLuint list
)
8269 GLboolean save_compile_flag
;
8270 GET_CURRENT_CONTEXT(ctx
);
8271 FLUSH_CURRENT(ctx
, 0);
8273 if (MESA_VERBOSE
& VERBOSE_API
)
8274 _mesa_debug(ctx
, "glCallList %d\n", list
);
8277 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8282 mesa_print_display_list( list
);
8284 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8285 * execute the display list, and restore the CompileFlag.
8287 save_compile_flag
= ctx
->CompileFlag
;
8288 if (save_compile_flag
) {
8289 ctx
->CompileFlag
= GL_FALSE
;
8292 execute_list(ctx
, list
);
8293 ctx
->CompileFlag
= save_compile_flag
;
8295 /* also restore API function pointers to point to "save" versions */
8296 if (save_compile_flag
) {
8297 ctx
->CurrentDispatch
= ctx
->Save
;
8298 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8304 * Execute glCallLists: call multiple display lists.
8307 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8309 GET_CURRENT_CONTEXT(ctx
);
8311 GLboolean save_compile_flag
;
8313 if (MESA_VERBOSE
& VERBOSE_API
)
8314 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8318 case GL_UNSIGNED_BYTE
:
8320 case GL_UNSIGNED_SHORT
:
8322 case GL_UNSIGNED_INT
:
8330 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8334 /* Save the CompileFlag status, turn it off, execute display list,
8335 * and restore the CompileFlag.
8337 save_compile_flag
= ctx
->CompileFlag
;
8338 ctx
->CompileFlag
= GL_FALSE
;
8340 for (i
= 0; i
< n
; i
++) {
8341 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8342 execute_list(ctx
, list
);
8345 ctx
->CompileFlag
= save_compile_flag
;
8347 /* also restore API function pointers to point to "save" versions */
8348 if (save_compile_flag
) {
8349 ctx
->CurrentDispatch
= ctx
->Save
;
8350 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8356 * Set the offset added to list numbers in glCallLists.
8359 _mesa_ListBase(GLuint base
)
8361 GET_CURRENT_CONTEXT(ctx
);
8362 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8363 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8364 ctx
->List
.ListBase
= base
;
8368 * Setup the given dispatch table to point to Mesa's display list
8369 * building functions.
8371 * This does not include any of the tnl functions - they are
8372 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8376 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8378 struct _glapi_table
*table
= ctx
->Save
;
8379 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8381 /* Initially populate the dispatch table with the contents of the
8382 * normal-execution dispatch table. This lets us skip populating functions
8383 * that should be called directly instead of compiled into display lists.
8385 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8387 _mesa_loopback_init_api_table(ctx
, table
);
8390 vbo_initialize_save_dispatch(ctx
, table
);
8393 SET_Accum(table
, save_Accum
);
8394 SET_AlphaFunc(table
, save_AlphaFunc
);
8395 SET_Bitmap(table
, save_Bitmap
);
8396 SET_BlendFunc(table
, save_BlendFunc
);
8397 SET_CallList(table
, save_CallList
);
8398 SET_CallLists(table
, save_CallLists
);
8399 SET_Clear(table
, save_Clear
);
8400 SET_ClearAccum(table
, save_ClearAccum
);
8401 SET_ClearColor(table
, save_ClearColor
);
8402 SET_ClearDepth(table
, save_ClearDepth
);
8403 SET_ClearIndex(table
, save_ClearIndex
);
8404 SET_ClearStencil(table
, save_ClearStencil
);
8405 SET_ClipPlane(table
, save_ClipPlane
);
8406 SET_ColorMask(table
, save_ColorMask
);
8407 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8408 SET_ColorMaterial(table
, save_ColorMaterial
);
8409 SET_CopyPixels(table
, save_CopyPixels
);
8410 SET_CullFace(table
, save_CullFace
);
8411 SET_DepthFunc(table
, save_DepthFunc
);
8412 SET_DepthMask(table
, save_DepthMask
);
8413 SET_DepthRange(table
, save_DepthRange
);
8414 SET_Disable(table
, save_Disable
);
8415 SET_Disablei(table
, save_DisableIndexed
);
8416 SET_DrawBuffer(table
, save_DrawBuffer
);
8417 SET_DrawPixels(table
, save_DrawPixels
);
8418 SET_Enable(table
, save_Enable
);
8419 SET_Enablei(table
, save_EnableIndexed
);
8420 SET_EvalMesh1(table
, save_EvalMesh1
);
8421 SET_EvalMesh2(table
, save_EvalMesh2
);
8422 SET_Fogf(table
, save_Fogf
);
8423 SET_Fogfv(table
, save_Fogfv
);
8424 SET_Fogi(table
, save_Fogi
);
8425 SET_Fogiv(table
, save_Fogiv
);
8426 SET_FrontFace(table
, save_FrontFace
);
8427 SET_Frustum(table
, save_Frustum
);
8428 SET_Hint(table
, save_Hint
);
8429 SET_IndexMask(table
, save_IndexMask
);
8430 SET_InitNames(table
, save_InitNames
);
8431 SET_LightModelf(table
, save_LightModelf
);
8432 SET_LightModelfv(table
, save_LightModelfv
);
8433 SET_LightModeli(table
, save_LightModeli
);
8434 SET_LightModeliv(table
, save_LightModeliv
);
8435 SET_Lightf(table
, save_Lightf
);
8436 SET_Lightfv(table
, save_Lightfv
);
8437 SET_Lighti(table
, save_Lighti
);
8438 SET_Lightiv(table
, save_Lightiv
);
8439 SET_LineStipple(table
, save_LineStipple
);
8440 SET_LineWidth(table
, save_LineWidth
);
8441 SET_ListBase(table
, save_ListBase
);
8442 SET_LoadIdentity(table
, save_LoadIdentity
);
8443 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8444 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8445 SET_LoadName(table
, save_LoadName
);
8446 SET_LogicOp(table
, save_LogicOp
);
8447 SET_Map1d(table
, save_Map1d
);
8448 SET_Map1f(table
, save_Map1f
);
8449 SET_Map2d(table
, save_Map2d
);
8450 SET_Map2f(table
, save_Map2f
);
8451 SET_MapGrid1d(table
, save_MapGrid1d
);
8452 SET_MapGrid1f(table
, save_MapGrid1f
);
8453 SET_MapGrid2d(table
, save_MapGrid2d
);
8454 SET_MapGrid2f(table
, save_MapGrid2f
);
8455 SET_MatrixMode(table
, save_MatrixMode
);
8456 SET_MultMatrixd(table
, save_MultMatrixd
);
8457 SET_MultMatrixf(table
, save_MultMatrixf
);
8458 SET_NewList(table
, save_NewList
);
8459 SET_Ortho(table
, save_Ortho
);
8460 SET_PassThrough(table
, save_PassThrough
);
8461 SET_PixelMapfv(table
, save_PixelMapfv
);
8462 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8463 SET_PixelMapusv(table
, save_PixelMapusv
);
8464 SET_PixelTransferf(table
, save_PixelTransferf
);
8465 SET_PixelTransferi(table
, save_PixelTransferi
);
8466 SET_PixelZoom(table
, save_PixelZoom
);
8467 SET_PointSize(table
, save_PointSize
);
8468 SET_PolygonMode(table
, save_PolygonMode
);
8469 SET_PolygonOffset(table
, save_PolygonOffset
);
8470 SET_PolygonStipple(table
, save_PolygonStipple
);
8471 SET_PopAttrib(table
, save_PopAttrib
);
8472 SET_PopMatrix(table
, save_PopMatrix
);
8473 SET_PopName(table
, save_PopName
);
8474 SET_PushAttrib(table
, save_PushAttrib
);
8475 SET_PushMatrix(table
, save_PushMatrix
);
8476 SET_PushName(table
, save_PushName
);
8477 SET_RasterPos2d(table
, save_RasterPos2d
);
8478 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8479 SET_RasterPos2f(table
, save_RasterPos2f
);
8480 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8481 SET_RasterPos2i(table
, save_RasterPos2i
);
8482 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8483 SET_RasterPos2s(table
, save_RasterPos2s
);
8484 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8485 SET_RasterPos3d(table
, save_RasterPos3d
);
8486 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8487 SET_RasterPos3f(table
, save_RasterPos3f
);
8488 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8489 SET_RasterPos3i(table
, save_RasterPos3i
);
8490 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8491 SET_RasterPos3s(table
, save_RasterPos3s
);
8492 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8493 SET_RasterPos4d(table
, save_RasterPos4d
);
8494 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8495 SET_RasterPos4f(table
, save_RasterPos4f
);
8496 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8497 SET_RasterPos4i(table
, save_RasterPos4i
);
8498 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8499 SET_RasterPos4s(table
, save_RasterPos4s
);
8500 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8501 SET_ReadBuffer(table
, save_ReadBuffer
);
8502 SET_Rectf(table
, save_Rectf
);
8503 SET_Rotated(table
, save_Rotated
);
8504 SET_Rotatef(table
, save_Rotatef
);
8505 SET_Scaled(table
, save_Scaled
);
8506 SET_Scalef(table
, save_Scalef
);
8507 SET_Scissor(table
, save_Scissor
);
8508 SET_ShadeModel(table
, save_ShadeModel
);
8509 SET_StencilFunc(table
, save_StencilFunc
);
8510 SET_StencilMask(table
, save_StencilMask
);
8511 SET_StencilOp(table
, save_StencilOp
);
8512 SET_TexEnvf(table
, save_TexEnvf
);
8513 SET_TexEnvfv(table
, save_TexEnvfv
);
8514 SET_TexEnvi(table
, save_TexEnvi
);
8515 SET_TexEnviv(table
, save_TexEnviv
);
8516 SET_TexGend(table
, save_TexGend
);
8517 SET_TexGendv(table
, save_TexGendv
);
8518 SET_TexGenf(table
, save_TexGenf
);
8519 SET_TexGenfv(table
, save_TexGenfv
);
8520 SET_TexGeni(table
, save_TexGeni
);
8521 SET_TexGeniv(table
, save_TexGeniv
);
8522 SET_TexImage1D(table
, save_TexImage1D
);
8523 SET_TexImage2D(table
, save_TexImage2D
);
8524 SET_TexParameterf(table
, save_TexParameterf
);
8525 SET_TexParameterfv(table
, save_TexParameterfv
);
8526 SET_TexParameteri(table
, save_TexParameteri
);
8527 SET_TexParameteriv(table
, save_TexParameteriv
);
8528 SET_Translated(table
, save_Translated
);
8529 SET_Translatef(table
, save_Translatef
);
8530 SET_Viewport(table
, save_Viewport
);
8533 SET_BindTexture(table
, save_BindTexture
);
8534 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8535 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8536 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8537 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8538 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8539 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8540 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8543 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8544 SET_TexImage3D(table
, save_TexImage3D
);
8545 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8548 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8549 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8550 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8552 /* ATI_separate_stencil */
8553 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8555 /* GL_ARB_imaging */
8556 /* Not all are supported */
8557 SET_BlendColor(table
, save_BlendColor
);
8558 SET_BlendEquation(table
, save_BlendEquation
);
8560 /* 2. GL_EXT_blend_color */
8562 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8565 /* 3. GL_EXT_polygon_offset */
8566 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8568 /* 6. GL_EXT_texture3d */
8570 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8571 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8572 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8575 /* 37. GL_EXT_blend_minmax */
8577 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8580 /* 54. GL_EXT_point_parameters */
8581 SET_PointParameterf(table
, save_PointParameterfEXT
);
8582 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8584 /* 173. GL_EXT_blend_func_separate */
8585 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8587 /* 197. GL_MESA_window_pos */
8588 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8589 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8590 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8591 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8592 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8593 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8594 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8595 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8596 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8597 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8598 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8599 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8600 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8601 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8602 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8603 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8604 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8605 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8606 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8607 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8608 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8609 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8610 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8611 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8613 /* 233. GL_NV_vertex_program */
8614 /* The following commands DO NOT go into display lists:
8615 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8616 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8618 SET_BindProgramARB(table
, save_BindProgramNV
);
8620 /* 244. GL_ATI_envmap_bumpmap */
8621 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8622 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8624 /* 245. GL_ATI_fragment_shader */
8625 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8626 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8628 /* 262. GL_NV_point_sprite */
8629 SET_PointParameteri(table
, save_PointParameteriNV
);
8630 SET_PointParameteriv(table
, save_PointParameterivNV
);
8632 /* 268. GL_EXT_stencil_two_side */
8633 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8635 /* ???. GL_EXT_depth_bounds_test */
8636 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8638 /* ARB 1. GL_ARB_multitexture */
8639 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8641 /* ARB 3. GL_ARB_transpose_matrix */
8642 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8643 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8644 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8645 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8647 /* ARB 5. GL_ARB_multisample */
8648 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8650 /* ARB 12. GL_ARB_texture_compression */
8651 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8652 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8653 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8654 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8655 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8656 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8658 /* ARB 14. GL_ARB_point_parameters */
8659 /* aliased with EXT_point_parameters functions */
8661 /* ARB 25. GL_ARB_window_pos */
8662 /* aliased with MESA_window_pos functions */
8664 /* ARB 26. GL_ARB_vertex_program */
8665 /* ARB 27. GL_ARB_fragment_program */
8666 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8667 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8668 SET_BindProgramARB(table
, save_BindProgramNV
);
8669 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8670 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8671 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8672 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8673 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8674 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8675 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8676 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8678 SET_BeginQuery(table
, save_BeginQueryARB
);
8679 SET_EndQuery(table
, save_EndQueryARB
);
8680 SET_QueryCounter(table
, save_QueryCounter
);
8682 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8684 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8686 SET_UseProgram(table
, save_UseProgramObjectARB
);
8687 SET_Uniform1f(table
, save_Uniform1fARB
);
8688 SET_Uniform2f(table
, save_Uniform2fARB
);
8689 SET_Uniform3f(table
, save_Uniform3fARB
);
8690 SET_Uniform4f(table
, save_Uniform4fARB
);
8691 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8692 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8693 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8694 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8695 SET_Uniform1i(table
, save_Uniform1iARB
);
8696 SET_Uniform2i(table
, save_Uniform2iARB
);
8697 SET_Uniform3i(table
, save_Uniform3iARB
);
8698 SET_Uniform4i(table
, save_Uniform4iARB
);
8699 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8700 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8701 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8702 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8703 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8704 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8705 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8706 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8707 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8708 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8709 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8710 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8711 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8713 /* 299. GL_EXT_blend_equation_separate */
8714 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8716 /* GL_EXT_gpu_program_parameters */
8717 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8718 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8720 /* 364. GL_EXT_provoking_vertex */
8721 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8723 /* GL_EXT_texture_integer */
8724 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8725 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8726 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8727 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8729 /* 377. GL_EXT_separate_shader_objects */
8730 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8731 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8733 /* GL_ARB_color_buffer_float */
8734 SET_ClampColor(table
, save_ClampColorARB
);
8737 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8738 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8739 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8740 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8742 SET_Uniform1ui(table
, save_Uniform1ui
);
8743 SET_Uniform2ui(table
, save_Uniform2ui
);
8744 SET_Uniform3ui(table
, save_Uniform3ui
);
8745 SET_Uniform4ui(table
, save_Uniform4ui
);
8746 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8747 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8748 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8749 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8751 (void) save_Uniform1ui
;
8752 (void) save_Uniform2ui
;
8753 (void) save_Uniform3ui
;
8754 (void) save_Uniform4ui
;
8755 (void) save_Uniform1uiv
;
8756 (void) save_Uniform2uiv
;
8757 (void) save_Uniform3uiv
;
8758 (void) save_Uniform4uiv
;
8762 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8763 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8764 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8765 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8766 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8767 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8768 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8769 SET_DrawTransformFeedbackInstanced(table
,
8770 save_DrawTransformFeedbackInstanced
);
8771 SET_DrawTransformFeedbackStreamInstanced(table
,
8772 save_DrawTransformFeedbackStreamInstanced
);
8773 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8774 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8776 /* GL_ARB_instanced_arrays */
8777 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8779 /* GL_NV_texture_barrier */
8780 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8782 SET_BindSampler(table
, save_BindSampler
);
8783 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8784 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8785 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8786 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8787 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8788 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8790 /* GL_ARB_draw_buffer_blend */
8791 SET_BlendFunciARB(table
, save_BlendFunci
);
8792 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8793 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8794 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8796 /* GL_ARB_geometry_shader4 */
8797 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8798 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8799 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8801 /* GL_NV_conditional_render */
8802 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8803 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8806 SET_WaitSync(table
, save_WaitSync
);
8808 /* GL_ARB_uniform_buffer_object */
8809 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8811 /* GL_ARB_draw_instanced */
8812 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8813 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8815 /* GL_ARB_draw_elements_base_vertex */
8816 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8818 /* GL_ARB_base_instance */
8819 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8820 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8821 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8827 enum_string(GLenum k
)
8829 return _mesa_lookup_enum_by_nr(k
);
8834 * Print the commands in a display list. For debugging only.
8835 * TODO: many commands aren't handled yet.
8837 static void GLAPIENTRY
8838 print_list(struct gl_context
*ctx
, GLuint list
)
8840 struct gl_display_list
*dlist
;
8844 if (!islist(ctx
, list
)) {
8845 printf("%u is not a display list ID\n", list
);
8849 dlist
= _mesa_lookup_list(ctx
, list
);
8855 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8857 done
= n
? GL_FALSE
: GL_TRUE
;
8859 const OpCode opcode
= n
[0].opcode
;
8861 if (is_ext_opcode(opcode
)) {
8862 n
+= ext_opcode_print(ctx
, n
);
8867 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8870 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8871 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8872 get_pointer(&n
[7]));
8874 case OPCODE_CALL_LIST
:
8875 printf("CallList %d\n", (int) n
[1].ui
);
8877 case OPCODE_CALL_LIST_OFFSET
:
8878 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8879 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8881 case OPCODE_DISABLE
:
8882 printf("Disable %s\n", enum_string(n
[1].e
));
8885 printf("Enable %s\n", enum_string(n
[1].e
));
8887 case OPCODE_FRUSTUM
:
8888 printf("Frustum %g %g %g %g %g %g\n",
8889 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8891 case OPCODE_LINE_STIPPLE
:
8892 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8894 case OPCODE_LOAD_IDENTITY
:
8895 printf("LoadIdentity\n");
8897 case OPCODE_LOAD_MATRIX
:
8898 printf("LoadMatrix\n");
8899 printf(" %8f %8f %8f %8f\n",
8900 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8901 printf(" %8f %8f %8f %8f\n",
8902 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8903 printf(" %8f %8f %8f %8f\n",
8904 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8905 printf(" %8f %8f %8f %8f\n",
8906 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8908 case OPCODE_MULT_MATRIX
:
8909 printf("MultMatrix (or Rotate)\n");
8910 printf(" %8f %8f %8f %8f\n",
8911 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8912 printf(" %8f %8f %8f %8f\n",
8913 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8914 printf(" %8f %8f %8f %8f\n",
8915 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8916 printf(" %8f %8f %8f %8f\n",
8917 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8920 printf("Ortho %g %g %g %g %g %g\n",
8921 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8923 case OPCODE_POP_ATTRIB
:
8924 printf("PopAttrib\n");
8926 case OPCODE_POP_MATRIX
:
8927 printf("PopMatrix\n");
8929 case OPCODE_POP_NAME
:
8930 printf("PopName\n");
8932 case OPCODE_PUSH_ATTRIB
:
8933 printf("PushAttrib %x\n", n
[1].bf
);
8935 case OPCODE_PUSH_MATRIX
:
8936 printf("PushMatrix\n");
8938 case OPCODE_PUSH_NAME
:
8939 printf("PushName %d\n", (int) n
[1].ui
);
8941 case OPCODE_RASTER_POS
:
8942 printf("RasterPos %g %g %g %g\n",
8943 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8946 printf("Rotate %g %g %g %g\n",
8947 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8950 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8952 case OPCODE_TRANSLATE
:
8953 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8955 case OPCODE_BIND_TEXTURE
:
8956 printf("BindTexture %s %d\n",
8957 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8959 case OPCODE_SHADE_MODEL
:
8960 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8963 printf("Map1 %s %.3f %.3f %d %d\n",
8964 _mesa_lookup_enum_by_nr(n
[1].ui
),
8965 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
8968 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
8969 _mesa_lookup_enum_by_nr(n
[1].ui
),
8970 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
8971 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
8973 case OPCODE_MAPGRID1
:
8974 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
8976 case OPCODE_MAPGRID2
:
8977 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
8978 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
8980 case OPCODE_EVALMESH1
:
8981 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
8983 case OPCODE_EVALMESH2
:
8984 printf("EvalMesh2 %d %d %d %d\n",
8985 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
8988 case OPCODE_ATTR_1F_NV
:
8989 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
8991 case OPCODE_ATTR_2F_NV
:
8992 printf("ATTR_2F_NV attr %d: %f %f\n",
8993 n
[1].i
, n
[2].f
, n
[3].f
);
8995 case OPCODE_ATTR_3F_NV
:
8996 printf("ATTR_3F_NV attr %d: %f %f %f\n",
8997 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
8999 case OPCODE_ATTR_4F_NV
:
9000 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9001 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9003 case OPCODE_ATTR_1F_ARB
:
9004 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9006 case OPCODE_ATTR_2F_ARB
:
9007 printf("ATTR_2F_ARB attr %d: %f %f\n",
9008 n
[1].i
, n
[2].f
, n
[3].f
);
9010 case OPCODE_ATTR_3F_ARB
:
9011 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9012 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9014 case OPCODE_ATTR_4F_ARB
:
9015 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9016 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9019 case OPCODE_MATERIAL
:
9020 printf("MATERIAL %x %x: %f %f %f %f\n",
9021 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9024 printf("BEGIN %x\n", n
[1].i
);
9030 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9033 case OPCODE_EVAL_C1
:
9034 printf("EVAL_C1 %f\n", n
[1].f
);
9036 case OPCODE_EVAL_C2
:
9037 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9039 case OPCODE_EVAL_P1
:
9040 printf("EVAL_P1 %d\n", n
[1].i
);
9042 case OPCODE_EVAL_P2
:
9043 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9046 case OPCODE_PROVOKING_VERTEX
:
9047 printf("ProvokingVertex %s\n",
9048 _mesa_lookup_enum_by_nr(n
[1].ui
));
9052 * meta opcodes/commands
9055 printf("Error: %s %s\n", enum_string(n
[1].e
),
9056 (const char *) get_pointer(&n
[2]));
9058 case OPCODE_CONTINUE
:
9059 printf("DISPLAY-LIST-CONTINUE\n");
9060 n
= (Node
*) get_pointer(&n
[1]);
9062 case OPCODE_END_OF_LIST
:
9063 printf("END-LIST %u\n", list
);
9067 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9069 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9070 opcode
, (void *) n
);
9074 printf("command %d, %u operands\n", opcode
,
9078 /* increment n to point to next compiled command */
9079 if (opcode
!= OPCODE_CONTINUE
) {
9080 n
+= InstSize
[opcode
];
9089 * Clients may call this function to help debug display list problems.
9090 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9091 * changed, or break in the future without notice.
9094 mesa_print_display_list(GLuint list
)
9096 GET_CURRENT_CONTEXT(ctx
);
9097 print_list(ctx
, list
);
9101 /**********************************************************************/
9102 /***** Initialization *****/
9103 /**********************************************************************/
9106 save_vtxfmt_init(GLvertexformat
* vfmt
)
9108 vfmt
->ArrayElement
= _ae_ArrayElement
;
9110 vfmt
->Begin
= save_Begin
;
9112 vfmt
->CallList
= save_CallList
;
9113 vfmt
->CallLists
= save_CallLists
;
9115 vfmt
->Color3f
= save_Color3f
;
9116 vfmt
->Color3fv
= save_Color3fv
;
9117 vfmt
->Color4f
= save_Color4f
;
9118 vfmt
->Color4fv
= save_Color4fv
;
9119 vfmt
->EdgeFlag
= save_EdgeFlag
;
9120 vfmt
->End
= save_End
;
9122 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9123 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9124 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9125 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9126 vfmt
->EvalPoint1
= save_EvalPoint1
;
9127 vfmt
->EvalPoint2
= save_EvalPoint2
;
9129 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9130 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9131 vfmt
->Indexf
= save_Indexf
;
9132 vfmt
->Indexfv
= save_Indexfv
;
9133 vfmt
->Materialfv
= save_Materialfv
;
9134 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9135 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9136 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9137 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9138 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9139 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9140 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9141 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9142 vfmt
->Normal3f
= save_Normal3f
;
9143 vfmt
->Normal3fv
= save_Normal3fv
;
9144 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9145 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9146 vfmt
->TexCoord1f
= save_TexCoord1f
;
9147 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9148 vfmt
->TexCoord2f
= save_TexCoord2f
;
9149 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9150 vfmt
->TexCoord3f
= save_TexCoord3f
;
9151 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9152 vfmt
->TexCoord4f
= save_TexCoord4f
;
9153 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9154 vfmt
->Vertex2f
= save_Vertex2f
;
9155 vfmt
->Vertex2fv
= save_Vertex2fv
;
9156 vfmt
->Vertex3f
= save_Vertex3f
;
9157 vfmt
->Vertex3fv
= save_Vertex3fv
;
9158 vfmt
->Vertex4f
= save_Vertex4f
;
9159 vfmt
->Vertex4fv
= save_Vertex4fv
;
9160 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9161 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9162 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9163 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9164 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9165 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9166 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9167 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9172 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9173 const GLvertexformat
*vfmt
)
9175 SET_CallList(disp
, vfmt
->CallList
);
9176 SET_CallLists(disp
, vfmt
->CallLists
);
9181 * Initialize display list state for given context.
9184 _mesa_init_display_list(struct gl_context
*ctx
)
9186 static GLboolean tableInitialized
= GL_FALSE
;
9188 /* zero-out the instruction size table, just once */
9189 if (!tableInitialized
) {
9190 memset(InstSize
, 0, sizeof(InstSize
));
9191 tableInitialized
= GL_TRUE
;
9194 /* extension info */
9195 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9198 ctx
->ListState
.CallDepth
= 0;
9199 ctx
->ExecuteFlag
= GL_TRUE
;
9200 ctx
->CompileFlag
= GL_FALSE
;
9201 ctx
->ListState
.CurrentBlock
= NULL
;
9202 ctx
->ListState
.CurrentPos
= 0;
9204 /* Display List group */
9205 ctx
->List
.ListBase
= 0;
9207 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9212 _mesa_free_display_list_data(struct gl_context
*ctx
)
9215 ctx
->ListExt
= NULL
;