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
));
1071 * Called by EndList to try to reduce memory used for the list.
1074 trim_list(struct gl_context
*ctx
)
1076 /* If the list we're ending only has one allocated block of nodes/tokens
1077 * and its size isn't a full block size, realloc the block to use less
1078 * memory. This is important for apps that create many small display
1079 * lists and apps that use glXUseXFont (many lists each containing one
1081 * Note: we currently only trim display lists that allocated one block
1082 * of tokens. That hits the short list case which is what we're mainly
1083 * concerned with. Trimming longer lists would involve traversing the
1084 * linked list of blocks.
1086 struct gl_dlist_state
*list
= &ctx
->ListState
;
1088 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1089 (list
->CurrentPos
< BLOCK_SIZE
)) {
1090 /* There's only one block and it's not full, so realloc */
1091 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1092 list
->CurrentList
->Head
=
1093 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1094 if (!list
->CurrentBlock
) {
1095 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1103 * Display List compilation functions
1105 static void GLAPIENTRY
1106 save_Accum(GLenum op
, GLfloat value
)
1108 GET_CURRENT_CONTEXT(ctx
);
1110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1111 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1116 if (ctx
->ExecuteFlag
) {
1117 CALL_Accum(ctx
->Exec
, (op
, value
));
1122 static void GLAPIENTRY
1123 save_AlphaFunc(GLenum func
, GLclampf ref
)
1125 GET_CURRENT_CONTEXT(ctx
);
1127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1128 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1131 n
[2].f
= (GLfloat
) ref
;
1133 if (ctx
->ExecuteFlag
) {
1134 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1139 static void GLAPIENTRY
1140 save_BindTexture(GLenum target
, GLuint texture
)
1142 GET_CURRENT_CONTEXT(ctx
);
1144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1145 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1150 if (ctx
->ExecuteFlag
) {
1151 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1156 static void GLAPIENTRY
1157 save_Bitmap(GLsizei width
, GLsizei height
,
1158 GLfloat xorig
, GLfloat yorig
,
1159 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1161 GET_CURRENT_CONTEXT(ctx
);
1163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1164 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1166 n
[1].i
= (GLint
) width
;
1167 n
[2].i
= (GLint
) height
;
1173 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1174 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1176 if (ctx
->ExecuteFlag
) {
1177 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1178 xorig
, yorig
, xmove
, ymove
, pixels
));
1183 static void GLAPIENTRY
1184 save_BlendEquation(GLenum mode
)
1186 GET_CURRENT_CONTEXT(ctx
);
1188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1189 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1193 if (ctx
->ExecuteFlag
) {
1194 CALL_BlendEquation(ctx
->Exec
, (mode
));
1199 static void GLAPIENTRY
1200 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1202 GET_CURRENT_CONTEXT(ctx
);
1204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1205 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1210 if (ctx
->ExecuteFlag
) {
1211 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1216 static void GLAPIENTRY
1217 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1218 GLenum sfactorA
, GLenum dfactorA
)
1220 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1225 n
[1].e
= sfactorRGB
;
1226 n
[2].e
= dfactorRGB
;
1230 if (ctx
->ExecuteFlag
) {
1231 CALL_BlendFuncSeparate(ctx
->Exec
,
1232 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1237 static void GLAPIENTRY
1238 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1240 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1244 static void GLAPIENTRY
1245 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1247 GET_CURRENT_CONTEXT(ctx
);
1249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1250 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1257 if (ctx
->ExecuteFlag
) {
1258 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1262 /* GL_ARB_draw_buffers_blend */
1263 static void GLAPIENTRY
1264 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1265 GLenum sfactorA
, GLenum dfactorA
)
1267 GET_CURRENT_CONTEXT(ctx
);
1269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1270 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1273 n
[2].e
= sfactorRGB
;
1274 n
[3].e
= dfactorRGB
;
1278 if (ctx
->ExecuteFlag
) {
1279 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1280 sfactorA
, dfactorA
));
1284 /* GL_ARB_draw_buffers_blend */
1285 static void GLAPIENTRY
1286 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1288 GET_CURRENT_CONTEXT(ctx
);
1290 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1291 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1297 if (ctx
->ExecuteFlag
) {
1298 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1302 /* GL_ARB_draw_buffers_blend */
1303 static void GLAPIENTRY
1304 save_BlendEquationi(GLuint buf
, GLenum mode
)
1306 GET_CURRENT_CONTEXT(ctx
);
1308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1309 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1314 if (ctx
->ExecuteFlag
) {
1315 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1319 /* GL_ARB_draw_buffers_blend */
1320 static void GLAPIENTRY
1321 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1323 GET_CURRENT_CONTEXT(ctx
);
1325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1326 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1332 if (ctx
->ExecuteFlag
) {
1333 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1338 /* GL_ARB_draw_instanced. */
1339 static void GLAPIENTRY
1340 save_DrawArraysInstancedARB(GLenum mode
,
1345 GET_CURRENT_CONTEXT(ctx
);
1346 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1347 "glDrawArraysInstanced() during display list compile");
1350 static void GLAPIENTRY
1351 save_DrawElementsInstancedARB(GLenum mode
,
1354 const GLvoid
*indices
,
1357 GET_CURRENT_CONTEXT(ctx
);
1358 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1359 "glDrawElementsInstanced() during display list compile");
1362 static void GLAPIENTRY
1363 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1366 const GLvoid
*indices
,
1370 GET_CURRENT_CONTEXT(ctx
);
1371 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1372 "glDrawElementsInstancedBaseVertex() during display list compile");
1375 /* GL_ARB_base_instance. */
1376 static void GLAPIENTRY
1377 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1381 GLuint baseinstance
)
1383 GET_CURRENT_CONTEXT(ctx
);
1384 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1385 "glDrawArraysInstancedBaseInstance() during display list compile");
1388 static void APIENTRY
1389 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1392 const void *indices
,
1394 GLuint baseinstance
)
1396 GET_CURRENT_CONTEXT(ctx
);
1397 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1398 "glDrawElementsInstancedBaseInstance() during display list compile");
1401 static void APIENTRY
1402 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1405 const void *indices
,
1408 GLuint baseinstance
)
1410 GET_CURRENT_CONTEXT(ctx
);
1411 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1412 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1417 * While building a display list we cache some OpenGL state.
1418 * Under some circumstances we need to invalidate that state (immediately
1419 * when we start compiling a list, or after glCallList(s)).
1422 invalidate_saved_current_state(struct gl_context
*ctx
)
1426 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1427 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1429 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1430 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1432 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1434 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1438 static void GLAPIENTRY
1439 save_CallList(GLuint list
)
1441 GET_CURRENT_CONTEXT(ctx
);
1443 SAVE_FLUSH_VERTICES(ctx
);
1445 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1450 /* After this, we don't know what state we're in. Invalidate all
1451 * cached information previously gathered:
1453 invalidate_saved_current_state( ctx
);
1455 if (ctx
->ExecuteFlag
) {
1456 _mesa_CallList(list
);
1461 static void GLAPIENTRY
1462 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1464 GET_CURRENT_CONTEXT(ctx
);
1466 GLboolean typeErrorFlag
;
1468 SAVE_FLUSH_VERTICES(ctx
);
1472 case GL_UNSIGNED_BYTE
:
1474 case GL_UNSIGNED_SHORT
:
1476 case GL_UNSIGNED_INT
:
1481 typeErrorFlag
= GL_FALSE
;
1484 typeErrorFlag
= GL_TRUE
;
1487 for (i
= 0; i
< num
; i
++) {
1488 GLint list
= translate_id(i
, type
, lists
);
1489 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1492 n
[2].b
= typeErrorFlag
;
1496 /* After this, we don't know what state we're in. Invalidate all
1497 * cached information previously gathered:
1499 invalidate_saved_current_state( ctx
);
1501 if (ctx
->ExecuteFlag
) {
1502 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1507 static void GLAPIENTRY
1508 save_Clear(GLbitfield mask
)
1510 GET_CURRENT_CONTEXT(ctx
);
1512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1513 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1517 if (ctx
->ExecuteFlag
) {
1518 CALL_Clear(ctx
->Exec
, (mask
));
1523 static void GLAPIENTRY
1524 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1526 GET_CURRENT_CONTEXT(ctx
);
1528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1529 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1532 n
[2].i
= drawbuffer
;
1534 if (buffer
== GL_COLOR
) {
1545 if (ctx
->ExecuteFlag
) {
1546 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1551 static void GLAPIENTRY
1552 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1554 GET_CURRENT_CONTEXT(ctx
);
1556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1557 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1560 n
[2].i
= drawbuffer
;
1562 if (buffer
== GL_COLOR
) {
1573 if (ctx
->ExecuteFlag
) {
1574 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1579 static void GLAPIENTRY
1580 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1582 GET_CURRENT_CONTEXT(ctx
);
1584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1585 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1588 n
[2].i
= drawbuffer
;
1590 if (buffer
== GL_COLOR
) {
1601 if (ctx
->ExecuteFlag
) {
1602 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1607 static void GLAPIENTRY
1608 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1609 GLfloat depth
, GLint stencil
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1617 n
[2].i
= drawbuffer
;
1621 if (ctx
->ExecuteFlag
) {
1622 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1627 static void GLAPIENTRY
1628 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1630 GET_CURRENT_CONTEXT(ctx
);
1632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1633 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1640 if (ctx
->ExecuteFlag
) {
1641 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1646 static void GLAPIENTRY
1647 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1649 GET_CURRENT_CONTEXT(ctx
);
1651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1652 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1659 if (ctx
->ExecuteFlag
) {
1660 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1665 static void GLAPIENTRY
1666 save_ClearDepth(GLclampd depth
)
1668 GET_CURRENT_CONTEXT(ctx
);
1670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1671 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1673 n
[1].f
= (GLfloat
) depth
;
1675 if (ctx
->ExecuteFlag
) {
1676 CALL_ClearDepth(ctx
->Exec
, (depth
));
1681 static void GLAPIENTRY
1682 save_ClearIndex(GLfloat c
)
1684 GET_CURRENT_CONTEXT(ctx
);
1686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1687 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1691 if (ctx
->ExecuteFlag
) {
1692 CALL_ClearIndex(ctx
->Exec
, (c
));
1697 static void GLAPIENTRY
1698 save_ClearStencil(GLint s
)
1700 GET_CURRENT_CONTEXT(ctx
);
1702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1703 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1707 if (ctx
->ExecuteFlag
) {
1708 CALL_ClearStencil(ctx
->Exec
, (s
));
1713 static void GLAPIENTRY
1714 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1716 GET_CURRENT_CONTEXT(ctx
);
1718 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1719 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1722 n
[2].f
= (GLfloat
) equ
[0];
1723 n
[3].f
= (GLfloat
) equ
[1];
1724 n
[4].f
= (GLfloat
) equ
[2];
1725 n
[5].f
= (GLfloat
) equ
[3];
1727 if (ctx
->ExecuteFlag
) {
1728 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1734 static void GLAPIENTRY
1735 save_ColorMask(GLboolean red
, GLboolean green
,
1736 GLboolean blue
, GLboolean alpha
)
1738 GET_CURRENT_CONTEXT(ctx
);
1740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1741 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1748 if (ctx
->ExecuteFlag
) {
1749 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1754 static void GLAPIENTRY
1755 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1756 GLboolean blue
, GLboolean alpha
)
1758 GET_CURRENT_CONTEXT(ctx
);
1760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1761 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1769 if (ctx
->ExecuteFlag
) {
1770 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1775 static void GLAPIENTRY
1776 save_ColorMaterial(GLenum face
, GLenum mode
)
1778 GET_CURRENT_CONTEXT(ctx
);
1780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1782 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1787 if (ctx
->ExecuteFlag
) {
1788 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1793 static void GLAPIENTRY
1794 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1796 GET_CURRENT_CONTEXT(ctx
);
1798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1799 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1803 n
[3].i
= (GLint
) width
;
1804 n
[4].i
= (GLint
) height
;
1807 if (ctx
->ExecuteFlag
) {
1808 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1814 static void GLAPIENTRY
1815 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1816 GLint x
, GLint y
, GLsizei width
, GLint border
)
1818 GET_CURRENT_CONTEXT(ctx
);
1820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1821 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1825 n
[3].e
= internalformat
;
1831 if (ctx
->ExecuteFlag
) {
1832 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1833 x
, y
, width
, border
));
1838 static void GLAPIENTRY
1839 save_CopyTexImage2D(GLenum target
, GLint level
,
1840 GLenum internalformat
,
1841 GLint x
, GLint y
, GLsizei width
,
1842 GLsizei height
, GLint border
)
1844 GET_CURRENT_CONTEXT(ctx
);
1846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1847 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1851 n
[3].e
= internalformat
;
1858 if (ctx
->ExecuteFlag
) {
1859 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1860 x
, y
, width
, height
, border
));
1866 static void GLAPIENTRY
1867 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1868 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1870 GET_CURRENT_CONTEXT(ctx
);
1872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1873 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1882 if (ctx
->ExecuteFlag
) {
1883 CALL_CopyTexSubImage1D(ctx
->Exec
,
1884 (target
, level
, xoffset
, x
, y
, width
));
1889 static void GLAPIENTRY
1890 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1891 GLint xoffset
, GLint yoffset
,
1892 GLint x
, GLint y
, GLsizei width
, GLint height
)
1894 GET_CURRENT_CONTEXT(ctx
);
1896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1897 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1908 if (ctx
->ExecuteFlag
) {
1909 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1910 x
, y
, width
, height
));
1915 static void GLAPIENTRY
1916 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1917 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1918 GLint x
, GLint y
, GLsizei width
, GLint height
)
1920 GET_CURRENT_CONTEXT(ctx
);
1922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1923 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1935 if (ctx
->ExecuteFlag
) {
1936 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1937 xoffset
, yoffset
, zoffset
,
1938 x
, y
, width
, height
));
1943 static void GLAPIENTRY
1944 save_CullFace(GLenum mode
)
1946 GET_CURRENT_CONTEXT(ctx
);
1948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1949 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
1953 if (ctx
->ExecuteFlag
) {
1954 CALL_CullFace(ctx
->Exec
, (mode
));
1959 static void GLAPIENTRY
1960 save_DepthFunc(GLenum func
)
1962 GET_CURRENT_CONTEXT(ctx
);
1964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1965 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
1969 if (ctx
->ExecuteFlag
) {
1970 CALL_DepthFunc(ctx
->Exec
, (func
));
1975 static void GLAPIENTRY
1976 save_DepthMask(GLboolean mask
)
1978 GET_CURRENT_CONTEXT(ctx
);
1980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1981 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
1985 if (ctx
->ExecuteFlag
) {
1986 CALL_DepthMask(ctx
->Exec
, (mask
));
1991 static void GLAPIENTRY
1992 save_DepthRange(GLclampd nearval
, GLclampd farval
)
1994 GET_CURRENT_CONTEXT(ctx
);
1996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1997 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
1999 n
[1].f
= (GLfloat
) nearval
;
2000 n
[2].f
= (GLfloat
) farval
;
2002 if (ctx
->ExecuteFlag
) {
2003 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2008 static void GLAPIENTRY
2009 save_Disable(GLenum cap
)
2011 GET_CURRENT_CONTEXT(ctx
);
2013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2014 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2018 if (ctx
->ExecuteFlag
) {
2019 CALL_Disable(ctx
->Exec
, (cap
));
2024 static void GLAPIENTRY
2025 save_DisableIndexed(GLuint index
, GLenum cap
)
2027 GET_CURRENT_CONTEXT(ctx
);
2029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2030 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2035 if (ctx
->ExecuteFlag
) {
2036 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2041 static void GLAPIENTRY
2042 save_DrawBuffer(GLenum mode
)
2044 GET_CURRENT_CONTEXT(ctx
);
2046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2047 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2051 if (ctx
->ExecuteFlag
) {
2052 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2057 static void GLAPIENTRY
2058 save_DrawPixels(GLsizei width
, GLsizei height
,
2059 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2061 GET_CURRENT_CONTEXT(ctx
);
2064 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2066 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2073 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2074 pixels
, &ctx
->Unpack
));
2076 if (ctx
->ExecuteFlag
) {
2077 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2083 static void GLAPIENTRY
2084 save_Enable(GLenum cap
)
2086 GET_CURRENT_CONTEXT(ctx
);
2088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2089 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2093 if (ctx
->ExecuteFlag
) {
2094 CALL_Enable(ctx
->Exec
, (cap
));
2100 static void GLAPIENTRY
2101 save_EnableIndexed(GLuint index
, GLenum cap
)
2103 GET_CURRENT_CONTEXT(ctx
);
2105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2106 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2111 if (ctx
->ExecuteFlag
) {
2112 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2118 static void GLAPIENTRY
2119 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2121 GET_CURRENT_CONTEXT(ctx
);
2123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2124 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2130 if (ctx
->ExecuteFlag
) {
2131 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2136 static void GLAPIENTRY
2137 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2139 GET_CURRENT_CONTEXT(ctx
);
2141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2142 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2150 if (ctx
->ExecuteFlag
) {
2151 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2158 static void GLAPIENTRY
2159 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2161 GET_CURRENT_CONTEXT(ctx
);
2163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2164 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2172 if (ctx
->ExecuteFlag
) {
2173 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2178 static void GLAPIENTRY
2179 save_Fogf(GLenum pname
, GLfloat param
)
2183 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2184 save_Fogfv(pname
, parray
);
2188 static void GLAPIENTRY
2189 save_Fogiv(GLenum pname
, const GLint
*params
)
2194 case GL_FOG_DENSITY
:
2198 p
[0] = (GLfloat
) *params
;
2204 p
[0] = INT_TO_FLOAT(params
[0]);
2205 p
[1] = INT_TO_FLOAT(params
[1]);
2206 p
[2] = INT_TO_FLOAT(params
[2]);
2207 p
[3] = INT_TO_FLOAT(params
[3]);
2210 /* Error will be caught later in gl_Fogfv */
2211 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2213 save_Fogfv(pname
, p
);
2217 static void GLAPIENTRY
2218 save_Fogi(GLenum pname
, GLint param
)
2222 parray
[1] = parray
[2] = parray
[3] = 0;
2223 save_Fogiv(pname
, parray
);
2227 static void GLAPIENTRY
2228 save_FrontFace(GLenum mode
)
2230 GET_CURRENT_CONTEXT(ctx
);
2232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2233 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2237 if (ctx
->ExecuteFlag
) {
2238 CALL_FrontFace(ctx
->Exec
, (mode
));
2243 static void GLAPIENTRY
2244 save_Frustum(GLdouble left
, GLdouble right
,
2245 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2247 GET_CURRENT_CONTEXT(ctx
);
2249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2250 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2252 n
[1].f
= (GLfloat
) left
;
2253 n
[2].f
= (GLfloat
) right
;
2254 n
[3].f
= (GLfloat
) bottom
;
2255 n
[4].f
= (GLfloat
) top
;
2256 n
[5].f
= (GLfloat
) nearval
;
2257 n
[6].f
= (GLfloat
) farval
;
2259 if (ctx
->ExecuteFlag
) {
2260 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2265 static void GLAPIENTRY
2266 save_Hint(GLenum target
, GLenum mode
)
2268 GET_CURRENT_CONTEXT(ctx
);
2270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2271 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2276 if (ctx
->ExecuteFlag
) {
2277 CALL_Hint(ctx
->Exec
, (target
, mode
));
2282 static void GLAPIENTRY
2283 save_IndexMask(GLuint mask
)
2285 GET_CURRENT_CONTEXT(ctx
);
2287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2288 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2292 if (ctx
->ExecuteFlag
) {
2293 CALL_IndexMask(ctx
->Exec
, (mask
));
2298 static void GLAPIENTRY
2299 save_InitNames(void)
2301 GET_CURRENT_CONTEXT(ctx
);
2302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2303 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2304 if (ctx
->ExecuteFlag
) {
2305 CALL_InitNames(ctx
->Exec
, ());
2310 static void GLAPIENTRY
2311 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2313 GET_CURRENT_CONTEXT(ctx
);
2315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2316 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2334 case GL_SPOT_DIRECTION
:
2337 case GL_SPOT_EXPONENT
:
2340 case GL_SPOT_CUTOFF
:
2343 case GL_CONSTANT_ATTENUATION
:
2346 case GL_LINEAR_ATTENUATION
:
2349 case GL_QUADRATIC_ATTENUATION
:
2355 for (i
= 0; i
< nParams
; i
++) {
2356 n
[3 + i
].f
= params
[i
];
2359 if (ctx
->ExecuteFlag
) {
2360 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2365 static void GLAPIENTRY
2366 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2370 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2371 save_Lightfv(light
, pname
, parray
);
2375 static void GLAPIENTRY
2376 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2383 fparam
[0] = INT_TO_FLOAT(params
[0]);
2384 fparam
[1] = INT_TO_FLOAT(params
[1]);
2385 fparam
[2] = INT_TO_FLOAT(params
[2]);
2386 fparam
[3] = INT_TO_FLOAT(params
[3]);
2389 fparam
[0] = (GLfloat
) params
[0];
2390 fparam
[1] = (GLfloat
) params
[1];
2391 fparam
[2] = (GLfloat
) params
[2];
2392 fparam
[3] = (GLfloat
) params
[3];
2394 case GL_SPOT_DIRECTION
:
2395 fparam
[0] = (GLfloat
) params
[0];
2396 fparam
[1] = (GLfloat
) params
[1];
2397 fparam
[2] = (GLfloat
) params
[2];
2399 case GL_SPOT_EXPONENT
:
2400 case GL_SPOT_CUTOFF
:
2401 case GL_CONSTANT_ATTENUATION
:
2402 case GL_LINEAR_ATTENUATION
:
2403 case GL_QUADRATIC_ATTENUATION
:
2404 fparam
[0] = (GLfloat
) params
[0];
2407 /* error will be caught later in gl_Lightfv */
2410 save_Lightfv(light
, pname
, fparam
);
2414 static void GLAPIENTRY
2415 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2419 parray
[1] = parray
[2] = parray
[3] = 0;
2420 save_Lightiv(light
, pname
, parray
);
2424 static void GLAPIENTRY
2425 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2427 GET_CURRENT_CONTEXT(ctx
);
2429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2430 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2438 if (ctx
->ExecuteFlag
) {
2439 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2444 static void GLAPIENTRY
2445 save_LightModelf(GLenum pname
, GLfloat param
)
2449 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2450 save_LightModelfv(pname
, parray
);
2454 static void GLAPIENTRY
2455 save_LightModeliv(GLenum pname
, const GLint
*params
)
2459 case GL_LIGHT_MODEL_AMBIENT
:
2460 fparam
[0] = INT_TO_FLOAT(params
[0]);
2461 fparam
[1] = INT_TO_FLOAT(params
[1]);
2462 fparam
[2] = INT_TO_FLOAT(params
[2]);
2463 fparam
[3] = INT_TO_FLOAT(params
[3]);
2465 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2466 case GL_LIGHT_MODEL_TWO_SIDE
:
2467 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2468 fparam
[0] = (GLfloat
) params
[0];
2474 /* Error will be caught later in gl_LightModelfv */
2475 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2477 save_LightModelfv(pname
, fparam
);
2481 static void GLAPIENTRY
2482 save_LightModeli(GLenum pname
, GLint param
)
2486 parray
[1] = parray
[2] = parray
[3] = 0;
2487 save_LightModeliv(pname
, parray
);
2491 static void GLAPIENTRY
2492 save_LineStipple(GLint factor
, GLushort pattern
)
2494 GET_CURRENT_CONTEXT(ctx
);
2496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2497 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2502 if (ctx
->ExecuteFlag
) {
2503 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2508 static void GLAPIENTRY
2509 save_LineWidth(GLfloat width
)
2511 GET_CURRENT_CONTEXT(ctx
);
2513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2514 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2518 if (ctx
->ExecuteFlag
) {
2519 CALL_LineWidth(ctx
->Exec
, (width
));
2524 static void GLAPIENTRY
2525 save_ListBase(GLuint base
)
2527 GET_CURRENT_CONTEXT(ctx
);
2529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2530 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2534 if (ctx
->ExecuteFlag
) {
2535 CALL_ListBase(ctx
->Exec
, (base
));
2540 static void GLAPIENTRY
2541 save_LoadIdentity(void)
2543 GET_CURRENT_CONTEXT(ctx
);
2544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2545 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2546 if (ctx
->ExecuteFlag
) {
2547 CALL_LoadIdentity(ctx
->Exec
, ());
2552 static void GLAPIENTRY
2553 save_LoadMatrixf(const GLfloat
* m
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2561 for (i
= 0; i
< 16; i
++) {
2565 if (ctx
->ExecuteFlag
) {
2566 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2571 static void GLAPIENTRY
2572 save_LoadMatrixd(const GLdouble
* m
)
2576 for (i
= 0; i
< 16; i
++) {
2577 f
[i
] = (GLfloat
) m
[i
];
2579 save_LoadMatrixf(f
);
2583 static void GLAPIENTRY
2584 save_LoadName(GLuint name
)
2586 GET_CURRENT_CONTEXT(ctx
);
2588 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2589 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2593 if (ctx
->ExecuteFlag
) {
2594 CALL_LoadName(ctx
->Exec
, (name
));
2599 static void GLAPIENTRY
2600 save_LogicOp(GLenum opcode
)
2602 GET_CURRENT_CONTEXT(ctx
);
2604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2605 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2609 if (ctx
->ExecuteFlag
) {
2610 CALL_LogicOp(ctx
->Exec
, (opcode
));
2615 static void GLAPIENTRY
2616 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2617 GLint order
, const GLdouble
* points
)
2619 GET_CURRENT_CONTEXT(ctx
);
2621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2622 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2624 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2626 n
[2].f
= (GLfloat
) u1
;
2627 n
[3].f
= (GLfloat
) u2
;
2628 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2630 save_pointer(&n
[6], pnts
);
2632 if (ctx
->ExecuteFlag
) {
2633 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2637 static void GLAPIENTRY
2638 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2639 GLint order
, const GLfloat
* points
)
2641 GET_CURRENT_CONTEXT(ctx
);
2643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2644 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2646 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2650 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2652 save_pointer(&n
[6], pnts
);
2654 if (ctx
->ExecuteFlag
) {
2655 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2660 static void GLAPIENTRY
2661 save_Map2d(GLenum target
,
2662 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2663 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2664 const GLdouble
* points
)
2666 GET_CURRENT_CONTEXT(ctx
);
2668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2669 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2671 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2672 vstride
, vorder
, points
);
2674 n
[2].f
= (GLfloat
) u1
;
2675 n
[3].f
= (GLfloat
) u2
;
2676 n
[4].f
= (GLfloat
) v1
;
2677 n
[5].f
= (GLfloat
) v2
;
2678 /* XXX verify these strides are correct */
2679 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2680 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2683 save_pointer(&n
[10], pnts
);
2685 if (ctx
->ExecuteFlag
) {
2686 CALL_Map2d(ctx
->Exec
, (target
,
2687 u1
, u2
, ustride
, uorder
,
2688 v1
, v2
, vstride
, vorder
, points
));
2693 static void GLAPIENTRY
2694 save_Map2f(GLenum target
,
2695 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2696 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2697 const GLfloat
* points
)
2699 GET_CURRENT_CONTEXT(ctx
);
2701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2702 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2704 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2705 vstride
, vorder
, points
);
2711 /* XXX verify these strides are correct */
2712 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2713 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2716 save_pointer(&n
[10], pnts
);
2718 if (ctx
->ExecuteFlag
) {
2719 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2720 v1
, v2
, vstride
, vorder
, points
));
2725 static void GLAPIENTRY
2726 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2728 GET_CURRENT_CONTEXT(ctx
);
2730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2731 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2737 if (ctx
->ExecuteFlag
) {
2738 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2743 static void GLAPIENTRY
2744 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2746 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2750 static void GLAPIENTRY
2751 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2752 GLint vn
, GLfloat v1
, GLfloat v2
)
2754 GET_CURRENT_CONTEXT(ctx
);
2756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2757 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2766 if (ctx
->ExecuteFlag
) {
2767 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2773 static void GLAPIENTRY
2774 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2775 GLint vn
, GLdouble v1
, GLdouble v2
)
2777 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2778 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2782 static void GLAPIENTRY
2783 save_MatrixMode(GLenum mode
)
2785 GET_CURRENT_CONTEXT(ctx
);
2787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2788 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2792 if (ctx
->ExecuteFlag
) {
2793 CALL_MatrixMode(ctx
->Exec
, (mode
));
2798 static void GLAPIENTRY
2799 save_MultMatrixf(const GLfloat
* m
)
2801 GET_CURRENT_CONTEXT(ctx
);
2803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2804 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2807 for (i
= 0; i
< 16; i
++) {
2811 if (ctx
->ExecuteFlag
) {
2812 CALL_MultMatrixf(ctx
->Exec
, (m
));
2817 static void GLAPIENTRY
2818 save_MultMatrixd(const GLdouble
* m
)
2822 for (i
= 0; i
< 16; i
++) {
2823 f
[i
] = (GLfloat
) m
[i
];
2825 save_MultMatrixf(f
);
2829 static void GLAPIENTRY
2830 save_NewList(GLuint name
, GLenum mode
)
2832 GET_CURRENT_CONTEXT(ctx
);
2833 /* It's an error to call this function while building a display list */
2834 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2841 static void GLAPIENTRY
2842 save_Ortho(GLdouble left
, GLdouble right
,
2843 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2845 GET_CURRENT_CONTEXT(ctx
);
2847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2848 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2850 n
[1].f
= (GLfloat
) left
;
2851 n
[2].f
= (GLfloat
) right
;
2852 n
[3].f
= (GLfloat
) bottom
;
2853 n
[4].f
= (GLfloat
) top
;
2854 n
[5].f
= (GLfloat
) nearval
;
2855 n
[6].f
= (GLfloat
) farval
;
2857 if (ctx
->ExecuteFlag
) {
2858 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2863 static void GLAPIENTRY
2864 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2866 GET_CURRENT_CONTEXT(ctx
);
2868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2869 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2873 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2875 if (ctx
->ExecuteFlag
) {
2876 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2881 static void GLAPIENTRY
2882 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2884 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2886 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2887 for (i
= 0; i
< mapsize
; i
++) {
2888 fvalues
[i
] = (GLfloat
) values
[i
];
2892 for (i
= 0; i
< mapsize
; i
++) {
2893 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2896 save_PixelMapfv(map
, mapsize
, fvalues
);
2900 static void GLAPIENTRY
2901 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2903 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2905 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2906 for (i
= 0; i
< mapsize
; i
++) {
2907 fvalues
[i
] = (GLfloat
) values
[i
];
2911 for (i
= 0; i
< mapsize
; i
++) {
2912 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2915 save_PixelMapfv(map
, mapsize
, fvalues
);
2919 static void GLAPIENTRY
2920 save_PixelTransferf(GLenum pname
, GLfloat param
)
2922 GET_CURRENT_CONTEXT(ctx
);
2924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2925 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2930 if (ctx
->ExecuteFlag
) {
2931 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2936 static void GLAPIENTRY
2937 save_PixelTransferi(GLenum pname
, GLint param
)
2939 save_PixelTransferf(pname
, (GLfloat
) param
);
2943 static void GLAPIENTRY
2944 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
2946 GET_CURRENT_CONTEXT(ctx
);
2948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2949 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
2954 if (ctx
->ExecuteFlag
) {
2955 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
2960 static void GLAPIENTRY
2961 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
2963 GET_CURRENT_CONTEXT(ctx
);
2965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2966 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
2973 if (ctx
->ExecuteFlag
) {
2974 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
2979 static void GLAPIENTRY
2980 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
2984 parray
[1] = parray
[2] = 0.0F
;
2985 save_PointParameterfvEXT(pname
, parray
);
2988 static void GLAPIENTRY
2989 save_PointParameteriNV(GLenum pname
, GLint param
)
2992 parray
[0] = (GLfloat
) param
;
2993 parray
[1] = parray
[2] = 0.0F
;
2994 save_PointParameterfvEXT(pname
, parray
);
2997 static void GLAPIENTRY
2998 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3001 parray
[0] = (GLfloat
) param
[0];
3002 parray
[1] = parray
[2] = 0.0F
;
3003 save_PointParameterfvEXT(pname
, parray
);
3007 static void GLAPIENTRY
3008 save_PointSize(GLfloat size
)
3010 GET_CURRENT_CONTEXT(ctx
);
3012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3013 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3017 if (ctx
->ExecuteFlag
) {
3018 CALL_PointSize(ctx
->Exec
, (size
));
3023 static void GLAPIENTRY
3024 save_PolygonMode(GLenum face
, GLenum mode
)
3026 GET_CURRENT_CONTEXT(ctx
);
3028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3029 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3034 if (ctx
->ExecuteFlag
) {
3035 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3040 static void GLAPIENTRY
3041 save_PolygonStipple(const GLubyte
* pattern
)
3043 GET_CURRENT_CONTEXT(ctx
);
3046 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3048 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3051 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3052 pattern
, &ctx
->Unpack
));
3054 if (ctx
->ExecuteFlag
) {
3055 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3060 static void GLAPIENTRY
3061 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3063 GET_CURRENT_CONTEXT(ctx
);
3065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3066 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3071 if (ctx
->ExecuteFlag
) {
3072 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3077 static void GLAPIENTRY
3078 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3080 GET_CURRENT_CONTEXT(ctx
);
3081 /* XXX mult by DepthMaxF here??? */
3082 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3086 static void GLAPIENTRY
3087 save_PopAttrib(void)
3089 GET_CURRENT_CONTEXT(ctx
);
3090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3091 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3092 if (ctx
->ExecuteFlag
) {
3093 CALL_PopAttrib(ctx
->Exec
, ());
3098 static void GLAPIENTRY
3099 save_PopMatrix(void)
3101 GET_CURRENT_CONTEXT(ctx
);
3102 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3103 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3104 if (ctx
->ExecuteFlag
) {
3105 CALL_PopMatrix(ctx
->Exec
, ());
3110 static void GLAPIENTRY
3113 GET_CURRENT_CONTEXT(ctx
);
3114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3115 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3116 if (ctx
->ExecuteFlag
) {
3117 CALL_PopName(ctx
->Exec
, ());
3122 static void GLAPIENTRY
3123 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3124 const GLclampf
* priorities
)
3126 GET_CURRENT_CONTEXT(ctx
);
3128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3130 for (i
= 0; i
< num
; i
++) {
3132 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3134 n
[1].ui
= textures
[i
];
3135 n
[2].f
= priorities
[i
];
3138 if (ctx
->ExecuteFlag
) {
3139 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3144 static void GLAPIENTRY
3145 save_PushAttrib(GLbitfield mask
)
3147 GET_CURRENT_CONTEXT(ctx
);
3149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3150 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3154 if (ctx
->ExecuteFlag
) {
3155 CALL_PushAttrib(ctx
->Exec
, (mask
));
3160 static void GLAPIENTRY
3161 save_PushMatrix(void)
3163 GET_CURRENT_CONTEXT(ctx
);
3164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3165 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3166 if (ctx
->ExecuteFlag
) {
3167 CALL_PushMatrix(ctx
->Exec
, ());
3172 static void GLAPIENTRY
3173 save_PushName(GLuint name
)
3175 GET_CURRENT_CONTEXT(ctx
);
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3178 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3182 if (ctx
->ExecuteFlag
) {
3183 CALL_PushName(ctx
->Exec
, (name
));
3188 static void GLAPIENTRY
3189 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3191 GET_CURRENT_CONTEXT(ctx
);
3193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3194 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3201 if (ctx
->ExecuteFlag
) {
3202 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3206 static void GLAPIENTRY
3207 save_RasterPos2d(GLdouble x
, GLdouble y
)
3209 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3212 static void GLAPIENTRY
3213 save_RasterPos2f(GLfloat x
, GLfloat y
)
3215 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3218 static void GLAPIENTRY
3219 save_RasterPos2i(GLint x
, GLint y
)
3221 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3224 static void GLAPIENTRY
3225 save_RasterPos2s(GLshort x
, GLshort y
)
3227 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3230 static void GLAPIENTRY
3231 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3233 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3236 static void GLAPIENTRY
3237 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3239 save_RasterPos4f(x
, y
, z
, 1.0F
);
3242 static void GLAPIENTRY
3243 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3245 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3248 static void GLAPIENTRY
3249 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3251 save_RasterPos4f(x
, y
, z
, 1.0F
);
3254 static void GLAPIENTRY
3255 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3257 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3260 static void GLAPIENTRY
3261 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3263 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3266 static void GLAPIENTRY
3267 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3269 save_RasterPos4f(x
, y
, z
, w
);
3272 static void GLAPIENTRY
3273 save_RasterPos2dv(const GLdouble
* v
)
3275 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3278 static void GLAPIENTRY
3279 save_RasterPos2fv(const GLfloat
* v
)
3281 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3284 static void GLAPIENTRY
3285 save_RasterPos2iv(const GLint
* v
)
3287 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3290 static void GLAPIENTRY
3291 save_RasterPos2sv(const GLshort
* v
)
3293 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3296 static void GLAPIENTRY
3297 save_RasterPos3dv(const GLdouble
* v
)
3299 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3302 static void GLAPIENTRY
3303 save_RasterPos3fv(const GLfloat
* v
)
3305 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3308 static void GLAPIENTRY
3309 save_RasterPos3iv(const GLint
* v
)
3311 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3314 static void GLAPIENTRY
3315 save_RasterPos3sv(const GLshort
* v
)
3317 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3320 static void GLAPIENTRY
3321 save_RasterPos4dv(const GLdouble
* v
)
3323 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3324 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3327 static void GLAPIENTRY
3328 save_RasterPos4fv(const GLfloat
* v
)
3330 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3333 static void GLAPIENTRY
3334 save_RasterPos4iv(const GLint
* v
)
3336 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3337 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3340 static void GLAPIENTRY
3341 save_RasterPos4sv(const GLshort
* v
)
3343 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3347 static void GLAPIENTRY
3348 save_PassThrough(GLfloat token
)
3350 GET_CURRENT_CONTEXT(ctx
);
3352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3353 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3357 if (ctx
->ExecuteFlag
) {
3358 CALL_PassThrough(ctx
->Exec
, (token
));
3363 static void GLAPIENTRY
3364 save_ReadBuffer(GLenum mode
)
3366 GET_CURRENT_CONTEXT(ctx
);
3368 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3369 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3373 if (ctx
->ExecuteFlag
) {
3374 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3379 static void GLAPIENTRY
3380 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3382 GET_CURRENT_CONTEXT(ctx
);
3384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3385 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3392 if (ctx
->ExecuteFlag
) {
3393 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3398 static void GLAPIENTRY
3399 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3401 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3405 static void GLAPIENTRY
3406 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3408 GET_CURRENT_CONTEXT(ctx
);
3410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3411 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3417 if (ctx
->ExecuteFlag
) {
3418 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3423 static void GLAPIENTRY
3424 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3426 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3430 static void GLAPIENTRY
3431 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3433 GET_CURRENT_CONTEXT(ctx
);
3435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3436 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3443 if (ctx
->ExecuteFlag
) {
3444 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3449 static void GLAPIENTRY
3450 save_ShadeModel(GLenum mode
)
3452 GET_CURRENT_CONTEXT(ctx
);
3454 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3456 if (ctx
->ExecuteFlag
) {
3457 CALL_ShadeModel(ctx
->Exec
, (mode
));
3460 /* Don't compile this call if it's a no-op.
3461 * By avoiding this state change we have a better chance of
3462 * coalescing subsequent drawing commands into one batch.
3464 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3467 SAVE_FLUSH_VERTICES(ctx
);
3469 ctx
->ListState
.Current
.ShadeModel
= mode
;
3471 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3478 static void GLAPIENTRY
3479 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3481 GET_CURRENT_CONTEXT(ctx
);
3483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3484 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3490 if (ctx
->ExecuteFlag
) {
3491 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3496 static void GLAPIENTRY
3497 save_StencilMask(GLuint mask
)
3499 GET_CURRENT_CONTEXT(ctx
);
3501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3502 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3506 if (ctx
->ExecuteFlag
) {
3507 CALL_StencilMask(ctx
->Exec
, (mask
));
3512 static void GLAPIENTRY
3513 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3515 GET_CURRENT_CONTEXT(ctx
);
3517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3518 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3524 if (ctx
->ExecuteFlag
) {
3525 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3530 static void GLAPIENTRY
3531 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3533 GET_CURRENT_CONTEXT(ctx
);
3535 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3536 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3543 if (ctx
->ExecuteFlag
) {
3544 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3549 static void GLAPIENTRY
3550 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3553 GET_CURRENT_CONTEXT(ctx
);
3555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3557 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3565 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3572 if (ctx
->ExecuteFlag
) {
3573 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3574 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3579 static void GLAPIENTRY
3580 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3582 GET_CURRENT_CONTEXT(ctx
);
3584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3585 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3590 if (ctx
->ExecuteFlag
) {
3591 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3596 static void GLAPIENTRY
3597 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3599 GET_CURRENT_CONTEXT(ctx
);
3601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3602 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3609 if (ctx
->ExecuteFlag
) {
3610 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3615 static void GLAPIENTRY
3616 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3618 GET_CURRENT_CONTEXT(ctx
);
3620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3621 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3625 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3633 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3636 if (ctx
->ExecuteFlag
) {
3637 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3642 static void GLAPIENTRY
3643 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3646 parray
[0] = (GLfloat
) param
;
3647 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3648 save_TexEnvfv(target
, pname
, parray
);
3652 static void GLAPIENTRY
3653 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3656 p
[0] = (GLfloat
) param
;
3657 p
[1] = p
[2] = p
[3] = 0.0F
;
3658 save_TexEnvfv(target
, pname
, p
);
3662 static void GLAPIENTRY
3663 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3666 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3667 p
[0] = INT_TO_FLOAT(param
[0]);
3668 p
[1] = INT_TO_FLOAT(param
[1]);
3669 p
[2] = INT_TO_FLOAT(param
[2]);
3670 p
[3] = INT_TO_FLOAT(param
[3]);
3673 p
[0] = (GLfloat
) param
[0];
3674 p
[1] = p
[2] = p
[3] = 0.0F
;
3676 save_TexEnvfv(target
, pname
, p
);
3680 static void GLAPIENTRY
3681 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3683 GET_CURRENT_CONTEXT(ctx
);
3685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3686 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3695 if (ctx
->ExecuteFlag
) {
3696 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3701 static void GLAPIENTRY
3702 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3705 p
[0] = (GLfloat
) params
[0];
3706 p
[1] = (GLfloat
) params
[1];
3707 p
[2] = (GLfloat
) params
[2];
3708 p
[3] = (GLfloat
) params
[3];
3709 save_TexGenfv(coord
, pname
, p
);
3713 static void GLAPIENTRY
3714 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3717 parray
[0] = (GLfloat
) param
;
3718 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3719 save_TexGenfv(coord
, pname
, parray
);
3723 static void GLAPIENTRY
3724 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3727 p
[0] = (GLfloat
) params
[0];
3728 p
[1] = (GLfloat
) params
[1];
3729 p
[2] = (GLfloat
) params
[2];
3730 p
[3] = (GLfloat
) params
[3];
3731 save_TexGenfv(coord
, pname
, p
);
3735 static void GLAPIENTRY
3736 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3740 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3741 save_TexGenfv(coord
, pname
, parray
);
3745 static void GLAPIENTRY
3746 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3750 parray
[1] = parray
[2] = parray
[3] = 0;
3751 save_TexGeniv(coord
, pname
, parray
);
3755 static void GLAPIENTRY
3756 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3758 GET_CURRENT_CONTEXT(ctx
);
3760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3761 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3770 if (ctx
->ExecuteFlag
) {
3771 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3776 static void GLAPIENTRY
3777 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3781 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3782 save_TexParameterfv(target
, pname
, parray
);
3786 static void GLAPIENTRY
3787 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3790 fparam
[0] = (GLfloat
) param
;
3791 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3792 save_TexParameterfv(target
, pname
, fparam
);
3796 static void GLAPIENTRY
3797 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3800 fparam
[0] = (GLfloat
) params
[0];
3801 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3802 save_TexParameterfv(target
, pname
, fparam
);
3806 static void GLAPIENTRY
3807 save_TexImage1D(GLenum target
,
3808 GLint level
, GLint components
,
3809 GLsizei width
, GLint border
,
3810 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3812 GET_CURRENT_CONTEXT(ctx
);
3813 if (target
== GL_PROXY_TEXTURE_1D
) {
3814 /* don't compile, execute immediately */
3815 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3816 border
, format
, type
, pixels
));
3820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3821 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3825 n
[3].i
= components
;
3826 n
[4].i
= (GLint
) width
;
3831 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3832 pixels
, &ctx
->Unpack
));
3834 if (ctx
->ExecuteFlag
) {
3835 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3836 border
, format
, type
, pixels
));
3842 static void GLAPIENTRY
3843 save_TexImage2D(GLenum target
,
3844 GLint level
, GLint components
,
3845 GLsizei width
, GLsizei height
, GLint border
,
3846 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3848 GET_CURRENT_CONTEXT(ctx
);
3849 if (target
== GL_PROXY_TEXTURE_2D
) {
3850 /* don't compile, execute immediately */
3851 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3852 height
, border
, format
, type
, pixels
));
3856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3857 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3861 n
[3].i
= components
;
3862 n
[4].i
= (GLint
) width
;
3863 n
[5].i
= (GLint
) height
;
3868 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3869 pixels
, &ctx
->Unpack
));
3871 if (ctx
->ExecuteFlag
) {
3872 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3873 height
, border
, format
, type
, pixels
));
3879 static void GLAPIENTRY
3880 save_TexImage3D(GLenum target
,
3881 GLint level
, GLint internalFormat
,
3882 GLsizei width
, GLsizei height
, GLsizei depth
,
3884 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3886 GET_CURRENT_CONTEXT(ctx
);
3887 if (target
== GL_PROXY_TEXTURE_3D
) {
3888 /* don't compile, execute immediately */
3889 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3890 height
, depth
, border
, format
, type
,
3895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3896 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3900 n
[3].i
= (GLint
) internalFormat
;
3901 n
[4].i
= (GLint
) width
;
3902 n
[5].i
= (GLint
) height
;
3903 n
[6].i
= (GLint
) depth
;
3907 save_pointer(&n
[10],
3908 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3909 pixels
, &ctx
->Unpack
));
3911 if (ctx
->ExecuteFlag
) {
3912 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3913 height
, depth
, border
, format
, type
,
3920 static void GLAPIENTRY
3921 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3922 GLsizei width
, GLenum format
, GLenum type
,
3923 const GLvoid
* pixels
)
3925 GET_CURRENT_CONTEXT(ctx
);
3928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3930 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
3935 n
[4].i
= (GLint
) width
;
3939 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3940 pixels
, &ctx
->Unpack
));
3942 if (ctx
->ExecuteFlag
) {
3943 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
3944 format
, type
, pixels
));
3949 static void GLAPIENTRY
3950 save_TexSubImage2D(GLenum target
, GLint level
,
3951 GLint xoffset
, GLint yoffset
,
3952 GLsizei width
, GLsizei height
,
3953 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3955 GET_CURRENT_CONTEXT(ctx
);
3958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3960 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
3966 n
[5].i
= (GLint
) width
;
3967 n
[6].i
= (GLint
) height
;
3971 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3972 pixels
, &ctx
->Unpack
));
3974 if (ctx
->ExecuteFlag
) {
3975 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
3976 width
, height
, format
, type
, pixels
));
3981 static void GLAPIENTRY
3982 save_TexSubImage3D(GLenum target
, GLint level
,
3983 GLint xoffset
, GLint yoffset
, GLint zoffset
,
3984 GLsizei width
, GLsizei height
, GLsizei depth
,
3985 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3987 GET_CURRENT_CONTEXT(ctx
);
3990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3992 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
3999 n
[6].i
= (GLint
) width
;
4000 n
[7].i
= (GLint
) height
;
4001 n
[8].i
= (GLint
) depth
;
4004 save_pointer(&n
[11],
4005 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4006 pixels
, &ctx
->Unpack
));
4008 if (ctx
->ExecuteFlag
) {
4009 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4010 xoffset
, yoffset
, zoffset
,
4011 width
, height
, depth
, format
, type
,
4017 static void GLAPIENTRY
4018 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4020 GET_CURRENT_CONTEXT(ctx
);
4022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4023 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4029 if (ctx
->ExecuteFlag
) {
4030 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4035 static void GLAPIENTRY
4036 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4038 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4043 static void GLAPIENTRY
4044 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4046 GET_CURRENT_CONTEXT(ctx
);
4048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4049 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4053 n
[3].i
= (GLint
) width
;
4054 n
[4].i
= (GLint
) height
;
4056 if (ctx
->ExecuteFlag
) {
4057 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4062 static void GLAPIENTRY
4063 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4065 GET_CURRENT_CONTEXT(ctx
);
4067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4068 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4075 if (ctx
->ExecuteFlag
) {
4076 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4080 static void GLAPIENTRY
4081 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4083 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4086 static void GLAPIENTRY
4087 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4089 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4092 static void GLAPIENTRY
4093 save_WindowPos2iMESA(GLint x
, GLint y
)
4095 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4098 static void GLAPIENTRY
4099 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4101 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4104 static void GLAPIENTRY
4105 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4107 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4110 static void GLAPIENTRY
4111 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4113 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4116 static void GLAPIENTRY
4117 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4119 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4122 static void GLAPIENTRY
4123 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4125 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4128 static void GLAPIENTRY
4129 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4131 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4134 static void GLAPIENTRY
4135 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4137 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4140 static void GLAPIENTRY
4141 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4143 save_WindowPos4fMESA(x
, y
, z
, w
);
4146 static void GLAPIENTRY
4147 save_WindowPos2dvMESA(const GLdouble
* v
)
4149 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4152 static void GLAPIENTRY
4153 save_WindowPos2fvMESA(const GLfloat
* v
)
4155 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4158 static void GLAPIENTRY
4159 save_WindowPos2ivMESA(const GLint
* v
)
4161 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4164 static void GLAPIENTRY
4165 save_WindowPos2svMESA(const GLshort
* v
)
4167 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4170 static void GLAPIENTRY
4171 save_WindowPos3dvMESA(const GLdouble
* v
)
4173 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4176 static void GLAPIENTRY
4177 save_WindowPos3fvMESA(const GLfloat
* v
)
4179 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4182 static void GLAPIENTRY
4183 save_WindowPos3ivMESA(const GLint
* v
)
4185 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4188 static void GLAPIENTRY
4189 save_WindowPos3svMESA(const GLshort
* v
)
4191 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4194 static void GLAPIENTRY
4195 save_WindowPos4dvMESA(const GLdouble
* v
)
4197 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4198 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4201 static void GLAPIENTRY
4202 save_WindowPos4fvMESA(const GLfloat
* v
)
4204 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4207 static void GLAPIENTRY
4208 save_WindowPos4ivMESA(const GLint
* v
)
4210 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4211 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4214 static void GLAPIENTRY
4215 save_WindowPos4svMESA(const GLshort
* v
)
4217 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4222 /* GL_ARB_multitexture */
4223 static void GLAPIENTRY
4224 save_ActiveTextureARB(GLenum target
)
4226 GET_CURRENT_CONTEXT(ctx
);
4228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4229 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4233 if (ctx
->ExecuteFlag
) {
4234 CALL_ActiveTexture(ctx
->Exec
, (target
));
4239 /* GL_ARB_transpose_matrix */
4241 static void GLAPIENTRY
4242 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4245 _math_transposefd(tm
, m
);
4246 save_LoadMatrixf(tm
);
4250 static void GLAPIENTRY
4251 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4254 _math_transposef(tm
, m
);
4255 save_LoadMatrixf(tm
);
4259 static void GLAPIENTRY
4260 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4263 _math_transposefd(tm
, m
);
4264 save_MultMatrixf(tm
);
4268 static void GLAPIENTRY
4269 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4272 _math_transposef(tm
, m
);
4273 save_MultMatrixf(tm
);
4276 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4278 GET_CURRENT_CONTEXT(ctx
);
4284 image
= malloc(size
);
4286 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4289 memcpy(image
, data
, size
);
4295 /* GL_ARB_texture_compression */
4296 static void GLAPIENTRY
4297 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4298 GLenum internalFormat
, GLsizei width
,
4299 GLint border
, GLsizei imageSize
,
4300 const GLvoid
* data
)
4302 GET_CURRENT_CONTEXT(ctx
);
4303 if (target
== GL_PROXY_TEXTURE_1D
) {
4304 /* don't compile, execute immediately */
4305 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4306 width
, border
, imageSize
,
4311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4313 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4314 6 + POINTER_DWORDS
);
4318 n
[3].e
= internalFormat
;
4319 n
[4].i
= (GLint
) width
;
4323 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4325 if (ctx
->ExecuteFlag
) {
4326 CALL_CompressedTexImage1D(ctx
->Exec
,
4327 (target
, level
, internalFormat
, width
,
4328 border
, imageSize
, data
));
4334 static void GLAPIENTRY
4335 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4336 GLenum internalFormat
, GLsizei width
,
4337 GLsizei height
, GLint border
, GLsizei imageSize
,
4338 const GLvoid
* data
)
4340 GET_CURRENT_CONTEXT(ctx
);
4341 if (target
== GL_PROXY_TEXTURE_2D
) {
4342 /* don't compile, execute immediately */
4343 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4344 width
, height
, border
,
4349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4351 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4352 7 + POINTER_DWORDS
);
4356 n
[3].e
= internalFormat
;
4357 n
[4].i
= (GLint
) width
;
4358 n
[5].i
= (GLint
) height
;
4362 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4364 if (ctx
->ExecuteFlag
) {
4365 CALL_CompressedTexImage2D(ctx
->Exec
,
4366 (target
, level
, internalFormat
, width
,
4367 height
, border
, imageSize
, data
));
4373 static void GLAPIENTRY
4374 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4375 GLenum internalFormat
, GLsizei width
,
4376 GLsizei height
, GLsizei depth
, GLint border
,
4377 GLsizei imageSize
, const GLvoid
* data
)
4379 GET_CURRENT_CONTEXT(ctx
);
4380 if (target
== GL_PROXY_TEXTURE_3D
) {
4381 /* don't compile, execute immediately */
4382 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4383 width
, height
, depth
, border
,
4388 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4390 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4391 8 + POINTER_DWORDS
);
4395 n
[3].e
= internalFormat
;
4396 n
[4].i
= (GLint
) width
;
4397 n
[5].i
= (GLint
) height
;
4398 n
[6].i
= (GLint
) depth
;
4402 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4404 if (ctx
->ExecuteFlag
) {
4405 CALL_CompressedTexImage3D(ctx
->Exec
,
4406 (target
, level
, internalFormat
, width
,
4407 height
, depth
, border
, imageSize
,
4414 static void GLAPIENTRY
4415 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4416 GLsizei width
, GLenum format
,
4417 GLsizei imageSize
, const GLvoid
* data
)
4420 GET_CURRENT_CONTEXT(ctx
);
4421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4423 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4424 6 + POINTER_DWORDS
);
4429 n
[4].i
= (GLint
) width
;
4433 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4435 if (ctx
->ExecuteFlag
) {
4436 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4437 width
, format
, imageSize
,
4443 static void GLAPIENTRY
4444 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4445 GLint yoffset
, GLsizei width
, GLsizei height
,
4446 GLenum format
, GLsizei imageSize
,
4447 const GLvoid
* data
)
4450 GET_CURRENT_CONTEXT(ctx
);
4451 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4453 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4454 8 + POINTER_DWORDS
);
4460 n
[5].i
= (GLint
) width
;
4461 n
[6].i
= (GLint
) height
;
4465 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4467 if (ctx
->ExecuteFlag
) {
4468 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4469 (target
, level
, xoffset
, yoffset
, width
,
4470 height
, format
, imageSize
, data
));
4475 static void GLAPIENTRY
4476 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4477 GLint yoffset
, GLint zoffset
, GLsizei width
,
4478 GLsizei height
, GLsizei depth
, GLenum format
,
4479 GLsizei imageSize
, const GLvoid
* data
)
4482 GET_CURRENT_CONTEXT(ctx
);
4483 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4485 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4486 10 + POINTER_DWORDS
);
4493 n
[6].i
= (GLint
) width
;
4494 n
[7].i
= (GLint
) height
;
4495 n
[8].i
= (GLint
) depth
;
4497 n
[10].i
= imageSize
;
4498 save_pointer(&n
[11],
4499 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4501 if (ctx
->ExecuteFlag
) {
4502 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4503 (target
, level
, xoffset
, yoffset
,
4504 zoffset
, width
, height
, depth
, format
,
4510 /* GL_ARB_multisample */
4511 static void GLAPIENTRY
4512 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4514 GET_CURRENT_CONTEXT(ctx
);
4516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4517 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4522 if (ctx
->ExecuteFlag
) {
4523 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4529 * GL_NV_fragment_program
4531 static void GLAPIENTRY
4532 save_BindProgramNV(GLenum target
, GLuint id
)
4534 GET_CURRENT_CONTEXT(ctx
);
4536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4537 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4542 if (ctx
->ExecuteFlag
) {
4543 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4547 static void GLAPIENTRY
4548 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4549 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4551 GET_CURRENT_CONTEXT(ctx
);
4553 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4554 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4563 if (ctx
->ExecuteFlag
) {
4564 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4569 static void GLAPIENTRY
4570 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4571 const GLfloat
*params
)
4573 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4574 params
[2], params
[3]);
4578 static void GLAPIENTRY
4579 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4580 const GLfloat
* params
)
4582 GET_CURRENT_CONTEXT(ctx
);
4584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4588 const GLfloat
* p
= params
;
4590 for (i
= 0 ; i
< count
; i
++) {
4591 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4604 if (ctx
->ExecuteFlag
) {
4605 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4610 static void GLAPIENTRY
4611 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4612 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4614 save_ProgramEnvParameter4fARB(target
, index
,
4616 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4620 static void GLAPIENTRY
4621 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4622 const GLdouble
*params
)
4624 save_ProgramEnvParameter4fARB(target
, index
,
4625 (GLfloat
) params
[0],
4626 (GLfloat
) params
[1],
4627 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4631 static void GLAPIENTRY
4632 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4633 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4635 GET_CURRENT_CONTEXT(ctx
);
4637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4638 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4647 if (ctx
->ExecuteFlag
) {
4648 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4653 static void GLAPIENTRY
4654 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4655 const GLfloat
*params
)
4657 GET_CURRENT_CONTEXT(ctx
);
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4660 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4669 if (ctx
->ExecuteFlag
) {
4670 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4675 static void GLAPIENTRY
4676 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4677 const GLfloat
*params
)
4679 GET_CURRENT_CONTEXT(ctx
);
4681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4685 const GLfloat
* p
= params
;
4687 for (i
= 0 ; i
< count
; i
++) {
4688 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4701 if (ctx
->ExecuteFlag
) {
4702 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4707 static void GLAPIENTRY
4708 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4709 GLdouble x
, GLdouble y
,
4710 GLdouble z
, GLdouble w
)
4712 GET_CURRENT_CONTEXT(ctx
);
4714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4715 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4719 n
[3].f
= (GLfloat
) x
;
4720 n
[4].f
= (GLfloat
) y
;
4721 n
[5].f
= (GLfloat
) z
;
4722 n
[6].f
= (GLfloat
) w
;
4724 if (ctx
->ExecuteFlag
) {
4725 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4730 static void GLAPIENTRY
4731 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4732 const GLdouble
*params
)
4734 GET_CURRENT_CONTEXT(ctx
);
4736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4737 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4741 n
[3].f
= (GLfloat
) params
[0];
4742 n
[4].f
= (GLfloat
) params
[1];
4743 n
[5].f
= (GLfloat
) params
[2];
4744 n
[6].f
= (GLfloat
) params
[3];
4746 if (ctx
->ExecuteFlag
) {
4747 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4752 /* GL_EXT_stencil_two_side */
4753 static void GLAPIENTRY
4754 save_ActiveStencilFaceEXT(GLenum face
)
4756 GET_CURRENT_CONTEXT(ctx
);
4758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4759 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4763 if (ctx
->ExecuteFlag
) {
4764 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4769 /* GL_EXT_depth_bounds_test */
4770 static void GLAPIENTRY
4771 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4773 GET_CURRENT_CONTEXT(ctx
);
4775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4776 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4778 n
[1].f
= (GLfloat
) zmin
;
4779 n
[2].f
= (GLfloat
) zmax
;
4781 if (ctx
->ExecuteFlag
) {
4782 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4788 static void GLAPIENTRY
4789 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4790 const GLvoid
* string
)
4792 GET_CURRENT_CONTEXT(ctx
);
4795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4797 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4799 GLubyte
*programCopy
= malloc(len
);
4801 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4804 memcpy(programCopy
, string
, len
);
4808 save_pointer(&n
[4], programCopy
);
4810 if (ctx
->ExecuteFlag
) {
4811 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4816 static void GLAPIENTRY
4817 save_BeginQueryARB(GLenum target
, GLuint id
)
4819 GET_CURRENT_CONTEXT(ctx
);
4821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4822 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4827 if (ctx
->ExecuteFlag
) {
4828 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4832 static void GLAPIENTRY
4833 save_EndQueryARB(GLenum target
)
4835 GET_CURRENT_CONTEXT(ctx
);
4837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4838 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4842 if (ctx
->ExecuteFlag
) {
4843 CALL_EndQuery(ctx
->Exec
, (target
));
4847 static void GLAPIENTRY
4848 save_QueryCounter(GLuint id
, GLenum target
)
4850 GET_CURRENT_CONTEXT(ctx
);
4852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4853 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4858 if (ctx
->ExecuteFlag
) {
4859 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4863 static void GLAPIENTRY
4864 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4866 GET_CURRENT_CONTEXT(ctx
);
4868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4869 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4875 if (ctx
->ExecuteFlag
) {
4876 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4880 static void GLAPIENTRY
4881 save_EndQueryIndexed(GLenum target
, GLuint index
)
4883 GET_CURRENT_CONTEXT(ctx
);
4885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4886 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4891 if (ctx
->ExecuteFlag
) {
4892 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4897 static void GLAPIENTRY
4898 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4900 GET_CURRENT_CONTEXT(ctx
);
4902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4903 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4907 if (count
> MAX_DRAW_BUFFERS
)
4908 count
= MAX_DRAW_BUFFERS
;
4909 for (i
= 0; i
< count
; i
++) {
4910 n
[2 + i
].e
= buffers
[i
];
4913 if (ctx
->ExecuteFlag
) {
4914 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4918 static void GLAPIENTRY
4919 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4921 GET_CURRENT_CONTEXT(ctx
);
4924 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4932 if (ctx
->ExecuteFlag
) {
4933 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4937 static void GLAPIENTRY
4938 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
4941 p
[0] = INT_TO_FLOAT(param
[0]);
4942 p
[1] = INT_TO_FLOAT(param
[1]);
4943 p
[2] = INT_TO_FLOAT(param
[2]);
4944 p
[3] = INT_TO_FLOAT(param
[3]);
4945 save_TexBumpParameterfvATI(pname
, p
);
4948 static void GLAPIENTRY
4949 save_BindFragmentShaderATI(GLuint id
)
4951 GET_CURRENT_CONTEXT(ctx
);
4954 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
4958 if (ctx
->ExecuteFlag
) {
4959 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
4963 static void GLAPIENTRY
4964 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
4966 GET_CURRENT_CONTEXT(ctx
);
4969 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
4977 if (ctx
->ExecuteFlag
) {
4978 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
4982 static void GLAPIENTRY
4983 save_Attr1fNV(GLenum attr
, GLfloat x
)
4985 GET_CURRENT_CONTEXT(ctx
);
4987 SAVE_FLUSH_VERTICES(ctx
);
4988 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
4994 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
4995 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
4996 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
4998 if (ctx
->ExecuteFlag
) {
4999 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5003 static void GLAPIENTRY
5004 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 SAVE_FLUSH_VERTICES(ctx
);
5009 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5016 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5017 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5018 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5020 if (ctx
->ExecuteFlag
) {
5021 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5025 static void GLAPIENTRY
5026 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5028 GET_CURRENT_CONTEXT(ctx
);
5030 SAVE_FLUSH_VERTICES(ctx
);
5031 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5039 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5040 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5041 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5043 if (ctx
->ExecuteFlag
) {
5044 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5048 static void GLAPIENTRY
5049 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5051 GET_CURRENT_CONTEXT(ctx
);
5053 SAVE_FLUSH_VERTICES(ctx
);
5054 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5063 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5064 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5065 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5067 if (ctx
->ExecuteFlag
) {
5068 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5073 static void GLAPIENTRY
5074 save_Attr1fARB(GLenum attr
, GLfloat x
)
5076 GET_CURRENT_CONTEXT(ctx
);
5078 SAVE_FLUSH_VERTICES(ctx
);
5079 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5085 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5086 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5087 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5089 if (ctx
->ExecuteFlag
) {
5090 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5094 static void GLAPIENTRY
5095 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5097 GET_CURRENT_CONTEXT(ctx
);
5099 SAVE_FLUSH_VERTICES(ctx
);
5100 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5107 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5108 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5109 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5111 if (ctx
->ExecuteFlag
) {
5112 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5116 static void GLAPIENTRY
5117 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5119 GET_CURRENT_CONTEXT(ctx
);
5121 SAVE_FLUSH_VERTICES(ctx
);
5122 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5130 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5131 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5132 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5134 if (ctx
->ExecuteFlag
) {
5135 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5139 static void GLAPIENTRY
5140 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5142 GET_CURRENT_CONTEXT(ctx
);
5144 SAVE_FLUSH_VERTICES(ctx
);
5145 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5154 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5155 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5156 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5158 if (ctx
->ExecuteFlag
) {
5159 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5164 static void GLAPIENTRY
5165 save_EvalCoord1f(GLfloat x
)
5167 GET_CURRENT_CONTEXT(ctx
);
5169 SAVE_FLUSH_VERTICES(ctx
);
5170 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5174 if (ctx
->ExecuteFlag
) {
5175 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5179 static void GLAPIENTRY
5180 save_EvalCoord1fv(const GLfloat
* v
)
5182 save_EvalCoord1f(v
[0]);
5185 static void GLAPIENTRY
5186 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5188 GET_CURRENT_CONTEXT(ctx
);
5190 SAVE_FLUSH_VERTICES(ctx
);
5191 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5196 if (ctx
->ExecuteFlag
) {
5197 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5201 static void GLAPIENTRY
5202 save_EvalCoord2fv(const GLfloat
* v
)
5204 save_EvalCoord2f(v
[0], v
[1]);
5208 static void GLAPIENTRY
5209 save_EvalPoint1(GLint x
)
5211 GET_CURRENT_CONTEXT(ctx
);
5213 SAVE_FLUSH_VERTICES(ctx
);
5214 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5218 if (ctx
->ExecuteFlag
) {
5219 CALL_EvalPoint1(ctx
->Exec
, (x
));
5223 static void GLAPIENTRY
5224 save_EvalPoint2(GLint x
, GLint y
)
5226 GET_CURRENT_CONTEXT(ctx
);
5228 SAVE_FLUSH_VERTICES(ctx
);
5229 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5234 if (ctx
->ExecuteFlag
) {
5235 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5239 static void GLAPIENTRY
5240 save_Indexf(GLfloat x
)
5242 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5245 static void GLAPIENTRY
5246 save_Indexfv(const GLfloat
* v
)
5248 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5251 static void GLAPIENTRY
5252 save_EdgeFlag(GLboolean x
)
5254 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5259 * Compare 'count' elements of vectors 'a' and 'b'.
5260 * \return GL_TRUE if equal, GL_FALSE if different.
5262 static inline GLboolean
5263 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5265 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5270 * This glMaterial function is used for glMaterial calls that are outside
5271 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5273 static void GLAPIENTRY
5274 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5276 GET_CURRENT_CONTEXT(ctx
);
5284 case GL_FRONT_AND_BACK
:
5287 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5296 case GL_AMBIENT_AND_DIFFUSE
:
5302 case GL_COLOR_INDEXES
:
5306 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5310 if (ctx
->ExecuteFlag
) {
5311 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5314 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5316 /* Try to eliminate redundant statechanges. Because it is legal to
5317 * call glMaterial even inside begin/end calls, don't need to worry
5318 * about ctx->Driver.CurrentSavePrimitive here.
5320 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5321 if (bitmask
& (1 << i
)) {
5322 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5323 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5324 /* no change in material value */
5325 bitmask
&= ~(1 << i
);
5328 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5329 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5334 /* If this call has no effect, return early */
5338 SAVE_FLUSH_VERTICES(ctx
);
5340 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5344 for (i
= 0; i
< args
; i
++)
5345 n
[3 + i
].f
= param
[i
];
5349 static void GLAPIENTRY
5350 save_Begin(GLenum mode
)
5352 GET_CURRENT_CONTEXT(ctx
);
5354 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5355 /* compile this error into the display list */
5356 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5358 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5359 /* compile this error into the display list */
5360 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5365 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5367 /* Give the driver an opportunity to hook in an optimized
5368 * display list compiler.
5370 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5373 SAVE_FLUSH_VERTICES(ctx
);
5374 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5379 if (ctx
->ExecuteFlag
) {
5380 CALL_Begin(ctx
->Exec
, (mode
));
5385 static void GLAPIENTRY
5388 GET_CURRENT_CONTEXT(ctx
);
5389 SAVE_FLUSH_VERTICES(ctx
);
5390 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5391 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5392 if (ctx
->ExecuteFlag
) {
5393 CALL_End(ctx
->Exec
, ());
5397 static void GLAPIENTRY
5398 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5400 GET_CURRENT_CONTEXT(ctx
);
5402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5403 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5410 if (ctx
->ExecuteFlag
) {
5411 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5416 static void GLAPIENTRY
5417 save_Vertex2f(GLfloat x
, GLfloat y
)
5419 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5422 static void GLAPIENTRY
5423 save_Vertex2fv(const GLfloat
* v
)
5425 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5428 static void GLAPIENTRY
5429 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5431 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5434 static void GLAPIENTRY
5435 save_Vertex3fv(const GLfloat
* v
)
5437 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5440 static void GLAPIENTRY
5441 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5443 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5446 static void GLAPIENTRY
5447 save_Vertex4fv(const GLfloat
* v
)
5449 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5452 static void GLAPIENTRY
5453 save_TexCoord1f(GLfloat x
)
5455 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5458 static void GLAPIENTRY
5459 save_TexCoord1fv(const GLfloat
* v
)
5461 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5464 static void GLAPIENTRY
5465 save_TexCoord2f(GLfloat x
, GLfloat y
)
5467 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5470 static void GLAPIENTRY
5471 save_TexCoord2fv(const GLfloat
* v
)
5473 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5476 static void GLAPIENTRY
5477 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5479 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5482 static void GLAPIENTRY
5483 save_TexCoord3fv(const GLfloat
* v
)
5485 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5488 static void GLAPIENTRY
5489 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5491 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5494 static void GLAPIENTRY
5495 save_TexCoord4fv(const GLfloat
* v
)
5497 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5500 static void GLAPIENTRY
5501 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5503 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5506 static void GLAPIENTRY
5507 save_Normal3fv(const GLfloat
* v
)
5509 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5512 static void GLAPIENTRY
5513 save_FogCoordfEXT(GLfloat x
)
5515 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5518 static void GLAPIENTRY
5519 save_FogCoordfvEXT(const GLfloat
* v
)
5521 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5524 static void GLAPIENTRY
5525 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5527 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5530 static void GLAPIENTRY
5531 save_Color3fv(const GLfloat
* v
)
5533 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5536 static void GLAPIENTRY
5537 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5539 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5542 static void GLAPIENTRY
5543 save_Color4fv(const GLfloat
* v
)
5545 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5548 static void GLAPIENTRY
5549 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5551 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5554 static void GLAPIENTRY
5555 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5557 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5561 /* Just call the respective ATTR for texcoord
5563 static void GLAPIENTRY
5564 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5566 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5567 save_Attr1fNV(attr
, x
);
5570 static void GLAPIENTRY
5571 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5573 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5574 save_Attr1fNV(attr
, v
[0]);
5577 static void GLAPIENTRY
5578 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5580 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5581 save_Attr2fNV(attr
, x
, y
);
5584 static void GLAPIENTRY
5585 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5587 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5588 save_Attr2fNV(attr
, v
[0], v
[1]);
5591 static void GLAPIENTRY
5592 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5594 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5595 save_Attr3fNV(attr
, x
, y
, z
);
5598 static void GLAPIENTRY
5599 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5601 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5602 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5605 static void GLAPIENTRY
5606 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5607 GLfloat z
, GLfloat w
)
5609 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5610 save_Attr4fNV(attr
, x
, y
, z
, w
);
5613 static void GLAPIENTRY
5614 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5616 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5617 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5622 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5628 GET_CURRENT_CONTEXT(ctx
);
5629 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5634 static void GLAPIENTRY
5635 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5637 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5638 save_Attr1fARB(index
, x
);
5643 static void GLAPIENTRY
5644 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5646 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5647 save_Attr1fARB(index
, v
[0]);
5652 static void GLAPIENTRY
5653 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5655 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5656 save_Attr2fARB(index
, x
, y
);
5661 static void GLAPIENTRY
5662 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5664 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5665 save_Attr2fARB(index
, v
[0], v
[1]);
5670 static void GLAPIENTRY
5671 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5673 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5674 save_Attr3fARB(index
, x
, y
, z
);
5679 static void GLAPIENTRY
5680 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5682 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5683 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5688 static void GLAPIENTRY
5689 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5692 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5693 save_Attr4fARB(index
, x
, y
, z
, w
);
5698 static void GLAPIENTRY
5699 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5701 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5702 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5707 static void GLAPIENTRY
5708 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5709 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5710 GLbitfield mask
, GLenum filter
)
5712 GET_CURRENT_CONTEXT(ctx
);
5714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5715 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5728 if (ctx
->ExecuteFlag
) {
5729 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5730 dstX0
, dstY0
, dstX1
, dstY1
,
5736 /** GL_EXT_provoking_vertex */
5737 static void GLAPIENTRY
5738 save_ProvokingVertexEXT(GLenum mode
)
5740 GET_CURRENT_CONTEXT(ctx
);
5742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5743 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5747 if (ctx
->ExecuteFlag
) {
5748 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5749 _mesa_ProvokingVertex(mode
);
5754 /** GL_EXT_transform_feedback */
5755 static void GLAPIENTRY
5756 save_BeginTransformFeedback(GLenum mode
)
5758 GET_CURRENT_CONTEXT(ctx
);
5760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5761 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5765 if (ctx
->ExecuteFlag
) {
5766 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5771 /** GL_EXT_transform_feedback */
5772 static void GLAPIENTRY
5773 save_EndTransformFeedback(void)
5775 GET_CURRENT_CONTEXT(ctx
);
5776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5777 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5778 if (ctx
->ExecuteFlag
) {
5779 CALL_EndTransformFeedback(ctx
->Exec
, ());
5783 static void GLAPIENTRY
5784 save_BindTransformFeedback(GLenum target
, GLuint name
)
5786 GET_CURRENT_CONTEXT(ctx
);
5788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5789 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5794 if (ctx
->ExecuteFlag
) {
5795 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5799 static void GLAPIENTRY
5800 save_PauseTransformFeedback(void)
5802 GET_CURRENT_CONTEXT(ctx
);
5803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5804 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5805 if (ctx
->ExecuteFlag
) {
5806 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5810 static void GLAPIENTRY
5811 save_ResumeTransformFeedback(void)
5813 GET_CURRENT_CONTEXT(ctx
);
5814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5815 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5816 if (ctx
->ExecuteFlag
) {
5817 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5821 static void GLAPIENTRY
5822 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5824 GET_CURRENT_CONTEXT(ctx
);
5826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5827 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5832 if (ctx
->ExecuteFlag
) {
5833 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5837 static void GLAPIENTRY
5838 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5840 GET_CURRENT_CONTEXT(ctx
);
5842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5843 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5849 if (ctx
->ExecuteFlag
) {
5850 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5854 static void GLAPIENTRY
5855 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5858 GET_CURRENT_CONTEXT(ctx
);
5860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5861 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5865 n
[3].si
= primcount
;
5867 if (ctx
->ExecuteFlag
) {
5868 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5872 static void GLAPIENTRY
5873 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5874 GLuint stream
, GLsizei primcount
)
5876 GET_CURRENT_CONTEXT(ctx
);
5878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5879 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5884 n
[4].si
= primcount
;
5886 if (ctx
->ExecuteFlag
) {
5887 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5892 /* aka UseProgram() */
5893 static void GLAPIENTRY
5894 save_UseProgramObjectARB(GLhandleARB program
)
5896 GET_CURRENT_CONTEXT(ctx
);
5898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5899 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5903 if (ctx
->ExecuteFlag
) {
5904 CALL_UseProgram(ctx
->Exec
, (program
));
5909 static void GLAPIENTRY
5910 save_Uniform1fARB(GLint location
, GLfloat x
)
5912 GET_CURRENT_CONTEXT(ctx
);
5914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5915 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5920 if (ctx
->ExecuteFlag
) {
5921 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5926 static void GLAPIENTRY
5927 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5929 GET_CURRENT_CONTEXT(ctx
);
5931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5932 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5938 if (ctx
->ExecuteFlag
) {
5939 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
5944 static void GLAPIENTRY
5945 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
5947 GET_CURRENT_CONTEXT(ctx
);
5949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5950 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
5957 if (ctx
->ExecuteFlag
) {
5958 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
5963 static void GLAPIENTRY
5964 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5966 GET_CURRENT_CONTEXT(ctx
);
5968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5969 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
5977 if (ctx
->ExecuteFlag
) {
5978 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
5983 static void GLAPIENTRY
5984 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
5986 GET_CURRENT_CONTEXT(ctx
);
5988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5989 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
5993 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
5995 if (ctx
->ExecuteFlag
) {
5996 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6000 static void GLAPIENTRY
6001 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6003 GET_CURRENT_CONTEXT(ctx
);
6005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6006 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6010 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6012 if (ctx
->ExecuteFlag
) {
6013 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6017 static void GLAPIENTRY
6018 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6020 GET_CURRENT_CONTEXT(ctx
);
6022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6023 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6027 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6029 if (ctx
->ExecuteFlag
) {
6030 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6034 static void GLAPIENTRY
6035 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6037 GET_CURRENT_CONTEXT(ctx
);
6039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6040 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6044 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6046 if (ctx
->ExecuteFlag
) {
6047 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6052 static void GLAPIENTRY
6053 save_Uniform1iARB(GLint location
, GLint x
)
6055 GET_CURRENT_CONTEXT(ctx
);
6057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6058 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6063 if (ctx
->ExecuteFlag
) {
6064 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6068 static void GLAPIENTRY
6069 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6071 GET_CURRENT_CONTEXT(ctx
);
6073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6074 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6080 if (ctx
->ExecuteFlag
) {
6081 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6085 static void GLAPIENTRY
6086 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6088 GET_CURRENT_CONTEXT(ctx
);
6090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6091 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6098 if (ctx
->ExecuteFlag
) {
6099 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6103 static void GLAPIENTRY
6104 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6106 GET_CURRENT_CONTEXT(ctx
);
6108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6109 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6117 if (ctx
->ExecuteFlag
) {
6118 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6124 static void GLAPIENTRY
6125 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6127 GET_CURRENT_CONTEXT(ctx
);
6129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6130 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6134 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6136 if (ctx
->ExecuteFlag
) {
6137 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6141 static void GLAPIENTRY
6142 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6144 GET_CURRENT_CONTEXT(ctx
);
6146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6147 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6151 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6153 if (ctx
->ExecuteFlag
) {
6154 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6158 static void GLAPIENTRY
6159 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6161 GET_CURRENT_CONTEXT(ctx
);
6163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6164 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6168 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6170 if (ctx
->ExecuteFlag
) {
6171 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6175 static void GLAPIENTRY
6176 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6178 GET_CURRENT_CONTEXT(ctx
);
6180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6181 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6185 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6187 if (ctx
->ExecuteFlag
) {
6188 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6194 static void GLAPIENTRY
6195 save_Uniform1ui(GLint location
, GLuint x
)
6197 GET_CURRENT_CONTEXT(ctx
);
6199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6200 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6205 if (ctx
->ExecuteFlag
) {
6206 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6210 static void GLAPIENTRY
6211 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6213 GET_CURRENT_CONTEXT(ctx
);
6215 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6216 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6222 if (ctx
->ExecuteFlag
) {
6223 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6227 static void GLAPIENTRY
6228 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6230 GET_CURRENT_CONTEXT(ctx
);
6232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6233 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6240 if (ctx
->ExecuteFlag
) {
6241 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6245 static void GLAPIENTRY
6246 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6248 GET_CURRENT_CONTEXT(ctx
);
6250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6251 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6259 if (ctx
->ExecuteFlag
) {
6260 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6266 static void GLAPIENTRY
6267 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6269 GET_CURRENT_CONTEXT(ctx
);
6271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6272 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6276 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6278 if (ctx
->ExecuteFlag
) {
6279 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6283 static void GLAPIENTRY
6284 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6286 GET_CURRENT_CONTEXT(ctx
);
6288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6289 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6293 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6295 if (ctx
->ExecuteFlag
) {
6296 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6300 static void GLAPIENTRY
6301 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6303 GET_CURRENT_CONTEXT(ctx
);
6305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6306 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6310 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6312 if (ctx
->ExecuteFlag
) {
6313 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6317 static void GLAPIENTRY
6318 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6320 GET_CURRENT_CONTEXT(ctx
);
6322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6323 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6327 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6329 if (ctx
->ExecuteFlag
) {
6330 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6336 static void GLAPIENTRY
6337 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6340 GET_CURRENT_CONTEXT(ctx
);
6342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6343 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6348 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6350 if (ctx
->ExecuteFlag
) {
6351 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6355 static void GLAPIENTRY
6356 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6359 GET_CURRENT_CONTEXT(ctx
);
6361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6362 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6367 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6369 if (ctx
->ExecuteFlag
) {
6370 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6374 static void GLAPIENTRY
6375 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6378 GET_CURRENT_CONTEXT(ctx
);
6380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6381 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6386 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6388 if (ctx
->ExecuteFlag
) {
6389 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6394 static void GLAPIENTRY
6395 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6398 GET_CURRENT_CONTEXT(ctx
);
6400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6401 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6406 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6408 if (ctx
->ExecuteFlag
) {
6409 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6413 static void GLAPIENTRY
6414 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6417 GET_CURRENT_CONTEXT(ctx
);
6419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6420 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6425 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6427 if (ctx
->ExecuteFlag
) {
6428 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6433 static void GLAPIENTRY
6434 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6437 GET_CURRENT_CONTEXT(ctx
);
6439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6440 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6445 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6447 if (ctx
->ExecuteFlag
) {
6448 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6452 static void GLAPIENTRY
6453 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6456 GET_CURRENT_CONTEXT(ctx
);
6458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6459 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6464 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6466 if (ctx
->ExecuteFlag
) {
6467 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6472 static void GLAPIENTRY
6473 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6476 GET_CURRENT_CONTEXT(ctx
);
6478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6479 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6484 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6486 if (ctx
->ExecuteFlag
) {
6487 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6491 static void GLAPIENTRY
6492 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6495 GET_CURRENT_CONTEXT(ctx
);
6497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6498 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6503 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6505 if (ctx
->ExecuteFlag
) {
6506 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6510 static void GLAPIENTRY
6511 save_ClampColorARB(GLenum target
, GLenum clamp
)
6513 GET_CURRENT_CONTEXT(ctx
);
6515 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6516 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6521 if (ctx
->ExecuteFlag
) {
6522 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6526 static void GLAPIENTRY
6527 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6529 GET_CURRENT_CONTEXT(ctx
);
6531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6532 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6537 if (ctx
->ExecuteFlag
) {
6538 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6542 static void GLAPIENTRY
6543 save_ActiveProgramEXT(GLuint program
)
6545 GET_CURRENT_CONTEXT(ctx
);
6547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6548 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6552 if (ctx
->ExecuteFlag
) {
6553 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6557 /** GL_EXT_texture_integer */
6558 static void GLAPIENTRY
6559 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6561 GET_CURRENT_CONTEXT(ctx
);
6563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6564 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6571 if (ctx
->ExecuteFlag
) {
6572 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6576 /** GL_EXT_texture_integer */
6577 static void GLAPIENTRY
6578 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6580 GET_CURRENT_CONTEXT(ctx
);
6582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6583 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6590 if (ctx
->ExecuteFlag
) {
6591 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6595 /** GL_EXT_texture_integer */
6596 static void GLAPIENTRY
6597 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6599 GET_CURRENT_CONTEXT(ctx
);
6601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6602 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6611 if (ctx
->ExecuteFlag
) {
6612 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6616 /** GL_EXT_texture_integer */
6617 static void GLAPIENTRY
6618 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6620 GET_CURRENT_CONTEXT(ctx
);
6622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6623 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6627 n
[3].ui
= params
[0];
6628 n
[4].ui
= params
[1];
6629 n
[5].ui
= params
[2];
6630 n
[6].ui
= params
[3];
6632 if (ctx
->ExecuteFlag
) {
6633 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6637 /* GL_ARB_instanced_arrays */
6638 static void GLAPIENTRY
6639 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6641 GET_CURRENT_CONTEXT(ctx
);
6643 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6644 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6649 if (ctx
->ExecuteFlag
) {
6650 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6655 /* GL_NV_texture_barrier */
6656 static void GLAPIENTRY
6657 save_TextureBarrierNV(void)
6659 GET_CURRENT_CONTEXT(ctx
);
6660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6661 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6662 if (ctx
->ExecuteFlag
) {
6663 CALL_TextureBarrierNV(ctx
->Exec
, ());
6668 /* GL_ARB_sampler_objects */
6669 static void GLAPIENTRY
6670 save_BindSampler(GLuint unit
, GLuint sampler
)
6673 GET_CURRENT_CONTEXT(ctx
);
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6675 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6680 if (ctx
->ExecuteFlag
) {
6681 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6685 static void GLAPIENTRY
6686 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6689 GET_CURRENT_CONTEXT(ctx
);
6690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6691 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
6696 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6702 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6705 if (ctx
->ExecuteFlag
) {
6706 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
6710 static void GLAPIENTRY
6711 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
6715 parray
[1] = parray
[2] = parray
[3] = 0;
6716 save_SamplerParameteriv(sampler
, pname
, parray
);
6719 static void GLAPIENTRY
6720 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
6723 GET_CURRENT_CONTEXT(ctx
);
6724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6725 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
6730 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6736 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
6739 if (ctx
->ExecuteFlag
) {
6740 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
6744 static void GLAPIENTRY
6745 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
6749 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
6750 save_SamplerParameterfv(sampler
, pname
, parray
);
6753 static void GLAPIENTRY
6754 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6757 GET_CURRENT_CONTEXT(ctx
);
6758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6759 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
6764 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6770 n
[4].i
= n
[5].i
= n
[6].i
= 0;
6773 if (ctx
->ExecuteFlag
) {
6774 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
6778 static void GLAPIENTRY
6779 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
6782 GET_CURRENT_CONTEXT(ctx
);
6783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6784 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
6788 n
[3].ui
= params
[0];
6789 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
6790 n
[4].ui
= params
[1];
6791 n
[5].ui
= params
[2];
6792 n
[6].ui
= params
[3];
6795 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
6798 if (ctx
->ExecuteFlag
) {
6799 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
6803 /* GL_ARB_geometry_shader4 */
6804 static void GLAPIENTRY
6805 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
6808 GET_CURRENT_CONTEXT(ctx
);
6809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6810 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
6816 if (ctx
->ExecuteFlag
) {
6817 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
6821 static void GLAPIENTRY
6822 save_FramebufferTexture(GLenum target
, GLenum attachment
,
6823 GLuint texture
, GLint level
)
6826 GET_CURRENT_CONTEXT(ctx
);
6827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6828 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
6831 n
[2].e
= attachment
;
6835 if (ctx
->ExecuteFlag
) {
6836 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
6840 static void GLAPIENTRY
6841 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
6842 GLuint texture
, GLint level
, GLenum face
)
6845 GET_CURRENT_CONTEXT(ctx
);
6846 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6847 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
6850 n
[2].e
= attachment
;
6855 if (ctx
->ExecuteFlag
) {
6856 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
6863 static void GLAPIENTRY
6864 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
6867 GET_CURRENT_CONTEXT(ctx
);
6868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6869 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
6871 union uint64_pair p
;
6874 n
[2].ui
= p
.uint32
[0];
6875 n
[3].ui
= p
.uint32
[1];
6876 save_pointer(&n
[4], sync
);
6878 if (ctx
->ExecuteFlag
) {
6879 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
6884 /** GL_NV_conditional_render */
6885 static void GLAPIENTRY
6886 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
6888 GET_CURRENT_CONTEXT(ctx
);
6890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6891 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
6896 if (ctx
->ExecuteFlag
) {
6897 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
6901 static void GLAPIENTRY
6902 save_EndConditionalRender(void)
6904 GET_CURRENT_CONTEXT(ctx
);
6905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6906 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
6907 if (ctx
->ExecuteFlag
) {
6908 CALL_EndConditionalRender(ctx
->Exec
, ());
6912 static void GLAPIENTRY
6913 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
6915 GET_CURRENT_CONTEXT(ctx
);
6917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6918 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
6924 if (ctx
->ExecuteFlag
) {
6925 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
6931 * Save an error-generating command into display list.
6933 * KW: Will appear in the list before the vertex buffer containing the
6934 * command that provoked the error. I don't see this as a problem.
6937 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6940 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
6943 save_pointer(&n
[2], (void *) s
);
6944 /* note: the data/string here doesn't have to be freed in
6945 * _mesa_delete_list() since the string is never dynamically
6953 * Compile an error into current display list.
6956 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
6958 if (ctx
->CompileFlag
)
6959 save_error(ctx
, error
, s
);
6960 if (ctx
->ExecuteFlag
)
6961 _mesa_error(ctx
, error
, "%s", s
);
6966 * Test if ID names a display list.
6969 islist(struct gl_context
*ctx
, GLuint list
)
6971 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
6981 /**********************************************************************/
6982 /* Display list execution */
6983 /**********************************************************************/
6987 * Execute a display list. Note that the ListBase offset must have already
6988 * been added before calling this function. I.e. the list argument is
6989 * the absolute list number, not relative to ListBase.
6990 * \param list - display list number
6993 execute_list(struct gl_context
*ctx
, GLuint list
)
6995 struct gl_display_list
*dlist
;
6999 if (list
== 0 || !islist(ctx
, list
))
7002 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7003 /* raise an error? */
7007 dlist
= _mesa_lookup_list(ctx
, list
);
7011 ctx
->ListState
.CallDepth
++;
7013 if (ctx
->Driver
.BeginCallList
)
7014 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7020 const OpCode opcode
= n
[0].opcode
;
7022 if (is_ext_opcode(opcode
)) {
7023 n
+= ext_opcode_execute(ctx
, n
);
7028 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7031 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7033 case OPCODE_ALPHA_FUNC
:
7034 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7036 case OPCODE_BIND_TEXTURE
:
7037 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7041 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7042 ctx
->Unpack
= ctx
->DefaultPacking
;
7043 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7044 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7045 get_pointer(&n
[7])));
7046 ctx
->Unpack
= save
; /* restore */
7049 case OPCODE_BLEND_COLOR
:
7050 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7052 case OPCODE_BLEND_EQUATION
:
7053 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7055 case OPCODE_BLEND_EQUATION_SEPARATE
:
7056 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7058 case OPCODE_BLEND_FUNC_SEPARATE
:
7059 CALL_BlendFuncSeparate(ctx
->Exec
,
7060 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7063 case OPCODE_BLEND_FUNC_I
:
7064 /* GL_ARB_draw_buffers_blend */
7065 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7067 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7068 /* GL_ARB_draw_buffers_blend */
7069 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7072 case OPCODE_BLEND_EQUATION_I
:
7073 /* GL_ARB_draw_buffers_blend */
7074 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7076 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7077 /* GL_ARB_draw_buffers_blend */
7078 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7079 (n
[1].ui
, n
[2].e
, n
[3].e
));
7082 case OPCODE_CALL_LIST
:
7083 /* Generated by glCallList(), don't add ListBase */
7084 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7085 execute_list(ctx
, n
[1].ui
);
7088 case OPCODE_CALL_LIST_OFFSET
:
7089 /* Generated by glCallLists() so we must add ListBase */
7091 /* user specified a bad data type at compile time */
7092 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7094 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7095 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7096 execute_list(ctx
, list
);
7100 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7102 case OPCODE_CLEAR_BUFFER_IV
:
7109 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7112 case OPCODE_CLEAR_BUFFER_UIV
:
7119 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7122 case OPCODE_CLEAR_BUFFER_FV
:
7129 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7132 case OPCODE_CLEAR_BUFFER_FI
:
7133 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7135 case OPCODE_CLEAR_COLOR
:
7136 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7138 case OPCODE_CLEAR_ACCUM
:
7139 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7141 case OPCODE_CLEAR_DEPTH
:
7142 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7144 case OPCODE_CLEAR_INDEX
:
7145 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7147 case OPCODE_CLEAR_STENCIL
:
7148 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7150 case OPCODE_CLIP_PLANE
:
7157 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7160 case OPCODE_COLOR_MASK
:
7161 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7163 case OPCODE_COLOR_MASK_INDEXED
:
7164 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7167 case OPCODE_COLOR_MATERIAL
:
7168 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7170 case OPCODE_COPY_PIXELS
:
7171 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7172 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7175 case OPCODE_COPY_TEX_IMAGE1D
:
7176 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7177 n
[5].i
, n
[6].i
, n
[7].i
));
7179 case OPCODE_COPY_TEX_IMAGE2D
:
7180 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7181 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7183 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7184 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7185 n
[4].i
, n
[5].i
, n
[6].i
));
7187 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7188 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7189 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7192 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7193 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7194 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7197 case OPCODE_CULL_FACE
:
7198 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7200 case OPCODE_DEPTH_FUNC
:
7201 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7203 case OPCODE_DEPTH_MASK
:
7204 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7206 case OPCODE_DEPTH_RANGE
:
7207 CALL_DepthRange(ctx
->Exec
,
7208 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7210 case OPCODE_DISABLE
:
7211 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7213 case OPCODE_DISABLE_INDEXED
:
7214 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7216 case OPCODE_DRAW_BUFFER
:
7217 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7219 case OPCODE_DRAW_PIXELS
:
7221 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7222 ctx
->Unpack
= ctx
->DefaultPacking
;
7223 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7224 get_pointer(&n
[5])));
7225 ctx
->Unpack
= save
; /* restore */
7229 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7231 case OPCODE_ENABLE_INDEXED
:
7232 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7234 case OPCODE_EVALMESH1
:
7235 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7237 case OPCODE_EVALMESH2
:
7238 CALL_EvalMesh2(ctx
->Exec
,
7239 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7248 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7251 case OPCODE_FRONT_FACE
:
7252 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7254 case OPCODE_FRUSTUM
:
7255 CALL_Frustum(ctx
->Exec
,
7256 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7259 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7261 case OPCODE_INDEX_MASK
:
7262 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7264 case OPCODE_INIT_NAMES
:
7265 CALL_InitNames(ctx
->Exec
, ());
7274 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7277 case OPCODE_LIGHT_MODEL
:
7284 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7287 case OPCODE_LINE_STIPPLE
:
7288 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7290 case OPCODE_LINE_WIDTH
:
7291 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7293 case OPCODE_LIST_BASE
:
7294 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7296 case OPCODE_LOAD_IDENTITY
:
7297 CALL_LoadIdentity(ctx
->Exec
, ());
7299 case OPCODE_LOAD_MATRIX
:
7300 if (sizeof(Node
) == sizeof(GLfloat
)) {
7301 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7306 for (i
= 0; i
< 16; i
++) {
7309 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7312 case OPCODE_LOAD_NAME
:
7313 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7315 case OPCODE_LOGIC_OP
:
7316 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7320 GLenum target
= n
[1].e
;
7321 GLint ustride
= _mesa_evaluator_components(target
);
7322 GLint uorder
= n
[5].i
;
7323 GLfloat u1
= n
[2].f
;
7324 GLfloat u2
= n
[3].f
;
7325 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7326 (GLfloat
*) get_pointer(&n
[6])));
7331 GLenum target
= n
[1].e
;
7332 GLfloat u1
= n
[2].f
;
7333 GLfloat u2
= n
[3].f
;
7334 GLfloat v1
= n
[4].f
;
7335 GLfloat v2
= n
[5].f
;
7336 GLint ustride
= n
[6].i
;
7337 GLint vstride
= n
[7].i
;
7338 GLint uorder
= n
[8].i
;
7339 GLint vorder
= n
[9].i
;
7340 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7341 v1
, v2
, vstride
, vorder
,
7342 (GLfloat
*) get_pointer(&n
[10])));
7345 case OPCODE_MAPGRID1
:
7346 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7348 case OPCODE_MAPGRID2
:
7349 CALL_MapGrid2f(ctx
->Exec
,
7350 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7352 case OPCODE_MATRIX_MODE
:
7353 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7355 case OPCODE_MULT_MATRIX
:
7356 if (sizeof(Node
) == sizeof(GLfloat
)) {
7357 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7362 for (i
= 0; i
< 16; i
++) {
7365 CALL_MultMatrixf(ctx
->Exec
, (m
));
7369 CALL_Ortho(ctx
->Exec
,
7370 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7372 case OPCODE_PASSTHROUGH
:
7373 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7375 case OPCODE_PIXEL_MAP
:
7376 CALL_PixelMapfv(ctx
->Exec
,
7377 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
7379 case OPCODE_PIXEL_TRANSFER
:
7380 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7382 case OPCODE_PIXEL_ZOOM
:
7383 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7385 case OPCODE_POINT_SIZE
:
7386 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7388 case OPCODE_POINT_PARAMETERS
:
7394 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7397 case OPCODE_POLYGON_MODE
:
7398 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7400 case OPCODE_POLYGON_STIPPLE
:
7402 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7403 ctx
->Unpack
= ctx
->DefaultPacking
;
7404 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
7405 ctx
->Unpack
= save
; /* restore */
7408 case OPCODE_POLYGON_OFFSET
:
7409 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7411 case OPCODE_POP_ATTRIB
:
7412 CALL_PopAttrib(ctx
->Exec
, ());
7414 case OPCODE_POP_MATRIX
:
7415 CALL_PopMatrix(ctx
->Exec
, ());
7417 case OPCODE_POP_NAME
:
7418 CALL_PopName(ctx
->Exec
, ());
7420 case OPCODE_PRIORITIZE_TEXTURE
:
7421 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7423 case OPCODE_PUSH_ATTRIB
:
7424 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7426 case OPCODE_PUSH_MATRIX
:
7427 CALL_PushMatrix(ctx
->Exec
, ());
7429 case OPCODE_PUSH_NAME
:
7430 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7432 case OPCODE_RASTER_POS
:
7433 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7435 case OPCODE_READ_BUFFER
:
7436 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7439 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7442 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7444 case OPCODE_SCISSOR
:
7445 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7447 case OPCODE_SHADE_MODEL
:
7448 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7450 case OPCODE_PROVOKING_VERTEX
:
7451 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7453 case OPCODE_STENCIL_FUNC
:
7454 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7456 case OPCODE_STENCIL_MASK
:
7457 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7459 case OPCODE_STENCIL_OP
:
7460 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7462 case OPCODE_STENCIL_FUNC_SEPARATE
:
7463 CALL_StencilFuncSeparate(ctx
->Exec
,
7464 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7466 case OPCODE_STENCIL_MASK_SEPARATE
:
7467 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7469 case OPCODE_STENCIL_OP_SEPARATE
:
7470 CALL_StencilOpSeparate(ctx
->Exec
,
7471 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7480 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7490 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7493 case OPCODE_TEXPARAMETER
:
7500 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7503 case OPCODE_TEX_IMAGE1D
:
7505 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7506 ctx
->Unpack
= ctx
->DefaultPacking
;
7507 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7509 n
[3].i
, /* components */
7511 n
[5].e
, /* border */
7512 n
[6].e
, /* format */
7514 get_pointer(&n
[8])));
7515 ctx
->Unpack
= save
; /* restore */
7518 case OPCODE_TEX_IMAGE2D
:
7520 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7521 ctx
->Unpack
= ctx
->DefaultPacking
;
7522 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7524 n
[3].i
, /* components */
7526 n
[5].i
, /* height */
7527 n
[6].e
, /* border */
7528 n
[7].e
, /* format */
7530 get_pointer(&n
[9])));
7531 ctx
->Unpack
= save
; /* restore */
7534 case OPCODE_TEX_IMAGE3D
:
7536 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7537 ctx
->Unpack
= ctx
->DefaultPacking
;
7538 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7540 n
[3].i
, /* components */
7542 n
[5].i
, /* height */
7544 n
[7].e
, /* border */
7545 n
[8].e
, /* format */
7547 get_pointer(&n
[10])));
7548 ctx
->Unpack
= save
; /* restore */
7551 case OPCODE_TEX_SUB_IMAGE1D
:
7553 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7554 ctx
->Unpack
= ctx
->DefaultPacking
;
7555 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7557 n
[6].e
, get_pointer(&n
[7])));
7558 ctx
->Unpack
= save
; /* restore */
7561 case OPCODE_TEX_SUB_IMAGE2D
:
7563 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7564 ctx
->Unpack
= ctx
->DefaultPacking
;
7565 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7567 n
[6].i
, n
[7].e
, n
[8].e
,
7568 get_pointer(&n
[9])));
7569 ctx
->Unpack
= save
; /* restore */
7572 case OPCODE_TEX_SUB_IMAGE3D
:
7574 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7575 ctx
->Unpack
= ctx
->DefaultPacking
;
7576 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7577 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7578 n
[8].i
, n
[9].e
, n
[10].e
,
7579 get_pointer(&n
[11])));
7580 ctx
->Unpack
= save
; /* restore */
7583 case OPCODE_TRANSLATE
:
7584 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7586 case OPCODE_VIEWPORT
:
7587 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7588 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7590 case OPCODE_WINDOW_POS
:
7591 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7593 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7594 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
7596 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
7597 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7598 n
[4].i
, n
[5].i
, n
[6].i
,
7599 get_pointer(&n
[7])));
7601 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
7602 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7603 n
[4].i
, n
[5].i
, n
[6].i
,
7604 n
[7].i
, get_pointer(&n
[8])));
7606 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
7607 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
7608 n
[4].i
, n
[5].i
, n
[6].i
,
7610 get_pointer(&n
[9])));
7612 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
7613 CALL_CompressedTexSubImage1D(ctx
->Exec
,
7614 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7616 get_pointer(&n
[7])));
7618 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
7619 CALL_CompressedTexSubImage2D(ctx
->Exec
,
7620 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7621 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
7622 get_pointer(&n
[9])));
7624 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
7625 CALL_CompressedTexSubImage3D(ctx
->Exec
,
7626 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
7627 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7629 get_pointer(&n
[11])));
7631 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
7632 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
7634 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
7635 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7637 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
7638 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7640 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
7641 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
7642 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
7645 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
7646 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
7648 case OPCODE_DEPTH_BOUNDS_EXT
:
7649 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7651 case OPCODE_PROGRAM_STRING_ARB
:
7652 CALL_ProgramStringARB(ctx
->Exec
,
7653 (n
[1].e
, n
[2].e
, n
[3].i
,
7654 get_pointer(&n
[4])));
7656 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
7657 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
7661 case OPCODE_BEGIN_QUERY_ARB
:
7662 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7664 case OPCODE_END_QUERY_ARB
:
7665 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
7667 case OPCODE_QUERY_COUNTER
:
7668 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7670 case OPCODE_BEGIN_QUERY_INDEXED
:
7671 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
7673 case OPCODE_END_QUERY_INDEXED
:
7674 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7676 case OPCODE_DRAW_BUFFERS_ARB
:
7678 GLenum buffers
[MAX_DRAW_BUFFERS
];
7679 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
7680 for (i
= 0; i
< count
; i
++)
7681 buffers
[i
] = n
[2 + i
].e
;
7682 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
7685 case OPCODE_BLIT_FRAMEBUFFER
:
7686 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
7687 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
7690 case OPCODE_USE_PROGRAM
:
7691 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
7693 case OPCODE_USE_SHADER_PROGRAM_EXT
:
7694 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7696 case OPCODE_ACTIVE_PROGRAM_EXT
:
7697 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
7699 case OPCODE_UNIFORM_1F
:
7700 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
7702 case OPCODE_UNIFORM_2F
:
7703 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7705 case OPCODE_UNIFORM_3F
:
7706 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
7708 case OPCODE_UNIFORM_4F
:
7709 CALL_Uniform4f(ctx
->Exec
,
7710 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
7712 case OPCODE_UNIFORM_1FV
:
7713 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7715 case OPCODE_UNIFORM_2FV
:
7716 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7718 case OPCODE_UNIFORM_3FV
:
7719 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7721 case OPCODE_UNIFORM_4FV
:
7722 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7724 case OPCODE_UNIFORM_1I
:
7725 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7727 case OPCODE_UNIFORM_2I
:
7728 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
7730 case OPCODE_UNIFORM_3I
:
7731 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7733 case OPCODE_UNIFORM_4I
:
7734 CALL_Uniform4i(ctx
->Exec
,
7735 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7737 case OPCODE_UNIFORM_1IV
:
7738 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7740 case OPCODE_UNIFORM_2IV
:
7741 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7743 case OPCODE_UNIFORM_3IV
:
7744 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7746 case OPCODE_UNIFORM_4IV
:
7747 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
7749 case OPCODE_UNIFORM_1UI
:
7750 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
7752 case OPCODE_UNIFORM_2UI
:
7753 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
7755 case OPCODE_UNIFORM_3UI
:
7756 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
7758 case OPCODE_UNIFORM_4UI
:
7759 /*CALL_Uniform4uiARB(ctx->Exec,
7760 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
7763 case OPCODE_UNIFORM_1UIV
:
7764 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
7765 get_pointer(&n[3])));*/
7767 case OPCODE_UNIFORM_2UIV
:
7768 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
7769 get_pointer(&n[3])));*/
7771 case OPCODE_UNIFORM_3UIV
:
7772 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
7773 get_pointer(&n[3])));*/
7775 case OPCODE_UNIFORM_4UIV
:
7776 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
7777 get_pointer(&n[3])));*/
7779 case OPCODE_UNIFORM_MATRIX22
:
7780 CALL_UniformMatrix2fv(ctx
->Exec
,
7781 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7783 case OPCODE_UNIFORM_MATRIX33
:
7784 CALL_UniformMatrix3fv(ctx
->Exec
,
7785 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7787 case OPCODE_UNIFORM_MATRIX44
:
7788 CALL_UniformMatrix4fv(ctx
->Exec
,
7789 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7791 case OPCODE_UNIFORM_MATRIX23
:
7792 CALL_UniformMatrix2x3fv(ctx
->Exec
,
7793 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7795 case OPCODE_UNIFORM_MATRIX32
:
7796 CALL_UniformMatrix3x2fv(ctx
->Exec
,
7797 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7799 case OPCODE_UNIFORM_MATRIX24
:
7800 CALL_UniformMatrix2x4fv(ctx
->Exec
,
7801 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7803 case OPCODE_UNIFORM_MATRIX42
:
7804 CALL_UniformMatrix4x2fv(ctx
->Exec
,
7805 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7807 case OPCODE_UNIFORM_MATRIX34
:
7808 CALL_UniformMatrix3x4fv(ctx
->Exec
,
7809 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7811 case OPCODE_UNIFORM_MATRIX43
:
7812 CALL_UniformMatrix4x3fv(ctx
->Exec
,
7813 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
7816 case OPCODE_CLAMP_COLOR
:
7817 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7820 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
7823 GLuint i
, pname
= n
[1].ui
;
7825 for (i
= 0; i
< 4; i
++)
7826 values
[i
] = n
[1 + i
].f
;
7827 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
7830 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
7831 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
7833 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
7836 GLuint i
, dst
= n
[1].ui
;
7838 for (i
= 0; i
< 4; i
++)
7839 values
[i
] = n
[1 + i
].f
;
7840 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
7843 case OPCODE_ATTR_1F_NV
:
7844 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7846 case OPCODE_ATTR_2F_NV
:
7847 /* Really shouldn't have to do this - the Node structure
7848 * is convenient, but it would be better to store the data
7849 * packed appropriately so that it can be sent directly
7850 * on. With x86_64 becoming common, this will start to
7853 if (sizeof(Node
) == sizeof(GLfloat
))
7854 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7856 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7858 case OPCODE_ATTR_3F_NV
:
7859 if (sizeof(Node
) == sizeof(GLfloat
))
7860 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7862 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7865 case OPCODE_ATTR_4F_NV
:
7866 if (sizeof(Node
) == sizeof(GLfloat
))
7867 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7869 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7872 case OPCODE_ATTR_1F_ARB
:
7873 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7875 case OPCODE_ATTR_2F_ARB
:
7876 /* Really shouldn't have to do this - the Node structure
7877 * is convenient, but it would be better to store the data
7878 * packed appropriately so that it can be sent directly
7879 * on. With x86_64 becoming common, this will start to
7882 if (sizeof(Node
) == sizeof(GLfloat
))
7883 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7885 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
7887 case OPCODE_ATTR_3F_ARB
:
7888 if (sizeof(Node
) == sizeof(GLfloat
))
7889 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7891 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7894 case OPCODE_ATTR_4F_ARB
:
7895 if (sizeof(Node
) == sizeof(GLfloat
))
7896 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
7898 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
7901 case OPCODE_MATERIAL
:
7902 if (sizeof(Node
) == sizeof(GLfloat
))
7903 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
7910 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
7914 CALL_Begin(ctx
->Exec
, (n
[1].e
));
7917 CALL_End(ctx
->Exec
, ());
7920 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7922 case OPCODE_EVAL_C1
:
7923 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
7925 case OPCODE_EVAL_C2
:
7926 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7928 case OPCODE_EVAL_P1
:
7929 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
7931 case OPCODE_EVAL_P2
:
7932 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
7935 /* GL_EXT_texture_integer */
7936 case OPCODE_CLEARCOLOR_I
:
7937 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7939 case OPCODE_CLEARCOLOR_UI
:
7940 CALL_ClearColorIuiEXT(ctx
->Exec
,
7941 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
7943 case OPCODE_TEXPARAMETER_I
:
7950 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7953 case OPCODE_TEXPARAMETER_UI
:
7956 params
[0] = n
[3].ui
;
7957 params
[1] = n
[4].ui
;
7958 params
[2] = n
[5].ui
;
7959 params
[3] = n
[6].ui
;
7960 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7964 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
7965 /* GL_ARB_instanced_arrays */
7966 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
7969 case OPCODE_TEXTURE_BARRIER_NV
:
7970 CALL_TextureBarrierNV(ctx
->Exec
, ());
7973 /* GL_EXT/ARB_transform_feedback */
7974 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
7975 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
7977 case OPCODE_END_TRANSFORM_FEEDBACK
:
7978 CALL_EndTransformFeedback(ctx
->Exec
, ());
7980 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
7981 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7983 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
7984 CALL_PauseTransformFeedback(ctx
->Exec
, ());
7986 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
7987 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
7989 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
7990 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7992 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
7993 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
7994 (n
[1].e
, n
[2].ui
, n
[3].ui
));
7996 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
7997 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
7998 (n
[1].e
, n
[2].ui
, n
[3].si
));
8000 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8001 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8002 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8006 case OPCODE_BIND_SAMPLER
:
8007 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8009 case OPCODE_SAMPLER_PARAMETERIV
:
8016 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8019 case OPCODE_SAMPLER_PARAMETERFV
:
8026 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8029 case OPCODE_SAMPLER_PARAMETERIIV
:
8036 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8039 case OPCODE_SAMPLER_PARAMETERUIV
:
8042 params
[0] = n
[3].ui
;
8043 params
[1] = n
[4].ui
;
8044 params
[2] = n
[5].ui
;
8045 params
[3] = n
[6].ui
;
8046 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8050 /* GL_ARB_geometry_shader4 */
8051 case OPCODE_PROGRAM_PARAMETERI
:
8052 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8054 case OPCODE_FRAMEBUFFER_TEXTURE
:
8055 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8058 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8059 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8060 n
[3].ui
, n
[4].i
, n
[5].e
));
8064 case OPCODE_WAIT_SYNC
:
8066 union uint64_pair p
;
8067 p
.uint32
[0] = n
[2].ui
;
8068 p
.uint32
[1] = n
[3].ui
;
8069 CALL_WaitSync(ctx
->Exec
,
8070 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8074 /* GL_NV_conditional_render */
8075 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8076 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8078 case OPCODE_END_CONDITIONAL_RENDER
:
8079 CALL_EndConditionalRender(ctx
->Exec
, ());
8082 case OPCODE_UNIFORM_BLOCK_BINDING
:
8083 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8086 case OPCODE_CONTINUE
:
8087 n
= (Node
*) get_pointer(&n
[1]);
8089 case OPCODE_END_OF_LIST
:
8095 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8097 _mesa_problem(ctx
, "%s", msg
);
8102 /* increment n to point to next compiled command */
8103 if (opcode
!= OPCODE_CONTINUE
) {
8104 n
+= InstSize
[opcode
];
8109 if (ctx
->Driver
.EndCallList
)
8110 ctx
->Driver
.EndCallList(ctx
);
8112 ctx
->ListState
.CallDepth
--;
8117 /**********************************************************************/
8119 /**********************************************************************/
8122 * Test if a display list number is valid.
8124 GLboolean GLAPIENTRY
8125 _mesa_IsList(GLuint list
)
8127 GET_CURRENT_CONTEXT(ctx
);
8128 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8129 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8130 return islist(ctx
, list
);
8135 * Delete a sequence of consecutive display lists.
8138 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8140 GET_CURRENT_CONTEXT(ctx
);
8142 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8143 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8146 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8149 for (i
= list
; i
< list
+ range
; i
++) {
8150 destroy_list(ctx
, i
);
8156 * Return a display list number, n, such that lists n through n+range-1
8160 _mesa_GenLists(GLsizei range
)
8162 GET_CURRENT_CONTEXT(ctx
);
8164 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8165 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8168 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8176 * Make this an atomic operation
8178 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8180 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8182 /* reserve the list IDs by with empty/dummy lists */
8184 for (i
= 0; i
< range
; i
++) {
8185 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8186 make_list(base
+ i
, 1));
8190 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8197 * Begin a new display list.
8200 _mesa_NewList(GLuint name
, GLenum mode
)
8202 GET_CURRENT_CONTEXT(ctx
);
8204 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8205 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8207 if (MESA_VERBOSE
& VERBOSE_API
)
8208 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8209 _mesa_lookup_enum_by_nr(mode
));
8212 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8216 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8217 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8221 if (ctx
->ListState
.CurrentList
) {
8222 /* already compiling a display list */
8223 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8227 ctx
->CompileFlag
= GL_TRUE
;
8228 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8230 /* Reset accumulated list state */
8231 invalidate_saved_current_state( ctx
);
8233 /* Allocate new display list */
8234 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8235 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8236 ctx
->ListState
.CurrentPos
= 0;
8238 ctx
->Driver
.NewList(ctx
, name
, mode
);
8240 ctx
->CurrentDispatch
= ctx
->Save
;
8241 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8246 * End definition of current display list.
8251 GET_CURRENT_CONTEXT(ctx
);
8252 SAVE_FLUSH_VERTICES(ctx
);
8253 FLUSH_VERTICES(ctx
, 0);
8255 if (MESA_VERBOSE
& VERBOSE_API
)
8256 _mesa_debug(ctx
, "glEndList\n");
8258 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8259 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8260 "glEndList() called inside glBegin/End");
8263 /* Check that a list is under construction */
8264 if (!ctx
->ListState
.CurrentList
) {
8265 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8269 /* Call before emitting END_OF_LIST, in case the driver wants to
8270 * emit opcodes itself.
8272 ctx
->Driver
.EndList(ctx
);
8274 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8278 /* Destroy old list, if any */
8279 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8281 /* Install the new list */
8282 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8283 ctx
->ListState
.CurrentList
->Name
,
8284 ctx
->ListState
.CurrentList
);
8287 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8288 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8290 ctx
->ListState
.CurrentList
= NULL
;
8291 ctx
->ListState
.CurrentBlock
= NULL
;
8292 ctx
->ListState
.CurrentPos
= 0;
8293 ctx
->ExecuteFlag
= GL_TRUE
;
8294 ctx
->CompileFlag
= GL_FALSE
;
8296 ctx
->CurrentDispatch
= ctx
->Exec
;
8297 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8302 _mesa_CallList(GLuint list
)
8304 GLboolean save_compile_flag
;
8305 GET_CURRENT_CONTEXT(ctx
);
8306 FLUSH_CURRENT(ctx
, 0);
8308 if (MESA_VERBOSE
& VERBOSE_API
)
8309 _mesa_debug(ctx
, "glCallList %d\n", list
);
8312 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8317 mesa_print_display_list( list
);
8319 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8320 * execute the display list, and restore the CompileFlag.
8322 save_compile_flag
= ctx
->CompileFlag
;
8323 if (save_compile_flag
) {
8324 ctx
->CompileFlag
= GL_FALSE
;
8327 execute_list(ctx
, list
);
8328 ctx
->CompileFlag
= save_compile_flag
;
8330 /* also restore API function pointers to point to "save" versions */
8331 if (save_compile_flag
) {
8332 ctx
->CurrentDispatch
= ctx
->Save
;
8333 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8339 * Execute glCallLists: call multiple display lists.
8342 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8344 GET_CURRENT_CONTEXT(ctx
);
8346 GLboolean save_compile_flag
;
8348 if (MESA_VERBOSE
& VERBOSE_API
)
8349 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8353 case GL_UNSIGNED_BYTE
:
8355 case GL_UNSIGNED_SHORT
:
8357 case GL_UNSIGNED_INT
:
8365 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8369 /* Save the CompileFlag status, turn it off, execute display list,
8370 * and restore the CompileFlag.
8372 save_compile_flag
= ctx
->CompileFlag
;
8373 ctx
->CompileFlag
= GL_FALSE
;
8375 for (i
= 0; i
< n
; i
++) {
8376 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8377 execute_list(ctx
, list
);
8380 ctx
->CompileFlag
= save_compile_flag
;
8382 /* also restore API function pointers to point to "save" versions */
8383 if (save_compile_flag
) {
8384 ctx
->CurrentDispatch
= ctx
->Save
;
8385 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8391 * Set the offset added to list numbers in glCallLists.
8394 _mesa_ListBase(GLuint base
)
8396 GET_CURRENT_CONTEXT(ctx
);
8397 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8398 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8399 ctx
->List
.ListBase
= base
;
8403 * Setup the given dispatch table to point to Mesa's display list
8404 * building functions.
8406 * This does not include any of the tnl functions - they are
8407 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8411 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8413 struct _glapi_table
*table
= ctx
->Save
;
8414 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8416 /* Initially populate the dispatch table with the contents of the
8417 * normal-execution dispatch table. This lets us skip populating functions
8418 * that should be called directly instead of compiled into display lists.
8420 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8422 _mesa_loopback_init_api_table(ctx
, table
);
8425 vbo_initialize_save_dispatch(ctx
, table
);
8428 SET_Accum(table
, save_Accum
);
8429 SET_AlphaFunc(table
, save_AlphaFunc
);
8430 SET_Bitmap(table
, save_Bitmap
);
8431 SET_BlendFunc(table
, save_BlendFunc
);
8432 SET_CallList(table
, save_CallList
);
8433 SET_CallLists(table
, save_CallLists
);
8434 SET_Clear(table
, save_Clear
);
8435 SET_ClearAccum(table
, save_ClearAccum
);
8436 SET_ClearColor(table
, save_ClearColor
);
8437 SET_ClearDepth(table
, save_ClearDepth
);
8438 SET_ClearIndex(table
, save_ClearIndex
);
8439 SET_ClearStencil(table
, save_ClearStencil
);
8440 SET_ClipPlane(table
, save_ClipPlane
);
8441 SET_ColorMask(table
, save_ColorMask
);
8442 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8443 SET_ColorMaterial(table
, save_ColorMaterial
);
8444 SET_CopyPixels(table
, save_CopyPixels
);
8445 SET_CullFace(table
, save_CullFace
);
8446 SET_DepthFunc(table
, save_DepthFunc
);
8447 SET_DepthMask(table
, save_DepthMask
);
8448 SET_DepthRange(table
, save_DepthRange
);
8449 SET_Disable(table
, save_Disable
);
8450 SET_Disablei(table
, save_DisableIndexed
);
8451 SET_DrawBuffer(table
, save_DrawBuffer
);
8452 SET_DrawPixels(table
, save_DrawPixels
);
8453 SET_Enable(table
, save_Enable
);
8454 SET_Enablei(table
, save_EnableIndexed
);
8455 SET_EvalMesh1(table
, save_EvalMesh1
);
8456 SET_EvalMesh2(table
, save_EvalMesh2
);
8457 SET_Fogf(table
, save_Fogf
);
8458 SET_Fogfv(table
, save_Fogfv
);
8459 SET_Fogi(table
, save_Fogi
);
8460 SET_Fogiv(table
, save_Fogiv
);
8461 SET_FrontFace(table
, save_FrontFace
);
8462 SET_Frustum(table
, save_Frustum
);
8463 SET_Hint(table
, save_Hint
);
8464 SET_IndexMask(table
, save_IndexMask
);
8465 SET_InitNames(table
, save_InitNames
);
8466 SET_LightModelf(table
, save_LightModelf
);
8467 SET_LightModelfv(table
, save_LightModelfv
);
8468 SET_LightModeli(table
, save_LightModeli
);
8469 SET_LightModeliv(table
, save_LightModeliv
);
8470 SET_Lightf(table
, save_Lightf
);
8471 SET_Lightfv(table
, save_Lightfv
);
8472 SET_Lighti(table
, save_Lighti
);
8473 SET_Lightiv(table
, save_Lightiv
);
8474 SET_LineStipple(table
, save_LineStipple
);
8475 SET_LineWidth(table
, save_LineWidth
);
8476 SET_ListBase(table
, save_ListBase
);
8477 SET_LoadIdentity(table
, save_LoadIdentity
);
8478 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8479 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8480 SET_LoadName(table
, save_LoadName
);
8481 SET_LogicOp(table
, save_LogicOp
);
8482 SET_Map1d(table
, save_Map1d
);
8483 SET_Map1f(table
, save_Map1f
);
8484 SET_Map2d(table
, save_Map2d
);
8485 SET_Map2f(table
, save_Map2f
);
8486 SET_MapGrid1d(table
, save_MapGrid1d
);
8487 SET_MapGrid1f(table
, save_MapGrid1f
);
8488 SET_MapGrid2d(table
, save_MapGrid2d
);
8489 SET_MapGrid2f(table
, save_MapGrid2f
);
8490 SET_MatrixMode(table
, save_MatrixMode
);
8491 SET_MultMatrixd(table
, save_MultMatrixd
);
8492 SET_MultMatrixf(table
, save_MultMatrixf
);
8493 SET_NewList(table
, save_NewList
);
8494 SET_Ortho(table
, save_Ortho
);
8495 SET_PassThrough(table
, save_PassThrough
);
8496 SET_PixelMapfv(table
, save_PixelMapfv
);
8497 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8498 SET_PixelMapusv(table
, save_PixelMapusv
);
8499 SET_PixelTransferf(table
, save_PixelTransferf
);
8500 SET_PixelTransferi(table
, save_PixelTransferi
);
8501 SET_PixelZoom(table
, save_PixelZoom
);
8502 SET_PointSize(table
, save_PointSize
);
8503 SET_PolygonMode(table
, save_PolygonMode
);
8504 SET_PolygonOffset(table
, save_PolygonOffset
);
8505 SET_PolygonStipple(table
, save_PolygonStipple
);
8506 SET_PopAttrib(table
, save_PopAttrib
);
8507 SET_PopMatrix(table
, save_PopMatrix
);
8508 SET_PopName(table
, save_PopName
);
8509 SET_PushAttrib(table
, save_PushAttrib
);
8510 SET_PushMatrix(table
, save_PushMatrix
);
8511 SET_PushName(table
, save_PushName
);
8512 SET_RasterPos2d(table
, save_RasterPos2d
);
8513 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8514 SET_RasterPos2f(table
, save_RasterPos2f
);
8515 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8516 SET_RasterPos2i(table
, save_RasterPos2i
);
8517 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8518 SET_RasterPos2s(table
, save_RasterPos2s
);
8519 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8520 SET_RasterPos3d(table
, save_RasterPos3d
);
8521 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8522 SET_RasterPos3f(table
, save_RasterPos3f
);
8523 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8524 SET_RasterPos3i(table
, save_RasterPos3i
);
8525 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8526 SET_RasterPos3s(table
, save_RasterPos3s
);
8527 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8528 SET_RasterPos4d(table
, save_RasterPos4d
);
8529 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8530 SET_RasterPos4f(table
, save_RasterPos4f
);
8531 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8532 SET_RasterPos4i(table
, save_RasterPos4i
);
8533 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8534 SET_RasterPos4s(table
, save_RasterPos4s
);
8535 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8536 SET_ReadBuffer(table
, save_ReadBuffer
);
8537 SET_Rectf(table
, save_Rectf
);
8538 SET_Rotated(table
, save_Rotated
);
8539 SET_Rotatef(table
, save_Rotatef
);
8540 SET_Scaled(table
, save_Scaled
);
8541 SET_Scalef(table
, save_Scalef
);
8542 SET_Scissor(table
, save_Scissor
);
8543 SET_ShadeModel(table
, save_ShadeModel
);
8544 SET_StencilFunc(table
, save_StencilFunc
);
8545 SET_StencilMask(table
, save_StencilMask
);
8546 SET_StencilOp(table
, save_StencilOp
);
8547 SET_TexEnvf(table
, save_TexEnvf
);
8548 SET_TexEnvfv(table
, save_TexEnvfv
);
8549 SET_TexEnvi(table
, save_TexEnvi
);
8550 SET_TexEnviv(table
, save_TexEnviv
);
8551 SET_TexGend(table
, save_TexGend
);
8552 SET_TexGendv(table
, save_TexGendv
);
8553 SET_TexGenf(table
, save_TexGenf
);
8554 SET_TexGenfv(table
, save_TexGenfv
);
8555 SET_TexGeni(table
, save_TexGeni
);
8556 SET_TexGeniv(table
, save_TexGeniv
);
8557 SET_TexImage1D(table
, save_TexImage1D
);
8558 SET_TexImage2D(table
, save_TexImage2D
);
8559 SET_TexParameterf(table
, save_TexParameterf
);
8560 SET_TexParameterfv(table
, save_TexParameterfv
);
8561 SET_TexParameteri(table
, save_TexParameteri
);
8562 SET_TexParameteriv(table
, save_TexParameteriv
);
8563 SET_Translated(table
, save_Translated
);
8564 SET_Translatef(table
, save_Translatef
);
8565 SET_Viewport(table
, save_Viewport
);
8568 SET_BindTexture(table
, save_BindTexture
);
8569 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8570 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8571 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8572 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8573 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8574 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8575 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8578 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8579 SET_TexImage3D(table
, save_TexImage3D
);
8580 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8583 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8584 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8585 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8587 /* ATI_separate_stencil */
8588 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8590 /* GL_ARB_imaging */
8591 /* Not all are supported */
8592 SET_BlendColor(table
, save_BlendColor
);
8593 SET_BlendEquation(table
, save_BlendEquation
);
8595 /* 2. GL_EXT_blend_color */
8597 SET_BlendColorEXT(table
, save_BlendColorEXT
);
8600 /* 3. GL_EXT_polygon_offset */
8601 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
8603 /* 6. GL_EXT_texture3d */
8605 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
8606 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
8607 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
8610 /* 37. GL_EXT_blend_minmax */
8612 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
8615 /* 54. GL_EXT_point_parameters */
8616 SET_PointParameterf(table
, save_PointParameterfEXT
);
8617 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
8619 /* 173. GL_EXT_blend_func_separate */
8620 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
8622 /* 197. GL_MESA_window_pos */
8623 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
8624 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
8625 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
8626 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
8627 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
8628 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
8629 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
8630 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
8631 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
8632 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
8633 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
8634 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
8635 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
8636 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
8637 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
8638 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
8639 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
8640 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
8641 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
8642 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
8643 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
8644 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
8645 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
8646 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
8648 /* 233. GL_NV_vertex_program */
8649 /* The following commands DO NOT go into display lists:
8650 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
8651 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
8653 SET_BindProgramARB(table
, save_BindProgramNV
);
8655 /* 244. GL_ATI_envmap_bumpmap */
8656 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
8657 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
8659 /* 245. GL_ATI_fragment_shader */
8660 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
8661 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
8663 /* 262. GL_NV_point_sprite */
8664 SET_PointParameteri(table
, save_PointParameteriNV
);
8665 SET_PointParameteriv(table
, save_PointParameterivNV
);
8667 /* 268. GL_EXT_stencil_two_side */
8668 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
8670 /* ???. GL_EXT_depth_bounds_test */
8671 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
8673 /* ARB 1. GL_ARB_multitexture */
8674 SET_ActiveTexture(table
, save_ActiveTextureARB
);
8676 /* ARB 3. GL_ARB_transpose_matrix */
8677 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
8678 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
8679 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
8680 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
8682 /* ARB 5. GL_ARB_multisample */
8683 SET_SampleCoverage(table
, save_SampleCoverageARB
);
8685 /* ARB 12. GL_ARB_texture_compression */
8686 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
8687 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
8688 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
8689 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
8690 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
8691 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
8693 /* ARB 14. GL_ARB_point_parameters */
8694 /* aliased with EXT_point_parameters functions */
8696 /* ARB 25. GL_ARB_window_pos */
8697 /* aliased with MESA_window_pos functions */
8699 /* ARB 26. GL_ARB_vertex_program */
8700 /* ARB 27. GL_ARB_fragment_program */
8701 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
8702 SET_ProgramStringARB(table
, save_ProgramStringARB
);
8703 SET_BindProgramARB(table
, save_BindProgramNV
);
8704 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
8705 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
8706 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
8707 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
8708 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
8709 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
8710 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
8711 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
8713 SET_BeginQuery(table
, save_BeginQueryARB
);
8714 SET_EndQuery(table
, save_EndQueryARB
);
8715 SET_QueryCounter(table
, save_QueryCounter
);
8717 SET_DrawBuffers(table
, save_DrawBuffersARB
);
8719 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
8721 SET_UseProgram(table
, save_UseProgramObjectARB
);
8722 SET_Uniform1f(table
, save_Uniform1fARB
);
8723 SET_Uniform2f(table
, save_Uniform2fARB
);
8724 SET_Uniform3f(table
, save_Uniform3fARB
);
8725 SET_Uniform4f(table
, save_Uniform4fARB
);
8726 SET_Uniform1fv(table
, save_Uniform1fvARB
);
8727 SET_Uniform2fv(table
, save_Uniform2fvARB
);
8728 SET_Uniform3fv(table
, save_Uniform3fvARB
);
8729 SET_Uniform4fv(table
, save_Uniform4fvARB
);
8730 SET_Uniform1i(table
, save_Uniform1iARB
);
8731 SET_Uniform2i(table
, save_Uniform2iARB
);
8732 SET_Uniform3i(table
, save_Uniform3iARB
);
8733 SET_Uniform4i(table
, save_Uniform4iARB
);
8734 SET_Uniform1iv(table
, save_Uniform1ivARB
);
8735 SET_Uniform2iv(table
, save_Uniform2ivARB
);
8736 SET_Uniform3iv(table
, save_Uniform3ivARB
);
8737 SET_Uniform4iv(table
, save_Uniform4ivARB
);
8738 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
8739 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
8740 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
8741 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
8742 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
8743 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
8744 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
8745 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
8746 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
8748 /* 299. GL_EXT_blend_equation_separate */
8749 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
8751 /* GL_EXT_gpu_program_parameters */
8752 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
8753 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
8755 /* 364. GL_EXT_provoking_vertex */
8756 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
8758 /* GL_EXT_texture_integer */
8759 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
8760 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
8761 SET_TexParameterIiv(table
, save_TexParameterIiv
);
8762 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
8764 /* 377. GL_EXT_separate_shader_objects */
8765 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
8766 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
8768 /* GL_ARB_color_buffer_float */
8769 SET_ClampColor(table
, save_ClampColorARB
);
8772 SET_ClearBufferiv(table
, save_ClearBufferiv
);
8773 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
8774 SET_ClearBufferfv(table
, save_ClearBufferfv
);
8775 SET_ClearBufferfi(table
, save_ClearBufferfi
);
8777 SET_Uniform1ui(table
, save_Uniform1ui
);
8778 SET_Uniform2ui(table
, save_Uniform2ui
);
8779 SET_Uniform3ui(table
, save_Uniform3ui
);
8780 SET_Uniform4ui(table
, save_Uniform4ui
);
8781 SET_Uniform1uiv(table
, save_Uniform1uiv
);
8782 SET_Uniform2uiv(table
, save_Uniform2uiv
);
8783 SET_Uniform3uiv(table
, save_Uniform3uiv
);
8784 SET_Uniform4uiv(table
, save_Uniform4uiv
);
8786 (void) save_Uniform1ui
;
8787 (void) save_Uniform2ui
;
8788 (void) save_Uniform3ui
;
8789 (void) save_Uniform4ui
;
8790 (void) save_Uniform1uiv
;
8791 (void) save_Uniform2uiv
;
8792 (void) save_Uniform3uiv
;
8793 (void) save_Uniform4uiv
;
8797 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
8798 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
8799 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
8800 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
8801 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
8802 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
8803 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
8804 SET_DrawTransformFeedbackInstanced(table
,
8805 save_DrawTransformFeedbackInstanced
);
8806 SET_DrawTransformFeedbackStreamInstanced(table
,
8807 save_DrawTransformFeedbackStreamInstanced
);
8808 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
8809 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
8811 /* GL_ARB_instanced_arrays */
8812 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
8814 /* GL_NV_texture_barrier */
8815 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
8817 SET_BindSampler(table
, save_BindSampler
);
8818 SET_SamplerParameteri(table
, save_SamplerParameteri
);
8819 SET_SamplerParameterf(table
, save_SamplerParameterf
);
8820 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
8821 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
8822 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
8823 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
8825 /* GL_ARB_draw_buffer_blend */
8826 SET_BlendFunciARB(table
, save_BlendFunci
);
8827 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
8828 SET_BlendEquationiARB(table
, save_BlendEquationi
);
8829 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
8831 /* GL_ARB_geometry_shader4 */
8832 SET_ProgramParameteri(table
, save_ProgramParameteri
);
8833 SET_FramebufferTexture(table
, save_FramebufferTexture
);
8834 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
8836 /* GL_NV_conditional_render */
8837 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
8838 SET_EndConditionalRender(table
, save_EndConditionalRender
);
8841 SET_WaitSync(table
, save_WaitSync
);
8843 /* GL_ARB_uniform_buffer_object */
8844 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
8846 /* GL_ARB_draw_instanced */
8847 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
8848 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
8850 /* GL_ARB_draw_elements_base_vertex */
8851 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
8853 /* GL_ARB_base_instance */
8854 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
8855 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
8856 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
8862 enum_string(GLenum k
)
8864 return _mesa_lookup_enum_by_nr(k
);
8869 * Print the commands in a display list. For debugging only.
8870 * TODO: many commands aren't handled yet.
8872 static void GLAPIENTRY
8873 print_list(struct gl_context
*ctx
, GLuint list
)
8875 struct gl_display_list
*dlist
;
8879 if (!islist(ctx
, list
)) {
8880 printf("%u is not a display list ID\n", list
);
8884 dlist
= _mesa_lookup_list(ctx
, list
);
8890 printf("START-LIST %u, address %p\n", list
, (void *) n
);
8892 done
= n
? GL_FALSE
: GL_TRUE
;
8894 const OpCode opcode
= n
[0].opcode
;
8896 if (is_ext_opcode(opcode
)) {
8897 n
+= ext_opcode_print(ctx
, n
);
8902 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
8905 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
8906 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
8907 get_pointer(&n
[7]));
8909 case OPCODE_CALL_LIST
:
8910 printf("CallList %d\n", (int) n
[1].ui
);
8912 case OPCODE_CALL_LIST_OFFSET
:
8913 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
8914 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
8916 case OPCODE_DISABLE
:
8917 printf("Disable %s\n", enum_string(n
[1].e
));
8920 printf("Enable %s\n", enum_string(n
[1].e
));
8922 case OPCODE_FRUSTUM
:
8923 printf("Frustum %g %g %g %g %g %g\n",
8924 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8926 case OPCODE_LINE_STIPPLE
:
8927 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
8929 case OPCODE_LOAD_IDENTITY
:
8930 printf("LoadIdentity\n");
8932 case OPCODE_LOAD_MATRIX
:
8933 printf("LoadMatrix\n");
8934 printf(" %8f %8f %8f %8f\n",
8935 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8936 printf(" %8f %8f %8f %8f\n",
8937 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8938 printf(" %8f %8f %8f %8f\n",
8939 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8940 printf(" %8f %8f %8f %8f\n",
8941 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8943 case OPCODE_MULT_MATRIX
:
8944 printf("MultMatrix (or Rotate)\n");
8945 printf(" %8f %8f %8f %8f\n",
8946 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
8947 printf(" %8f %8f %8f %8f\n",
8948 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
8949 printf(" %8f %8f %8f %8f\n",
8950 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
8951 printf(" %8f %8f %8f %8f\n",
8952 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
8955 printf("Ortho %g %g %g %g %g %g\n",
8956 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
8958 case OPCODE_POP_ATTRIB
:
8959 printf("PopAttrib\n");
8961 case OPCODE_POP_MATRIX
:
8962 printf("PopMatrix\n");
8964 case OPCODE_POP_NAME
:
8965 printf("PopName\n");
8967 case OPCODE_PUSH_ATTRIB
:
8968 printf("PushAttrib %x\n", n
[1].bf
);
8970 case OPCODE_PUSH_MATRIX
:
8971 printf("PushMatrix\n");
8973 case OPCODE_PUSH_NAME
:
8974 printf("PushName %d\n", (int) n
[1].ui
);
8976 case OPCODE_RASTER_POS
:
8977 printf("RasterPos %g %g %g %g\n",
8978 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8981 printf("Rotate %g %g %g %g\n",
8982 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
8985 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8987 case OPCODE_TRANSLATE
:
8988 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
8990 case OPCODE_BIND_TEXTURE
:
8991 printf("BindTexture %s %d\n",
8992 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
8994 case OPCODE_SHADE_MODEL
:
8995 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
8998 printf("Map1 %s %.3f %.3f %d %d\n",
8999 _mesa_lookup_enum_by_nr(n
[1].ui
),
9000 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9003 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9004 _mesa_lookup_enum_by_nr(n
[1].ui
),
9005 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9006 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9008 case OPCODE_MAPGRID1
:
9009 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9011 case OPCODE_MAPGRID2
:
9012 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9013 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9015 case OPCODE_EVALMESH1
:
9016 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9018 case OPCODE_EVALMESH2
:
9019 printf("EvalMesh2 %d %d %d %d\n",
9020 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9023 case OPCODE_ATTR_1F_NV
:
9024 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9026 case OPCODE_ATTR_2F_NV
:
9027 printf("ATTR_2F_NV attr %d: %f %f\n",
9028 n
[1].i
, n
[2].f
, n
[3].f
);
9030 case OPCODE_ATTR_3F_NV
:
9031 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9032 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9034 case OPCODE_ATTR_4F_NV
:
9035 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9036 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9038 case OPCODE_ATTR_1F_ARB
:
9039 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9041 case OPCODE_ATTR_2F_ARB
:
9042 printf("ATTR_2F_ARB attr %d: %f %f\n",
9043 n
[1].i
, n
[2].f
, n
[3].f
);
9045 case OPCODE_ATTR_3F_ARB
:
9046 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9047 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9049 case OPCODE_ATTR_4F_ARB
:
9050 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9051 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9054 case OPCODE_MATERIAL
:
9055 printf("MATERIAL %x %x: %f %f %f %f\n",
9056 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9059 printf("BEGIN %x\n", n
[1].i
);
9065 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9068 case OPCODE_EVAL_C1
:
9069 printf("EVAL_C1 %f\n", n
[1].f
);
9071 case OPCODE_EVAL_C2
:
9072 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9074 case OPCODE_EVAL_P1
:
9075 printf("EVAL_P1 %d\n", n
[1].i
);
9077 case OPCODE_EVAL_P2
:
9078 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9081 case OPCODE_PROVOKING_VERTEX
:
9082 printf("ProvokingVertex %s\n",
9083 _mesa_lookup_enum_by_nr(n
[1].ui
));
9087 * meta opcodes/commands
9090 printf("Error: %s %s\n", enum_string(n
[1].e
),
9091 (const char *) get_pointer(&n
[2]));
9093 case OPCODE_CONTINUE
:
9094 printf("DISPLAY-LIST-CONTINUE\n");
9095 n
= (Node
*) get_pointer(&n
[1]);
9097 case OPCODE_END_OF_LIST
:
9098 printf("END-LIST %u\n", list
);
9102 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9104 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9105 opcode
, (void *) n
);
9109 printf("command %d, %u operands\n", opcode
,
9113 /* increment n to point to next compiled command */
9114 if (opcode
!= OPCODE_CONTINUE
) {
9115 n
+= InstSize
[opcode
];
9124 * Clients may call this function to help debug display list problems.
9125 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9126 * changed, or break in the future without notice.
9129 mesa_print_display_list(GLuint list
)
9131 GET_CURRENT_CONTEXT(ctx
);
9132 print_list(ctx
, list
);
9136 /**********************************************************************/
9137 /***** Initialization *****/
9138 /**********************************************************************/
9141 save_vtxfmt_init(GLvertexformat
* vfmt
)
9143 vfmt
->ArrayElement
= _ae_ArrayElement
;
9145 vfmt
->Begin
= save_Begin
;
9147 vfmt
->CallList
= save_CallList
;
9148 vfmt
->CallLists
= save_CallLists
;
9150 vfmt
->Color3f
= save_Color3f
;
9151 vfmt
->Color3fv
= save_Color3fv
;
9152 vfmt
->Color4f
= save_Color4f
;
9153 vfmt
->Color4fv
= save_Color4fv
;
9154 vfmt
->EdgeFlag
= save_EdgeFlag
;
9155 vfmt
->End
= save_End
;
9157 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9158 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9159 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9160 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9161 vfmt
->EvalPoint1
= save_EvalPoint1
;
9162 vfmt
->EvalPoint2
= save_EvalPoint2
;
9164 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9165 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9166 vfmt
->Indexf
= save_Indexf
;
9167 vfmt
->Indexfv
= save_Indexfv
;
9168 vfmt
->Materialfv
= save_Materialfv
;
9169 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9170 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9171 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9172 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9173 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9174 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9175 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9176 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9177 vfmt
->Normal3f
= save_Normal3f
;
9178 vfmt
->Normal3fv
= save_Normal3fv
;
9179 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9180 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9181 vfmt
->TexCoord1f
= save_TexCoord1f
;
9182 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9183 vfmt
->TexCoord2f
= save_TexCoord2f
;
9184 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9185 vfmt
->TexCoord3f
= save_TexCoord3f
;
9186 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9187 vfmt
->TexCoord4f
= save_TexCoord4f
;
9188 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9189 vfmt
->Vertex2f
= save_Vertex2f
;
9190 vfmt
->Vertex2fv
= save_Vertex2fv
;
9191 vfmt
->Vertex3f
= save_Vertex3f
;
9192 vfmt
->Vertex3fv
= save_Vertex3fv
;
9193 vfmt
->Vertex4f
= save_Vertex4f
;
9194 vfmt
->Vertex4fv
= save_Vertex4fv
;
9195 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9196 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9197 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9198 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9199 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9200 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9201 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9202 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9207 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9208 const GLvertexformat
*vfmt
)
9210 SET_CallList(disp
, vfmt
->CallList
);
9211 SET_CallLists(disp
, vfmt
->CallLists
);
9216 * Initialize display list state for given context.
9219 _mesa_init_display_list(struct gl_context
*ctx
)
9221 static GLboolean tableInitialized
= GL_FALSE
;
9223 /* zero-out the instruction size table, just once */
9224 if (!tableInitialized
) {
9225 memset(InstSize
, 0, sizeof(InstSize
));
9226 tableInitialized
= GL_TRUE
;
9229 /* extension info */
9230 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9233 ctx
->ListState
.CallDepth
= 0;
9234 ctx
->ExecuteFlag
= GL_TRUE
;
9235 ctx
->CompileFlag
= GL_FALSE
;
9236 ctx
->ListState
.CurrentBlock
= NULL
;
9237 ctx
->ListState
.CurrentPos
= 0;
9239 /* Display List group */
9240 ctx
->List
.ListBase
= 0;
9242 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9247 _mesa_free_display_list_data(struct gl_context
*ctx
)
9250 ctx
->ListExt
= NULL
;