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.
35 #include "api_arrayelt.h"
37 #include "api_loopback.h"
38 #include "api_validate.h"
39 #include "atifragshader.h"
41 #include "bufferobj.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
62 #include "texstorage.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
68 #include "math/m_matrix.h"
70 #include "main/dispatch.h"
77 * Other parts of Mesa (such as the VBO module) can plug into the display
78 * list system. This structure describes new display list instructions.
80 struct gl_list_instruction
83 void (*Execute
)( struct gl_context
*ctx
, void *data
);
84 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
85 void (*Print
)( struct gl_context
*ctx
, void *data
, FILE *f
);
89 #define MAX_DLIST_EXT_OPCODES 16
92 * Used by device drivers to hook new commands into display lists.
94 struct gl_list_extensions
96 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
105 * \param ctx GL context.
107 * Checks if dd_function_table::SaveNeedFlush is marked to flush
108 * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
110 #define SAVE_FLUSH_VERTICES(ctx) \
112 if (ctx->Driver.SaveNeedFlush) \
113 vbo_save_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_BIND_FRAGMENT_SHADER_ATI
,
321 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
323 OPCODE_STENCIL_FUNC_SEPARATE
,
324 OPCODE_STENCIL_OP_SEPARATE
,
325 OPCODE_STENCIL_MASK_SEPARATE
,
327 /* GL_ARB_shader_objects */
345 OPCODE_UNIFORM_MATRIX22
,
346 OPCODE_UNIFORM_MATRIX33
,
347 OPCODE_UNIFORM_MATRIX44
,
348 OPCODE_UNIFORM_MATRIX23
,
349 OPCODE_UNIFORM_MATRIX32
,
350 OPCODE_UNIFORM_MATRIX24
,
351 OPCODE_UNIFORM_MATRIX42
,
352 OPCODE_UNIFORM_MATRIX34
,
353 OPCODE_UNIFORM_MATRIX43
,
365 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
366 OPCODE_USE_PROGRAM_STAGES
,
367 OPCODE_PROGRAM_UNIFORM_1F
,
368 OPCODE_PROGRAM_UNIFORM_2F
,
369 OPCODE_PROGRAM_UNIFORM_3F
,
370 OPCODE_PROGRAM_UNIFORM_4F
,
371 OPCODE_PROGRAM_UNIFORM_1FV
,
372 OPCODE_PROGRAM_UNIFORM_2FV
,
373 OPCODE_PROGRAM_UNIFORM_3FV
,
374 OPCODE_PROGRAM_UNIFORM_4FV
,
375 OPCODE_PROGRAM_UNIFORM_1I
,
376 OPCODE_PROGRAM_UNIFORM_2I
,
377 OPCODE_PROGRAM_UNIFORM_3I
,
378 OPCODE_PROGRAM_UNIFORM_4I
,
379 OPCODE_PROGRAM_UNIFORM_1IV
,
380 OPCODE_PROGRAM_UNIFORM_2IV
,
381 OPCODE_PROGRAM_UNIFORM_3IV
,
382 OPCODE_PROGRAM_UNIFORM_4IV
,
383 OPCODE_PROGRAM_UNIFORM_1UI
,
384 OPCODE_PROGRAM_UNIFORM_2UI
,
385 OPCODE_PROGRAM_UNIFORM_3UI
,
386 OPCODE_PROGRAM_UNIFORM_4UI
,
387 OPCODE_PROGRAM_UNIFORM_1UIV
,
388 OPCODE_PROGRAM_UNIFORM_2UIV
,
389 OPCODE_PROGRAM_UNIFORM_3UIV
,
390 OPCODE_PROGRAM_UNIFORM_4UIV
,
391 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
392 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
401 /* GL_ARB_clip_control */
404 /* GL_ARB_color_buffer_float */
407 /* GL_EXT_framebuffer_blit */
408 OPCODE_BLIT_FRAMEBUFFER
,
410 /* Vertex attributes -- fallback for when optimized display
411 * list build isn't active.
430 /* GL_EXT_provoking_vertex */
431 OPCODE_PROVOKING_VERTEX
,
433 /* GL_EXT_transform_feedback */
434 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
435 OPCODE_END_TRANSFORM_FEEDBACK
,
436 OPCODE_BIND_TRANSFORM_FEEDBACK
,
437 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
438 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
439 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
441 /* GL_EXT_texture_integer */
443 OPCODE_CLEARCOLOR_UI
,
444 OPCODE_TEXPARAMETER_I
,
445 OPCODE_TEXPARAMETER_UI
,
447 /* GL_ARB_instanced_arrays */
448 OPCODE_VERTEX_ATTRIB_DIVISOR
,
450 /* GL_NV_texture_barrier */
451 OPCODE_TEXTURE_BARRIER_NV
,
453 /* GL_ARB_sampler_object */
455 OPCODE_SAMPLER_PARAMETERIV
,
456 OPCODE_SAMPLER_PARAMETERFV
,
457 OPCODE_SAMPLER_PARAMETERIIV
,
458 OPCODE_SAMPLER_PARAMETERUIV
,
463 /* GL_NV_conditional_render */
464 OPCODE_BEGIN_CONDITIONAL_RENDER
,
465 OPCODE_END_CONDITIONAL_RENDER
,
467 /* ARB_timer_query */
468 OPCODE_QUERY_COUNTER
,
470 /* ARB_transform_feedback3 */
471 OPCODE_BEGIN_QUERY_INDEXED
,
472 OPCODE_END_QUERY_INDEXED
,
473 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
475 /* ARB_transform_feedback_instanced */
476 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
477 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
479 /* ARB_uniform_buffer_object */
480 OPCODE_UNIFORM_BLOCK_BINDING
,
482 /* EXT_polygon_offset_clamp */
483 OPCODE_POLYGON_OFFSET_CLAMP
,
485 /* The following three are meta instructions */
486 OPCODE_ERROR
, /* raise compiled-in error */
488 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
498 * Display list instructions are stored as sequences of "nodes". Nodes
499 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
500 * are linked together with a pointer.
502 * Each instruction in the display list is stored as a sequence of
503 * contiguous nodes in memory.
504 * Each node is the union of a variety of data types.
506 * Note, all of these members should be 4 bytes in size or less for the
507 * sake of compact display lists. We store 8-byte pointers in a pair of
508 * these nodes using the save/get_pointer() functions below.
526 typedef union gl_dlist_node Node
;
529 /** How many 4-byte dwords to store a pointer */
530 #define POINTER_DWORDS (sizeof(void *) / 4)
532 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
533 * space for display lists. The following types and functions are
534 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
539 GLuint dwords
[POINTER_DWORDS
];
544 * Save a 4 or 8-byte pointer at dest (and dest+1).
547 save_pointer(Node
*dest
, void *src
)
552 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
553 STATIC_ASSERT(sizeof(Node
) == 4);
557 for (i
= 0; i
< POINTER_DWORDS
; i
++)
558 dest
[i
].ui
= p
.dwords
[i
];
563 * Retrieve a 4 or 8-byte pointer from node (node+1).
566 get_pointer(const Node
*node
)
571 for (i
= 0; i
< POINTER_DWORDS
; i
++)
572 p
.dwords
[i
] = node
[i
].ui
;
579 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
590 * How many nodes to allocate at a time. Note that bulk vertex data
591 * from glBegin/glVertex/glEnd primitives will typically wind up in
592 * a VBO, and not directly in the display list itself.
594 #define BLOCK_SIZE 256
599 * Number of nodes of storage needed for each instruction.
600 * Sizes for dynamically allocated opcodes are stored in the context struct.
602 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
605 void mesa_print_display_list(GLuint list
);
609 * Allocate a gl_display_list object with an initial block of storage.
610 * \param count how many display list nodes/tokes to allocate
612 static struct gl_display_list
*
613 make_list(GLuint name
, GLuint count
)
615 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
617 dlist
->Head
= malloc(sizeof(Node
) * count
);
618 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
624 * Lookup function to just encapsulate casting.
626 struct gl_display_list
*
627 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
629 return (struct gl_display_list
*)
630 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
634 /** Is the given opcode an extension code? */
635 static inline GLboolean
636 is_ext_opcode(OpCode opcode
)
638 return (opcode
>= OPCODE_EXT_0
);
642 /** Destroy an extended opcode instruction */
644 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
646 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
648 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
649 step
= ctx
->ListExt
->Opcode
[i
].Size
;
654 /** Execute an extended opcode instruction */
656 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
658 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
660 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
661 step
= ctx
->ListExt
->Opcode
[i
].Size
;
666 /** Print an extended opcode instruction */
668 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
670 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
672 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
673 step
= ctx
->ListExt
->Opcode
[i
].Size
;
679 * Delete the named display list, but don't remove from hash table.
680 * \param dlist - display list pointer
683 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
688 n
= block
= dlist
->Head
;
690 done
= block
? GL_FALSE
: GL_TRUE
;
692 const OpCode opcode
= n
[0].opcode
;
694 /* check for extension opcodes first */
695 if (is_ext_opcode(opcode
)) {
696 n
+= ext_opcode_destroy(ctx
, n
);
700 /* for some commands, we need to free malloc'd memory */
702 free(get_pointer(&n
[6]));
703 n
+= InstSize
[n
[0].opcode
];
706 free(get_pointer(&n
[10]));
707 n
+= InstSize
[n
[0].opcode
];
709 case OPCODE_DRAW_PIXELS
:
710 free(get_pointer(&n
[5]));
711 n
+= InstSize
[n
[0].opcode
];
714 free(get_pointer(&n
[7]));
715 n
+= InstSize
[n
[0].opcode
];
717 case OPCODE_POLYGON_STIPPLE
:
718 free(get_pointer(&n
[1]));
719 n
+= InstSize
[n
[0].opcode
];
721 case OPCODE_TEX_IMAGE1D
:
722 free(get_pointer(&n
[8]));
723 n
+= InstSize
[n
[0].opcode
];
725 case OPCODE_TEX_IMAGE2D
:
726 free(get_pointer(&n
[9]));
727 n
+= InstSize
[n
[0].opcode
];
729 case OPCODE_TEX_IMAGE3D
:
730 free(get_pointer(&n
[10]));
731 n
+= InstSize
[n
[0].opcode
];
733 case OPCODE_TEX_SUB_IMAGE1D
:
734 free(get_pointer(&n
[7]));
735 n
+= InstSize
[n
[0].opcode
];
737 case OPCODE_TEX_SUB_IMAGE2D
:
738 free(get_pointer(&n
[9]));
739 n
+= InstSize
[n
[0].opcode
];
741 case OPCODE_TEX_SUB_IMAGE3D
:
742 free(get_pointer(&n
[11]));
743 n
+= InstSize
[n
[0].opcode
];
745 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
746 free(get_pointer(&n
[7]));
747 n
+= InstSize
[n
[0].opcode
];
749 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
750 free(get_pointer(&n
[8]));
751 n
+= InstSize
[n
[0].opcode
];
753 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
754 free(get_pointer(&n
[9]));
755 n
+= InstSize
[n
[0].opcode
];
757 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
758 free(get_pointer(&n
[7]));
759 n
+= InstSize
[n
[0].opcode
];
761 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
762 free(get_pointer(&n
[9]));
763 n
+= InstSize
[n
[0].opcode
];
765 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
766 free(get_pointer(&n
[11]));
767 n
+= InstSize
[n
[0].opcode
];
769 case OPCODE_PROGRAM_STRING_ARB
:
770 free(get_pointer(&n
[4])); /* program string */
771 n
+= InstSize
[n
[0].opcode
];
773 case OPCODE_UNIFORM_1FV
:
774 case OPCODE_UNIFORM_2FV
:
775 case OPCODE_UNIFORM_3FV
:
776 case OPCODE_UNIFORM_4FV
:
777 case OPCODE_UNIFORM_1IV
:
778 case OPCODE_UNIFORM_2IV
:
779 case OPCODE_UNIFORM_3IV
:
780 case OPCODE_UNIFORM_4IV
:
781 case OPCODE_UNIFORM_1UIV
:
782 case OPCODE_UNIFORM_2UIV
:
783 case OPCODE_UNIFORM_3UIV
:
784 case OPCODE_UNIFORM_4UIV
:
785 free(get_pointer(&n
[3]));
786 n
+= InstSize
[n
[0].opcode
];
788 case OPCODE_UNIFORM_MATRIX22
:
789 case OPCODE_UNIFORM_MATRIX33
:
790 case OPCODE_UNIFORM_MATRIX44
:
791 case OPCODE_UNIFORM_MATRIX24
:
792 case OPCODE_UNIFORM_MATRIX42
:
793 case OPCODE_UNIFORM_MATRIX23
:
794 case OPCODE_UNIFORM_MATRIX32
:
795 case OPCODE_UNIFORM_MATRIX34
:
796 case OPCODE_UNIFORM_MATRIX43
:
797 free(get_pointer(&n
[4]));
798 n
+= InstSize
[n
[0].opcode
];
800 case OPCODE_PROGRAM_UNIFORM_1FV
:
801 case OPCODE_PROGRAM_UNIFORM_2FV
:
802 case OPCODE_PROGRAM_UNIFORM_3FV
:
803 case OPCODE_PROGRAM_UNIFORM_4FV
:
804 case OPCODE_PROGRAM_UNIFORM_1IV
:
805 case OPCODE_PROGRAM_UNIFORM_2IV
:
806 case OPCODE_PROGRAM_UNIFORM_3IV
:
807 case OPCODE_PROGRAM_UNIFORM_4IV
:
808 case OPCODE_PROGRAM_UNIFORM_1UIV
:
809 case OPCODE_PROGRAM_UNIFORM_2UIV
:
810 case OPCODE_PROGRAM_UNIFORM_3UIV
:
811 case OPCODE_PROGRAM_UNIFORM_4UIV
:
812 free(get_pointer(&n
[4]));
813 n
+= InstSize
[n
[0].opcode
];
815 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
816 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
817 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
818 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
819 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
820 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
821 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
824 free(get_pointer(&n
[5]));
825 n
+= InstSize
[n
[0].opcode
];
827 case OPCODE_PIXEL_MAP
:
828 free(get_pointer(&n
[3]));
829 n
+= InstSize
[n
[0].opcode
];
832 case OPCODE_CONTINUE
:
833 n
= (Node
*) get_pointer(&n
[1]);
837 case OPCODE_END_OF_LIST
:
842 /* Most frequent case */
843 n
+= InstSize
[n
[0].opcode
];
855 * Destroy a display list and remove from hash table.
856 * \param list - display list number
859 destroy_list(struct gl_context
*ctx
, GLuint list
)
861 struct gl_display_list
*dlist
;
866 dlist
= _mesa_lookup_list(ctx
, list
);
870 _mesa_delete_list(ctx
, dlist
);
871 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
876 * Translate the nth element of list from <type> to GLint.
879 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
891 bptr
= (GLbyte
*) list
;
892 return (GLint
) bptr
[n
];
893 case GL_UNSIGNED_BYTE
:
894 ubptr
= (GLubyte
*) list
;
895 return (GLint
) ubptr
[n
];
897 sptr
= (GLshort
*) list
;
898 return (GLint
) sptr
[n
];
899 case GL_UNSIGNED_SHORT
:
900 usptr
= (GLushort
*) list
;
901 return (GLint
) usptr
[n
];
903 iptr
= (GLint
*) list
;
905 case GL_UNSIGNED_INT
:
906 uiptr
= (GLuint
*) list
;
907 return (GLint
) uiptr
[n
];
909 fptr
= (GLfloat
*) list
;
910 return (GLint
) floorf(fptr
[n
]);
912 ubptr
= ((GLubyte
*) list
) + 2 * n
;
913 return (GLint
) ubptr
[0] * 256
916 ubptr
= ((GLubyte
*) list
) + 3 * n
;
917 return (GLint
) ubptr
[0] * 65536
918 + (GLint
) ubptr
[1] * 256
921 ubptr
= ((GLubyte
*) list
) + 4 * n
;
922 return (GLint
) ubptr
[0] * 16777216
923 + (GLint
) ubptr
[1] * 65536
924 + (GLint
) ubptr
[2] * 256
933 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
934 * If width < 0 or height < 0 or format or type are invalid we'll just
935 * return NULL. We will not generate an error since OpenGL command
936 * arguments aren't error-checked until the command is actually executed
937 * (not when they're compiled).
938 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
941 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
942 GLsizei width
, GLsizei height
, GLsizei depth
,
943 GLenum format
, GLenum type
, const GLvoid
* pixels
,
944 const struct gl_pixelstore_attrib
*unpack
)
946 if (width
<= 0 || height
<= 0) {
950 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
951 /* bad format and/or type */
955 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
959 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
960 format
, type
, pixels
, unpack
);
961 if (pixels
&& !image
) {
962 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
966 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
967 depth
, format
, type
, INT_MAX
, pixels
)) {
968 const GLubyte
*map
, *src
;
972 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
973 GL_MAP_READ_BIT
, unpack
->BufferObj
,
976 /* unable to map src buffer! */
977 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
981 src
= ADD_POINTERS(map
, pixels
);
982 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
983 format
, type
, src
, unpack
);
985 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
988 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
994 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
999 /** Return copy of memory */
1001 memdup(const void *src
, GLsizei bytes
)
1003 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1005 memcpy(b
, src
, bytes
);
1011 * Allocate space for a display list instruction (opcode + payload space).
1012 * \param opcode the instruction opcode (OPCODE_* value)
1013 * \param bytes instruction payload size (not counting opcode)
1014 * \param align8 does the payload need to be 8-byte aligned?
1015 * This is only relevant in 64-bit environments.
1016 * \return pointer to allocated memory (the payload will be at pointer+1)
1019 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1021 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1022 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1026 if (opcode
< OPCODE_EXT_0
) {
1027 if (InstSize
[opcode
] == 0) {
1028 /* save instruction size now */
1029 InstSize
[opcode
] = numNodes
;
1032 /* make sure instruction size agrees */
1033 assert(numNodes
== InstSize
[opcode
]);
1037 if (sizeof(void *) > sizeof(Node
) && align8
1038 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1039 /* The opcode would get placed at node[0] and the payload would start
1040 * at node[1]. But the payload needs to be at an even offset (8-byte
1049 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1051 /* This block is full. Allocate a new block and chain to it */
1053 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1054 n
[0].opcode
= OPCODE_CONTINUE
;
1055 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1057 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1061 /* a fresh block should be 8-byte aligned on 64-bit systems */
1062 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1064 save_pointer(&n
[1], newblock
);
1065 ctx
->ListState
.CurrentBlock
= newblock
;
1066 ctx
->ListState
.CurrentPos
= 0;
1068 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1069 * we have to insert a NOP so that the payload of the real opcode lands
1070 * on an even location:
1071 * node[0] = OPCODE_NOP
1072 * node[1] = OPCODE_x;
1073 * node[2] = start of payload
1075 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1078 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1080 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1081 n
[0].opcode
= OPCODE_NOP
;
1083 /* The "real" opcode will now be at an odd location and the payload
1084 * will be at an even location.
1087 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1089 n
[0].opcode
= opcode
;
1097 * Allocate space for a display list instruction. Used by callers outside
1098 * this file for things like VBO vertex data.
1100 * \param opcode the instruction opcode (OPCODE_* value)
1101 * \param bytes instruction size in bytes, not counting opcode.
1102 * \return pointer to the usable data area (not including the internal
1106 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1108 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1110 return n
+ 1; /* return pointer to payload area, after opcode */
1117 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1118 * aligned in 64-bit environments, 4-byte aligned otherwise.
1121 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1123 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1125 return n
+ 1; /* return pointer to payload area, after opcode */
1132 * This function allows modules and drivers to get their own opcodes
1133 * for extending display list functionality.
1134 * \param ctx the rendering context
1135 * \param size number of bytes for storing the new display list command
1136 * \param execute function to execute the new display list command
1137 * \param destroy function to destroy the new display list command
1138 * \param print function to print the new display list command
1139 * \return the new opcode number or -1 if error
1142 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1144 void (*execute
) (struct gl_context
*, void *),
1145 void (*destroy
) (struct gl_context
*, void *),
1146 void (*print
) (struct gl_context
*, void *, FILE *))
1148 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1149 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1150 ctx
->ListExt
->Opcode
[i
].Size
=
1151 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1152 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1153 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1154 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1155 return i
+ OPCODE_EXT_0
;
1162 * Allocate space for a display list instruction. The space is basically
1163 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1164 * function parameter, node[2] is the second parameter, etc.
1166 * \param opcode one of OPCODE_x
1167 * \param nparams number of function parameters
1168 * \return pointer to start of instruction space
1170 static inline Node
*
1171 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1173 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1178 * Called by EndList to try to reduce memory used for the list.
1181 trim_list(struct gl_context
*ctx
)
1183 /* If the list we're ending only has one allocated block of nodes/tokens
1184 * and its size isn't a full block size, realloc the block to use less
1185 * memory. This is important for apps that create many small display
1186 * lists and apps that use glXUseXFont (many lists each containing one
1188 * Note: we currently only trim display lists that allocated one block
1189 * of tokens. That hits the short list case which is what we're mainly
1190 * concerned with. Trimming longer lists would involve traversing the
1191 * linked list of blocks.
1193 struct gl_dlist_state
*list
= &ctx
->ListState
;
1195 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1196 (list
->CurrentPos
< BLOCK_SIZE
)) {
1197 /* There's only one block and it's not full, so realloc */
1198 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1199 list
->CurrentList
->Head
=
1200 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1201 if (!list
->CurrentBlock
) {
1202 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1210 * Display List compilation functions
1212 static void GLAPIENTRY
1213 save_Accum(GLenum op
, GLfloat value
)
1215 GET_CURRENT_CONTEXT(ctx
);
1217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1218 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1223 if (ctx
->ExecuteFlag
) {
1224 CALL_Accum(ctx
->Exec
, (op
, value
));
1229 static void GLAPIENTRY
1230 save_AlphaFunc(GLenum func
, GLclampf ref
)
1232 GET_CURRENT_CONTEXT(ctx
);
1234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1235 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1238 n
[2].f
= (GLfloat
) ref
;
1240 if (ctx
->ExecuteFlag
) {
1241 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1246 static void GLAPIENTRY
1247 save_BindTexture(GLenum target
, GLuint texture
)
1249 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1252 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1257 if (ctx
->ExecuteFlag
) {
1258 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1263 static void GLAPIENTRY
1264 save_Bitmap(GLsizei width
, GLsizei height
,
1265 GLfloat xorig
, GLfloat yorig
,
1266 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1268 GET_CURRENT_CONTEXT(ctx
);
1270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1271 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1273 n
[1].i
= (GLint
) width
;
1274 n
[2].i
= (GLint
) height
;
1280 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1281 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1283 if (ctx
->ExecuteFlag
) {
1284 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1285 xorig
, yorig
, xmove
, ymove
, pixels
));
1290 static void GLAPIENTRY
1291 save_BlendEquation(GLenum mode
)
1293 GET_CURRENT_CONTEXT(ctx
);
1295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1296 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1300 if (ctx
->ExecuteFlag
) {
1301 CALL_BlendEquation(ctx
->Exec
, (mode
));
1306 static void GLAPIENTRY
1307 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1309 GET_CURRENT_CONTEXT(ctx
);
1311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1312 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1317 if (ctx
->ExecuteFlag
) {
1318 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1323 static void GLAPIENTRY
1324 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1325 GLenum sfactorA
, GLenum dfactorA
)
1327 GET_CURRENT_CONTEXT(ctx
);
1329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1330 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1332 n
[1].e
= sfactorRGB
;
1333 n
[2].e
= dfactorRGB
;
1337 if (ctx
->ExecuteFlag
) {
1338 CALL_BlendFuncSeparate(ctx
->Exec
,
1339 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1344 static void GLAPIENTRY
1345 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1347 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1351 static void GLAPIENTRY
1352 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1354 GET_CURRENT_CONTEXT(ctx
);
1356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1357 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1364 if (ctx
->ExecuteFlag
) {
1365 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1369 /* GL_ARB_draw_buffers_blend */
1370 static void GLAPIENTRY
1371 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1372 GLenum sfactorA
, GLenum dfactorA
)
1374 GET_CURRENT_CONTEXT(ctx
);
1376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1377 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1380 n
[2].e
= sfactorRGB
;
1381 n
[3].e
= dfactorRGB
;
1385 if (ctx
->ExecuteFlag
) {
1386 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1387 sfactorA
, dfactorA
));
1391 /* GL_ARB_draw_buffers_blend */
1392 static void GLAPIENTRY
1393 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1395 GET_CURRENT_CONTEXT(ctx
);
1397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1398 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1404 if (ctx
->ExecuteFlag
) {
1405 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1409 /* GL_ARB_draw_buffers_blend */
1410 static void GLAPIENTRY
1411 save_BlendEquationi(GLuint buf
, GLenum mode
)
1413 GET_CURRENT_CONTEXT(ctx
);
1415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1416 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1421 if (ctx
->ExecuteFlag
) {
1422 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1426 /* GL_ARB_draw_buffers_blend */
1427 static void GLAPIENTRY
1428 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1430 GET_CURRENT_CONTEXT(ctx
);
1432 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1433 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1439 if (ctx
->ExecuteFlag
) {
1440 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1445 /* GL_ARB_draw_instanced. */
1446 static void GLAPIENTRY
1447 save_DrawArraysInstancedARB(GLenum mode
,
1452 GET_CURRENT_CONTEXT(ctx
);
1453 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1454 "glDrawArraysInstanced() during display list compile");
1457 static void GLAPIENTRY
1458 save_DrawElementsInstancedARB(GLenum mode
,
1461 const GLvoid
*indices
,
1464 GET_CURRENT_CONTEXT(ctx
);
1465 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1466 "glDrawElementsInstanced() during display list compile");
1469 static void GLAPIENTRY
1470 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1473 const GLvoid
*indices
,
1477 GET_CURRENT_CONTEXT(ctx
);
1478 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1479 "glDrawElementsInstancedBaseVertex() during display list compile");
1482 /* GL_ARB_base_instance. */
1483 static void GLAPIENTRY
1484 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1488 GLuint baseinstance
)
1490 GET_CURRENT_CONTEXT(ctx
);
1491 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1492 "glDrawArraysInstancedBaseInstance() during display list compile");
1495 static void APIENTRY
1496 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1499 const void *indices
,
1501 GLuint baseinstance
)
1503 GET_CURRENT_CONTEXT(ctx
);
1504 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1505 "glDrawElementsInstancedBaseInstance() during display list compile");
1508 static void APIENTRY
1509 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1512 const void *indices
,
1515 GLuint baseinstance
)
1517 GET_CURRENT_CONTEXT(ctx
);
1518 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1519 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1524 * While building a display list we cache some OpenGL state.
1525 * Under some circumstances we need to invalidate that state (immediately
1526 * when we start compiling a list, or after glCallList(s)).
1529 invalidate_saved_current_state(struct gl_context
*ctx
)
1533 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1534 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1536 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1537 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1539 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1541 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1545 static void GLAPIENTRY
1546 save_CallList(GLuint list
)
1548 GET_CURRENT_CONTEXT(ctx
);
1550 SAVE_FLUSH_VERTICES(ctx
);
1552 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1557 /* After this, we don't know what state we're in. Invalidate all
1558 * cached information previously gathered:
1560 invalidate_saved_current_state( ctx
);
1562 if (ctx
->ExecuteFlag
) {
1563 _mesa_CallList(list
);
1568 static void GLAPIENTRY
1569 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1571 GET_CURRENT_CONTEXT(ctx
);
1573 GLboolean typeErrorFlag
;
1575 SAVE_FLUSH_VERTICES(ctx
);
1579 case GL_UNSIGNED_BYTE
:
1581 case GL_UNSIGNED_SHORT
:
1583 case GL_UNSIGNED_INT
:
1588 typeErrorFlag
= GL_FALSE
;
1591 typeErrorFlag
= GL_TRUE
;
1594 for (i
= 0; i
< num
; i
++) {
1595 GLint list
= translate_id(i
, type
, lists
);
1596 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1599 n
[2].b
= typeErrorFlag
;
1603 /* After this, we don't know what state we're in. Invalidate all
1604 * cached information previously gathered:
1606 invalidate_saved_current_state( ctx
);
1608 if (ctx
->ExecuteFlag
) {
1609 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1614 static void GLAPIENTRY
1615 save_Clear(GLbitfield mask
)
1617 GET_CURRENT_CONTEXT(ctx
);
1619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1620 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1624 if (ctx
->ExecuteFlag
) {
1625 CALL_Clear(ctx
->Exec
, (mask
));
1630 static void GLAPIENTRY
1631 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1633 GET_CURRENT_CONTEXT(ctx
);
1635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1636 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1639 n
[2].i
= drawbuffer
;
1641 if (buffer
== GL_COLOR
) {
1652 if (ctx
->ExecuteFlag
) {
1653 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1658 static void GLAPIENTRY
1659 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1661 GET_CURRENT_CONTEXT(ctx
);
1663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1664 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1667 n
[2].i
= drawbuffer
;
1669 if (buffer
== GL_COLOR
) {
1680 if (ctx
->ExecuteFlag
) {
1681 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1686 static void GLAPIENTRY
1687 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1689 GET_CURRENT_CONTEXT(ctx
);
1691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1692 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1695 n
[2].i
= drawbuffer
;
1697 if (buffer
== GL_COLOR
) {
1708 if (ctx
->ExecuteFlag
) {
1709 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1714 static void GLAPIENTRY
1715 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1716 GLfloat depth
, GLint stencil
)
1718 GET_CURRENT_CONTEXT(ctx
);
1720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1721 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1724 n
[2].i
= drawbuffer
;
1728 if (ctx
->ExecuteFlag
) {
1729 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1734 static void GLAPIENTRY
1735 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1737 GET_CURRENT_CONTEXT(ctx
);
1739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1740 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1747 if (ctx
->ExecuteFlag
) {
1748 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1753 static void GLAPIENTRY
1754 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1756 GET_CURRENT_CONTEXT(ctx
);
1758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1759 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1766 if (ctx
->ExecuteFlag
) {
1767 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1772 static void GLAPIENTRY
1773 save_ClearDepth(GLclampd depth
)
1775 GET_CURRENT_CONTEXT(ctx
);
1777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1778 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1780 n
[1].f
= (GLfloat
) depth
;
1782 if (ctx
->ExecuteFlag
) {
1783 CALL_ClearDepth(ctx
->Exec
, (depth
));
1788 static void GLAPIENTRY
1789 save_ClearIndex(GLfloat c
)
1791 GET_CURRENT_CONTEXT(ctx
);
1793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1794 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1798 if (ctx
->ExecuteFlag
) {
1799 CALL_ClearIndex(ctx
->Exec
, (c
));
1804 static void GLAPIENTRY
1805 save_ClearStencil(GLint s
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1810 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1814 if (ctx
->ExecuteFlag
) {
1815 CALL_ClearStencil(ctx
->Exec
, (s
));
1820 static void GLAPIENTRY
1821 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1823 GET_CURRENT_CONTEXT(ctx
);
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1826 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1829 n
[2].f
= (GLfloat
) equ
[0];
1830 n
[3].f
= (GLfloat
) equ
[1];
1831 n
[4].f
= (GLfloat
) equ
[2];
1832 n
[5].f
= (GLfloat
) equ
[3];
1834 if (ctx
->ExecuteFlag
) {
1835 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1841 static void GLAPIENTRY
1842 save_ColorMask(GLboolean red
, GLboolean green
,
1843 GLboolean blue
, GLboolean alpha
)
1845 GET_CURRENT_CONTEXT(ctx
);
1847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1848 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1855 if (ctx
->ExecuteFlag
) {
1856 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1861 static void GLAPIENTRY
1862 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1863 GLboolean blue
, GLboolean alpha
)
1865 GET_CURRENT_CONTEXT(ctx
);
1867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1868 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1876 if (ctx
->ExecuteFlag
) {
1877 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1882 static void GLAPIENTRY
1883 save_ColorMaterial(GLenum face
, GLenum mode
)
1885 GET_CURRENT_CONTEXT(ctx
);
1887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1889 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1894 if (ctx
->ExecuteFlag
) {
1895 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1900 static void GLAPIENTRY
1901 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1903 GET_CURRENT_CONTEXT(ctx
);
1905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1906 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1910 n
[3].i
= (GLint
) width
;
1911 n
[4].i
= (GLint
) height
;
1914 if (ctx
->ExecuteFlag
) {
1915 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1921 static void GLAPIENTRY
1922 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1923 GLint x
, GLint y
, GLsizei width
, GLint border
)
1925 GET_CURRENT_CONTEXT(ctx
);
1927 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1928 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1932 n
[3].e
= internalformat
;
1938 if (ctx
->ExecuteFlag
) {
1939 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1940 x
, y
, width
, border
));
1945 static void GLAPIENTRY
1946 save_CopyTexImage2D(GLenum target
, GLint level
,
1947 GLenum internalformat
,
1948 GLint x
, GLint y
, GLsizei width
,
1949 GLsizei height
, GLint border
)
1951 GET_CURRENT_CONTEXT(ctx
);
1953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1954 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1958 n
[3].e
= internalformat
;
1965 if (ctx
->ExecuteFlag
) {
1966 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1967 x
, y
, width
, height
, border
));
1973 static void GLAPIENTRY
1974 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1975 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1977 GET_CURRENT_CONTEXT(ctx
);
1979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1980 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1989 if (ctx
->ExecuteFlag
) {
1990 CALL_CopyTexSubImage1D(ctx
->Exec
,
1991 (target
, level
, xoffset
, x
, y
, width
));
1996 static void GLAPIENTRY
1997 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1998 GLint xoffset
, GLint yoffset
,
1999 GLint x
, GLint y
, GLsizei width
, GLint height
)
2001 GET_CURRENT_CONTEXT(ctx
);
2003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2004 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2015 if (ctx
->ExecuteFlag
) {
2016 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2017 x
, y
, width
, height
));
2022 static void GLAPIENTRY
2023 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2024 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2025 GLint x
, GLint y
, GLsizei width
, GLint height
)
2027 GET_CURRENT_CONTEXT(ctx
);
2029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2030 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2042 if (ctx
->ExecuteFlag
) {
2043 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2044 xoffset
, yoffset
, zoffset
,
2045 x
, y
, width
, height
));
2050 static void GLAPIENTRY
2051 save_CullFace(GLenum mode
)
2053 GET_CURRENT_CONTEXT(ctx
);
2055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2056 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2060 if (ctx
->ExecuteFlag
) {
2061 CALL_CullFace(ctx
->Exec
, (mode
));
2066 static void GLAPIENTRY
2067 save_DepthFunc(GLenum func
)
2069 GET_CURRENT_CONTEXT(ctx
);
2071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2072 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2076 if (ctx
->ExecuteFlag
) {
2077 CALL_DepthFunc(ctx
->Exec
, (func
));
2082 static void GLAPIENTRY
2083 save_DepthMask(GLboolean mask
)
2085 GET_CURRENT_CONTEXT(ctx
);
2087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2088 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2092 if (ctx
->ExecuteFlag
) {
2093 CALL_DepthMask(ctx
->Exec
, (mask
));
2098 static void GLAPIENTRY
2099 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2101 GET_CURRENT_CONTEXT(ctx
);
2103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2104 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2106 n
[1].f
= (GLfloat
) nearval
;
2107 n
[2].f
= (GLfloat
) farval
;
2109 if (ctx
->ExecuteFlag
) {
2110 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2115 static void GLAPIENTRY
2116 save_Disable(GLenum cap
)
2118 GET_CURRENT_CONTEXT(ctx
);
2120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2121 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2125 if (ctx
->ExecuteFlag
) {
2126 CALL_Disable(ctx
->Exec
, (cap
));
2131 static void GLAPIENTRY
2132 save_DisableIndexed(GLuint index
, GLenum cap
)
2134 GET_CURRENT_CONTEXT(ctx
);
2136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2137 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2142 if (ctx
->ExecuteFlag
) {
2143 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2148 static void GLAPIENTRY
2149 save_DrawBuffer(GLenum mode
)
2151 GET_CURRENT_CONTEXT(ctx
);
2153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2154 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2158 if (ctx
->ExecuteFlag
) {
2159 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2164 static void GLAPIENTRY
2165 save_DrawPixels(GLsizei width
, GLsizei height
,
2166 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2168 GET_CURRENT_CONTEXT(ctx
);
2171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2173 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2180 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2181 pixels
, &ctx
->Unpack
));
2183 if (ctx
->ExecuteFlag
) {
2184 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2190 static void GLAPIENTRY
2191 save_Enable(GLenum cap
)
2193 GET_CURRENT_CONTEXT(ctx
);
2195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2196 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2200 if (ctx
->ExecuteFlag
) {
2201 CALL_Enable(ctx
->Exec
, (cap
));
2207 static void GLAPIENTRY
2208 save_EnableIndexed(GLuint index
, GLenum cap
)
2210 GET_CURRENT_CONTEXT(ctx
);
2212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2213 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2218 if (ctx
->ExecuteFlag
) {
2219 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2225 static void GLAPIENTRY
2226 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2228 GET_CURRENT_CONTEXT(ctx
);
2230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2231 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2237 if (ctx
->ExecuteFlag
) {
2238 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2243 static void GLAPIENTRY
2244 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2246 GET_CURRENT_CONTEXT(ctx
);
2248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2249 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2257 if (ctx
->ExecuteFlag
) {
2258 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2265 static void GLAPIENTRY
2266 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2268 GET_CURRENT_CONTEXT(ctx
);
2270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2271 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2279 if (ctx
->ExecuteFlag
) {
2280 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2285 static void GLAPIENTRY
2286 save_Fogf(GLenum pname
, GLfloat param
)
2290 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2291 save_Fogfv(pname
, parray
);
2295 static void GLAPIENTRY
2296 save_Fogiv(GLenum pname
, const GLint
*params
)
2301 case GL_FOG_DENSITY
:
2305 p
[0] = (GLfloat
) *params
;
2311 p
[0] = INT_TO_FLOAT(params
[0]);
2312 p
[1] = INT_TO_FLOAT(params
[1]);
2313 p
[2] = INT_TO_FLOAT(params
[2]);
2314 p
[3] = INT_TO_FLOAT(params
[3]);
2317 /* Error will be caught later in gl_Fogfv */
2318 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2320 save_Fogfv(pname
, p
);
2324 static void GLAPIENTRY
2325 save_Fogi(GLenum pname
, GLint param
)
2329 parray
[1] = parray
[2] = parray
[3] = 0;
2330 save_Fogiv(pname
, parray
);
2334 static void GLAPIENTRY
2335 save_FrontFace(GLenum mode
)
2337 GET_CURRENT_CONTEXT(ctx
);
2339 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2340 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2344 if (ctx
->ExecuteFlag
) {
2345 CALL_FrontFace(ctx
->Exec
, (mode
));
2350 static void GLAPIENTRY
2351 save_Frustum(GLdouble left
, GLdouble right
,
2352 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2354 GET_CURRENT_CONTEXT(ctx
);
2356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2357 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2359 n
[1].f
= (GLfloat
) left
;
2360 n
[2].f
= (GLfloat
) right
;
2361 n
[3].f
= (GLfloat
) bottom
;
2362 n
[4].f
= (GLfloat
) top
;
2363 n
[5].f
= (GLfloat
) nearval
;
2364 n
[6].f
= (GLfloat
) farval
;
2366 if (ctx
->ExecuteFlag
) {
2367 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2372 static void GLAPIENTRY
2373 save_Hint(GLenum target
, GLenum mode
)
2375 GET_CURRENT_CONTEXT(ctx
);
2377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2378 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2383 if (ctx
->ExecuteFlag
) {
2384 CALL_Hint(ctx
->Exec
, (target
, mode
));
2389 static void GLAPIENTRY
2390 save_IndexMask(GLuint mask
)
2392 GET_CURRENT_CONTEXT(ctx
);
2394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2395 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2399 if (ctx
->ExecuteFlag
) {
2400 CALL_IndexMask(ctx
->Exec
, (mask
));
2405 static void GLAPIENTRY
2406 save_InitNames(void)
2408 GET_CURRENT_CONTEXT(ctx
);
2409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2410 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2411 if (ctx
->ExecuteFlag
) {
2412 CALL_InitNames(ctx
->Exec
, ());
2417 static void GLAPIENTRY
2418 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2420 GET_CURRENT_CONTEXT(ctx
);
2422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2423 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2441 case GL_SPOT_DIRECTION
:
2444 case GL_SPOT_EXPONENT
:
2447 case GL_SPOT_CUTOFF
:
2450 case GL_CONSTANT_ATTENUATION
:
2453 case GL_LINEAR_ATTENUATION
:
2456 case GL_QUADRATIC_ATTENUATION
:
2462 for (i
= 0; i
< nParams
; i
++) {
2463 n
[3 + i
].f
= params
[i
];
2466 if (ctx
->ExecuteFlag
) {
2467 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2472 static void GLAPIENTRY
2473 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2477 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2478 save_Lightfv(light
, pname
, parray
);
2482 static void GLAPIENTRY
2483 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2490 fparam
[0] = INT_TO_FLOAT(params
[0]);
2491 fparam
[1] = INT_TO_FLOAT(params
[1]);
2492 fparam
[2] = INT_TO_FLOAT(params
[2]);
2493 fparam
[3] = INT_TO_FLOAT(params
[3]);
2496 fparam
[0] = (GLfloat
) params
[0];
2497 fparam
[1] = (GLfloat
) params
[1];
2498 fparam
[2] = (GLfloat
) params
[2];
2499 fparam
[3] = (GLfloat
) params
[3];
2501 case GL_SPOT_DIRECTION
:
2502 fparam
[0] = (GLfloat
) params
[0];
2503 fparam
[1] = (GLfloat
) params
[1];
2504 fparam
[2] = (GLfloat
) params
[2];
2506 case GL_SPOT_EXPONENT
:
2507 case GL_SPOT_CUTOFF
:
2508 case GL_CONSTANT_ATTENUATION
:
2509 case GL_LINEAR_ATTENUATION
:
2510 case GL_QUADRATIC_ATTENUATION
:
2511 fparam
[0] = (GLfloat
) params
[0];
2514 /* error will be caught later in gl_Lightfv */
2517 save_Lightfv(light
, pname
, fparam
);
2521 static void GLAPIENTRY
2522 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2526 parray
[1] = parray
[2] = parray
[3] = 0;
2527 save_Lightiv(light
, pname
, parray
);
2531 static void GLAPIENTRY
2532 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2534 GET_CURRENT_CONTEXT(ctx
);
2536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2537 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2545 if (ctx
->ExecuteFlag
) {
2546 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2551 static void GLAPIENTRY
2552 save_LightModelf(GLenum pname
, GLfloat param
)
2556 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2557 save_LightModelfv(pname
, parray
);
2561 static void GLAPIENTRY
2562 save_LightModeliv(GLenum pname
, const GLint
*params
)
2566 case GL_LIGHT_MODEL_AMBIENT
:
2567 fparam
[0] = INT_TO_FLOAT(params
[0]);
2568 fparam
[1] = INT_TO_FLOAT(params
[1]);
2569 fparam
[2] = INT_TO_FLOAT(params
[2]);
2570 fparam
[3] = INT_TO_FLOAT(params
[3]);
2572 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2573 case GL_LIGHT_MODEL_TWO_SIDE
:
2574 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2575 fparam
[0] = (GLfloat
) params
[0];
2581 /* Error will be caught later in gl_LightModelfv */
2582 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2584 save_LightModelfv(pname
, fparam
);
2588 static void GLAPIENTRY
2589 save_LightModeli(GLenum pname
, GLint param
)
2593 parray
[1] = parray
[2] = parray
[3] = 0;
2594 save_LightModeliv(pname
, parray
);
2598 static void GLAPIENTRY
2599 save_LineStipple(GLint factor
, GLushort pattern
)
2601 GET_CURRENT_CONTEXT(ctx
);
2603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2604 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2609 if (ctx
->ExecuteFlag
) {
2610 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2615 static void GLAPIENTRY
2616 save_LineWidth(GLfloat width
)
2618 GET_CURRENT_CONTEXT(ctx
);
2620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2621 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2625 if (ctx
->ExecuteFlag
) {
2626 CALL_LineWidth(ctx
->Exec
, (width
));
2631 static void GLAPIENTRY
2632 save_ListBase(GLuint base
)
2634 GET_CURRENT_CONTEXT(ctx
);
2636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2637 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2641 if (ctx
->ExecuteFlag
) {
2642 CALL_ListBase(ctx
->Exec
, (base
));
2647 static void GLAPIENTRY
2648 save_LoadIdentity(void)
2650 GET_CURRENT_CONTEXT(ctx
);
2651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2652 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2653 if (ctx
->ExecuteFlag
) {
2654 CALL_LoadIdentity(ctx
->Exec
, ());
2659 static void GLAPIENTRY
2660 save_LoadMatrixf(const GLfloat
* m
)
2662 GET_CURRENT_CONTEXT(ctx
);
2664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2665 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2668 for (i
= 0; i
< 16; i
++) {
2672 if (ctx
->ExecuteFlag
) {
2673 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2678 static void GLAPIENTRY
2679 save_LoadMatrixd(const GLdouble
* m
)
2683 for (i
= 0; i
< 16; i
++) {
2684 f
[i
] = (GLfloat
) m
[i
];
2686 save_LoadMatrixf(f
);
2690 static void GLAPIENTRY
2691 save_LoadName(GLuint name
)
2693 GET_CURRENT_CONTEXT(ctx
);
2695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2696 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2700 if (ctx
->ExecuteFlag
) {
2701 CALL_LoadName(ctx
->Exec
, (name
));
2706 static void GLAPIENTRY
2707 save_LogicOp(GLenum opcode
)
2709 GET_CURRENT_CONTEXT(ctx
);
2711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2712 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2716 if (ctx
->ExecuteFlag
) {
2717 CALL_LogicOp(ctx
->Exec
, (opcode
));
2722 static void GLAPIENTRY
2723 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2724 GLint order
, const GLdouble
* points
)
2726 GET_CURRENT_CONTEXT(ctx
);
2728 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2729 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2731 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2733 n
[2].f
= (GLfloat
) u1
;
2734 n
[3].f
= (GLfloat
) u2
;
2735 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2737 save_pointer(&n
[6], pnts
);
2739 if (ctx
->ExecuteFlag
) {
2740 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2744 static void GLAPIENTRY
2745 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2746 GLint order
, const GLfloat
* points
)
2748 GET_CURRENT_CONTEXT(ctx
);
2750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2751 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2753 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2757 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2759 save_pointer(&n
[6], pnts
);
2761 if (ctx
->ExecuteFlag
) {
2762 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2767 static void GLAPIENTRY
2768 save_Map2d(GLenum target
,
2769 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2770 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2771 const GLdouble
* points
)
2773 GET_CURRENT_CONTEXT(ctx
);
2775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2776 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2778 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2779 vstride
, vorder
, points
);
2781 n
[2].f
= (GLfloat
) u1
;
2782 n
[3].f
= (GLfloat
) u2
;
2783 n
[4].f
= (GLfloat
) v1
;
2784 n
[5].f
= (GLfloat
) v2
;
2785 /* XXX verify these strides are correct */
2786 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2787 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2790 save_pointer(&n
[10], pnts
);
2792 if (ctx
->ExecuteFlag
) {
2793 CALL_Map2d(ctx
->Exec
, (target
,
2794 u1
, u2
, ustride
, uorder
,
2795 v1
, v2
, vstride
, vorder
, points
));
2800 static void GLAPIENTRY
2801 save_Map2f(GLenum target
,
2802 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2803 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2804 const GLfloat
* points
)
2806 GET_CURRENT_CONTEXT(ctx
);
2808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2809 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2811 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2812 vstride
, vorder
, points
);
2818 /* XXX verify these strides are correct */
2819 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2820 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2823 save_pointer(&n
[10], pnts
);
2825 if (ctx
->ExecuteFlag
) {
2826 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2827 v1
, v2
, vstride
, vorder
, points
));
2832 static void GLAPIENTRY
2833 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2835 GET_CURRENT_CONTEXT(ctx
);
2837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2838 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2844 if (ctx
->ExecuteFlag
) {
2845 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2850 static void GLAPIENTRY
2851 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2853 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2857 static void GLAPIENTRY
2858 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2859 GLint vn
, GLfloat v1
, GLfloat v2
)
2861 GET_CURRENT_CONTEXT(ctx
);
2863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2864 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2873 if (ctx
->ExecuteFlag
) {
2874 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2880 static void GLAPIENTRY
2881 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2882 GLint vn
, GLdouble v1
, GLdouble v2
)
2884 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2885 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2889 static void GLAPIENTRY
2890 save_MatrixMode(GLenum mode
)
2892 GET_CURRENT_CONTEXT(ctx
);
2894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2895 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2899 if (ctx
->ExecuteFlag
) {
2900 CALL_MatrixMode(ctx
->Exec
, (mode
));
2905 static void GLAPIENTRY
2906 save_MultMatrixf(const GLfloat
* m
)
2908 GET_CURRENT_CONTEXT(ctx
);
2910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2911 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2914 for (i
= 0; i
< 16; i
++) {
2918 if (ctx
->ExecuteFlag
) {
2919 CALL_MultMatrixf(ctx
->Exec
, (m
));
2924 static void GLAPIENTRY
2925 save_MultMatrixd(const GLdouble
* m
)
2929 for (i
= 0; i
< 16; i
++) {
2930 f
[i
] = (GLfloat
) m
[i
];
2932 save_MultMatrixf(f
);
2936 static void GLAPIENTRY
2937 save_NewList(GLuint name
, GLenum mode
)
2939 GET_CURRENT_CONTEXT(ctx
);
2940 /* It's an error to call this function while building a display list */
2941 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2948 static void GLAPIENTRY
2949 save_Ortho(GLdouble left
, GLdouble right
,
2950 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2952 GET_CURRENT_CONTEXT(ctx
);
2954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2955 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2957 n
[1].f
= (GLfloat
) left
;
2958 n
[2].f
= (GLfloat
) right
;
2959 n
[3].f
= (GLfloat
) bottom
;
2960 n
[4].f
= (GLfloat
) top
;
2961 n
[5].f
= (GLfloat
) nearval
;
2962 n
[6].f
= (GLfloat
) farval
;
2964 if (ctx
->ExecuteFlag
) {
2965 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2970 static void GLAPIENTRY
2971 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2973 GET_CURRENT_CONTEXT(ctx
);
2975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2976 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2980 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2982 if (ctx
->ExecuteFlag
) {
2983 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2988 static void GLAPIENTRY
2989 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2991 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2993 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2994 for (i
= 0; i
< mapsize
; i
++) {
2995 fvalues
[i
] = (GLfloat
) values
[i
];
2999 for (i
= 0; i
< mapsize
; i
++) {
3000 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3003 save_PixelMapfv(map
, mapsize
, fvalues
);
3007 static void GLAPIENTRY
3008 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3010 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3012 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3013 for (i
= 0; i
< mapsize
; i
++) {
3014 fvalues
[i
] = (GLfloat
) values
[i
];
3018 for (i
= 0; i
< mapsize
; i
++) {
3019 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3022 save_PixelMapfv(map
, mapsize
, fvalues
);
3026 static void GLAPIENTRY
3027 save_PixelTransferf(GLenum pname
, GLfloat param
)
3029 GET_CURRENT_CONTEXT(ctx
);
3031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3032 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3037 if (ctx
->ExecuteFlag
) {
3038 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3043 static void GLAPIENTRY
3044 save_PixelTransferi(GLenum pname
, GLint param
)
3046 save_PixelTransferf(pname
, (GLfloat
) param
);
3050 static void GLAPIENTRY
3051 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3053 GET_CURRENT_CONTEXT(ctx
);
3055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3056 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3061 if (ctx
->ExecuteFlag
) {
3062 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3067 static void GLAPIENTRY
3068 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3070 GET_CURRENT_CONTEXT(ctx
);
3072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3073 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3080 if (ctx
->ExecuteFlag
) {
3081 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3086 static void GLAPIENTRY
3087 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3091 parray
[1] = parray
[2] = 0.0F
;
3092 save_PointParameterfvEXT(pname
, parray
);
3095 static void GLAPIENTRY
3096 save_PointParameteriNV(GLenum pname
, GLint param
)
3099 parray
[0] = (GLfloat
) param
;
3100 parray
[1] = parray
[2] = 0.0F
;
3101 save_PointParameterfvEXT(pname
, parray
);
3104 static void GLAPIENTRY
3105 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3108 parray
[0] = (GLfloat
) param
[0];
3109 parray
[1] = parray
[2] = 0.0F
;
3110 save_PointParameterfvEXT(pname
, parray
);
3114 static void GLAPIENTRY
3115 save_PointSize(GLfloat size
)
3117 GET_CURRENT_CONTEXT(ctx
);
3119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3120 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3124 if (ctx
->ExecuteFlag
) {
3125 CALL_PointSize(ctx
->Exec
, (size
));
3130 static void GLAPIENTRY
3131 save_PolygonMode(GLenum face
, GLenum mode
)
3133 GET_CURRENT_CONTEXT(ctx
);
3135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3136 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3141 if (ctx
->ExecuteFlag
) {
3142 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3147 static void GLAPIENTRY
3148 save_PolygonStipple(const GLubyte
* pattern
)
3150 GET_CURRENT_CONTEXT(ctx
);
3153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3155 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3158 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3159 pattern
, &ctx
->Unpack
));
3161 if (ctx
->ExecuteFlag
) {
3162 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3167 static void GLAPIENTRY
3168 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3170 GET_CURRENT_CONTEXT(ctx
);
3172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3173 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3178 if (ctx
->ExecuteFlag
) {
3179 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3184 static void GLAPIENTRY
3185 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3187 GET_CURRENT_CONTEXT(ctx
);
3188 /* XXX mult by DepthMaxF here??? */
3189 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3192 static void GLAPIENTRY
3193 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3195 GET_CURRENT_CONTEXT(ctx
);
3197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3198 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3204 if (ctx
->ExecuteFlag
) {
3205 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3209 static void GLAPIENTRY
3210 save_PopAttrib(void)
3212 GET_CURRENT_CONTEXT(ctx
);
3213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3214 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3215 if (ctx
->ExecuteFlag
) {
3216 CALL_PopAttrib(ctx
->Exec
, ());
3221 static void GLAPIENTRY
3222 save_PopMatrix(void)
3224 GET_CURRENT_CONTEXT(ctx
);
3225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3226 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3227 if (ctx
->ExecuteFlag
) {
3228 CALL_PopMatrix(ctx
->Exec
, ());
3233 static void GLAPIENTRY
3236 GET_CURRENT_CONTEXT(ctx
);
3237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3238 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3239 if (ctx
->ExecuteFlag
) {
3240 CALL_PopName(ctx
->Exec
, ());
3245 static void GLAPIENTRY
3246 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3247 const GLclampf
* priorities
)
3249 GET_CURRENT_CONTEXT(ctx
);
3251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3253 for (i
= 0; i
< num
; i
++) {
3255 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3257 n
[1].ui
= textures
[i
];
3258 n
[2].f
= priorities
[i
];
3261 if (ctx
->ExecuteFlag
) {
3262 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3267 static void GLAPIENTRY
3268 save_PushAttrib(GLbitfield mask
)
3270 GET_CURRENT_CONTEXT(ctx
);
3272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3273 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3277 if (ctx
->ExecuteFlag
) {
3278 CALL_PushAttrib(ctx
->Exec
, (mask
));
3283 static void GLAPIENTRY
3284 save_PushMatrix(void)
3286 GET_CURRENT_CONTEXT(ctx
);
3287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3288 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3289 if (ctx
->ExecuteFlag
) {
3290 CALL_PushMatrix(ctx
->Exec
, ());
3295 static void GLAPIENTRY
3296 save_PushName(GLuint name
)
3298 GET_CURRENT_CONTEXT(ctx
);
3300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3301 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3305 if (ctx
->ExecuteFlag
) {
3306 CALL_PushName(ctx
->Exec
, (name
));
3311 static void GLAPIENTRY
3312 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3314 GET_CURRENT_CONTEXT(ctx
);
3316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3317 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3324 if (ctx
->ExecuteFlag
) {
3325 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3329 static void GLAPIENTRY
3330 save_RasterPos2d(GLdouble x
, GLdouble y
)
3332 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3335 static void GLAPIENTRY
3336 save_RasterPos2f(GLfloat x
, GLfloat y
)
3338 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3341 static void GLAPIENTRY
3342 save_RasterPos2i(GLint x
, GLint y
)
3344 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3347 static void GLAPIENTRY
3348 save_RasterPos2s(GLshort x
, GLshort y
)
3350 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3353 static void GLAPIENTRY
3354 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3356 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3359 static void GLAPIENTRY
3360 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3362 save_RasterPos4f(x
, y
, z
, 1.0F
);
3365 static void GLAPIENTRY
3366 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3368 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3371 static void GLAPIENTRY
3372 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3374 save_RasterPos4f(x
, y
, z
, 1.0F
);
3377 static void GLAPIENTRY
3378 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3380 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3383 static void GLAPIENTRY
3384 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3386 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3389 static void GLAPIENTRY
3390 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3392 save_RasterPos4f(x
, y
, z
, w
);
3395 static void GLAPIENTRY
3396 save_RasterPos2dv(const GLdouble
* v
)
3398 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3401 static void GLAPIENTRY
3402 save_RasterPos2fv(const GLfloat
* v
)
3404 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3407 static void GLAPIENTRY
3408 save_RasterPos2iv(const GLint
* v
)
3410 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3413 static void GLAPIENTRY
3414 save_RasterPos2sv(const GLshort
* v
)
3416 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3419 static void GLAPIENTRY
3420 save_RasterPos3dv(const GLdouble
* v
)
3422 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3425 static void GLAPIENTRY
3426 save_RasterPos3fv(const GLfloat
* v
)
3428 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3431 static void GLAPIENTRY
3432 save_RasterPos3iv(const GLint
* v
)
3434 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3437 static void GLAPIENTRY
3438 save_RasterPos3sv(const GLshort
* v
)
3440 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3443 static void GLAPIENTRY
3444 save_RasterPos4dv(const GLdouble
* v
)
3446 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3447 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3450 static void GLAPIENTRY
3451 save_RasterPos4fv(const GLfloat
* v
)
3453 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3456 static void GLAPIENTRY
3457 save_RasterPos4iv(const GLint
* v
)
3459 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3460 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3463 static void GLAPIENTRY
3464 save_RasterPos4sv(const GLshort
* v
)
3466 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3470 static void GLAPIENTRY
3471 save_PassThrough(GLfloat token
)
3473 GET_CURRENT_CONTEXT(ctx
);
3475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3476 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3480 if (ctx
->ExecuteFlag
) {
3481 CALL_PassThrough(ctx
->Exec
, (token
));
3486 static void GLAPIENTRY
3487 save_ReadBuffer(GLenum mode
)
3489 GET_CURRENT_CONTEXT(ctx
);
3491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3492 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3496 if (ctx
->ExecuteFlag
) {
3497 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3502 static void GLAPIENTRY
3503 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3505 GET_CURRENT_CONTEXT(ctx
);
3507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3508 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3515 if (ctx
->ExecuteFlag
) {
3516 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3521 static void GLAPIENTRY
3522 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3524 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3528 static void GLAPIENTRY
3529 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3531 GET_CURRENT_CONTEXT(ctx
);
3533 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3534 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3540 if (ctx
->ExecuteFlag
) {
3541 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3546 static void GLAPIENTRY
3547 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3549 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3553 static void GLAPIENTRY
3554 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3556 GET_CURRENT_CONTEXT(ctx
);
3558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3559 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3566 if (ctx
->ExecuteFlag
) {
3567 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3572 static void GLAPIENTRY
3573 save_ShadeModel(GLenum mode
)
3575 GET_CURRENT_CONTEXT(ctx
);
3577 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3579 if (ctx
->ExecuteFlag
) {
3580 CALL_ShadeModel(ctx
->Exec
, (mode
));
3583 /* Don't compile this call if it's a no-op.
3584 * By avoiding this state change we have a better chance of
3585 * coalescing subsequent drawing commands into one batch.
3587 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3590 SAVE_FLUSH_VERTICES(ctx
);
3592 ctx
->ListState
.Current
.ShadeModel
= mode
;
3594 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3601 static void GLAPIENTRY
3602 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3604 GET_CURRENT_CONTEXT(ctx
);
3606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3607 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3613 if (ctx
->ExecuteFlag
) {
3614 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3619 static void GLAPIENTRY
3620 save_StencilMask(GLuint mask
)
3622 GET_CURRENT_CONTEXT(ctx
);
3624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3625 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3629 if (ctx
->ExecuteFlag
) {
3630 CALL_StencilMask(ctx
->Exec
, (mask
));
3635 static void GLAPIENTRY
3636 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3638 GET_CURRENT_CONTEXT(ctx
);
3640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3641 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3647 if (ctx
->ExecuteFlag
) {
3648 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3653 static void GLAPIENTRY
3654 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3656 GET_CURRENT_CONTEXT(ctx
);
3658 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3659 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3666 if (ctx
->ExecuteFlag
) {
3667 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3672 static void GLAPIENTRY
3673 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3676 GET_CURRENT_CONTEXT(ctx
);
3678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3680 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3688 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3695 if (ctx
->ExecuteFlag
) {
3696 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3697 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3702 static void GLAPIENTRY
3703 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3705 GET_CURRENT_CONTEXT(ctx
);
3707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3708 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3713 if (ctx
->ExecuteFlag
) {
3714 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3719 static void GLAPIENTRY
3720 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3722 GET_CURRENT_CONTEXT(ctx
);
3724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3725 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3732 if (ctx
->ExecuteFlag
) {
3733 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3738 static void GLAPIENTRY
3739 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3741 GET_CURRENT_CONTEXT(ctx
);
3743 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3744 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3748 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3756 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3759 if (ctx
->ExecuteFlag
) {
3760 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3765 static void GLAPIENTRY
3766 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3769 parray
[0] = (GLfloat
) param
;
3770 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3771 save_TexEnvfv(target
, pname
, parray
);
3775 static void GLAPIENTRY
3776 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3779 p
[0] = (GLfloat
) param
;
3780 p
[1] = p
[2] = p
[3] = 0.0F
;
3781 save_TexEnvfv(target
, pname
, p
);
3785 static void GLAPIENTRY
3786 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3789 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3790 p
[0] = INT_TO_FLOAT(param
[0]);
3791 p
[1] = INT_TO_FLOAT(param
[1]);
3792 p
[2] = INT_TO_FLOAT(param
[2]);
3793 p
[3] = INT_TO_FLOAT(param
[3]);
3796 p
[0] = (GLfloat
) param
[0];
3797 p
[1] = p
[2] = p
[3] = 0.0F
;
3799 save_TexEnvfv(target
, pname
, p
);
3803 static void GLAPIENTRY
3804 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3806 GET_CURRENT_CONTEXT(ctx
);
3808 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3809 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3818 if (ctx
->ExecuteFlag
) {
3819 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3824 static void GLAPIENTRY
3825 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3828 p
[0] = (GLfloat
) params
[0];
3829 p
[1] = (GLfloat
) params
[1];
3830 p
[2] = (GLfloat
) params
[2];
3831 p
[3] = (GLfloat
) params
[3];
3832 save_TexGenfv(coord
, pname
, p
);
3836 static void GLAPIENTRY
3837 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3840 parray
[0] = (GLfloat
) param
;
3841 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3842 save_TexGenfv(coord
, pname
, parray
);
3846 static void GLAPIENTRY
3847 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3850 p
[0] = (GLfloat
) params
[0];
3851 p
[1] = (GLfloat
) params
[1];
3852 p
[2] = (GLfloat
) params
[2];
3853 p
[3] = (GLfloat
) params
[3];
3854 save_TexGenfv(coord
, pname
, p
);
3858 static void GLAPIENTRY
3859 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3863 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3864 save_TexGenfv(coord
, pname
, parray
);
3868 static void GLAPIENTRY
3869 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3873 parray
[1] = parray
[2] = parray
[3] = 0;
3874 save_TexGeniv(coord
, pname
, parray
);
3878 static void GLAPIENTRY
3879 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3881 GET_CURRENT_CONTEXT(ctx
);
3883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3884 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3893 if (ctx
->ExecuteFlag
) {
3894 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3899 static void GLAPIENTRY
3900 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3904 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3905 save_TexParameterfv(target
, pname
, parray
);
3909 static void GLAPIENTRY
3910 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3913 fparam
[0] = (GLfloat
) param
;
3914 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3915 save_TexParameterfv(target
, pname
, fparam
);
3919 static void GLAPIENTRY
3920 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3923 fparam
[0] = (GLfloat
) params
[0];
3924 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3925 save_TexParameterfv(target
, pname
, fparam
);
3929 static void GLAPIENTRY
3930 save_TexImage1D(GLenum target
,
3931 GLint level
, GLint components
,
3932 GLsizei width
, GLint border
,
3933 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3935 GET_CURRENT_CONTEXT(ctx
);
3936 if (target
== GL_PROXY_TEXTURE_1D
) {
3937 /* don't compile, execute immediately */
3938 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3939 border
, format
, type
, pixels
));
3943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3944 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3948 n
[3].i
= components
;
3949 n
[4].i
= (GLint
) width
;
3954 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3955 pixels
, &ctx
->Unpack
));
3957 if (ctx
->ExecuteFlag
) {
3958 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3959 border
, format
, type
, pixels
));
3965 static void GLAPIENTRY
3966 save_TexImage2D(GLenum target
,
3967 GLint level
, GLint components
,
3968 GLsizei width
, GLsizei height
, GLint border
,
3969 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3971 GET_CURRENT_CONTEXT(ctx
);
3972 if (target
== GL_PROXY_TEXTURE_2D
) {
3973 /* don't compile, execute immediately */
3974 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3975 height
, border
, format
, type
, pixels
));
3979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3980 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3984 n
[3].i
= components
;
3985 n
[4].i
= (GLint
) width
;
3986 n
[5].i
= (GLint
) height
;
3991 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3992 pixels
, &ctx
->Unpack
));
3994 if (ctx
->ExecuteFlag
) {
3995 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3996 height
, border
, format
, type
, pixels
));
4002 static void GLAPIENTRY
4003 save_TexImage3D(GLenum target
,
4004 GLint level
, GLint internalFormat
,
4005 GLsizei width
, GLsizei height
, GLsizei depth
,
4007 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4009 GET_CURRENT_CONTEXT(ctx
);
4010 if (target
== GL_PROXY_TEXTURE_3D
) {
4011 /* don't compile, execute immediately */
4012 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4013 height
, depth
, border
, format
, type
,
4018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4019 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4023 n
[3].i
= (GLint
) internalFormat
;
4024 n
[4].i
= (GLint
) width
;
4025 n
[5].i
= (GLint
) height
;
4026 n
[6].i
= (GLint
) depth
;
4030 save_pointer(&n
[10],
4031 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4032 pixels
, &ctx
->Unpack
));
4034 if (ctx
->ExecuteFlag
) {
4035 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4036 height
, depth
, border
, format
, type
,
4043 static void GLAPIENTRY
4044 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4045 GLsizei width
, GLenum format
, GLenum type
,
4046 const GLvoid
* pixels
)
4048 GET_CURRENT_CONTEXT(ctx
);
4051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4053 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4058 n
[4].i
= (GLint
) width
;
4062 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4063 pixels
, &ctx
->Unpack
));
4065 if (ctx
->ExecuteFlag
) {
4066 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4067 format
, type
, pixels
));
4072 static void GLAPIENTRY
4073 save_TexSubImage2D(GLenum target
, GLint level
,
4074 GLint xoffset
, GLint yoffset
,
4075 GLsizei width
, GLsizei height
,
4076 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4078 GET_CURRENT_CONTEXT(ctx
);
4081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4083 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4089 n
[5].i
= (GLint
) width
;
4090 n
[6].i
= (GLint
) height
;
4094 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4095 pixels
, &ctx
->Unpack
));
4097 if (ctx
->ExecuteFlag
) {
4098 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4099 width
, height
, format
, type
, pixels
));
4104 static void GLAPIENTRY
4105 save_TexSubImage3D(GLenum target
, GLint level
,
4106 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4107 GLsizei width
, GLsizei height
, GLsizei depth
,
4108 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4110 GET_CURRENT_CONTEXT(ctx
);
4113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4115 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4122 n
[6].i
= (GLint
) width
;
4123 n
[7].i
= (GLint
) height
;
4124 n
[8].i
= (GLint
) depth
;
4127 save_pointer(&n
[11],
4128 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4129 pixels
, &ctx
->Unpack
));
4131 if (ctx
->ExecuteFlag
) {
4132 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4133 xoffset
, yoffset
, zoffset
,
4134 width
, height
, depth
, format
, type
,
4140 static void GLAPIENTRY
4141 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4143 GET_CURRENT_CONTEXT(ctx
);
4145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4146 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4152 if (ctx
->ExecuteFlag
) {
4153 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4158 static void GLAPIENTRY
4159 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4161 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4166 static void GLAPIENTRY
4167 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4169 GET_CURRENT_CONTEXT(ctx
);
4171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4172 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4176 n
[3].i
= (GLint
) width
;
4177 n
[4].i
= (GLint
) height
;
4179 if (ctx
->ExecuteFlag
) {
4180 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4185 static void GLAPIENTRY
4186 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4188 GET_CURRENT_CONTEXT(ctx
);
4190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4191 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4198 if (ctx
->ExecuteFlag
) {
4199 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4203 static void GLAPIENTRY
4204 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4206 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4209 static void GLAPIENTRY
4210 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4212 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4215 static void GLAPIENTRY
4216 save_WindowPos2iMESA(GLint x
, GLint y
)
4218 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4221 static void GLAPIENTRY
4222 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4224 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4227 static void GLAPIENTRY
4228 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4230 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4233 static void GLAPIENTRY
4234 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4236 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4239 static void GLAPIENTRY
4240 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4242 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4245 static void GLAPIENTRY
4246 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4248 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4251 static void GLAPIENTRY
4252 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4254 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4257 static void GLAPIENTRY
4258 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4260 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4263 static void GLAPIENTRY
4264 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4266 save_WindowPos4fMESA(x
, y
, z
, w
);
4269 static void GLAPIENTRY
4270 save_WindowPos2dvMESA(const GLdouble
* v
)
4272 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4275 static void GLAPIENTRY
4276 save_WindowPos2fvMESA(const GLfloat
* v
)
4278 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4281 static void GLAPIENTRY
4282 save_WindowPos2ivMESA(const GLint
* v
)
4284 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4287 static void GLAPIENTRY
4288 save_WindowPos2svMESA(const GLshort
* v
)
4290 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4293 static void GLAPIENTRY
4294 save_WindowPos3dvMESA(const GLdouble
* v
)
4296 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4299 static void GLAPIENTRY
4300 save_WindowPos3fvMESA(const GLfloat
* v
)
4302 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4305 static void GLAPIENTRY
4306 save_WindowPos3ivMESA(const GLint
* v
)
4308 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4311 static void GLAPIENTRY
4312 save_WindowPos3svMESA(const GLshort
* v
)
4314 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4317 static void GLAPIENTRY
4318 save_WindowPos4dvMESA(const GLdouble
* v
)
4320 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4321 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4324 static void GLAPIENTRY
4325 save_WindowPos4fvMESA(const GLfloat
* v
)
4327 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4330 static void GLAPIENTRY
4331 save_WindowPos4ivMESA(const GLint
* v
)
4333 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4334 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4337 static void GLAPIENTRY
4338 save_WindowPos4svMESA(const GLshort
* v
)
4340 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4345 /* GL_ARB_multitexture */
4346 static void GLAPIENTRY
4347 save_ActiveTextureARB(GLenum target
)
4349 GET_CURRENT_CONTEXT(ctx
);
4351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4352 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4356 if (ctx
->ExecuteFlag
) {
4357 CALL_ActiveTexture(ctx
->Exec
, (target
));
4362 /* GL_ARB_transpose_matrix */
4364 static void GLAPIENTRY
4365 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4368 _math_transposefd(tm
, m
);
4369 save_LoadMatrixf(tm
);
4373 static void GLAPIENTRY
4374 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4377 _math_transposef(tm
, m
);
4378 save_LoadMatrixf(tm
);
4382 static void GLAPIENTRY
4383 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4386 _math_transposefd(tm
, m
);
4387 save_MultMatrixf(tm
);
4391 static void GLAPIENTRY
4392 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4395 _math_transposef(tm
, m
);
4396 save_MultMatrixf(tm
);
4399 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4401 GET_CURRENT_CONTEXT(ctx
);
4407 image
= malloc(size
);
4409 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4412 memcpy(image
, data
, size
);
4418 /* GL_ARB_texture_compression */
4419 static void GLAPIENTRY
4420 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4421 GLenum internalFormat
, GLsizei width
,
4422 GLint border
, GLsizei imageSize
,
4423 const GLvoid
* data
)
4425 GET_CURRENT_CONTEXT(ctx
);
4426 if (target
== GL_PROXY_TEXTURE_1D
) {
4427 /* don't compile, execute immediately */
4428 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4429 width
, border
, imageSize
,
4434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4436 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4437 6 + POINTER_DWORDS
);
4441 n
[3].e
= internalFormat
;
4442 n
[4].i
= (GLint
) width
;
4446 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4448 if (ctx
->ExecuteFlag
) {
4449 CALL_CompressedTexImage1D(ctx
->Exec
,
4450 (target
, level
, internalFormat
, width
,
4451 border
, imageSize
, data
));
4457 static void GLAPIENTRY
4458 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4459 GLenum internalFormat
, GLsizei width
,
4460 GLsizei height
, GLint border
, GLsizei imageSize
,
4461 const GLvoid
* data
)
4463 GET_CURRENT_CONTEXT(ctx
);
4464 if (target
== GL_PROXY_TEXTURE_2D
) {
4465 /* don't compile, execute immediately */
4466 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4467 width
, height
, border
,
4472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4474 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4475 7 + POINTER_DWORDS
);
4479 n
[3].e
= internalFormat
;
4480 n
[4].i
= (GLint
) width
;
4481 n
[5].i
= (GLint
) height
;
4485 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4487 if (ctx
->ExecuteFlag
) {
4488 CALL_CompressedTexImage2D(ctx
->Exec
,
4489 (target
, level
, internalFormat
, width
,
4490 height
, border
, imageSize
, data
));
4496 static void GLAPIENTRY
4497 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4498 GLenum internalFormat
, GLsizei width
,
4499 GLsizei height
, GLsizei depth
, GLint border
,
4500 GLsizei imageSize
, const GLvoid
* data
)
4502 GET_CURRENT_CONTEXT(ctx
);
4503 if (target
== GL_PROXY_TEXTURE_3D
) {
4504 /* don't compile, execute immediately */
4505 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4506 width
, height
, depth
, border
,
4511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4513 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4514 8 + POINTER_DWORDS
);
4518 n
[3].e
= internalFormat
;
4519 n
[4].i
= (GLint
) width
;
4520 n
[5].i
= (GLint
) height
;
4521 n
[6].i
= (GLint
) depth
;
4525 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4527 if (ctx
->ExecuteFlag
) {
4528 CALL_CompressedTexImage3D(ctx
->Exec
,
4529 (target
, level
, internalFormat
, width
,
4530 height
, depth
, border
, imageSize
,
4537 static void GLAPIENTRY
4538 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4539 GLsizei width
, GLenum format
,
4540 GLsizei imageSize
, const GLvoid
* data
)
4543 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4546 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4547 6 + POINTER_DWORDS
);
4552 n
[4].i
= (GLint
) width
;
4556 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4558 if (ctx
->ExecuteFlag
) {
4559 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4560 width
, format
, imageSize
,
4566 static void GLAPIENTRY
4567 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4568 GLint yoffset
, GLsizei width
, GLsizei height
,
4569 GLenum format
, GLsizei imageSize
,
4570 const GLvoid
* data
)
4573 GET_CURRENT_CONTEXT(ctx
);
4574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4576 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4577 8 + POINTER_DWORDS
);
4583 n
[5].i
= (GLint
) width
;
4584 n
[6].i
= (GLint
) height
;
4588 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4590 if (ctx
->ExecuteFlag
) {
4591 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4592 (target
, level
, xoffset
, yoffset
, width
,
4593 height
, format
, imageSize
, data
));
4598 static void GLAPIENTRY
4599 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4600 GLint yoffset
, GLint zoffset
, GLsizei width
,
4601 GLsizei height
, GLsizei depth
, GLenum format
,
4602 GLsizei imageSize
, const GLvoid
* data
)
4605 GET_CURRENT_CONTEXT(ctx
);
4606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4608 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4609 10 + POINTER_DWORDS
);
4616 n
[6].i
= (GLint
) width
;
4617 n
[7].i
= (GLint
) height
;
4618 n
[8].i
= (GLint
) depth
;
4620 n
[10].i
= imageSize
;
4621 save_pointer(&n
[11],
4622 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4624 if (ctx
->ExecuteFlag
) {
4625 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4626 (target
, level
, xoffset
, yoffset
,
4627 zoffset
, width
, height
, depth
, format
,
4633 /* GL_ARB_multisample */
4634 static void GLAPIENTRY
4635 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4637 GET_CURRENT_CONTEXT(ctx
);
4639 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4640 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4645 if (ctx
->ExecuteFlag
) {
4646 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4652 * GL_NV_fragment_program
4654 static void GLAPIENTRY
4655 save_BindProgramNV(GLenum target
, GLuint id
)
4657 GET_CURRENT_CONTEXT(ctx
);
4659 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4660 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4665 if (ctx
->ExecuteFlag
) {
4666 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4670 static void GLAPIENTRY
4671 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4672 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4674 GET_CURRENT_CONTEXT(ctx
);
4676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4677 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4686 if (ctx
->ExecuteFlag
) {
4687 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4692 static void GLAPIENTRY
4693 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4694 const GLfloat
*params
)
4696 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4697 params
[2], params
[3]);
4701 static void GLAPIENTRY
4702 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4703 const GLfloat
* params
)
4705 GET_CURRENT_CONTEXT(ctx
);
4707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4711 const GLfloat
* p
= params
;
4713 for (i
= 0 ; i
< count
; i
++) {
4714 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4727 if (ctx
->ExecuteFlag
) {
4728 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4733 static void GLAPIENTRY
4734 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4735 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4737 save_ProgramEnvParameter4fARB(target
, index
,
4739 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4743 static void GLAPIENTRY
4744 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4745 const GLdouble
*params
)
4747 save_ProgramEnvParameter4fARB(target
, index
,
4748 (GLfloat
) params
[0],
4749 (GLfloat
) params
[1],
4750 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4754 static void GLAPIENTRY
4755 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4756 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4758 GET_CURRENT_CONTEXT(ctx
);
4760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4761 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4770 if (ctx
->ExecuteFlag
) {
4771 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4776 static void GLAPIENTRY
4777 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4778 const GLfloat
*params
)
4780 GET_CURRENT_CONTEXT(ctx
);
4782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4783 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4792 if (ctx
->ExecuteFlag
) {
4793 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4798 static void GLAPIENTRY
4799 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4800 const GLfloat
*params
)
4802 GET_CURRENT_CONTEXT(ctx
);
4804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4808 const GLfloat
* p
= params
;
4810 for (i
= 0 ; i
< count
; i
++) {
4811 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4824 if (ctx
->ExecuteFlag
) {
4825 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4830 static void GLAPIENTRY
4831 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4832 GLdouble x
, GLdouble y
,
4833 GLdouble z
, GLdouble w
)
4835 GET_CURRENT_CONTEXT(ctx
);
4837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4838 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4842 n
[3].f
= (GLfloat
) x
;
4843 n
[4].f
= (GLfloat
) y
;
4844 n
[5].f
= (GLfloat
) z
;
4845 n
[6].f
= (GLfloat
) w
;
4847 if (ctx
->ExecuteFlag
) {
4848 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4853 static void GLAPIENTRY
4854 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4855 const GLdouble
*params
)
4857 GET_CURRENT_CONTEXT(ctx
);
4859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4860 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4864 n
[3].f
= (GLfloat
) params
[0];
4865 n
[4].f
= (GLfloat
) params
[1];
4866 n
[5].f
= (GLfloat
) params
[2];
4867 n
[6].f
= (GLfloat
) params
[3];
4869 if (ctx
->ExecuteFlag
) {
4870 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4875 /* GL_EXT_stencil_two_side */
4876 static void GLAPIENTRY
4877 save_ActiveStencilFaceEXT(GLenum face
)
4879 GET_CURRENT_CONTEXT(ctx
);
4881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4882 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4886 if (ctx
->ExecuteFlag
) {
4887 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4892 /* GL_EXT_depth_bounds_test */
4893 static void GLAPIENTRY
4894 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4896 GET_CURRENT_CONTEXT(ctx
);
4898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4899 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4901 n
[1].f
= (GLfloat
) zmin
;
4902 n
[2].f
= (GLfloat
) zmax
;
4904 if (ctx
->ExecuteFlag
) {
4905 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4911 static void GLAPIENTRY
4912 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4913 const GLvoid
* string
)
4915 GET_CURRENT_CONTEXT(ctx
);
4918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4920 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4922 GLubyte
*programCopy
= malloc(len
);
4924 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4927 memcpy(programCopy
, string
, len
);
4931 save_pointer(&n
[4], programCopy
);
4933 if (ctx
->ExecuteFlag
) {
4934 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4939 static void GLAPIENTRY
4940 save_BeginQueryARB(GLenum target
, GLuint id
)
4942 GET_CURRENT_CONTEXT(ctx
);
4944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4945 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4950 if (ctx
->ExecuteFlag
) {
4951 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4955 static void GLAPIENTRY
4956 save_EndQueryARB(GLenum target
)
4958 GET_CURRENT_CONTEXT(ctx
);
4960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4961 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4965 if (ctx
->ExecuteFlag
) {
4966 CALL_EndQuery(ctx
->Exec
, (target
));
4970 static void GLAPIENTRY
4971 save_QueryCounter(GLuint id
, GLenum target
)
4973 GET_CURRENT_CONTEXT(ctx
);
4975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4976 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4981 if (ctx
->ExecuteFlag
) {
4982 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4986 static void GLAPIENTRY
4987 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4989 GET_CURRENT_CONTEXT(ctx
);
4991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4992 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4998 if (ctx
->ExecuteFlag
) {
4999 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5003 static void GLAPIENTRY
5004 save_EndQueryIndexed(GLenum target
, GLuint index
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5009 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5014 if (ctx
->ExecuteFlag
) {
5015 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5020 static void GLAPIENTRY
5021 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5023 GET_CURRENT_CONTEXT(ctx
);
5025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5026 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5030 if (count
> MAX_DRAW_BUFFERS
)
5031 count
= MAX_DRAW_BUFFERS
;
5032 for (i
= 0; i
< count
; i
++) {
5033 n
[2 + i
].e
= buffers
[i
];
5036 if (ctx
->ExecuteFlag
) {
5037 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5041 static void GLAPIENTRY
5042 save_BindFragmentShaderATI(GLuint id
)
5044 GET_CURRENT_CONTEXT(ctx
);
5047 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5051 if (ctx
->ExecuteFlag
) {
5052 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5056 static void GLAPIENTRY
5057 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5059 GET_CURRENT_CONTEXT(ctx
);
5062 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5070 if (ctx
->ExecuteFlag
) {
5071 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5075 static void GLAPIENTRY
5076 save_Attr1fNV(GLenum attr
, GLfloat x
)
5078 GET_CURRENT_CONTEXT(ctx
);
5080 SAVE_FLUSH_VERTICES(ctx
);
5081 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5087 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5088 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5089 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5091 if (ctx
->ExecuteFlag
) {
5092 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5096 static void GLAPIENTRY
5097 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5099 GET_CURRENT_CONTEXT(ctx
);
5101 SAVE_FLUSH_VERTICES(ctx
);
5102 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5109 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5110 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5111 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5113 if (ctx
->ExecuteFlag
) {
5114 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5118 static void GLAPIENTRY
5119 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5121 GET_CURRENT_CONTEXT(ctx
);
5123 SAVE_FLUSH_VERTICES(ctx
);
5124 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5132 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5133 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5134 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5136 if (ctx
->ExecuteFlag
) {
5137 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5141 static void GLAPIENTRY
5142 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5144 GET_CURRENT_CONTEXT(ctx
);
5146 SAVE_FLUSH_VERTICES(ctx
);
5147 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5156 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5157 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5158 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5160 if (ctx
->ExecuteFlag
) {
5161 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5166 static void GLAPIENTRY
5167 save_Attr1fARB(GLenum attr
, GLfloat x
)
5169 GET_CURRENT_CONTEXT(ctx
);
5171 SAVE_FLUSH_VERTICES(ctx
);
5172 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5178 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5179 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5180 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5182 if (ctx
->ExecuteFlag
) {
5183 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5187 static void GLAPIENTRY
5188 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5190 GET_CURRENT_CONTEXT(ctx
);
5192 SAVE_FLUSH_VERTICES(ctx
);
5193 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5200 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5201 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5202 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5204 if (ctx
->ExecuteFlag
) {
5205 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5209 static void GLAPIENTRY
5210 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5212 GET_CURRENT_CONTEXT(ctx
);
5214 SAVE_FLUSH_VERTICES(ctx
);
5215 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5223 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5224 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5225 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5227 if (ctx
->ExecuteFlag
) {
5228 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5232 static void GLAPIENTRY
5233 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5235 GET_CURRENT_CONTEXT(ctx
);
5237 SAVE_FLUSH_VERTICES(ctx
);
5238 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5247 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5248 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5249 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5251 if (ctx
->ExecuteFlag
) {
5252 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5257 static void GLAPIENTRY
5258 save_EvalCoord1f(GLfloat x
)
5260 GET_CURRENT_CONTEXT(ctx
);
5262 SAVE_FLUSH_VERTICES(ctx
);
5263 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5267 if (ctx
->ExecuteFlag
) {
5268 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5272 static void GLAPIENTRY
5273 save_EvalCoord1fv(const GLfloat
* v
)
5275 save_EvalCoord1f(v
[0]);
5278 static void GLAPIENTRY
5279 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5281 GET_CURRENT_CONTEXT(ctx
);
5283 SAVE_FLUSH_VERTICES(ctx
);
5284 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5289 if (ctx
->ExecuteFlag
) {
5290 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5294 static void GLAPIENTRY
5295 save_EvalCoord2fv(const GLfloat
* v
)
5297 save_EvalCoord2f(v
[0], v
[1]);
5301 static void GLAPIENTRY
5302 save_EvalPoint1(GLint x
)
5304 GET_CURRENT_CONTEXT(ctx
);
5306 SAVE_FLUSH_VERTICES(ctx
);
5307 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5311 if (ctx
->ExecuteFlag
) {
5312 CALL_EvalPoint1(ctx
->Exec
, (x
));
5316 static void GLAPIENTRY
5317 save_EvalPoint2(GLint x
, GLint y
)
5319 GET_CURRENT_CONTEXT(ctx
);
5321 SAVE_FLUSH_VERTICES(ctx
);
5322 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5327 if (ctx
->ExecuteFlag
) {
5328 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5332 static void GLAPIENTRY
5333 save_Indexf(GLfloat x
)
5335 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5338 static void GLAPIENTRY
5339 save_Indexfv(const GLfloat
* v
)
5341 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5344 static void GLAPIENTRY
5345 save_EdgeFlag(GLboolean x
)
5347 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5352 * Compare 'count' elements of vectors 'a' and 'b'.
5353 * \return GL_TRUE if equal, GL_FALSE if different.
5355 static inline GLboolean
5356 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5358 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5363 * This glMaterial function is used for glMaterial calls that are outside
5364 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5366 static void GLAPIENTRY
5367 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5369 GET_CURRENT_CONTEXT(ctx
);
5377 case GL_FRONT_AND_BACK
:
5380 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5389 case GL_AMBIENT_AND_DIFFUSE
:
5395 case GL_COLOR_INDEXES
:
5399 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5403 if (ctx
->ExecuteFlag
) {
5404 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5407 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5409 /* Try to eliminate redundant statechanges. Because it is legal to
5410 * call glMaterial even inside begin/end calls, don't need to worry
5411 * about ctx->Driver.CurrentSavePrimitive here.
5413 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5414 if (bitmask
& (1 << i
)) {
5415 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5416 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5417 /* no change in material value */
5418 bitmask
&= ~(1 << i
);
5421 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5422 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5427 /* If this call has no effect, return early */
5431 SAVE_FLUSH_VERTICES(ctx
);
5433 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5437 for (i
= 0; i
< args
; i
++)
5438 n
[3 + i
].f
= param
[i
];
5442 static void GLAPIENTRY
5443 save_Begin(GLenum mode
)
5445 GET_CURRENT_CONTEXT(ctx
);
5447 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5448 /* compile this error into the display list */
5449 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5451 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5452 /* compile this error into the display list */
5453 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5458 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5460 /* Give the driver an opportunity to hook in an optimized
5461 * display list compiler.
5463 if (vbo_save_NotifyBegin(ctx
, mode
))
5466 SAVE_FLUSH_VERTICES(ctx
);
5467 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5472 if (ctx
->ExecuteFlag
) {
5473 CALL_Begin(ctx
->Exec
, (mode
));
5478 static void GLAPIENTRY
5481 GET_CURRENT_CONTEXT(ctx
);
5482 SAVE_FLUSH_VERTICES(ctx
);
5483 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5484 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5485 if (ctx
->ExecuteFlag
) {
5486 CALL_End(ctx
->Exec
, ());
5490 static void GLAPIENTRY
5491 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5493 GET_CURRENT_CONTEXT(ctx
);
5495 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5496 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5503 if (ctx
->ExecuteFlag
) {
5504 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5509 static void GLAPIENTRY
5510 save_Vertex2f(GLfloat x
, GLfloat y
)
5512 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5515 static void GLAPIENTRY
5516 save_Vertex2fv(const GLfloat
* v
)
5518 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5521 static void GLAPIENTRY
5522 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5524 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5527 static void GLAPIENTRY
5528 save_Vertex3fv(const GLfloat
* v
)
5530 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5533 static void GLAPIENTRY
5534 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5536 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5539 static void GLAPIENTRY
5540 save_Vertex4fv(const GLfloat
* v
)
5542 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5545 static void GLAPIENTRY
5546 save_TexCoord1f(GLfloat x
)
5548 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5551 static void GLAPIENTRY
5552 save_TexCoord1fv(const GLfloat
* v
)
5554 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5557 static void GLAPIENTRY
5558 save_TexCoord2f(GLfloat x
, GLfloat y
)
5560 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5563 static void GLAPIENTRY
5564 save_TexCoord2fv(const GLfloat
* v
)
5566 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5569 static void GLAPIENTRY
5570 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5572 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5575 static void GLAPIENTRY
5576 save_TexCoord3fv(const GLfloat
* v
)
5578 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5581 static void GLAPIENTRY
5582 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5584 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5587 static void GLAPIENTRY
5588 save_TexCoord4fv(const GLfloat
* v
)
5590 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5593 static void GLAPIENTRY
5594 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5596 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5599 static void GLAPIENTRY
5600 save_Normal3fv(const GLfloat
* v
)
5602 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5605 static void GLAPIENTRY
5606 save_FogCoordfEXT(GLfloat x
)
5608 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5611 static void GLAPIENTRY
5612 save_FogCoordfvEXT(const GLfloat
* v
)
5614 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5617 static void GLAPIENTRY
5618 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5620 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5623 static void GLAPIENTRY
5624 save_Color3fv(const GLfloat
* v
)
5626 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5629 static void GLAPIENTRY
5630 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5632 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5635 static void GLAPIENTRY
5636 save_Color4fv(const GLfloat
* v
)
5638 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5641 static void GLAPIENTRY
5642 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5644 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5647 static void GLAPIENTRY
5648 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5650 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5654 /* Just call the respective ATTR for texcoord
5656 static void GLAPIENTRY
5657 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5659 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5660 save_Attr1fNV(attr
, x
);
5663 static void GLAPIENTRY
5664 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5666 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5667 save_Attr1fNV(attr
, v
[0]);
5670 static void GLAPIENTRY
5671 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5673 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5674 save_Attr2fNV(attr
, x
, y
);
5677 static void GLAPIENTRY
5678 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5680 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5681 save_Attr2fNV(attr
, v
[0], v
[1]);
5684 static void GLAPIENTRY
5685 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5687 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5688 save_Attr3fNV(attr
, x
, y
, z
);
5691 static void GLAPIENTRY
5692 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5694 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5695 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5698 static void GLAPIENTRY
5699 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5700 GLfloat z
, GLfloat w
)
5702 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5703 save_Attr4fNV(attr
, x
, y
, z
, w
);
5706 static void GLAPIENTRY
5707 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5709 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5710 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5715 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5721 GET_CURRENT_CONTEXT(ctx
);
5722 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5727 static void GLAPIENTRY
5728 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5730 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5731 save_Attr1fARB(index
, x
);
5736 static void GLAPIENTRY
5737 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5739 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5740 save_Attr1fARB(index
, v
[0]);
5745 static void GLAPIENTRY
5746 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5748 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5749 save_Attr2fARB(index
, x
, y
);
5754 static void GLAPIENTRY
5755 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5757 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5758 save_Attr2fARB(index
, v
[0], v
[1]);
5763 static void GLAPIENTRY
5764 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5766 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5767 save_Attr3fARB(index
, x
, y
, z
);
5772 static void GLAPIENTRY
5773 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5775 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5776 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5781 static void GLAPIENTRY
5782 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5785 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5786 save_Attr4fARB(index
, x
, y
, z
, w
);
5791 static void GLAPIENTRY
5792 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5794 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5795 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5800 static void GLAPIENTRY
5801 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5802 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5803 GLbitfield mask
, GLenum filter
)
5805 GET_CURRENT_CONTEXT(ctx
);
5807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5808 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5821 if (ctx
->ExecuteFlag
) {
5822 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5823 dstX0
, dstY0
, dstX1
, dstY1
,
5829 /** GL_EXT_provoking_vertex */
5830 static void GLAPIENTRY
5831 save_ProvokingVertexEXT(GLenum mode
)
5833 GET_CURRENT_CONTEXT(ctx
);
5835 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5836 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5840 if (ctx
->ExecuteFlag
) {
5841 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5842 _mesa_ProvokingVertex(mode
);
5847 /** GL_EXT_transform_feedback */
5848 static void GLAPIENTRY
5849 save_BeginTransformFeedback(GLenum mode
)
5851 GET_CURRENT_CONTEXT(ctx
);
5853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5854 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5858 if (ctx
->ExecuteFlag
) {
5859 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5864 /** GL_EXT_transform_feedback */
5865 static void GLAPIENTRY
5866 save_EndTransformFeedback(void)
5868 GET_CURRENT_CONTEXT(ctx
);
5869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5870 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5871 if (ctx
->ExecuteFlag
) {
5872 CALL_EndTransformFeedback(ctx
->Exec
, ());
5876 static void GLAPIENTRY
5877 save_BindTransformFeedback(GLenum target
, GLuint name
)
5879 GET_CURRENT_CONTEXT(ctx
);
5881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5882 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5887 if (ctx
->ExecuteFlag
) {
5888 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5892 static void GLAPIENTRY
5893 save_PauseTransformFeedback(void)
5895 GET_CURRENT_CONTEXT(ctx
);
5896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5897 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5898 if (ctx
->ExecuteFlag
) {
5899 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5903 static void GLAPIENTRY
5904 save_ResumeTransformFeedback(void)
5906 GET_CURRENT_CONTEXT(ctx
);
5907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5908 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5909 if (ctx
->ExecuteFlag
) {
5910 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5914 static void GLAPIENTRY
5915 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5917 GET_CURRENT_CONTEXT(ctx
);
5919 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5920 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5925 if (ctx
->ExecuteFlag
) {
5926 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5930 static void GLAPIENTRY
5931 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5933 GET_CURRENT_CONTEXT(ctx
);
5935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5936 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5942 if (ctx
->ExecuteFlag
) {
5943 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5947 static void GLAPIENTRY
5948 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5951 GET_CURRENT_CONTEXT(ctx
);
5953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5954 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5958 n
[3].si
= primcount
;
5960 if (ctx
->ExecuteFlag
) {
5961 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5965 static void GLAPIENTRY
5966 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5967 GLuint stream
, GLsizei primcount
)
5969 GET_CURRENT_CONTEXT(ctx
);
5971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5972 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5977 n
[4].si
= primcount
;
5979 if (ctx
->ExecuteFlag
) {
5980 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5985 static void GLAPIENTRY
5986 save_UseProgram(GLuint program
)
5988 GET_CURRENT_CONTEXT(ctx
);
5990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5991 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5995 if (ctx
->ExecuteFlag
) {
5996 CALL_UseProgram(ctx
->Exec
, (program
));
6001 static void GLAPIENTRY
6002 save_Uniform1fARB(GLint location
, GLfloat x
)
6004 GET_CURRENT_CONTEXT(ctx
);
6006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6007 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6012 if (ctx
->ExecuteFlag
) {
6013 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6018 static void GLAPIENTRY
6019 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6021 GET_CURRENT_CONTEXT(ctx
);
6023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6024 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6030 if (ctx
->ExecuteFlag
) {
6031 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6036 static void GLAPIENTRY
6037 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6039 GET_CURRENT_CONTEXT(ctx
);
6041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6042 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6049 if (ctx
->ExecuteFlag
) {
6050 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6055 static void GLAPIENTRY
6056 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6058 GET_CURRENT_CONTEXT(ctx
);
6060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6061 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6069 if (ctx
->ExecuteFlag
) {
6070 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6075 static void GLAPIENTRY
6076 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6078 GET_CURRENT_CONTEXT(ctx
);
6080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6081 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6085 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6087 if (ctx
->ExecuteFlag
) {
6088 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6092 static void GLAPIENTRY
6093 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6095 GET_CURRENT_CONTEXT(ctx
);
6097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6098 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6102 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6104 if (ctx
->ExecuteFlag
) {
6105 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6109 static void GLAPIENTRY
6110 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6112 GET_CURRENT_CONTEXT(ctx
);
6114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6115 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6119 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6121 if (ctx
->ExecuteFlag
) {
6122 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6126 static void GLAPIENTRY
6127 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6129 GET_CURRENT_CONTEXT(ctx
);
6131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6132 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6136 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6138 if (ctx
->ExecuteFlag
) {
6139 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6144 static void GLAPIENTRY
6145 save_Uniform1iARB(GLint location
, GLint x
)
6147 GET_CURRENT_CONTEXT(ctx
);
6149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6150 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6155 if (ctx
->ExecuteFlag
) {
6156 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6160 static void GLAPIENTRY
6161 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6163 GET_CURRENT_CONTEXT(ctx
);
6165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6166 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6172 if (ctx
->ExecuteFlag
) {
6173 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6177 static void GLAPIENTRY
6178 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6180 GET_CURRENT_CONTEXT(ctx
);
6182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6183 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6190 if (ctx
->ExecuteFlag
) {
6191 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6195 static void GLAPIENTRY
6196 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6198 GET_CURRENT_CONTEXT(ctx
);
6200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6201 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6209 if (ctx
->ExecuteFlag
) {
6210 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6216 static void GLAPIENTRY
6217 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6219 GET_CURRENT_CONTEXT(ctx
);
6221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6222 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6226 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6228 if (ctx
->ExecuteFlag
) {
6229 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6233 static void GLAPIENTRY
6234 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6236 GET_CURRENT_CONTEXT(ctx
);
6238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6239 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6243 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6245 if (ctx
->ExecuteFlag
) {
6246 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6250 static void GLAPIENTRY
6251 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6253 GET_CURRENT_CONTEXT(ctx
);
6255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6256 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6260 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6262 if (ctx
->ExecuteFlag
) {
6263 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6267 static void GLAPIENTRY
6268 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6270 GET_CURRENT_CONTEXT(ctx
);
6272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6273 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6277 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6279 if (ctx
->ExecuteFlag
) {
6280 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6286 static void GLAPIENTRY
6287 save_Uniform1ui(GLint location
, GLuint x
)
6289 GET_CURRENT_CONTEXT(ctx
);
6291 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6292 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6297 if (ctx
->ExecuteFlag
) {
6298 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6302 static void GLAPIENTRY
6303 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6305 GET_CURRENT_CONTEXT(ctx
);
6307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6308 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6314 if (ctx
->ExecuteFlag
) {
6315 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6319 static void GLAPIENTRY
6320 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6322 GET_CURRENT_CONTEXT(ctx
);
6324 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6325 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6332 if (ctx
->ExecuteFlag
) {
6333 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6337 static void GLAPIENTRY
6338 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6340 GET_CURRENT_CONTEXT(ctx
);
6342 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6343 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6351 if (ctx
->ExecuteFlag
) {
6352 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6358 static void GLAPIENTRY
6359 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6361 GET_CURRENT_CONTEXT(ctx
);
6363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6364 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6368 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6370 if (ctx
->ExecuteFlag
) {
6371 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6375 static void GLAPIENTRY
6376 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6378 GET_CURRENT_CONTEXT(ctx
);
6380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6381 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6385 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6387 if (ctx
->ExecuteFlag
) {
6388 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6392 static void GLAPIENTRY
6393 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6395 GET_CURRENT_CONTEXT(ctx
);
6397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6398 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6402 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6404 if (ctx
->ExecuteFlag
) {
6405 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6409 static void GLAPIENTRY
6410 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6412 GET_CURRENT_CONTEXT(ctx
);
6414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6415 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6419 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6421 if (ctx
->ExecuteFlag
) {
6422 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6428 static void GLAPIENTRY
6429 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6432 GET_CURRENT_CONTEXT(ctx
);
6434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6435 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6440 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6442 if (ctx
->ExecuteFlag
) {
6443 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6447 static void GLAPIENTRY
6448 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6451 GET_CURRENT_CONTEXT(ctx
);
6453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6454 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6459 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6461 if (ctx
->ExecuteFlag
) {
6462 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6466 static void GLAPIENTRY
6467 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6470 GET_CURRENT_CONTEXT(ctx
);
6472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6473 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6478 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6480 if (ctx
->ExecuteFlag
) {
6481 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6486 static void GLAPIENTRY
6487 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6490 GET_CURRENT_CONTEXT(ctx
);
6492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6493 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6498 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6500 if (ctx
->ExecuteFlag
) {
6501 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6505 static void GLAPIENTRY
6506 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6509 GET_CURRENT_CONTEXT(ctx
);
6511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6512 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6517 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6519 if (ctx
->ExecuteFlag
) {
6520 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6525 static void GLAPIENTRY
6526 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6529 GET_CURRENT_CONTEXT(ctx
);
6531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6532 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6537 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6539 if (ctx
->ExecuteFlag
) {
6540 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6544 static void GLAPIENTRY
6545 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6548 GET_CURRENT_CONTEXT(ctx
);
6550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6551 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6556 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6558 if (ctx
->ExecuteFlag
) {
6559 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6564 static void GLAPIENTRY
6565 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6568 GET_CURRENT_CONTEXT(ctx
);
6570 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6571 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6576 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6578 if (ctx
->ExecuteFlag
) {
6579 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6583 static void GLAPIENTRY
6584 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6587 GET_CURRENT_CONTEXT(ctx
);
6589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6590 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6595 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6597 if (ctx
->ExecuteFlag
) {
6598 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6602 static void GLAPIENTRY
6603 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6605 GET_CURRENT_CONTEXT(ctx
);
6607 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6608 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6614 if (ctx
->ExecuteFlag
) {
6615 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6619 static void GLAPIENTRY
6620 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6622 GET_CURRENT_CONTEXT(ctx
);
6624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6625 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6631 if (ctx
->ExecuteFlag
) {
6632 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6636 static void GLAPIENTRY
6637 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6639 GET_CURRENT_CONTEXT(ctx
);
6641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6642 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6649 if (ctx
->ExecuteFlag
) {
6650 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6654 static void GLAPIENTRY
6655 save_ProgramUniform3f(GLuint program
, GLint location
,
6656 GLfloat x
, GLfloat y
, GLfloat z
)
6658 GET_CURRENT_CONTEXT(ctx
);
6660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6661 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6669 if (ctx
->ExecuteFlag
) {
6670 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6674 static void GLAPIENTRY
6675 save_ProgramUniform4f(GLuint program
, GLint location
,
6676 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6678 GET_CURRENT_CONTEXT(ctx
);
6680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6681 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6690 if (ctx
->ExecuteFlag
) {
6691 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6695 static void GLAPIENTRY
6696 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6699 GET_CURRENT_CONTEXT(ctx
);
6701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6702 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6707 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6709 if (ctx
->ExecuteFlag
) {
6710 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6714 static void GLAPIENTRY
6715 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6718 GET_CURRENT_CONTEXT(ctx
);
6720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6721 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6726 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6728 if (ctx
->ExecuteFlag
) {
6729 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6733 static void GLAPIENTRY
6734 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6737 GET_CURRENT_CONTEXT(ctx
);
6739 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6740 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6745 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6747 if (ctx
->ExecuteFlag
) {
6748 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6752 static void GLAPIENTRY
6753 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6756 GET_CURRENT_CONTEXT(ctx
);
6758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6759 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6764 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6766 if (ctx
->ExecuteFlag
) {
6767 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6771 static void GLAPIENTRY
6772 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6774 GET_CURRENT_CONTEXT(ctx
);
6776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6777 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6783 if (ctx
->ExecuteFlag
) {
6784 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6788 static void GLAPIENTRY
6789 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6791 GET_CURRENT_CONTEXT(ctx
);
6793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6794 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6801 if (ctx
->ExecuteFlag
) {
6802 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6806 static void GLAPIENTRY
6807 save_ProgramUniform3i(GLuint program
, GLint location
,
6808 GLint x
, GLint y
, GLint z
)
6810 GET_CURRENT_CONTEXT(ctx
);
6812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6813 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6821 if (ctx
->ExecuteFlag
) {
6822 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6826 static void GLAPIENTRY
6827 save_ProgramUniform4i(GLuint program
, GLint location
,
6828 GLint x
, GLint y
, GLint z
, GLint w
)
6830 GET_CURRENT_CONTEXT(ctx
);
6832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6833 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6842 if (ctx
->ExecuteFlag
) {
6843 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6847 static void GLAPIENTRY
6848 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6851 GET_CURRENT_CONTEXT(ctx
);
6853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6854 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6859 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6861 if (ctx
->ExecuteFlag
) {
6862 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6866 static void GLAPIENTRY
6867 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6870 GET_CURRENT_CONTEXT(ctx
);
6872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6873 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6878 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6880 if (ctx
->ExecuteFlag
) {
6881 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6885 static void GLAPIENTRY
6886 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6889 GET_CURRENT_CONTEXT(ctx
);
6891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6892 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6897 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6899 if (ctx
->ExecuteFlag
) {
6900 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6904 static void GLAPIENTRY
6905 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6908 GET_CURRENT_CONTEXT(ctx
);
6910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6911 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6916 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6918 if (ctx
->ExecuteFlag
) {
6919 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6923 static void GLAPIENTRY
6924 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6926 GET_CURRENT_CONTEXT(ctx
);
6928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6929 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6935 if (ctx
->ExecuteFlag
) {
6936 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6940 static void GLAPIENTRY
6941 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6943 GET_CURRENT_CONTEXT(ctx
);
6945 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6946 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6953 if (ctx
->ExecuteFlag
) {
6954 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6958 static void GLAPIENTRY
6959 save_ProgramUniform3ui(GLuint program
, GLint location
,
6960 GLuint x
, GLuint y
, GLuint z
)
6962 GET_CURRENT_CONTEXT(ctx
);
6964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6965 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6973 if (ctx
->ExecuteFlag
) {
6974 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6978 static void GLAPIENTRY
6979 save_ProgramUniform4ui(GLuint program
, GLint location
,
6980 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6982 GET_CURRENT_CONTEXT(ctx
);
6984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6985 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
6994 if (ctx
->ExecuteFlag
) {
6995 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6999 static void GLAPIENTRY
7000 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7003 GET_CURRENT_CONTEXT(ctx
);
7005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7006 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7011 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7013 if (ctx
->ExecuteFlag
) {
7014 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7018 static void GLAPIENTRY
7019 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7022 GET_CURRENT_CONTEXT(ctx
);
7024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7025 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7030 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7032 if (ctx
->ExecuteFlag
) {
7033 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7037 static void GLAPIENTRY
7038 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7041 GET_CURRENT_CONTEXT(ctx
);
7043 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7044 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7049 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7051 if (ctx
->ExecuteFlag
) {
7052 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7056 static void GLAPIENTRY
7057 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7060 GET_CURRENT_CONTEXT(ctx
);
7062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7063 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7068 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7070 if (ctx
->ExecuteFlag
) {
7071 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7075 static void GLAPIENTRY
7076 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7077 GLboolean transpose
, const GLfloat
*v
)
7079 GET_CURRENT_CONTEXT(ctx
);
7081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7082 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7083 4 + POINTER_DWORDS
);
7089 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7091 if (ctx
->ExecuteFlag
) {
7092 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7093 (program
, location
, count
, transpose
, v
));
7097 static void GLAPIENTRY
7098 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7099 GLboolean transpose
, const GLfloat
*v
)
7101 GET_CURRENT_CONTEXT(ctx
);
7103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7104 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7105 4 + POINTER_DWORDS
);
7111 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7113 if (ctx
->ExecuteFlag
) {
7114 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7115 (program
, location
, count
, transpose
, v
));
7119 static void GLAPIENTRY
7120 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7121 GLboolean transpose
, const GLfloat
*v
)
7123 GET_CURRENT_CONTEXT(ctx
);
7125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7126 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7127 4 + POINTER_DWORDS
);
7133 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7135 if (ctx
->ExecuteFlag
) {
7136 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7137 (program
, location
, count
, transpose
, v
));
7141 static void GLAPIENTRY
7142 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7143 GLboolean transpose
, const GLfloat
*v
)
7145 GET_CURRENT_CONTEXT(ctx
);
7147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7148 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7149 4 + POINTER_DWORDS
);
7155 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7157 if (ctx
->ExecuteFlag
) {
7158 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7159 (program
, location
, count
, transpose
, v
));
7163 static void GLAPIENTRY
7164 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7165 GLboolean transpose
, const GLfloat
*v
)
7167 GET_CURRENT_CONTEXT(ctx
);
7169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7170 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7171 4 + POINTER_DWORDS
);
7177 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7179 if (ctx
->ExecuteFlag
) {
7180 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7181 (program
, location
, count
, transpose
, v
));
7185 static void GLAPIENTRY
7186 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7187 GLboolean transpose
, const GLfloat
*v
)
7189 GET_CURRENT_CONTEXT(ctx
);
7191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7192 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7193 4 + POINTER_DWORDS
);
7199 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7201 if (ctx
->ExecuteFlag
) {
7202 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7203 (program
, location
, count
, transpose
, v
));
7207 static void GLAPIENTRY
7208 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7209 GLboolean transpose
, const GLfloat
*v
)
7211 GET_CURRENT_CONTEXT(ctx
);
7213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7214 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7215 4 + POINTER_DWORDS
);
7221 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7223 if (ctx
->ExecuteFlag
) {
7224 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7225 (program
, location
, count
, transpose
, v
));
7229 static void GLAPIENTRY
7230 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7231 GLboolean transpose
, const GLfloat
*v
)
7233 GET_CURRENT_CONTEXT(ctx
);
7235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7236 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7237 4 + POINTER_DWORDS
);
7243 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7245 if (ctx
->ExecuteFlag
) {
7246 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7247 (program
, location
, count
, transpose
, v
));
7251 static void GLAPIENTRY
7252 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7253 GLboolean transpose
, const GLfloat
*v
)
7255 GET_CURRENT_CONTEXT(ctx
);
7257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7258 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7259 4 + POINTER_DWORDS
);
7265 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7267 if (ctx
->ExecuteFlag
) {
7268 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7269 (program
, location
, count
, transpose
, v
));
7273 static void GLAPIENTRY
7274 save_ClipControl(GLenum origin
, GLenum depth
)
7276 GET_CURRENT_CONTEXT(ctx
);
7278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7279 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7284 if (ctx
->ExecuteFlag
) {
7285 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7289 static void GLAPIENTRY
7290 save_ClampColorARB(GLenum target
, GLenum clamp
)
7292 GET_CURRENT_CONTEXT(ctx
);
7294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7295 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7300 if (ctx
->ExecuteFlag
) {
7301 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7305 /** GL_EXT_texture_integer */
7306 static void GLAPIENTRY
7307 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7309 GET_CURRENT_CONTEXT(ctx
);
7311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7312 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7319 if (ctx
->ExecuteFlag
) {
7320 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7324 /** GL_EXT_texture_integer */
7325 static void GLAPIENTRY
7326 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7328 GET_CURRENT_CONTEXT(ctx
);
7330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7331 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7338 if (ctx
->ExecuteFlag
) {
7339 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7343 /** GL_EXT_texture_integer */
7344 static void GLAPIENTRY
7345 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7347 GET_CURRENT_CONTEXT(ctx
);
7349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7350 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7359 if (ctx
->ExecuteFlag
) {
7360 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7364 /** GL_EXT_texture_integer */
7365 static void GLAPIENTRY
7366 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7368 GET_CURRENT_CONTEXT(ctx
);
7370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7371 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7375 n
[3].ui
= params
[0];
7376 n
[4].ui
= params
[1];
7377 n
[5].ui
= params
[2];
7378 n
[6].ui
= params
[3];
7380 if (ctx
->ExecuteFlag
) {
7381 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7385 /* GL_ARB_instanced_arrays */
7386 static void GLAPIENTRY
7387 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7389 GET_CURRENT_CONTEXT(ctx
);
7391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7392 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7397 if (ctx
->ExecuteFlag
) {
7398 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7403 /* GL_NV_texture_barrier */
7404 static void GLAPIENTRY
7405 save_TextureBarrierNV(void)
7407 GET_CURRENT_CONTEXT(ctx
);
7408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7409 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7410 if (ctx
->ExecuteFlag
) {
7411 CALL_TextureBarrierNV(ctx
->Exec
, ());
7416 /* GL_ARB_sampler_objects */
7417 static void GLAPIENTRY
7418 save_BindSampler(GLuint unit
, GLuint sampler
)
7421 GET_CURRENT_CONTEXT(ctx
);
7422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7423 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7428 if (ctx
->ExecuteFlag
) {
7429 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7433 static void GLAPIENTRY
7434 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7437 GET_CURRENT_CONTEXT(ctx
);
7438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7439 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7444 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7450 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7453 if (ctx
->ExecuteFlag
) {
7454 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7458 static void GLAPIENTRY
7459 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7463 parray
[1] = parray
[2] = parray
[3] = 0;
7464 save_SamplerParameteriv(sampler
, pname
, parray
);
7467 static void GLAPIENTRY
7468 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7471 GET_CURRENT_CONTEXT(ctx
);
7472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7473 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7478 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7484 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7487 if (ctx
->ExecuteFlag
) {
7488 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7492 static void GLAPIENTRY
7493 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7497 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7498 save_SamplerParameterfv(sampler
, pname
, parray
);
7501 static void GLAPIENTRY
7502 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7505 GET_CURRENT_CONTEXT(ctx
);
7506 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7507 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7512 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7518 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7521 if (ctx
->ExecuteFlag
) {
7522 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7526 static void GLAPIENTRY
7527 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7530 GET_CURRENT_CONTEXT(ctx
);
7531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7532 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7536 n
[3].ui
= params
[0];
7537 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7538 n
[4].ui
= params
[1];
7539 n
[5].ui
= params
[2];
7540 n
[6].ui
= params
[3];
7543 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7546 if (ctx
->ExecuteFlag
) {
7547 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7551 static void GLAPIENTRY
7552 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7555 GET_CURRENT_CONTEXT(ctx
);
7556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7557 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7559 union uint64_pair p
;
7562 n
[2].ui
= p
.uint32
[0];
7563 n
[3].ui
= p
.uint32
[1];
7564 save_pointer(&n
[4], sync
);
7566 if (ctx
->ExecuteFlag
) {
7567 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7572 /** GL_NV_conditional_render */
7573 static void GLAPIENTRY
7574 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7576 GET_CURRENT_CONTEXT(ctx
);
7578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7579 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7584 if (ctx
->ExecuteFlag
) {
7585 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7589 static void GLAPIENTRY
7590 save_EndConditionalRender(void)
7592 GET_CURRENT_CONTEXT(ctx
);
7593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7594 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7595 if (ctx
->ExecuteFlag
) {
7596 CALL_EndConditionalRender(ctx
->Exec
, ());
7600 static void GLAPIENTRY
7601 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7603 GET_CURRENT_CONTEXT(ctx
);
7605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7606 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7612 if (ctx
->ExecuteFlag
) {
7613 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7619 * Save an error-generating command into display list.
7621 * KW: Will appear in the list before the vertex buffer containing the
7622 * command that provoked the error. I don't see this as a problem.
7625 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7628 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7631 save_pointer(&n
[2], (void *) s
);
7632 /* note: the data/string here doesn't have to be freed in
7633 * _mesa_delete_list() since the string is never dynamically
7641 * Compile an error into current display list.
7644 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7646 if (ctx
->CompileFlag
)
7647 save_error(ctx
, error
, s
);
7648 if (ctx
->ExecuteFlag
)
7649 _mesa_error(ctx
, error
, "%s", s
);
7654 * Test if ID names a display list.
7657 islist(struct gl_context
*ctx
, GLuint list
)
7659 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7669 /**********************************************************************/
7670 /* Display list execution */
7671 /**********************************************************************/
7675 * Execute a display list. Note that the ListBase offset must have already
7676 * been added before calling this function. I.e. the list argument is
7677 * the absolute list number, not relative to ListBase.
7678 * \param list - display list number
7681 execute_list(struct gl_context
*ctx
, GLuint list
)
7683 struct gl_display_list
*dlist
;
7687 if (list
== 0 || !islist(ctx
, list
))
7690 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7691 /* raise an error? */
7695 dlist
= _mesa_lookup_list(ctx
, list
);
7699 ctx
->ListState
.CallDepth
++;
7701 vbo_save_BeginCallList(ctx
, dlist
);
7707 const OpCode opcode
= n
[0].opcode
;
7709 if (is_ext_opcode(opcode
)) {
7710 n
+= ext_opcode_execute(ctx
, n
);
7715 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7718 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7720 case OPCODE_ALPHA_FUNC
:
7721 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7723 case OPCODE_BIND_TEXTURE
:
7724 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7728 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7729 ctx
->Unpack
= ctx
->DefaultPacking
;
7730 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7731 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7732 get_pointer(&n
[7])));
7733 ctx
->Unpack
= save
; /* restore */
7736 case OPCODE_BLEND_COLOR
:
7737 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7739 case OPCODE_BLEND_EQUATION
:
7740 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7742 case OPCODE_BLEND_EQUATION_SEPARATE
:
7743 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7745 case OPCODE_BLEND_FUNC_SEPARATE
:
7746 CALL_BlendFuncSeparate(ctx
->Exec
,
7747 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7750 case OPCODE_BLEND_FUNC_I
:
7751 /* GL_ARB_draw_buffers_blend */
7752 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7754 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7755 /* GL_ARB_draw_buffers_blend */
7756 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7759 case OPCODE_BLEND_EQUATION_I
:
7760 /* GL_ARB_draw_buffers_blend */
7761 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7763 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7764 /* GL_ARB_draw_buffers_blend */
7765 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7766 (n
[1].ui
, n
[2].e
, n
[3].e
));
7769 case OPCODE_CALL_LIST
:
7770 /* Generated by glCallList(), don't add ListBase */
7771 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7772 execute_list(ctx
, n
[1].ui
);
7775 case OPCODE_CALL_LIST_OFFSET
:
7776 /* Generated by glCallLists() so we must add ListBase */
7778 /* user specified a bad data type at compile time */
7779 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7781 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7782 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7783 execute_list(ctx
, list
);
7787 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7789 case OPCODE_CLEAR_BUFFER_IV
:
7796 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7799 case OPCODE_CLEAR_BUFFER_UIV
:
7806 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7809 case OPCODE_CLEAR_BUFFER_FV
:
7816 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7819 case OPCODE_CLEAR_BUFFER_FI
:
7820 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7822 case OPCODE_CLEAR_COLOR
:
7823 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7825 case OPCODE_CLEAR_ACCUM
:
7826 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7828 case OPCODE_CLEAR_DEPTH
:
7829 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7831 case OPCODE_CLEAR_INDEX
:
7832 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7834 case OPCODE_CLEAR_STENCIL
:
7835 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7837 case OPCODE_CLIP_PLANE
:
7844 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7847 case OPCODE_COLOR_MASK
:
7848 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7850 case OPCODE_COLOR_MASK_INDEXED
:
7851 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7854 case OPCODE_COLOR_MATERIAL
:
7855 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7857 case OPCODE_COPY_PIXELS
:
7858 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7859 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7862 case OPCODE_COPY_TEX_IMAGE1D
:
7863 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7864 n
[5].i
, n
[6].i
, n
[7].i
));
7866 case OPCODE_COPY_TEX_IMAGE2D
:
7867 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7868 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7870 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7871 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7872 n
[4].i
, n
[5].i
, n
[6].i
));
7874 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7875 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7876 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7879 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7880 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7881 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7884 case OPCODE_CULL_FACE
:
7885 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7887 case OPCODE_DEPTH_FUNC
:
7888 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7890 case OPCODE_DEPTH_MASK
:
7891 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7893 case OPCODE_DEPTH_RANGE
:
7894 CALL_DepthRange(ctx
->Exec
,
7895 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7897 case OPCODE_DISABLE
:
7898 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7900 case OPCODE_DISABLE_INDEXED
:
7901 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7903 case OPCODE_DRAW_BUFFER
:
7904 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7906 case OPCODE_DRAW_PIXELS
:
7908 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7909 ctx
->Unpack
= ctx
->DefaultPacking
;
7910 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7911 get_pointer(&n
[5])));
7912 ctx
->Unpack
= save
; /* restore */
7916 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7918 case OPCODE_ENABLE_INDEXED
:
7919 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7921 case OPCODE_EVALMESH1
:
7922 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7924 case OPCODE_EVALMESH2
:
7925 CALL_EvalMesh2(ctx
->Exec
,
7926 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7935 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7938 case OPCODE_FRONT_FACE
:
7939 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7941 case OPCODE_FRUSTUM
:
7942 CALL_Frustum(ctx
->Exec
,
7943 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7946 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7948 case OPCODE_INDEX_MASK
:
7949 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7951 case OPCODE_INIT_NAMES
:
7952 CALL_InitNames(ctx
->Exec
, ());
7961 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7964 case OPCODE_LIGHT_MODEL
:
7971 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7974 case OPCODE_LINE_STIPPLE
:
7975 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7977 case OPCODE_LINE_WIDTH
:
7978 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7980 case OPCODE_LIST_BASE
:
7981 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7983 case OPCODE_LOAD_IDENTITY
:
7984 CALL_LoadIdentity(ctx
->Exec
, ());
7986 case OPCODE_LOAD_MATRIX
:
7987 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
7988 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7990 case OPCODE_LOAD_NAME
:
7991 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7993 case OPCODE_LOGIC_OP
:
7994 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7998 GLenum target
= n
[1].e
;
7999 GLint ustride
= _mesa_evaluator_components(target
);
8000 GLint uorder
= n
[5].i
;
8001 GLfloat u1
= n
[2].f
;
8002 GLfloat u2
= n
[3].f
;
8003 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8004 (GLfloat
*) get_pointer(&n
[6])));
8009 GLenum target
= n
[1].e
;
8010 GLfloat u1
= n
[2].f
;
8011 GLfloat u2
= n
[3].f
;
8012 GLfloat v1
= n
[4].f
;
8013 GLfloat v2
= n
[5].f
;
8014 GLint ustride
= n
[6].i
;
8015 GLint vstride
= n
[7].i
;
8016 GLint uorder
= n
[8].i
;
8017 GLint vorder
= n
[9].i
;
8018 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8019 v1
, v2
, vstride
, vorder
,
8020 (GLfloat
*) get_pointer(&n
[10])));
8023 case OPCODE_MAPGRID1
:
8024 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8026 case OPCODE_MAPGRID2
:
8027 CALL_MapGrid2f(ctx
->Exec
,
8028 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8030 case OPCODE_MATRIX_MODE
:
8031 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8033 case OPCODE_MULT_MATRIX
:
8034 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8037 CALL_Ortho(ctx
->Exec
,
8038 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8040 case OPCODE_PASSTHROUGH
:
8041 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8043 case OPCODE_PIXEL_MAP
:
8044 CALL_PixelMapfv(ctx
->Exec
,
8045 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8047 case OPCODE_PIXEL_TRANSFER
:
8048 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8050 case OPCODE_PIXEL_ZOOM
:
8051 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8053 case OPCODE_POINT_SIZE
:
8054 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8056 case OPCODE_POINT_PARAMETERS
:
8062 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8065 case OPCODE_POLYGON_MODE
:
8066 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8068 case OPCODE_POLYGON_STIPPLE
:
8070 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8071 ctx
->Unpack
= ctx
->DefaultPacking
;
8072 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8073 ctx
->Unpack
= save
; /* restore */
8076 case OPCODE_POLYGON_OFFSET
:
8077 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8079 case OPCODE_POLYGON_OFFSET_CLAMP
:
8080 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8082 case OPCODE_POP_ATTRIB
:
8083 CALL_PopAttrib(ctx
->Exec
, ());
8085 case OPCODE_POP_MATRIX
:
8086 CALL_PopMatrix(ctx
->Exec
, ());
8088 case OPCODE_POP_NAME
:
8089 CALL_PopName(ctx
->Exec
, ());
8091 case OPCODE_PRIORITIZE_TEXTURE
:
8092 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8094 case OPCODE_PUSH_ATTRIB
:
8095 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8097 case OPCODE_PUSH_MATRIX
:
8098 CALL_PushMatrix(ctx
->Exec
, ());
8100 case OPCODE_PUSH_NAME
:
8101 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8103 case OPCODE_RASTER_POS
:
8104 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8106 case OPCODE_READ_BUFFER
:
8107 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8110 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8113 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8115 case OPCODE_SCISSOR
:
8116 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8118 case OPCODE_SHADE_MODEL
:
8119 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8121 case OPCODE_PROVOKING_VERTEX
:
8122 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8124 case OPCODE_STENCIL_FUNC
:
8125 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8127 case OPCODE_STENCIL_MASK
:
8128 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8130 case OPCODE_STENCIL_OP
:
8131 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8133 case OPCODE_STENCIL_FUNC_SEPARATE
:
8134 CALL_StencilFuncSeparate(ctx
->Exec
,
8135 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8137 case OPCODE_STENCIL_MASK_SEPARATE
:
8138 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8140 case OPCODE_STENCIL_OP_SEPARATE
:
8141 CALL_StencilOpSeparate(ctx
->Exec
,
8142 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8151 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8161 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8164 case OPCODE_TEXPARAMETER
:
8171 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8174 case OPCODE_TEX_IMAGE1D
:
8176 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8177 ctx
->Unpack
= ctx
->DefaultPacking
;
8178 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8180 n
[3].i
, /* components */
8182 n
[5].e
, /* border */
8183 n
[6].e
, /* format */
8185 get_pointer(&n
[8])));
8186 ctx
->Unpack
= save
; /* restore */
8189 case OPCODE_TEX_IMAGE2D
:
8191 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8192 ctx
->Unpack
= ctx
->DefaultPacking
;
8193 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8195 n
[3].i
, /* components */
8197 n
[5].i
, /* height */
8198 n
[6].e
, /* border */
8199 n
[7].e
, /* format */
8201 get_pointer(&n
[9])));
8202 ctx
->Unpack
= save
; /* restore */
8205 case OPCODE_TEX_IMAGE3D
:
8207 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8208 ctx
->Unpack
= ctx
->DefaultPacking
;
8209 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8211 n
[3].i
, /* components */
8213 n
[5].i
, /* height */
8215 n
[7].e
, /* border */
8216 n
[8].e
, /* format */
8218 get_pointer(&n
[10])));
8219 ctx
->Unpack
= save
; /* restore */
8222 case OPCODE_TEX_SUB_IMAGE1D
:
8224 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8225 ctx
->Unpack
= ctx
->DefaultPacking
;
8226 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8228 n
[6].e
, get_pointer(&n
[7])));
8229 ctx
->Unpack
= save
; /* restore */
8232 case OPCODE_TEX_SUB_IMAGE2D
:
8234 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8235 ctx
->Unpack
= ctx
->DefaultPacking
;
8236 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8238 n
[6].i
, n
[7].e
, n
[8].e
,
8239 get_pointer(&n
[9])));
8240 ctx
->Unpack
= save
; /* restore */
8243 case OPCODE_TEX_SUB_IMAGE3D
:
8245 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8246 ctx
->Unpack
= ctx
->DefaultPacking
;
8247 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8248 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8249 n
[8].i
, n
[9].e
, n
[10].e
,
8250 get_pointer(&n
[11])));
8251 ctx
->Unpack
= save
; /* restore */
8254 case OPCODE_TRANSLATE
:
8255 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8257 case OPCODE_VIEWPORT
:
8258 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8259 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8261 case OPCODE_WINDOW_POS
:
8262 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8264 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8265 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8267 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8268 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8269 n
[4].i
, n
[5].i
, n
[6].i
,
8270 get_pointer(&n
[7])));
8272 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8273 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8274 n
[4].i
, n
[5].i
, n
[6].i
,
8275 n
[7].i
, get_pointer(&n
[8])));
8277 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8278 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8279 n
[4].i
, n
[5].i
, n
[6].i
,
8281 get_pointer(&n
[9])));
8283 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8284 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8285 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8287 get_pointer(&n
[7])));
8289 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8290 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8291 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8292 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8293 get_pointer(&n
[9])));
8295 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8296 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8297 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8298 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8300 get_pointer(&n
[11])));
8302 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8303 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8305 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8306 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8308 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8309 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8311 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8312 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8313 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8316 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8317 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8319 case OPCODE_DEPTH_BOUNDS_EXT
:
8320 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8322 case OPCODE_PROGRAM_STRING_ARB
:
8323 CALL_ProgramStringARB(ctx
->Exec
,
8324 (n
[1].e
, n
[2].e
, n
[3].i
,
8325 get_pointer(&n
[4])));
8327 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8328 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8332 case OPCODE_BEGIN_QUERY_ARB
:
8333 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8335 case OPCODE_END_QUERY_ARB
:
8336 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8338 case OPCODE_QUERY_COUNTER
:
8339 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8341 case OPCODE_BEGIN_QUERY_INDEXED
:
8342 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8344 case OPCODE_END_QUERY_INDEXED
:
8345 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8347 case OPCODE_DRAW_BUFFERS_ARB
:
8349 GLenum buffers
[MAX_DRAW_BUFFERS
];
8350 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8351 for (i
= 0; i
< count
; i
++)
8352 buffers
[i
] = n
[2 + i
].e
;
8353 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8356 case OPCODE_BLIT_FRAMEBUFFER
:
8357 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8358 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8361 case OPCODE_USE_PROGRAM
:
8362 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8364 case OPCODE_UNIFORM_1F
:
8365 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8367 case OPCODE_UNIFORM_2F
:
8368 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8370 case OPCODE_UNIFORM_3F
:
8371 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8373 case OPCODE_UNIFORM_4F
:
8374 CALL_Uniform4f(ctx
->Exec
,
8375 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8377 case OPCODE_UNIFORM_1FV
:
8378 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8380 case OPCODE_UNIFORM_2FV
:
8381 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8383 case OPCODE_UNIFORM_3FV
:
8384 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8386 case OPCODE_UNIFORM_4FV
:
8387 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8389 case OPCODE_UNIFORM_1I
:
8390 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8392 case OPCODE_UNIFORM_2I
:
8393 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8395 case OPCODE_UNIFORM_3I
:
8396 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8398 case OPCODE_UNIFORM_4I
:
8399 CALL_Uniform4i(ctx
->Exec
,
8400 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8402 case OPCODE_UNIFORM_1IV
:
8403 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8405 case OPCODE_UNIFORM_2IV
:
8406 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8408 case OPCODE_UNIFORM_3IV
:
8409 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8411 case OPCODE_UNIFORM_4IV
:
8412 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8414 case OPCODE_UNIFORM_1UI
:
8415 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8417 case OPCODE_UNIFORM_2UI
:
8418 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8420 case OPCODE_UNIFORM_3UI
:
8421 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8423 case OPCODE_UNIFORM_4UI
:
8424 /*CALL_Uniform4uiARB(ctx->Exec,
8425 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8428 case OPCODE_UNIFORM_1UIV
:
8429 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8430 get_pointer(&n[3])));*/
8432 case OPCODE_UNIFORM_2UIV
:
8433 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8434 get_pointer(&n[3])));*/
8436 case OPCODE_UNIFORM_3UIV
:
8437 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8438 get_pointer(&n[3])));*/
8440 case OPCODE_UNIFORM_4UIV
:
8441 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8442 get_pointer(&n[3])));*/
8444 case OPCODE_UNIFORM_MATRIX22
:
8445 CALL_UniformMatrix2fv(ctx
->Exec
,
8446 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8448 case OPCODE_UNIFORM_MATRIX33
:
8449 CALL_UniformMatrix3fv(ctx
->Exec
,
8450 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8452 case OPCODE_UNIFORM_MATRIX44
:
8453 CALL_UniformMatrix4fv(ctx
->Exec
,
8454 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8456 case OPCODE_UNIFORM_MATRIX23
:
8457 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8458 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8460 case OPCODE_UNIFORM_MATRIX32
:
8461 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8462 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8464 case OPCODE_UNIFORM_MATRIX24
:
8465 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8466 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8468 case OPCODE_UNIFORM_MATRIX42
:
8469 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8470 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8472 case OPCODE_UNIFORM_MATRIX34
:
8473 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8474 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8476 case OPCODE_UNIFORM_MATRIX43
:
8477 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8478 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8481 case OPCODE_USE_PROGRAM_STAGES
:
8482 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8484 case OPCODE_PROGRAM_UNIFORM_1F
:
8485 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8487 case OPCODE_PROGRAM_UNIFORM_2F
:
8488 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8490 case OPCODE_PROGRAM_UNIFORM_3F
:
8491 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8492 n
[3].f
, n
[4].f
, n
[5].f
));
8494 case OPCODE_PROGRAM_UNIFORM_4F
:
8495 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8496 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8498 case OPCODE_PROGRAM_UNIFORM_1FV
:
8499 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8500 get_pointer(&n
[4])));
8502 case OPCODE_PROGRAM_UNIFORM_2FV
:
8503 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8504 get_pointer(&n
[4])));
8506 case OPCODE_PROGRAM_UNIFORM_3FV
:
8507 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8508 get_pointer(&n
[4])));
8510 case OPCODE_PROGRAM_UNIFORM_4FV
:
8511 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8512 get_pointer(&n
[4])));
8514 case OPCODE_PROGRAM_UNIFORM_1I
:
8515 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8517 case OPCODE_PROGRAM_UNIFORM_2I
:
8518 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8520 case OPCODE_PROGRAM_UNIFORM_3I
:
8521 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8522 n
[3].i
, n
[4].i
, n
[5].i
));
8524 case OPCODE_PROGRAM_UNIFORM_4I
:
8525 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8526 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8528 case OPCODE_PROGRAM_UNIFORM_1IV
:
8529 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8530 get_pointer(&n
[4])));
8532 case OPCODE_PROGRAM_UNIFORM_2IV
:
8533 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8534 get_pointer(&n
[4])));
8536 case OPCODE_PROGRAM_UNIFORM_3IV
:
8537 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8538 get_pointer(&n
[4])));
8540 case OPCODE_PROGRAM_UNIFORM_4IV
:
8541 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8542 get_pointer(&n
[4])));
8544 case OPCODE_PROGRAM_UNIFORM_1UI
:
8545 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8547 case OPCODE_PROGRAM_UNIFORM_2UI
:
8548 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8551 case OPCODE_PROGRAM_UNIFORM_3UI
:
8552 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8553 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8555 case OPCODE_PROGRAM_UNIFORM_4UI
:
8556 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8558 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8560 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8561 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8562 get_pointer(&n
[4])));
8564 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8565 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8566 get_pointer(&n
[4])));
8568 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8569 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8570 get_pointer(&n
[4])));
8572 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8573 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8574 get_pointer(&n
[4])));
8576 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8577 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8578 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8579 get_pointer(&n
[5])));
8581 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8582 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8583 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8584 get_pointer(&n
[5])));
8586 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8587 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8588 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8589 get_pointer(&n
[5])));
8591 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8592 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8593 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8594 get_pointer(&n
[5])));
8596 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8597 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8598 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8599 get_pointer(&n
[5])));
8601 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8602 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8603 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8604 get_pointer(&n
[5])));
8606 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8607 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8608 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8609 get_pointer(&n
[5])));
8611 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8612 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8613 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8614 get_pointer(&n
[5])));
8616 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8617 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8618 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8619 get_pointer(&n
[5])));
8622 case OPCODE_CLIP_CONTROL
:
8623 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8626 case OPCODE_CLAMP_COLOR
:
8627 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8630 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8631 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8633 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8634 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8636 case OPCODE_ATTR_1F_NV
:
8637 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8639 case OPCODE_ATTR_2F_NV
:
8640 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8642 case OPCODE_ATTR_3F_NV
:
8643 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8645 case OPCODE_ATTR_4F_NV
:
8646 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8648 case OPCODE_ATTR_1F_ARB
:
8649 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8651 case OPCODE_ATTR_2F_ARB
:
8652 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8654 case OPCODE_ATTR_3F_ARB
:
8655 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8657 case OPCODE_ATTR_4F_ARB
:
8658 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8660 case OPCODE_MATERIAL
:
8661 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8664 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8667 CALL_End(ctx
->Exec
, ());
8670 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8672 case OPCODE_EVAL_C1
:
8673 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8675 case OPCODE_EVAL_C2
:
8676 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8678 case OPCODE_EVAL_P1
:
8679 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8681 case OPCODE_EVAL_P2
:
8682 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8685 /* GL_EXT_texture_integer */
8686 case OPCODE_CLEARCOLOR_I
:
8687 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8689 case OPCODE_CLEARCOLOR_UI
:
8690 CALL_ClearColorIuiEXT(ctx
->Exec
,
8691 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8693 case OPCODE_TEXPARAMETER_I
:
8700 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8703 case OPCODE_TEXPARAMETER_UI
:
8706 params
[0] = n
[3].ui
;
8707 params
[1] = n
[4].ui
;
8708 params
[2] = n
[5].ui
;
8709 params
[3] = n
[6].ui
;
8710 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8714 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8715 /* GL_ARB_instanced_arrays */
8716 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8719 case OPCODE_TEXTURE_BARRIER_NV
:
8720 CALL_TextureBarrierNV(ctx
->Exec
, ());
8723 /* GL_EXT/ARB_transform_feedback */
8724 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8725 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8727 case OPCODE_END_TRANSFORM_FEEDBACK
:
8728 CALL_EndTransformFeedback(ctx
->Exec
, ());
8730 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8731 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8733 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8734 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8736 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8737 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8739 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8740 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8742 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8743 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8744 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8746 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8747 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8748 (n
[1].e
, n
[2].ui
, n
[3].si
));
8750 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8751 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8752 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8756 case OPCODE_BIND_SAMPLER
:
8757 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8759 case OPCODE_SAMPLER_PARAMETERIV
:
8766 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8769 case OPCODE_SAMPLER_PARAMETERFV
:
8776 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8779 case OPCODE_SAMPLER_PARAMETERIIV
:
8786 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8789 case OPCODE_SAMPLER_PARAMETERUIV
:
8792 params
[0] = n
[3].ui
;
8793 params
[1] = n
[4].ui
;
8794 params
[2] = n
[5].ui
;
8795 params
[3] = n
[6].ui
;
8796 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8801 case OPCODE_WAIT_SYNC
:
8803 union uint64_pair p
;
8804 p
.uint32
[0] = n
[2].ui
;
8805 p
.uint32
[1] = n
[3].ui
;
8806 CALL_WaitSync(ctx
->Exec
,
8807 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8811 /* GL_NV_conditional_render */
8812 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8813 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8815 case OPCODE_END_CONDITIONAL_RENDER
:
8816 CALL_EndConditionalRender(ctx
->Exec
, ());
8819 case OPCODE_UNIFORM_BLOCK_BINDING
:
8820 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8823 case OPCODE_CONTINUE
:
8824 n
= (Node
*) get_pointer(&n
[1]);
8829 case OPCODE_END_OF_LIST
:
8835 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8837 _mesa_problem(ctx
, "%s", msg
);
8842 /* increment n to point to next compiled command */
8843 if (opcode
!= OPCODE_CONTINUE
) {
8844 n
+= InstSize
[opcode
];
8849 vbo_save_EndCallList(ctx
);
8851 ctx
->ListState
.CallDepth
--;
8856 /**********************************************************************/
8858 /**********************************************************************/
8861 * Test if a display list number is valid.
8863 GLboolean GLAPIENTRY
8864 _mesa_IsList(GLuint list
)
8866 GET_CURRENT_CONTEXT(ctx
);
8867 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8868 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8869 return islist(ctx
, list
);
8874 * Delete a sequence of consecutive display lists.
8877 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8879 GET_CURRENT_CONTEXT(ctx
);
8881 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8882 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8885 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8888 for (i
= list
; i
< list
+ range
; i
++) {
8889 destroy_list(ctx
, i
);
8895 * Return a display list number, n, such that lists n through n+range-1
8899 _mesa_GenLists(GLsizei range
)
8901 GET_CURRENT_CONTEXT(ctx
);
8903 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8904 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8907 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8915 * Make this an atomic operation
8917 mtx_lock(&ctx
->Shared
->Mutex
);
8919 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8921 /* reserve the list IDs by with empty/dummy lists */
8923 for (i
= 0; i
< range
; i
++) {
8924 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8925 make_list(base
+ i
, 1));
8929 mtx_unlock(&ctx
->Shared
->Mutex
);
8936 * Begin a new display list.
8939 _mesa_NewList(GLuint name
, GLenum mode
)
8941 GET_CURRENT_CONTEXT(ctx
);
8943 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8944 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8946 if (MESA_VERBOSE
& VERBOSE_API
)
8947 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8948 _mesa_enum_to_string(mode
));
8951 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8955 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8956 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8960 if (ctx
->ListState
.CurrentList
) {
8961 /* already compiling a display list */
8962 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8966 ctx
->CompileFlag
= GL_TRUE
;
8967 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8969 /* Reset accumulated list state */
8970 invalidate_saved_current_state( ctx
);
8972 /* Allocate new display list */
8973 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8974 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8975 ctx
->ListState
.CurrentPos
= 0;
8977 vbo_save_NewList(ctx
, name
, mode
);
8979 ctx
->CurrentDispatch
= ctx
->Save
;
8980 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8985 * End definition of current display list.
8990 GET_CURRENT_CONTEXT(ctx
);
8991 SAVE_FLUSH_VERTICES(ctx
);
8992 FLUSH_VERTICES(ctx
, 0);
8994 if (MESA_VERBOSE
& VERBOSE_API
)
8995 _mesa_debug(ctx
, "glEndList\n");
8997 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8998 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8999 "glEndList() called inside glBegin/End");
9002 /* Check that a list is under construction */
9003 if (!ctx
->ListState
.CurrentList
) {
9004 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9008 /* Call before emitting END_OF_LIST, in case the driver wants to
9009 * emit opcodes itself.
9011 vbo_save_EndList(ctx
);
9013 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9017 /* Destroy old list, if any */
9018 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9020 /* Install the new list */
9021 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9022 ctx
->ListState
.CurrentList
->Name
,
9023 ctx
->ListState
.CurrentList
);
9026 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9027 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9029 ctx
->ListState
.CurrentList
= NULL
;
9030 ctx
->ListState
.CurrentBlock
= NULL
;
9031 ctx
->ListState
.CurrentPos
= 0;
9032 ctx
->ExecuteFlag
= GL_TRUE
;
9033 ctx
->CompileFlag
= GL_FALSE
;
9035 ctx
->CurrentDispatch
= ctx
->Exec
;
9036 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9041 _mesa_CallList(GLuint list
)
9043 GLboolean save_compile_flag
;
9044 GET_CURRENT_CONTEXT(ctx
);
9045 FLUSH_CURRENT(ctx
, 0);
9047 if (MESA_VERBOSE
& VERBOSE_API
)
9048 _mesa_debug(ctx
, "glCallList %d\n", list
);
9051 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9056 mesa_print_display_list( list
);
9058 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9059 * execute the display list, and restore the CompileFlag.
9061 save_compile_flag
= ctx
->CompileFlag
;
9062 if (save_compile_flag
) {
9063 ctx
->CompileFlag
= GL_FALSE
;
9066 execute_list(ctx
, list
);
9067 ctx
->CompileFlag
= save_compile_flag
;
9069 /* also restore API function pointers to point to "save" versions */
9070 if (save_compile_flag
) {
9071 ctx
->CurrentDispatch
= ctx
->Save
;
9072 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9078 * Execute glCallLists: call multiple display lists.
9081 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9083 GET_CURRENT_CONTEXT(ctx
);
9085 GLboolean save_compile_flag
;
9087 if (MESA_VERBOSE
& VERBOSE_API
)
9088 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9092 case GL_UNSIGNED_BYTE
:
9094 case GL_UNSIGNED_SHORT
:
9096 case GL_UNSIGNED_INT
:
9104 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9108 /* Save the CompileFlag status, turn it off, execute display list,
9109 * and restore the CompileFlag.
9111 save_compile_flag
= ctx
->CompileFlag
;
9112 ctx
->CompileFlag
= GL_FALSE
;
9114 for (i
= 0; i
< n
; i
++) {
9115 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9116 execute_list(ctx
, list
);
9119 ctx
->CompileFlag
= save_compile_flag
;
9121 /* also restore API function pointers to point to "save" versions */
9122 if (save_compile_flag
) {
9123 ctx
->CurrentDispatch
= ctx
->Save
;
9124 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9130 * Set the offset added to list numbers in glCallLists.
9133 _mesa_ListBase(GLuint base
)
9135 GET_CURRENT_CONTEXT(ctx
);
9136 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9137 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9138 ctx
->List
.ListBase
= base
;
9142 * Setup the given dispatch table to point to Mesa's display list
9143 * building functions.
9145 * This does not include any of the tnl functions - they are
9146 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9150 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9152 struct _glapi_table
*table
= ctx
->Save
;
9153 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9155 /* Initially populate the dispatch table with the contents of the
9156 * normal-execution dispatch table. This lets us skip populating functions
9157 * that should be called directly instead of compiled into display lists.
9159 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9161 _mesa_loopback_init_api_table(ctx
, table
);
9164 vbo_initialize_save_dispatch(ctx
, table
);
9167 SET_Accum(table
, save_Accum
);
9168 SET_AlphaFunc(table
, save_AlphaFunc
);
9169 SET_Bitmap(table
, save_Bitmap
);
9170 SET_BlendFunc(table
, save_BlendFunc
);
9171 SET_CallList(table
, save_CallList
);
9172 SET_CallLists(table
, save_CallLists
);
9173 SET_Clear(table
, save_Clear
);
9174 SET_ClearAccum(table
, save_ClearAccum
);
9175 SET_ClearColor(table
, save_ClearColor
);
9176 SET_ClearDepth(table
, save_ClearDepth
);
9177 SET_ClearIndex(table
, save_ClearIndex
);
9178 SET_ClearStencil(table
, save_ClearStencil
);
9179 SET_ClipPlane(table
, save_ClipPlane
);
9180 SET_ColorMask(table
, save_ColorMask
);
9181 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9182 SET_ColorMaterial(table
, save_ColorMaterial
);
9183 SET_CopyPixels(table
, save_CopyPixels
);
9184 SET_CullFace(table
, save_CullFace
);
9185 SET_DepthFunc(table
, save_DepthFunc
);
9186 SET_DepthMask(table
, save_DepthMask
);
9187 SET_DepthRange(table
, save_DepthRange
);
9188 SET_Disable(table
, save_Disable
);
9189 SET_Disablei(table
, save_DisableIndexed
);
9190 SET_DrawBuffer(table
, save_DrawBuffer
);
9191 SET_DrawPixels(table
, save_DrawPixels
);
9192 SET_Enable(table
, save_Enable
);
9193 SET_Enablei(table
, save_EnableIndexed
);
9194 SET_EvalMesh1(table
, save_EvalMesh1
);
9195 SET_EvalMesh2(table
, save_EvalMesh2
);
9196 SET_Fogf(table
, save_Fogf
);
9197 SET_Fogfv(table
, save_Fogfv
);
9198 SET_Fogi(table
, save_Fogi
);
9199 SET_Fogiv(table
, save_Fogiv
);
9200 SET_FrontFace(table
, save_FrontFace
);
9201 SET_Frustum(table
, save_Frustum
);
9202 SET_Hint(table
, save_Hint
);
9203 SET_IndexMask(table
, save_IndexMask
);
9204 SET_InitNames(table
, save_InitNames
);
9205 SET_LightModelf(table
, save_LightModelf
);
9206 SET_LightModelfv(table
, save_LightModelfv
);
9207 SET_LightModeli(table
, save_LightModeli
);
9208 SET_LightModeliv(table
, save_LightModeliv
);
9209 SET_Lightf(table
, save_Lightf
);
9210 SET_Lightfv(table
, save_Lightfv
);
9211 SET_Lighti(table
, save_Lighti
);
9212 SET_Lightiv(table
, save_Lightiv
);
9213 SET_LineStipple(table
, save_LineStipple
);
9214 SET_LineWidth(table
, save_LineWidth
);
9215 SET_ListBase(table
, save_ListBase
);
9216 SET_LoadIdentity(table
, save_LoadIdentity
);
9217 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9218 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9219 SET_LoadName(table
, save_LoadName
);
9220 SET_LogicOp(table
, save_LogicOp
);
9221 SET_Map1d(table
, save_Map1d
);
9222 SET_Map1f(table
, save_Map1f
);
9223 SET_Map2d(table
, save_Map2d
);
9224 SET_Map2f(table
, save_Map2f
);
9225 SET_MapGrid1d(table
, save_MapGrid1d
);
9226 SET_MapGrid1f(table
, save_MapGrid1f
);
9227 SET_MapGrid2d(table
, save_MapGrid2d
);
9228 SET_MapGrid2f(table
, save_MapGrid2f
);
9229 SET_MatrixMode(table
, save_MatrixMode
);
9230 SET_MultMatrixd(table
, save_MultMatrixd
);
9231 SET_MultMatrixf(table
, save_MultMatrixf
);
9232 SET_NewList(table
, save_NewList
);
9233 SET_Ortho(table
, save_Ortho
);
9234 SET_PassThrough(table
, save_PassThrough
);
9235 SET_PixelMapfv(table
, save_PixelMapfv
);
9236 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9237 SET_PixelMapusv(table
, save_PixelMapusv
);
9238 SET_PixelTransferf(table
, save_PixelTransferf
);
9239 SET_PixelTransferi(table
, save_PixelTransferi
);
9240 SET_PixelZoom(table
, save_PixelZoom
);
9241 SET_PointSize(table
, save_PointSize
);
9242 SET_PolygonMode(table
, save_PolygonMode
);
9243 SET_PolygonOffset(table
, save_PolygonOffset
);
9244 SET_PolygonStipple(table
, save_PolygonStipple
);
9245 SET_PopAttrib(table
, save_PopAttrib
);
9246 SET_PopMatrix(table
, save_PopMatrix
);
9247 SET_PopName(table
, save_PopName
);
9248 SET_PushAttrib(table
, save_PushAttrib
);
9249 SET_PushMatrix(table
, save_PushMatrix
);
9250 SET_PushName(table
, save_PushName
);
9251 SET_RasterPos2d(table
, save_RasterPos2d
);
9252 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9253 SET_RasterPos2f(table
, save_RasterPos2f
);
9254 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9255 SET_RasterPos2i(table
, save_RasterPos2i
);
9256 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9257 SET_RasterPos2s(table
, save_RasterPos2s
);
9258 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9259 SET_RasterPos3d(table
, save_RasterPos3d
);
9260 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9261 SET_RasterPos3f(table
, save_RasterPos3f
);
9262 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9263 SET_RasterPos3i(table
, save_RasterPos3i
);
9264 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9265 SET_RasterPos3s(table
, save_RasterPos3s
);
9266 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9267 SET_RasterPos4d(table
, save_RasterPos4d
);
9268 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9269 SET_RasterPos4f(table
, save_RasterPos4f
);
9270 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9271 SET_RasterPos4i(table
, save_RasterPos4i
);
9272 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9273 SET_RasterPos4s(table
, save_RasterPos4s
);
9274 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9275 SET_ReadBuffer(table
, save_ReadBuffer
);
9276 SET_Rectf(table
, save_Rectf
);
9277 SET_Rotated(table
, save_Rotated
);
9278 SET_Rotatef(table
, save_Rotatef
);
9279 SET_Scaled(table
, save_Scaled
);
9280 SET_Scalef(table
, save_Scalef
);
9281 SET_Scissor(table
, save_Scissor
);
9282 SET_ShadeModel(table
, save_ShadeModel
);
9283 SET_StencilFunc(table
, save_StencilFunc
);
9284 SET_StencilMask(table
, save_StencilMask
);
9285 SET_StencilOp(table
, save_StencilOp
);
9286 SET_TexEnvf(table
, save_TexEnvf
);
9287 SET_TexEnvfv(table
, save_TexEnvfv
);
9288 SET_TexEnvi(table
, save_TexEnvi
);
9289 SET_TexEnviv(table
, save_TexEnviv
);
9290 SET_TexGend(table
, save_TexGend
);
9291 SET_TexGendv(table
, save_TexGendv
);
9292 SET_TexGenf(table
, save_TexGenf
);
9293 SET_TexGenfv(table
, save_TexGenfv
);
9294 SET_TexGeni(table
, save_TexGeni
);
9295 SET_TexGeniv(table
, save_TexGeniv
);
9296 SET_TexImage1D(table
, save_TexImage1D
);
9297 SET_TexImage2D(table
, save_TexImage2D
);
9298 SET_TexParameterf(table
, save_TexParameterf
);
9299 SET_TexParameterfv(table
, save_TexParameterfv
);
9300 SET_TexParameteri(table
, save_TexParameteri
);
9301 SET_TexParameteriv(table
, save_TexParameteriv
);
9302 SET_Translated(table
, save_Translated
);
9303 SET_Translatef(table
, save_Translatef
);
9304 SET_Viewport(table
, save_Viewport
);
9307 SET_BindTexture(table
, save_BindTexture
);
9308 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9309 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9310 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9311 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9312 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9313 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9314 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9317 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9318 SET_TexImage3D(table
, save_TexImage3D
);
9319 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9322 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9323 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9324 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9326 /* ATI_separate_stencil */
9327 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9329 /* GL_ARB_imaging */
9330 /* Not all are supported */
9331 SET_BlendColor(table
, save_BlendColor
);
9332 SET_BlendEquation(table
, save_BlendEquation
);
9334 /* 2. GL_EXT_blend_color */
9336 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9339 /* 3. GL_EXT_polygon_offset */
9340 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9342 /* 6. GL_EXT_texture3d */
9344 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9345 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9346 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9349 /* 37. GL_EXT_blend_minmax */
9351 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9354 /* 54. GL_EXT_point_parameters */
9355 SET_PointParameterf(table
, save_PointParameterfEXT
);
9356 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9358 /* 173. GL_EXT_blend_func_separate */
9359 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9361 /* 197. GL_MESA_window_pos */
9362 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9363 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9364 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9365 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9366 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9367 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9368 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9369 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9370 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9371 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9372 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9373 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9374 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9375 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9376 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9377 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9378 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9379 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9380 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9381 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9382 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9383 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9384 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9385 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9387 /* 233. GL_NV_vertex_program */
9388 /* The following commands DO NOT go into display lists:
9389 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9390 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9392 SET_BindProgramARB(table
, save_BindProgramNV
);
9394 /* 245. GL_ATI_fragment_shader */
9395 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9396 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9398 /* 262. GL_NV_point_sprite */
9399 SET_PointParameteri(table
, save_PointParameteriNV
);
9400 SET_PointParameteriv(table
, save_PointParameterivNV
);
9402 /* 268. GL_EXT_stencil_two_side */
9403 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9405 /* ???. GL_EXT_depth_bounds_test */
9406 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9408 /* ARB 1. GL_ARB_multitexture */
9409 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9411 /* ARB 3. GL_ARB_transpose_matrix */
9412 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9413 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9414 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9415 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9417 /* ARB 5. GL_ARB_multisample */
9418 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9420 /* ARB 12. GL_ARB_texture_compression */
9421 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9422 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9423 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9424 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9425 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9426 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9428 /* ARB 14. GL_ARB_point_parameters */
9429 /* aliased with EXT_point_parameters functions */
9431 /* ARB 25. GL_ARB_window_pos */
9432 /* aliased with MESA_window_pos functions */
9434 /* ARB 26. GL_ARB_vertex_program */
9435 /* ARB 27. GL_ARB_fragment_program */
9436 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9437 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9438 SET_BindProgramARB(table
, save_BindProgramNV
);
9439 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9440 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9441 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9442 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9443 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9444 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9445 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9446 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9448 SET_BeginQuery(table
, save_BeginQueryARB
);
9449 SET_EndQuery(table
, save_EndQueryARB
);
9450 SET_QueryCounter(table
, save_QueryCounter
);
9452 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9454 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9456 SET_UseProgram(table
, save_UseProgram
);
9457 SET_Uniform1f(table
, save_Uniform1fARB
);
9458 SET_Uniform2f(table
, save_Uniform2fARB
);
9459 SET_Uniform3f(table
, save_Uniform3fARB
);
9460 SET_Uniform4f(table
, save_Uniform4fARB
);
9461 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9462 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9463 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9464 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9465 SET_Uniform1i(table
, save_Uniform1iARB
);
9466 SET_Uniform2i(table
, save_Uniform2iARB
);
9467 SET_Uniform3i(table
, save_Uniform3iARB
);
9468 SET_Uniform4i(table
, save_Uniform4iARB
);
9469 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9470 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9471 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9472 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9473 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9474 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9475 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9476 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9477 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9478 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9479 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9480 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9481 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9483 /* 299. GL_EXT_blend_equation_separate */
9484 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9486 /* GL_EXT_gpu_program_parameters */
9487 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9488 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9490 /* 364. GL_EXT_provoking_vertex */
9491 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9493 /* GL_EXT_texture_integer */
9494 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9495 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9496 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9497 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9499 /* GL_ARB_clip_control */
9500 SET_ClipControl(table
, save_ClipControl
);
9502 /* GL_ARB_color_buffer_float */
9503 SET_ClampColor(table
, save_ClampColorARB
);
9506 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9507 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9508 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9509 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9511 SET_Uniform1ui(table
, save_Uniform1ui
);
9512 SET_Uniform2ui(table
, save_Uniform2ui
);
9513 SET_Uniform3ui(table
, save_Uniform3ui
);
9514 SET_Uniform4ui(table
, save_Uniform4ui
);
9515 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9516 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9517 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9518 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9520 (void) save_Uniform1ui
;
9521 (void) save_Uniform2ui
;
9522 (void) save_Uniform3ui
;
9523 (void) save_Uniform4ui
;
9524 (void) save_Uniform1uiv
;
9525 (void) save_Uniform2uiv
;
9526 (void) save_Uniform3uiv
;
9527 (void) save_Uniform4uiv
;
9531 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9532 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9533 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9534 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9535 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9536 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9537 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9538 SET_DrawTransformFeedbackInstanced(table
,
9539 save_DrawTransformFeedbackInstanced
);
9540 SET_DrawTransformFeedbackStreamInstanced(table
,
9541 save_DrawTransformFeedbackStreamInstanced
);
9542 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9543 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9545 /* GL_ARB_instanced_arrays */
9546 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9548 /* GL_NV_texture_barrier */
9549 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9551 SET_BindSampler(table
, save_BindSampler
);
9552 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9553 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9554 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9555 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9556 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9557 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9559 /* GL_ARB_draw_buffer_blend */
9560 SET_BlendFunciARB(table
, save_BlendFunci
);
9561 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9562 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9563 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9565 /* GL_NV_conditional_render */
9566 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9567 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9570 SET_WaitSync(table
, save_WaitSync
);
9572 /* GL_ARB_uniform_buffer_object */
9573 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9575 /* GL_ARB_draw_instanced */
9576 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9577 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9579 /* GL_ARB_draw_elements_base_vertex */
9580 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9582 /* GL_ARB_base_instance */
9583 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9584 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9585 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9587 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9588 SET_UseProgramStages(table
, save_UseProgramStages
);
9589 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9590 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9591 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9592 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9593 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9594 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9595 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9596 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9597 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9598 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9599 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9600 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9601 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9602 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9603 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9604 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9605 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9606 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9607 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9608 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9609 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9610 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9611 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9612 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9613 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9614 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9615 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9616 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9617 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9618 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9619 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9620 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9621 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9623 /* GL_EXT_polygon_offset_clamp */
9624 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
9630 enum_string(GLenum k
)
9632 return _mesa_enum_to_string(k
);
9637 * Print the commands in a display list. For debugging only.
9638 * TODO: many commands aren't handled yet.
9639 * \param fname filename to write display list to. If null, use stdout.
9641 static void GLAPIENTRY
9642 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9644 struct gl_display_list
*dlist
;
9650 f
= fopen(fname
, "w");
9655 if (!islist(ctx
, list
)) {
9656 fprintf(f
, "%u is not a display list ID\n", list
);
9660 dlist
= _mesa_lookup_list(ctx
, list
);
9666 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9668 done
= n
? GL_FALSE
: GL_TRUE
;
9670 const OpCode opcode
= n
[0].opcode
;
9672 if (is_ext_opcode(opcode
)) {
9673 n
+= ext_opcode_print(ctx
, n
, f
);
9678 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9680 case OPCODE_ACTIVE_TEXTURE
:
9681 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9684 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9685 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9686 get_pointer(&n
[7]));
9688 case OPCODE_BLEND_COLOR
:
9689 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
9690 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9692 case OPCODE_BLEND_EQUATION
:
9693 fprintf(f
, "BlendEquation %s\n",
9694 enum_string(n
[1].e
));
9696 case OPCODE_BLEND_EQUATION_SEPARATE
:
9697 fprintf(f
, "BlendEquationSeparate %s, %s\n",
9698 enum_string(n
[1].e
),
9699 enum_string(n
[2].e
));
9701 case OPCODE_BLEND_FUNC_SEPARATE
:
9702 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
9703 enum_string(n
[1].e
),
9704 enum_string(n
[2].e
),
9705 enum_string(n
[3].e
),
9706 enum_string(n
[4].e
));
9708 case OPCODE_BLEND_EQUATION_I
:
9709 fprintf(f
, "BlendEquationi %u, %s\n",
9710 n
[1].ui
, enum_string(n
[2].e
));
9712 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
9713 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
9714 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9716 case OPCODE_BLEND_FUNC_I
:
9717 fprintf(f
, "BlendFunci %u, %s, %s\n",
9718 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9720 case OPCODE_BLEND_FUNC_SEPARATE_I
:
9721 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
9723 enum_string(n
[2].e
),
9724 enum_string(n
[3].e
),
9725 enum_string(n
[4].e
),
9726 enum_string(n
[5].e
));
9728 case OPCODE_CALL_LIST
:
9729 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9731 case OPCODE_CALL_LIST_OFFSET
:
9732 fprintf(f
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9733 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9735 case OPCODE_DISABLE
:
9736 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9739 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9741 case OPCODE_FRUSTUM
:
9742 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9743 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9745 case OPCODE_LINE_STIPPLE
:
9746 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9748 case OPCODE_LINE_WIDTH
:
9749 fprintf(f
, "LineWidth %f\n", n
[1].f
);
9751 case OPCODE_LOAD_IDENTITY
:
9752 fprintf(f
, "LoadIdentity\n");
9754 case OPCODE_LOAD_MATRIX
:
9755 fprintf(f
, "LoadMatrix\n");
9756 fprintf(f
, " %8f %8f %8f %8f\n",
9757 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9758 fprintf(f
, " %8f %8f %8f %8f\n",
9759 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9760 fprintf(f
, " %8f %8f %8f %8f\n",
9761 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9762 fprintf(f
, " %8f %8f %8f %8f\n",
9763 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9765 case OPCODE_MULT_MATRIX
:
9766 fprintf(f
, "MultMatrix (or Rotate)\n");
9767 fprintf(f
, " %8f %8f %8f %8f\n",
9768 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9769 fprintf(f
, " %8f %8f %8f %8f\n",
9770 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9771 fprintf(f
, " %8f %8f %8f %8f\n",
9772 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9773 fprintf(f
, " %8f %8f %8f %8f\n",
9774 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9777 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9778 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9780 case OPCODE_POINT_SIZE
:
9781 fprintf(f
, "PointSize %f\n", n
[1].f
);
9783 case OPCODE_POP_ATTRIB
:
9784 fprintf(f
, "PopAttrib\n");
9786 case OPCODE_POP_MATRIX
:
9787 fprintf(f
, "PopMatrix\n");
9789 case OPCODE_POP_NAME
:
9790 fprintf(f
, "PopName\n");
9792 case OPCODE_PUSH_ATTRIB
:
9793 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9795 case OPCODE_PUSH_MATRIX
:
9796 fprintf(f
, "PushMatrix\n");
9798 case OPCODE_PUSH_NAME
:
9799 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9801 case OPCODE_RASTER_POS
:
9802 fprintf(f
, "RasterPos %g %g %g %g\n",
9803 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9806 fprintf(f
, "Rotate %g %g %g %g\n",
9807 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9810 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9812 case OPCODE_TRANSLATE
:
9813 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9815 case OPCODE_BIND_TEXTURE
:
9816 fprintf(f
, "BindTexture %s %d\n",
9817 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
9819 case OPCODE_SHADE_MODEL
:
9820 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
9823 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9824 _mesa_enum_to_string(n
[1].ui
),
9825 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9828 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9829 _mesa_enum_to_string(n
[1].ui
),
9830 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9831 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9833 case OPCODE_MAPGRID1
:
9834 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9836 case OPCODE_MAPGRID2
:
9837 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9838 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9840 case OPCODE_EVALMESH1
:
9841 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9843 case OPCODE_EVALMESH2
:
9844 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9845 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9848 case OPCODE_ATTR_1F_NV
:
9849 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9851 case OPCODE_ATTR_2F_NV
:
9852 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9853 n
[1].i
, n
[2].f
, n
[3].f
);
9855 case OPCODE_ATTR_3F_NV
:
9856 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9857 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9859 case OPCODE_ATTR_4F_NV
:
9860 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9861 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9863 case OPCODE_ATTR_1F_ARB
:
9864 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9866 case OPCODE_ATTR_2F_ARB
:
9867 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9868 n
[1].i
, n
[2].f
, n
[3].f
);
9870 case OPCODE_ATTR_3F_ARB
:
9871 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9872 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9874 case OPCODE_ATTR_4F_ARB
:
9875 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9876 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9879 case OPCODE_MATERIAL
:
9880 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9881 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9884 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9887 fprintf(f
, "END\n");
9890 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9893 case OPCODE_EVAL_C1
:
9894 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9896 case OPCODE_EVAL_C2
:
9897 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9899 case OPCODE_EVAL_P1
:
9900 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9902 case OPCODE_EVAL_P2
:
9903 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9906 case OPCODE_PROVOKING_VERTEX
:
9907 fprintf(f
, "ProvokingVertex %s\n",
9908 _mesa_enum_to_string(n
[1].ui
));
9912 * meta opcodes/commands
9915 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
9916 (const char *) get_pointer(&n
[2]));
9918 case OPCODE_CONTINUE
:
9919 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
9920 n
= (Node
*) get_pointer(&n
[1]);
9923 fprintf(f
, "NOP\n");
9925 case OPCODE_END_OF_LIST
:
9926 fprintf(f
, "END-LIST %u\n", list
);
9930 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9932 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9933 opcode
, (void *) n
);
9937 fprintf(f
, "command %d, %u operands\n", opcode
,
9941 /* increment n to point to next compiled command */
9942 if (opcode
!= OPCODE_CONTINUE
) {
9943 n
+= InstSize
[opcode
];
9956 * Clients may call this function to help debug display list problems.
9957 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9958 * changed, or break in the future without notice.
9961 mesa_print_display_list(GLuint list
)
9963 GET_CURRENT_CONTEXT(ctx
);
9964 print_list(ctx
, list
, NULL
);
9968 /**********************************************************************/
9969 /***** Initialization *****/
9970 /**********************************************************************/
9973 save_vtxfmt_init(GLvertexformat
* vfmt
)
9975 vfmt
->ArrayElement
= _ae_ArrayElement
;
9977 vfmt
->Begin
= save_Begin
;
9979 vfmt
->CallList
= save_CallList
;
9980 vfmt
->CallLists
= save_CallLists
;
9982 vfmt
->Color3f
= save_Color3f
;
9983 vfmt
->Color3fv
= save_Color3fv
;
9984 vfmt
->Color4f
= save_Color4f
;
9985 vfmt
->Color4fv
= save_Color4fv
;
9986 vfmt
->EdgeFlag
= save_EdgeFlag
;
9987 vfmt
->End
= save_End
;
9989 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9990 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9991 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9992 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9993 vfmt
->EvalPoint1
= save_EvalPoint1
;
9994 vfmt
->EvalPoint2
= save_EvalPoint2
;
9996 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9997 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9998 vfmt
->Indexf
= save_Indexf
;
9999 vfmt
->Indexfv
= save_Indexfv
;
10000 vfmt
->Materialfv
= save_Materialfv
;
10001 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10002 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10003 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10004 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10005 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10006 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10007 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10008 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10009 vfmt
->Normal3f
= save_Normal3f
;
10010 vfmt
->Normal3fv
= save_Normal3fv
;
10011 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10012 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10013 vfmt
->TexCoord1f
= save_TexCoord1f
;
10014 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10015 vfmt
->TexCoord2f
= save_TexCoord2f
;
10016 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10017 vfmt
->TexCoord3f
= save_TexCoord3f
;
10018 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10019 vfmt
->TexCoord4f
= save_TexCoord4f
;
10020 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10021 vfmt
->Vertex2f
= save_Vertex2f
;
10022 vfmt
->Vertex2fv
= save_Vertex2fv
;
10023 vfmt
->Vertex3f
= save_Vertex3f
;
10024 vfmt
->Vertex3fv
= save_Vertex3fv
;
10025 vfmt
->Vertex4f
= save_Vertex4f
;
10026 vfmt
->Vertex4fv
= save_Vertex4fv
;
10027 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10028 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10029 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10030 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10031 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10032 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10033 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10034 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10039 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10040 const GLvertexformat
*vfmt
)
10042 SET_CallList(disp
, vfmt
->CallList
);
10043 SET_CallLists(disp
, vfmt
->CallLists
);
10048 * Initialize display list state for given context.
10051 _mesa_init_display_list(struct gl_context
*ctx
)
10053 static GLboolean tableInitialized
= GL_FALSE
;
10055 /* zero-out the instruction size table, just once */
10056 if (!tableInitialized
) {
10057 memset(InstSize
, 0, sizeof(InstSize
));
10058 tableInitialized
= GL_TRUE
;
10061 /* extension info */
10062 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10065 ctx
->ListState
.CallDepth
= 0;
10066 ctx
->ExecuteFlag
= GL_TRUE
;
10067 ctx
->CompileFlag
= GL_FALSE
;
10068 ctx
->ListState
.CurrentBlock
= NULL
;
10069 ctx
->ListState
.CurrentPos
= 0;
10071 /* Display List group */
10072 ctx
->List
.ListBase
= 0;
10074 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10076 InstSize
[OPCODE_NOP
] = 1;
10081 _mesa_free_display_list_data(struct gl_context
*ctx
)
10083 free(ctx
->ListExt
);
10084 ctx
->ListExt
= NULL
;