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 /* aka UseProgram() */
5986 static void GLAPIENTRY
5987 save_UseProgramObjectARB(GLhandleARB program
)
5989 GET_CURRENT_CONTEXT(ctx
);
5991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5992 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5996 if (ctx
->ExecuteFlag
) {
5997 CALL_UseProgram(ctx
->Exec
, (program
));
6002 static void GLAPIENTRY
6003 save_Uniform1fARB(GLint location
, GLfloat x
)
6005 GET_CURRENT_CONTEXT(ctx
);
6007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6008 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6013 if (ctx
->ExecuteFlag
) {
6014 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6019 static void GLAPIENTRY
6020 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6022 GET_CURRENT_CONTEXT(ctx
);
6024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6025 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6031 if (ctx
->ExecuteFlag
) {
6032 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6037 static void GLAPIENTRY
6038 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6040 GET_CURRENT_CONTEXT(ctx
);
6042 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6043 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6050 if (ctx
->ExecuteFlag
) {
6051 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6056 static void GLAPIENTRY
6057 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6059 GET_CURRENT_CONTEXT(ctx
);
6061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6062 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6070 if (ctx
->ExecuteFlag
) {
6071 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6076 static void GLAPIENTRY
6077 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6079 GET_CURRENT_CONTEXT(ctx
);
6081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6082 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6086 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6088 if (ctx
->ExecuteFlag
) {
6089 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6093 static void GLAPIENTRY
6094 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6096 GET_CURRENT_CONTEXT(ctx
);
6098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6099 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6103 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6105 if (ctx
->ExecuteFlag
) {
6106 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6110 static void GLAPIENTRY
6111 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6113 GET_CURRENT_CONTEXT(ctx
);
6115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6116 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6120 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6122 if (ctx
->ExecuteFlag
) {
6123 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6127 static void GLAPIENTRY
6128 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6130 GET_CURRENT_CONTEXT(ctx
);
6132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6133 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6137 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6139 if (ctx
->ExecuteFlag
) {
6140 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6145 static void GLAPIENTRY
6146 save_Uniform1iARB(GLint location
, GLint x
)
6148 GET_CURRENT_CONTEXT(ctx
);
6150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6151 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6156 if (ctx
->ExecuteFlag
) {
6157 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6161 static void GLAPIENTRY
6162 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6164 GET_CURRENT_CONTEXT(ctx
);
6166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6167 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6173 if (ctx
->ExecuteFlag
) {
6174 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6178 static void GLAPIENTRY
6179 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6181 GET_CURRENT_CONTEXT(ctx
);
6183 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6184 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6191 if (ctx
->ExecuteFlag
) {
6192 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6196 static void GLAPIENTRY
6197 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6199 GET_CURRENT_CONTEXT(ctx
);
6201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6202 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6210 if (ctx
->ExecuteFlag
) {
6211 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6217 static void GLAPIENTRY
6218 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6220 GET_CURRENT_CONTEXT(ctx
);
6222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6223 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6227 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6229 if (ctx
->ExecuteFlag
) {
6230 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6234 static void GLAPIENTRY
6235 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6237 GET_CURRENT_CONTEXT(ctx
);
6239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6240 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6244 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6246 if (ctx
->ExecuteFlag
) {
6247 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6251 static void GLAPIENTRY
6252 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6254 GET_CURRENT_CONTEXT(ctx
);
6256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6257 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6261 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6263 if (ctx
->ExecuteFlag
) {
6264 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6268 static void GLAPIENTRY
6269 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6271 GET_CURRENT_CONTEXT(ctx
);
6273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6274 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6278 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6280 if (ctx
->ExecuteFlag
) {
6281 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6287 static void GLAPIENTRY
6288 save_Uniform1ui(GLint location
, GLuint x
)
6290 GET_CURRENT_CONTEXT(ctx
);
6292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6293 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6298 if (ctx
->ExecuteFlag
) {
6299 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6303 static void GLAPIENTRY
6304 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6306 GET_CURRENT_CONTEXT(ctx
);
6308 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6309 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6315 if (ctx
->ExecuteFlag
) {
6316 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6320 static void GLAPIENTRY
6321 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6323 GET_CURRENT_CONTEXT(ctx
);
6325 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6326 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6333 if (ctx
->ExecuteFlag
) {
6334 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6338 static void GLAPIENTRY
6339 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6341 GET_CURRENT_CONTEXT(ctx
);
6343 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6344 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6352 if (ctx
->ExecuteFlag
) {
6353 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6359 static void GLAPIENTRY
6360 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6362 GET_CURRENT_CONTEXT(ctx
);
6364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6365 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6369 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6371 if (ctx
->ExecuteFlag
) {
6372 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6376 static void GLAPIENTRY
6377 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6379 GET_CURRENT_CONTEXT(ctx
);
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6382 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6386 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6388 if (ctx
->ExecuteFlag
) {
6389 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6393 static void GLAPIENTRY
6394 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6396 GET_CURRENT_CONTEXT(ctx
);
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6399 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6403 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6405 if (ctx
->ExecuteFlag
) {
6406 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6410 static void GLAPIENTRY
6411 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6413 GET_CURRENT_CONTEXT(ctx
);
6415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6416 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6420 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6422 if (ctx
->ExecuteFlag
) {
6423 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6429 static void GLAPIENTRY
6430 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6433 GET_CURRENT_CONTEXT(ctx
);
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6436 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6441 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6443 if (ctx
->ExecuteFlag
) {
6444 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6448 static void GLAPIENTRY
6449 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6452 GET_CURRENT_CONTEXT(ctx
);
6454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6455 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6460 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6462 if (ctx
->ExecuteFlag
) {
6463 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6467 static void GLAPIENTRY
6468 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6471 GET_CURRENT_CONTEXT(ctx
);
6473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6474 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6479 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6481 if (ctx
->ExecuteFlag
) {
6482 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6487 static void GLAPIENTRY
6488 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6491 GET_CURRENT_CONTEXT(ctx
);
6493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6494 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6499 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6501 if (ctx
->ExecuteFlag
) {
6502 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6506 static void GLAPIENTRY
6507 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6510 GET_CURRENT_CONTEXT(ctx
);
6512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6513 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6518 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6520 if (ctx
->ExecuteFlag
) {
6521 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6526 static void GLAPIENTRY
6527 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6530 GET_CURRENT_CONTEXT(ctx
);
6532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6533 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6538 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6540 if (ctx
->ExecuteFlag
) {
6541 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6545 static void GLAPIENTRY
6546 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6549 GET_CURRENT_CONTEXT(ctx
);
6551 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6552 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6557 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6559 if (ctx
->ExecuteFlag
) {
6560 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6565 static void GLAPIENTRY
6566 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6569 GET_CURRENT_CONTEXT(ctx
);
6571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6572 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6577 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6579 if (ctx
->ExecuteFlag
) {
6580 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6584 static void GLAPIENTRY
6585 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6588 GET_CURRENT_CONTEXT(ctx
);
6590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6591 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6596 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6598 if (ctx
->ExecuteFlag
) {
6599 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6603 static void GLAPIENTRY
6604 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6606 GET_CURRENT_CONTEXT(ctx
);
6608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6609 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6615 if (ctx
->ExecuteFlag
) {
6616 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6620 static void GLAPIENTRY
6621 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6623 GET_CURRENT_CONTEXT(ctx
);
6625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6626 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6632 if (ctx
->ExecuteFlag
) {
6633 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6637 static void GLAPIENTRY
6638 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6640 GET_CURRENT_CONTEXT(ctx
);
6642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6643 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6650 if (ctx
->ExecuteFlag
) {
6651 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6655 static void GLAPIENTRY
6656 save_ProgramUniform3f(GLuint program
, GLint location
,
6657 GLfloat x
, GLfloat y
, GLfloat z
)
6659 GET_CURRENT_CONTEXT(ctx
);
6661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6662 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6670 if (ctx
->ExecuteFlag
) {
6671 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6675 static void GLAPIENTRY
6676 save_ProgramUniform4f(GLuint program
, GLint location
,
6677 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6679 GET_CURRENT_CONTEXT(ctx
);
6681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6682 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6691 if (ctx
->ExecuteFlag
) {
6692 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6696 static void GLAPIENTRY
6697 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6700 GET_CURRENT_CONTEXT(ctx
);
6702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6703 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6708 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6710 if (ctx
->ExecuteFlag
) {
6711 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6715 static void GLAPIENTRY
6716 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6719 GET_CURRENT_CONTEXT(ctx
);
6721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6722 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6727 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6729 if (ctx
->ExecuteFlag
) {
6730 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6734 static void GLAPIENTRY
6735 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6738 GET_CURRENT_CONTEXT(ctx
);
6740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6741 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6746 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6748 if (ctx
->ExecuteFlag
) {
6749 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6753 static void GLAPIENTRY
6754 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6757 GET_CURRENT_CONTEXT(ctx
);
6759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6760 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6765 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6767 if (ctx
->ExecuteFlag
) {
6768 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6772 static void GLAPIENTRY
6773 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6775 GET_CURRENT_CONTEXT(ctx
);
6777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6778 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6784 if (ctx
->ExecuteFlag
) {
6785 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6789 static void GLAPIENTRY
6790 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6792 GET_CURRENT_CONTEXT(ctx
);
6794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6795 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6802 if (ctx
->ExecuteFlag
) {
6803 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6807 static void GLAPIENTRY
6808 save_ProgramUniform3i(GLuint program
, GLint location
,
6809 GLint x
, GLint y
, GLint z
)
6811 GET_CURRENT_CONTEXT(ctx
);
6813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6814 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6822 if (ctx
->ExecuteFlag
) {
6823 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6827 static void GLAPIENTRY
6828 save_ProgramUniform4i(GLuint program
, GLint location
,
6829 GLint x
, GLint y
, GLint z
, GLint w
)
6831 GET_CURRENT_CONTEXT(ctx
);
6833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6834 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6843 if (ctx
->ExecuteFlag
) {
6844 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6848 static void GLAPIENTRY
6849 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6852 GET_CURRENT_CONTEXT(ctx
);
6854 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6855 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6860 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6862 if (ctx
->ExecuteFlag
) {
6863 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6867 static void GLAPIENTRY
6868 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6871 GET_CURRENT_CONTEXT(ctx
);
6873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6874 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6879 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6881 if (ctx
->ExecuteFlag
) {
6882 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6886 static void GLAPIENTRY
6887 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6890 GET_CURRENT_CONTEXT(ctx
);
6892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6893 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6898 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6900 if (ctx
->ExecuteFlag
) {
6901 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6905 static void GLAPIENTRY
6906 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6909 GET_CURRENT_CONTEXT(ctx
);
6911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6912 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6917 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6919 if (ctx
->ExecuteFlag
) {
6920 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6924 static void GLAPIENTRY
6925 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6927 GET_CURRENT_CONTEXT(ctx
);
6929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6930 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6936 if (ctx
->ExecuteFlag
) {
6937 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6941 static void GLAPIENTRY
6942 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6944 GET_CURRENT_CONTEXT(ctx
);
6946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6947 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6954 if (ctx
->ExecuteFlag
) {
6955 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6959 static void GLAPIENTRY
6960 save_ProgramUniform3ui(GLuint program
, GLint location
,
6961 GLuint x
, GLuint y
, GLuint z
)
6963 GET_CURRENT_CONTEXT(ctx
);
6965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6966 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6974 if (ctx
->ExecuteFlag
) {
6975 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6979 static void GLAPIENTRY
6980 save_ProgramUniform4ui(GLuint program
, GLint location
,
6981 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6983 GET_CURRENT_CONTEXT(ctx
);
6985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6986 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
6995 if (ctx
->ExecuteFlag
) {
6996 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7000 static void GLAPIENTRY
7001 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7004 GET_CURRENT_CONTEXT(ctx
);
7006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7007 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7012 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7014 if (ctx
->ExecuteFlag
) {
7015 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7019 static void GLAPIENTRY
7020 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7023 GET_CURRENT_CONTEXT(ctx
);
7025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7026 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7031 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7033 if (ctx
->ExecuteFlag
) {
7034 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7038 static void GLAPIENTRY
7039 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7042 GET_CURRENT_CONTEXT(ctx
);
7044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7045 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7050 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7052 if (ctx
->ExecuteFlag
) {
7053 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7057 static void GLAPIENTRY
7058 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7061 GET_CURRENT_CONTEXT(ctx
);
7063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7064 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7069 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7071 if (ctx
->ExecuteFlag
) {
7072 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7076 static void GLAPIENTRY
7077 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7078 GLboolean transpose
, const GLfloat
*v
)
7080 GET_CURRENT_CONTEXT(ctx
);
7082 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7083 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7084 4 + POINTER_DWORDS
);
7090 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7092 if (ctx
->ExecuteFlag
) {
7093 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7094 (program
, location
, count
, transpose
, v
));
7098 static void GLAPIENTRY
7099 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7100 GLboolean transpose
, const GLfloat
*v
)
7102 GET_CURRENT_CONTEXT(ctx
);
7104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7105 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7106 4 + POINTER_DWORDS
);
7112 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7114 if (ctx
->ExecuteFlag
) {
7115 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7116 (program
, location
, count
, transpose
, v
));
7120 static void GLAPIENTRY
7121 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7122 GLboolean transpose
, const GLfloat
*v
)
7124 GET_CURRENT_CONTEXT(ctx
);
7126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7127 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7128 4 + POINTER_DWORDS
);
7134 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7136 if (ctx
->ExecuteFlag
) {
7137 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7138 (program
, location
, count
, transpose
, v
));
7142 static void GLAPIENTRY
7143 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7144 GLboolean transpose
, const GLfloat
*v
)
7146 GET_CURRENT_CONTEXT(ctx
);
7148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7149 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7150 4 + POINTER_DWORDS
);
7156 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7158 if (ctx
->ExecuteFlag
) {
7159 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7160 (program
, location
, count
, transpose
, v
));
7164 static void GLAPIENTRY
7165 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7166 GLboolean transpose
, const GLfloat
*v
)
7168 GET_CURRENT_CONTEXT(ctx
);
7170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7171 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7172 4 + POINTER_DWORDS
);
7178 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7180 if (ctx
->ExecuteFlag
) {
7181 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7182 (program
, location
, count
, transpose
, v
));
7186 static void GLAPIENTRY
7187 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7188 GLboolean transpose
, const GLfloat
*v
)
7190 GET_CURRENT_CONTEXT(ctx
);
7192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7193 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7194 4 + POINTER_DWORDS
);
7200 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7202 if (ctx
->ExecuteFlag
) {
7203 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7204 (program
, location
, count
, transpose
, v
));
7208 static void GLAPIENTRY
7209 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7210 GLboolean transpose
, const GLfloat
*v
)
7212 GET_CURRENT_CONTEXT(ctx
);
7214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7215 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7216 4 + POINTER_DWORDS
);
7222 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7224 if (ctx
->ExecuteFlag
) {
7225 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7226 (program
, location
, count
, transpose
, v
));
7230 static void GLAPIENTRY
7231 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7232 GLboolean transpose
, const GLfloat
*v
)
7234 GET_CURRENT_CONTEXT(ctx
);
7236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7237 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7238 4 + POINTER_DWORDS
);
7244 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7246 if (ctx
->ExecuteFlag
) {
7247 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7248 (program
, location
, count
, transpose
, v
));
7252 static void GLAPIENTRY
7253 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7254 GLboolean transpose
, const GLfloat
*v
)
7256 GET_CURRENT_CONTEXT(ctx
);
7258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7259 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7260 4 + POINTER_DWORDS
);
7266 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7268 if (ctx
->ExecuteFlag
) {
7269 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7270 (program
, location
, count
, transpose
, v
));
7274 static void GLAPIENTRY
7275 save_ClipControl(GLenum origin
, GLenum depth
)
7277 GET_CURRENT_CONTEXT(ctx
);
7279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7280 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7285 if (ctx
->ExecuteFlag
) {
7286 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7290 static void GLAPIENTRY
7291 save_ClampColorARB(GLenum target
, GLenum clamp
)
7293 GET_CURRENT_CONTEXT(ctx
);
7295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7296 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7301 if (ctx
->ExecuteFlag
) {
7302 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7306 /** GL_EXT_texture_integer */
7307 static void GLAPIENTRY
7308 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7310 GET_CURRENT_CONTEXT(ctx
);
7312 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7313 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7320 if (ctx
->ExecuteFlag
) {
7321 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7325 /** GL_EXT_texture_integer */
7326 static void GLAPIENTRY
7327 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7329 GET_CURRENT_CONTEXT(ctx
);
7331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7332 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7339 if (ctx
->ExecuteFlag
) {
7340 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7344 /** GL_EXT_texture_integer */
7345 static void GLAPIENTRY
7346 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7348 GET_CURRENT_CONTEXT(ctx
);
7350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7351 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7360 if (ctx
->ExecuteFlag
) {
7361 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7365 /** GL_EXT_texture_integer */
7366 static void GLAPIENTRY
7367 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7369 GET_CURRENT_CONTEXT(ctx
);
7371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7372 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7376 n
[3].ui
= params
[0];
7377 n
[4].ui
= params
[1];
7378 n
[5].ui
= params
[2];
7379 n
[6].ui
= params
[3];
7381 if (ctx
->ExecuteFlag
) {
7382 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7386 /* GL_ARB_instanced_arrays */
7387 static void GLAPIENTRY
7388 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7390 GET_CURRENT_CONTEXT(ctx
);
7392 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7393 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7398 if (ctx
->ExecuteFlag
) {
7399 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7404 /* GL_NV_texture_barrier */
7405 static void GLAPIENTRY
7406 save_TextureBarrierNV(void)
7408 GET_CURRENT_CONTEXT(ctx
);
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7410 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7411 if (ctx
->ExecuteFlag
) {
7412 CALL_TextureBarrierNV(ctx
->Exec
, ());
7417 /* GL_ARB_sampler_objects */
7418 static void GLAPIENTRY
7419 save_BindSampler(GLuint unit
, GLuint sampler
)
7422 GET_CURRENT_CONTEXT(ctx
);
7423 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7424 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7429 if (ctx
->ExecuteFlag
) {
7430 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7434 static void GLAPIENTRY
7435 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7438 GET_CURRENT_CONTEXT(ctx
);
7439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7440 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7445 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7451 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7454 if (ctx
->ExecuteFlag
) {
7455 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7459 static void GLAPIENTRY
7460 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7464 parray
[1] = parray
[2] = parray
[3] = 0;
7465 save_SamplerParameteriv(sampler
, pname
, parray
);
7468 static void GLAPIENTRY
7469 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7472 GET_CURRENT_CONTEXT(ctx
);
7473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7474 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7479 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7485 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7488 if (ctx
->ExecuteFlag
) {
7489 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7493 static void GLAPIENTRY
7494 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7498 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7499 save_SamplerParameterfv(sampler
, pname
, parray
);
7502 static void GLAPIENTRY
7503 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7506 GET_CURRENT_CONTEXT(ctx
);
7507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7508 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7513 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7519 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7522 if (ctx
->ExecuteFlag
) {
7523 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7527 static void GLAPIENTRY
7528 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7531 GET_CURRENT_CONTEXT(ctx
);
7532 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7533 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7537 n
[3].ui
= params
[0];
7538 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7539 n
[4].ui
= params
[1];
7540 n
[5].ui
= params
[2];
7541 n
[6].ui
= params
[3];
7544 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7547 if (ctx
->ExecuteFlag
) {
7548 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7552 static void GLAPIENTRY
7553 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7556 GET_CURRENT_CONTEXT(ctx
);
7557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7558 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7560 union uint64_pair p
;
7563 n
[2].ui
= p
.uint32
[0];
7564 n
[3].ui
= p
.uint32
[1];
7565 save_pointer(&n
[4], sync
);
7567 if (ctx
->ExecuteFlag
) {
7568 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7573 /** GL_NV_conditional_render */
7574 static void GLAPIENTRY
7575 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7577 GET_CURRENT_CONTEXT(ctx
);
7579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7580 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7585 if (ctx
->ExecuteFlag
) {
7586 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7590 static void GLAPIENTRY
7591 save_EndConditionalRender(void)
7593 GET_CURRENT_CONTEXT(ctx
);
7594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7595 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7596 if (ctx
->ExecuteFlag
) {
7597 CALL_EndConditionalRender(ctx
->Exec
, ());
7601 static void GLAPIENTRY
7602 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7604 GET_CURRENT_CONTEXT(ctx
);
7606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7607 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7613 if (ctx
->ExecuteFlag
) {
7614 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7620 * Save an error-generating command into display list.
7622 * KW: Will appear in the list before the vertex buffer containing the
7623 * command that provoked the error. I don't see this as a problem.
7626 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7629 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7632 save_pointer(&n
[2], (void *) s
);
7633 /* note: the data/string here doesn't have to be freed in
7634 * _mesa_delete_list() since the string is never dynamically
7642 * Compile an error into current display list.
7645 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7647 if (ctx
->CompileFlag
)
7648 save_error(ctx
, error
, s
);
7649 if (ctx
->ExecuteFlag
)
7650 _mesa_error(ctx
, error
, "%s", s
);
7655 * Test if ID names a display list.
7658 islist(struct gl_context
*ctx
, GLuint list
)
7660 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7670 /**********************************************************************/
7671 /* Display list execution */
7672 /**********************************************************************/
7676 * Execute a display list. Note that the ListBase offset must have already
7677 * been added before calling this function. I.e. the list argument is
7678 * the absolute list number, not relative to ListBase.
7679 * \param list - display list number
7682 execute_list(struct gl_context
*ctx
, GLuint list
)
7684 struct gl_display_list
*dlist
;
7688 if (list
== 0 || !islist(ctx
, list
))
7691 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7692 /* raise an error? */
7696 dlist
= _mesa_lookup_list(ctx
, list
);
7700 ctx
->ListState
.CallDepth
++;
7702 vbo_save_BeginCallList(ctx
, dlist
);
7708 const OpCode opcode
= n
[0].opcode
;
7710 if (is_ext_opcode(opcode
)) {
7711 n
+= ext_opcode_execute(ctx
, n
);
7716 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7719 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7721 case OPCODE_ALPHA_FUNC
:
7722 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7724 case OPCODE_BIND_TEXTURE
:
7725 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7729 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7730 ctx
->Unpack
= ctx
->DefaultPacking
;
7731 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7732 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7733 get_pointer(&n
[7])));
7734 ctx
->Unpack
= save
; /* restore */
7737 case OPCODE_BLEND_COLOR
:
7738 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7740 case OPCODE_BLEND_EQUATION
:
7741 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7743 case OPCODE_BLEND_EQUATION_SEPARATE
:
7744 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7746 case OPCODE_BLEND_FUNC_SEPARATE
:
7747 CALL_BlendFuncSeparate(ctx
->Exec
,
7748 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7751 case OPCODE_BLEND_FUNC_I
:
7752 /* GL_ARB_draw_buffers_blend */
7753 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7755 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7756 /* GL_ARB_draw_buffers_blend */
7757 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7760 case OPCODE_BLEND_EQUATION_I
:
7761 /* GL_ARB_draw_buffers_blend */
7762 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7764 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7765 /* GL_ARB_draw_buffers_blend */
7766 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7767 (n
[1].ui
, n
[2].e
, n
[3].e
));
7770 case OPCODE_CALL_LIST
:
7771 /* Generated by glCallList(), don't add ListBase */
7772 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7773 execute_list(ctx
, n
[1].ui
);
7776 case OPCODE_CALL_LIST_OFFSET
:
7777 /* Generated by glCallLists() so we must add ListBase */
7779 /* user specified a bad data type at compile time */
7780 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7782 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7783 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7784 execute_list(ctx
, list
);
7788 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7790 case OPCODE_CLEAR_BUFFER_IV
:
7797 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7800 case OPCODE_CLEAR_BUFFER_UIV
:
7807 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7810 case OPCODE_CLEAR_BUFFER_FV
:
7817 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7820 case OPCODE_CLEAR_BUFFER_FI
:
7821 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7823 case OPCODE_CLEAR_COLOR
:
7824 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7826 case OPCODE_CLEAR_ACCUM
:
7827 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7829 case OPCODE_CLEAR_DEPTH
:
7830 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7832 case OPCODE_CLEAR_INDEX
:
7833 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7835 case OPCODE_CLEAR_STENCIL
:
7836 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7838 case OPCODE_CLIP_PLANE
:
7845 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7848 case OPCODE_COLOR_MASK
:
7849 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7851 case OPCODE_COLOR_MASK_INDEXED
:
7852 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7855 case OPCODE_COLOR_MATERIAL
:
7856 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7858 case OPCODE_COPY_PIXELS
:
7859 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7860 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7863 case OPCODE_COPY_TEX_IMAGE1D
:
7864 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7865 n
[5].i
, n
[6].i
, n
[7].i
));
7867 case OPCODE_COPY_TEX_IMAGE2D
:
7868 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7869 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7871 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7872 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7873 n
[4].i
, n
[5].i
, n
[6].i
));
7875 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7876 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7877 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7880 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7881 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7882 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7885 case OPCODE_CULL_FACE
:
7886 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7888 case OPCODE_DEPTH_FUNC
:
7889 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7891 case OPCODE_DEPTH_MASK
:
7892 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7894 case OPCODE_DEPTH_RANGE
:
7895 CALL_DepthRange(ctx
->Exec
,
7896 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7898 case OPCODE_DISABLE
:
7899 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7901 case OPCODE_DISABLE_INDEXED
:
7902 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7904 case OPCODE_DRAW_BUFFER
:
7905 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7907 case OPCODE_DRAW_PIXELS
:
7909 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7910 ctx
->Unpack
= ctx
->DefaultPacking
;
7911 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7912 get_pointer(&n
[5])));
7913 ctx
->Unpack
= save
; /* restore */
7917 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7919 case OPCODE_ENABLE_INDEXED
:
7920 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7922 case OPCODE_EVALMESH1
:
7923 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7925 case OPCODE_EVALMESH2
:
7926 CALL_EvalMesh2(ctx
->Exec
,
7927 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7936 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7939 case OPCODE_FRONT_FACE
:
7940 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7942 case OPCODE_FRUSTUM
:
7943 CALL_Frustum(ctx
->Exec
,
7944 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7947 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7949 case OPCODE_INDEX_MASK
:
7950 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7952 case OPCODE_INIT_NAMES
:
7953 CALL_InitNames(ctx
->Exec
, ());
7962 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7965 case OPCODE_LIGHT_MODEL
:
7972 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7975 case OPCODE_LINE_STIPPLE
:
7976 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7978 case OPCODE_LINE_WIDTH
:
7979 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7981 case OPCODE_LIST_BASE
:
7982 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7984 case OPCODE_LOAD_IDENTITY
:
7985 CALL_LoadIdentity(ctx
->Exec
, ());
7987 case OPCODE_LOAD_MATRIX
:
7988 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
7989 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7991 case OPCODE_LOAD_NAME
:
7992 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7994 case OPCODE_LOGIC_OP
:
7995 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7999 GLenum target
= n
[1].e
;
8000 GLint ustride
= _mesa_evaluator_components(target
);
8001 GLint uorder
= n
[5].i
;
8002 GLfloat u1
= n
[2].f
;
8003 GLfloat u2
= n
[3].f
;
8004 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8005 (GLfloat
*) get_pointer(&n
[6])));
8010 GLenum target
= n
[1].e
;
8011 GLfloat u1
= n
[2].f
;
8012 GLfloat u2
= n
[3].f
;
8013 GLfloat v1
= n
[4].f
;
8014 GLfloat v2
= n
[5].f
;
8015 GLint ustride
= n
[6].i
;
8016 GLint vstride
= n
[7].i
;
8017 GLint uorder
= n
[8].i
;
8018 GLint vorder
= n
[9].i
;
8019 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8020 v1
, v2
, vstride
, vorder
,
8021 (GLfloat
*) get_pointer(&n
[10])));
8024 case OPCODE_MAPGRID1
:
8025 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8027 case OPCODE_MAPGRID2
:
8028 CALL_MapGrid2f(ctx
->Exec
,
8029 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8031 case OPCODE_MATRIX_MODE
:
8032 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8034 case OPCODE_MULT_MATRIX
:
8035 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8038 CALL_Ortho(ctx
->Exec
,
8039 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8041 case OPCODE_PASSTHROUGH
:
8042 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8044 case OPCODE_PIXEL_MAP
:
8045 CALL_PixelMapfv(ctx
->Exec
,
8046 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8048 case OPCODE_PIXEL_TRANSFER
:
8049 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8051 case OPCODE_PIXEL_ZOOM
:
8052 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8054 case OPCODE_POINT_SIZE
:
8055 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8057 case OPCODE_POINT_PARAMETERS
:
8063 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8066 case OPCODE_POLYGON_MODE
:
8067 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8069 case OPCODE_POLYGON_STIPPLE
:
8071 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8072 ctx
->Unpack
= ctx
->DefaultPacking
;
8073 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8074 ctx
->Unpack
= save
; /* restore */
8077 case OPCODE_POLYGON_OFFSET
:
8078 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8080 case OPCODE_POLYGON_OFFSET_CLAMP
:
8081 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8083 case OPCODE_POP_ATTRIB
:
8084 CALL_PopAttrib(ctx
->Exec
, ());
8086 case OPCODE_POP_MATRIX
:
8087 CALL_PopMatrix(ctx
->Exec
, ());
8089 case OPCODE_POP_NAME
:
8090 CALL_PopName(ctx
->Exec
, ());
8092 case OPCODE_PRIORITIZE_TEXTURE
:
8093 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8095 case OPCODE_PUSH_ATTRIB
:
8096 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8098 case OPCODE_PUSH_MATRIX
:
8099 CALL_PushMatrix(ctx
->Exec
, ());
8101 case OPCODE_PUSH_NAME
:
8102 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8104 case OPCODE_RASTER_POS
:
8105 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8107 case OPCODE_READ_BUFFER
:
8108 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8111 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8114 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8116 case OPCODE_SCISSOR
:
8117 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8119 case OPCODE_SHADE_MODEL
:
8120 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8122 case OPCODE_PROVOKING_VERTEX
:
8123 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8125 case OPCODE_STENCIL_FUNC
:
8126 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8128 case OPCODE_STENCIL_MASK
:
8129 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8131 case OPCODE_STENCIL_OP
:
8132 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8134 case OPCODE_STENCIL_FUNC_SEPARATE
:
8135 CALL_StencilFuncSeparate(ctx
->Exec
,
8136 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8138 case OPCODE_STENCIL_MASK_SEPARATE
:
8139 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8141 case OPCODE_STENCIL_OP_SEPARATE
:
8142 CALL_StencilOpSeparate(ctx
->Exec
,
8143 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8152 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8162 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8165 case OPCODE_TEXPARAMETER
:
8172 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8175 case OPCODE_TEX_IMAGE1D
:
8177 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8178 ctx
->Unpack
= ctx
->DefaultPacking
;
8179 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8181 n
[3].i
, /* components */
8183 n
[5].e
, /* border */
8184 n
[6].e
, /* format */
8186 get_pointer(&n
[8])));
8187 ctx
->Unpack
= save
; /* restore */
8190 case OPCODE_TEX_IMAGE2D
:
8192 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8193 ctx
->Unpack
= ctx
->DefaultPacking
;
8194 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8196 n
[3].i
, /* components */
8198 n
[5].i
, /* height */
8199 n
[6].e
, /* border */
8200 n
[7].e
, /* format */
8202 get_pointer(&n
[9])));
8203 ctx
->Unpack
= save
; /* restore */
8206 case OPCODE_TEX_IMAGE3D
:
8208 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8209 ctx
->Unpack
= ctx
->DefaultPacking
;
8210 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8212 n
[3].i
, /* components */
8214 n
[5].i
, /* height */
8216 n
[7].e
, /* border */
8217 n
[8].e
, /* format */
8219 get_pointer(&n
[10])));
8220 ctx
->Unpack
= save
; /* restore */
8223 case OPCODE_TEX_SUB_IMAGE1D
:
8225 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8226 ctx
->Unpack
= ctx
->DefaultPacking
;
8227 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8229 n
[6].e
, get_pointer(&n
[7])));
8230 ctx
->Unpack
= save
; /* restore */
8233 case OPCODE_TEX_SUB_IMAGE2D
:
8235 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8236 ctx
->Unpack
= ctx
->DefaultPacking
;
8237 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8239 n
[6].i
, n
[7].e
, n
[8].e
,
8240 get_pointer(&n
[9])));
8241 ctx
->Unpack
= save
; /* restore */
8244 case OPCODE_TEX_SUB_IMAGE3D
:
8246 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8247 ctx
->Unpack
= ctx
->DefaultPacking
;
8248 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8249 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8250 n
[8].i
, n
[9].e
, n
[10].e
,
8251 get_pointer(&n
[11])));
8252 ctx
->Unpack
= save
; /* restore */
8255 case OPCODE_TRANSLATE
:
8256 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8258 case OPCODE_VIEWPORT
:
8259 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8260 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8262 case OPCODE_WINDOW_POS
:
8263 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8265 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8266 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8268 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8269 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8270 n
[4].i
, n
[5].i
, n
[6].i
,
8271 get_pointer(&n
[7])));
8273 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8274 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8275 n
[4].i
, n
[5].i
, n
[6].i
,
8276 n
[7].i
, get_pointer(&n
[8])));
8278 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8279 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8280 n
[4].i
, n
[5].i
, n
[6].i
,
8282 get_pointer(&n
[9])));
8284 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8285 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8286 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8288 get_pointer(&n
[7])));
8290 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8291 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8292 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8293 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8294 get_pointer(&n
[9])));
8296 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8297 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8298 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8299 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8301 get_pointer(&n
[11])));
8303 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8304 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8306 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8307 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8309 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8310 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8312 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8313 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8314 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8317 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8318 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8320 case OPCODE_DEPTH_BOUNDS_EXT
:
8321 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8323 case OPCODE_PROGRAM_STRING_ARB
:
8324 CALL_ProgramStringARB(ctx
->Exec
,
8325 (n
[1].e
, n
[2].e
, n
[3].i
,
8326 get_pointer(&n
[4])));
8328 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8329 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8333 case OPCODE_BEGIN_QUERY_ARB
:
8334 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8336 case OPCODE_END_QUERY_ARB
:
8337 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8339 case OPCODE_QUERY_COUNTER
:
8340 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8342 case OPCODE_BEGIN_QUERY_INDEXED
:
8343 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8345 case OPCODE_END_QUERY_INDEXED
:
8346 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8348 case OPCODE_DRAW_BUFFERS_ARB
:
8350 GLenum buffers
[MAX_DRAW_BUFFERS
];
8351 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8352 for (i
= 0; i
< count
; i
++)
8353 buffers
[i
] = n
[2 + i
].e
;
8354 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8357 case OPCODE_BLIT_FRAMEBUFFER
:
8358 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8359 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8362 case OPCODE_USE_PROGRAM
:
8363 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8365 case OPCODE_UNIFORM_1F
:
8366 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8368 case OPCODE_UNIFORM_2F
:
8369 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8371 case OPCODE_UNIFORM_3F
:
8372 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8374 case OPCODE_UNIFORM_4F
:
8375 CALL_Uniform4f(ctx
->Exec
,
8376 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8378 case OPCODE_UNIFORM_1FV
:
8379 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8381 case OPCODE_UNIFORM_2FV
:
8382 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8384 case OPCODE_UNIFORM_3FV
:
8385 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8387 case OPCODE_UNIFORM_4FV
:
8388 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8390 case OPCODE_UNIFORM_1I
:
8391 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8393 case OPCODE_UNIFORM_2I
:
8394 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8396 case OPCODE_UNIFORM_3I
:
8397 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8399 case OPCODE_UNIFORM_4I
:
8400 CALL_Uniform4i(ctx
->Exec
,
8401 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8403 case OPCODE_UNIFORM_1IV
:
8404 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8406 case OPCODE_UNIFORM_2IV
:
8407 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8409 case OPCODE_UNIFORM_3IV
:
8410 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8412 case OPCODE_UNIFORM_4IV
:
8413 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8415 case OPCODE_UNIFORM_1UI
:
8416 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8418 case OPCODE_UNIFORM_2UI
:
8419 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8421 case OPCODE_UNIFORM_3UI
:
8422 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8424 case OPCODE_UNIFORM_4UI
:
8425 /*CALL_Uniform4uiARB(ctx->Exec,
8426 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8429 case OPCODE_UNIFORM_1UIV
:
8430 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8431 get_pointer(&n[3])));*/
8433 case OPCODE_UNIFORM_2UIV
:
8434 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8435 get_pointer(&n[3])));*/
8437 case OPCODE_UNIFORM_3UIV
:
8438 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8439 get_pointer(&n[3])));*/
8441 case OPCODE_UNIFORM_4UIV
:
8442 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8443 get_pointer(&n[3])));*/
8445 case OPCODE_UNIFORM_MATRIX22
:
8446 CALL_UniformMatrix2fv(ctx
->Exec
,
8447 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8449 case OPCODE_UNIFORM_MATRIX33
:
8450 CALL_UniformMatrix3fv(ctx
->Exec
,
8451 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8453 case OPCODE_UNIFORM_MATRIX44
:
8454 CALL_UniformMatrix4fv(ctx
->Exec
,
8455 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8457 case OPCODE_UNIFORM_MATRIX23
:
8458 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8459 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8461 case OPCODE_UNIFORM_MATRIX32
:
8462 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8463 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8465 case OPCODE_UNIFORM_MATRIX24
:
8466 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8467 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8469 case OPCODE_UNIFORM_MATRIX42
:
8470 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8471 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8473 case OPCODE_UNIFORM_MATRIX34
:
8474 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8475 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8477 case OPCODE_UNIFORM_MATRIX43
:
8478 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8479 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8482 case OPCODE_USE_PROGRAM_STAGES
:
8483 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8485 case OPCODE_PROGRAM_UNIFORM_1F
:
8486 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8488 case OPCODE_PROGRAM_UNIFORM_2F
:
8489 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8491 case OPCODE_PROGRAM_UNIFORM_3F
:
8492 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8493 n
[3].f
, n
[4].f
, n
[5].f
));
8495 case OPCODE_PROGRAM_UNIFORM_4F
:
8496 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8497 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8499 case OPCODE_PROGRAM_UNIFORM_1FV
:
8500 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8501 get_pointer(&n
[4])));
8503 case OPCODE_PROGRAM_UNIFORM_2FV
:
8504 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8505 get_pointer(&n
[4])));
8507 case OPCODE_PROGRAM_UNIFORM_3FV
:
8508 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8509 get_pointer(&n
[4])));
8511 case OPCODE_PROGRAM_UNIFORM_4FV
:
8512 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8513 get_pointer(&n
[4])));
8515 case OPCODE_PROGRAM_UNIFORM_1I
:
8516 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8518 case OPCODE_PROGRAM_UNIFORM_2I
:
8519 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8521 case OPCODE_PROGRAM_UNIFORM_3I
:
8522 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8523 n
[3].i
, n
[4].i
, n
[5].i
));
8525 case OPCODE_PROGRAM_UNIFORM_4I
:
8526 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8527 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8529 case OPCODE_PROGRAM_UNIFORM_1IV
:
8530 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8531 get_pointer(&n
[4])));
8533 case OPCODE_PROGRAM_UNIFORM_2IV
:
8534 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8535 get_pointer(&n
[4])));
8537 case OPCODE_PROGRAM_UNIFORM_3IV
:
8538 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8539 get_pointer(&n
[4])));
8541 case OPCODE_PROGRAM_UNIFORM_4IV
:
8542 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8543 get_pointer(&n
[4])));
8545 case OPCODE_PROGRAM_UNIFORM_1UI
:
8546 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8548 case OPCODE_PROGRAM_UNIFORM_2UI
:
8549 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8552 case OPCODE_PROGRAM_UNIFORM_3UI
:
8553 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8554 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8556 case OPCODE_PROGRAM_UNIFORM_4UI
:
8557 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8559 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8561 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8562 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8563 get_pointer(&n
[4])));
8565 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8566 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8567 get_pointer(&n
[4])));
8569 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8570 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8571 get_pointer(&n
[4])));
8573 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8574 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8575 get_pointer(&n
[4])));
8577 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8578 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8579 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8580 get_pointer(&n
[5])));
8582 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8583 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8584 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8585 get_pointer(&n
[5])));
8587 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8588 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8589 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8590 get_pointer(&n
[5])));
8592 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8593 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8594 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8595 get_pointer(&n
[5])));
8597 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8598 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8599 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8600 get_pointer(&n
[5])));
8602 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8603 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8604 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8605 get_pointer(&n
[5])));
8607 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8608 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8609 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8610 get_pointer(&n
[5])));
8612 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8613 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8614 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8615 get_pointer(&n
[5])));
8617 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8618 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8619 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8620 get_pointer(&n
[5])));
8623 case OPCODE_CLIP_CONTROL
:
8624 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8627 case OPCODE_CLAMP_COLOR
:
8628 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8631 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8632 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8634 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8635 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8637 case OPCODE_ATTR_1F_NV
:
8638 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8640 case OPCODE_ATTR_2F_NV
:
8641 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8643 case OPCODE_ATTR_3F_NV
:
8644 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8646 case OPCODE_ATTR_4F_NV
:
8647 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8649 case OPCODE_ATTR_1F_ARB
:
8650 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8652 case OPCODE_ATTR_2F_ARB
:
8653 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8655 case OPCODE_ATTR_3F_ARB
:
8656 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8658 case OPCODE_ATTR_4F_ARB
:
8659 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8661 case OPCODE_MATERIAL
:
8662 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8665 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8668 CALL_End(ctx
->Exec
, ());
8671 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8673 case OPCODE_EVAL_C1
:
8674 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8676 case OPCODE_EVAL_C2
:
8677 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8679 case OPCODE_EVAL_P1
:
8680 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8682 case OPCODE_EVAL_P2
:
8683 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8686 /* GL_EXT_texture_integer */
8687 case OPCODE_CLEARCOLOR_I
:
8688 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8690 case OPCODE_CLEARCOLOR_UI
:
8691 CALL_ClearColorIuiEXT(ctx
->Exec
,
8692 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8694 case OPCODE_TEXPARAMETER_I
:
8701 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8704 case OPCODE_TEXPARAMETER_UI
:
8707 params
[0] = n
[3].ui
;
8708 params
[1] = n
[4].ui
;
8709 params
[2] = n
[5].ui
;
8710 params
[3] = n
[6].ui
;
8711 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8715 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8716 /* GL_ARB_instanced_arrays */
8717 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8720 case OPCODE_TEXTURE_BARRIER_NV
:
8721 CALL_TextureBarrierNV(ctx
->Exec
, ());
8724 /* GL_EXT/ARB_transform_feedback */
8725 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8726 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8728 case OPCODE_END_TRANSFORM_FEEDBACK
:
8729 CALL_EndTransformFeedback(ctx
->Exec
, ());
8731 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8732 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8734 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8735 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8737 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8738 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8740 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8741 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8743 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8744 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8745 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8747 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8748 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8749 (n
[1].e
, n
[2].ui
, n
[3].si
));
8751 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8752 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8753 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8757 case OPCODE_BIND_SAMPLER
:
8758 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8760 case OPCODE_SAMPLER_PARAMETERIV
:
8767 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8770 case OPCODE_SAMPLER_PARAMETERFV
:
8777 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8780 case OPCODE_SAMPLER_PARAMETERIIV
:
8787 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8790 case OPCODE_SAMPLER_PARAMETERUIV
:
8793 params
[0] = n
[3].ui
;
8794 params
[1] = n
[4].ui
;
8795 params
[2] = n
[5].ui
;
8796 params
[3] = n
[6].ui
;
8797 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8802 case OPCODE_WAIT_SYNC
:
8804 union uint64_pair p
;
8805 p
.uint32
[0] = n
[2].ui
;
8806 p
.uint32
[1] = n
[3].ui
;
8807 CALL_WaitSync(ctx
->Exec
,
8808 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8812 /* GL_NV_conditional_render */
8813 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8814 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8816 case OPCODE_END_CONDITIONAL_RENDER
:
8817 CALL_EndConditionalRender(ctx
->Exec
, ());
8820 case OPCODE_UNIFORM_BLOCK_BINDING
:
8821 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8824 case OPCODE_CONTINUE
:
8825 n
= (Node
*) get_pointer(&n
[1]);
8830 case OPCODE_END_OF_LIST
:
8836 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8838 _mesa_problem(ctx
, "%s", msg
);
8843 /* increment n to point to next compiled command */
8844 if (opcode
!= OPCODE_CONTINUE
) {
8845 n
+= InstSize
[opcode
];
8850 vbo_save_EndCallList(ctx
);
8852 ctx
->ListState
.CallDepth
--;
8857 /**********************************************************************/
8859 /**********************************************************************/
8862 * Test if a display list number is valid.
8864 GLboolean GLAPIENTRY
8865 _mesa_IsList(GLuint list
)
8867 GET_CURRENT_CONTEXT(ctx
);
8868 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8869 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8870 return islist(ctx
, list
);
8875 * Delete a sequence of consecutive display lists.
8878 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8880 GET_CURRENT_CONTEXT(ctx
);
8882 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8883 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8886 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8889 for (i
= list
; i
< list
+ range
; i
++) {
8890 destroy_list(ctx
, i
);
8896 * Return a display list number, n, such that lists n through n+range-1
8900 _mesa_GenLists(GLsizei range
)
8902 GET_CURRENT_CONTEXT(ctx
);
8904 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8905 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8908 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8916 * Make this an atomic operation
8918 mtx_lock(&ctx
->Shared
->Mutex
);
8920 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8922 /* reserve the list IDs by with empty/dummy lists */
8924 for (i
= 0; i
< range
; i
++) {
8925 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8926 make_list(base
+ i
, 1));
8930 mtx_unlock(&ctx
->Shared
->Mutex
);
8937 * Begin a new display list.
8940 _mesa_NewList(GLuint name
, GLenum mode
)
8942 GET_CURRENT_CONTEXT(ctx
);
8944 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8945 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8947 if (MESA_VERBOSE
& VERBOSE_API
)
8948 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8949 _mesa_enum_to_string(mode
));
8952 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8956 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8957 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8961 if (ctx
->ListState
.CurrentList
) {
8962 /* already compiling a display list */
8963 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8967 ctx
->CompileFlag
= GL_TRUE
;
8968 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8970 /* Reset accumulated list state */
8971 invalidate_saved_current_state( ctx
);
8973 /* Allocate new display list */
8974 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8975 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8976 ctx
->ListState
.CurrentPos
= 0;
8978 vbo_save_NewList(ctx
, name
, mode
);
8980 ctx
->CurrentDispatch
= ctx
->Save
;
8981 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8986 * End definition of current display list.
8991 GET_CURRENT_CONTEXT(ctx
);
8992 SAVE_FLUSH_VERTICES(ctx
);
8993 FLUSH_VERTICES(ctx
, 0);
8995 if (MESA_VERBOSE
& VERBOSE_API
)
8996 _mesa_debug(ctx
, "glEndList\n");
8998 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8999 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9000 "glEndList() called inside glBegin/End");
9003 /* Check that a list is under construction */
9004 if (!ctx
->ListState
.CurrentList
) {
9005 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9009 /* Call before emitting END_OF_LIST, in case the driver wants to
9010 * emit opcodes itself.
9012 vbo_save_EndList(ctx
);
9014 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9018 /* Destroy old list, if any */
9019 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9021 /* Install the new list */
9022 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9023 ctx
->ListState
.CurrentList
->Name
,
9024 ctx
->ListState
.CurrentList
);
9027 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9028 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9030 ctx
->ListState
.CurrentList
= NULL
;
9031 ctx
->ListState
.CurrentBlock
= NULL
;
9032 ctx
->ListState
.CurrentPos
= 0;
9033 ctx
->ExecuteFlag
= GL_TRUE
;
9034 ctx
->CompileFlag
= GL_FALSE
;
9036 ctx
->CurrentDispatch
= ctx
->Exec
;
9037 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9042 _mesa_CallList(GLuint list
)
9044 GLboolean save_compile_flag
;
9045 GET_CURRENT_CONTEXT(ctx
);
9046 FLUSH_CURRENT(ctx
, 0);
9048 if (MESA_VERBOSE
& VERBOSE_API
)
9049 _mesa_debug(ctx
, "glCallList %d\n", list
);
9052 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9057 mesa_print_display_list( list
);
9059 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9060 * execute the display list, and restore the CompileFlag.
9062 save_compile_flag
= ctx
->CompileFlag
;
9063 if (save_compile_flag
) {
9064 ctx
->CompileFlag
= GL_FALSE
;
9067 execute_list(ctx
, list
);
9068 ctx
->CompileFlag
= save_compile_flag
;
9070 /* also restore API function pointers to point to "save" versions */
9071 if (save_compile_flag
) {
9072 ctx
->CurrentDispatch
= ctx
->Save
;
9073 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9079 * Execute glCallLists: call multiple display lists.
9082 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9084 GET_CURRENT_CONTEXT(ctx
);
9086 GLboolean save_compile_flag
;
9088 if (MESA_VERBOSE
& VERBOSE_API
)
9089 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9093 case GL_UNSIGNED_BYTE
:
9095 case GL_UNSIGNED_SHORT
:
9097 case GL_UNSIGNED_INT
:
9105 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9109 /* Save the CompileFlag status, turn it off, execute display list,
9110 * and restore the CompileFlag.
9112 save_compile_flag
= ctx
->CompileFlag
;
9113 ctx
->CompileFlag
= GL_FALSE
;
9115 for (i
= 0; i
< n
; i
++) {
9116 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9117 execute_list(ctx
, list
);
9120 ctx
->CompileFlag
= save_compile_flag
;
9122 /* also restore API function pointers to point to "save" versions */
9123 if (save_compile_flag
) {
9124 ctx
->CurrentDispatch
= ctx
->Save
;
9125 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9131 * Set the offset added to list numbers in glCallLists.
9134 _mesa_ListBase(GLuint base
)
9136 GET_CURRENT_CONTEXT(ctx
);
9137 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9138 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9139 ctx
->List
.ListBase
= base
;
9143 * Setup the given dispatch table to point to Mesa's display list
9144 * building functions.
9146 * This does not include any of the tnl functions - they are
9147 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9151 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9153 struct _glapi_table
*table
= ctx
->Save
;
9154 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9156 /* Initially populate the dispatch table with the contents of the
9157 * normal-execution dispatch table. This lets us skip populating functions
9158 * that should be called directly instead of compiled into display lists.
9160 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9162 _mesa_loopback_init_api_table(ctx
, table
);
9165 vbo_initialize_save_dispatch(ctx
, table
);
9168 SET_Accum(table
, save_Accum
);
9169 SET_AlphaFunc(table
, save_AlphaFunc
);
9170 SET_Bitmap(table
, save_Bitmap
);
9171 SET_BlendFunc(table
, save_BlendFunc
);
9172 SET_CallList(table
, save_CallList
);
9173 SET_CallLists(table
, save_CallLists
);
9174 SET_Clear(table
, save_Clear
);
9175 SET_ClearAccum(table
, save_ClearAccum
);
9176 SET_ClearColor(table
, save_ClearColor
);
9177 SET_ClearDepth(table
, save_ClearDepth
);
9178 SET_ClearIndex(table
, save_ClearIndex
);
9179 SET_ClearStencil(table
, save_ClearStencil
);
9180 SET_ClipPlane(table
, save_ClipPlane
);
9181 SET_ColorMask(table
, save_ColorMask
);
9182 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9183 SET_ColorMaterial(table
, save_ColorMaterial
);
9184 SET_CopyPixels(table
, save_CopyPixels
);
9185 SET_CullFace(table
, save_CullFace
);
9186 SET_DepthFunc(table
, save_DepthFunc
);
9187 SET_DepthMask(table
, save_DepthMask
);
9188 SET_DepthRange(table
, save_DepthRange
);
9189 SET_Disable(table
, save_Disable
);
9190 SET_Disablei(table
, save_DisableIndexed
);
9191 SET_DrawBuffer(table
, save_DrawBuffer
);
9192 SET_DrawPixels(table
, save_DrawPixels
);
9193 SET_Enable(table
, save_Enable
);
9194 SET_Enablei(table
, save_EnableIndexed
);
9195 SET_EvalMesh1(table
, save_EvalMesh1
);
9196 SET_EvalMesh2(table
, save_EvalMesh2
);
9197 SET_Fogf(table
, save_Fogf
);
9198 SET_Fogfv(table
, save_Fogfv
);
9199 SET_Fogi(table
, save_Fogi
);
9200 SET_Fogiv(table
, save_Fogiv
);
9201 SET_FrontFace(table
, save_FrontFace
);
9202 SET_Frustum(table
, save_Frustum
);
9203 SET_Hint(table
, save_Hint
);
9204 SET_IndexMask(table
, save_IndexMask
);
9205 SET_InitNames(table
, save_InitNames
);
9206 SET_LightModelf(table
, save_LightModelf
);
9207 SET_LightModelfv(table
, save_LightModelfv
);
9208 SET_LightModeli(table
, save_LightModeli
);
9209 SET_LightModeliv(table
, save_LightModeliv
);
9210 SET_Lightf(table
, save_Lightf
);
9211 SET_Lightfv(table
, save_Lightfv
);
9212 SET_Lighti(table
, save_Lighti
);
9213 SET_Lightiv(table
, save_Lightiv
);
9214 SET_LineStipple(table
, save_LineStipple
);
9215 SET_LineWidth(table
, save_LineWidth
);
9216 SET_ListBase(table
, save_ListBase
);
9217 SET_LoadIdentity(table
, save_LoadIdentity
);
9218 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9219 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9220 SET_LoadName(table
, save_LoadName
);
9221 SET_LogicOp(table
, save_LogicOp
);
9222 SET_Map1d(table
, save_Map1d
);
9223 SET_Map1f(table
, save_Map1f
);
9224 SET_Map2d(table
, save_Map2d
);
9225 SET_Map2f(table
, save_Map2f
);
9226 SET_MapGrid1d(table
, save_MapGrid1d
);
9227 SET_MapGrid1f(table
, save_MapGrid1f
);
9228 SET_MapGrid2d(table
, save_MapGrid2d
);
9229 SET_MapGrid2f(table
, save_MapGrid2f
);
9230 SET_MatrixMode(table
, save_MatrixMode
);
9231 SET_MultMatrixd(table
, save_MultMatrixd
);
9232 SET_MultMatrixf(table
, save_MultMatrixf
);
9233 SET_NewList(table
, save_NewList
);
9234 SET_Ortho(table
, save_Ortho
);
9235 SET_PassThrough(table
, save_PassThrough
);
9236 SET_PixelMapfv(table
, save_PixelMapfv
);
9237 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9238 SET_PixelMapusv(table
, save_PixelMapusv
);
9239 SET_PixelTransferf(table
, save_PixelTransferf
);
9240 SET_PixelTransferi(table
, save_PixelTransferi
);
9241 SET_PixelZoom(table
, save_PixelZoom
);
9242 SET_PointSize(table
, save_PointSize
);
9243 SET_PolygonMode(table
, save_PolygonMode
);
9244 SET_PolygonOffset(table
, save_PolygonOffset
);
9245 SET_PolygonStipple(table
, save_PolygonStipple
);
9246 SET_PopAttrib(table
, save_PopAttrib
);
9247 SET_PopMatrix(table
, save_PopMatrix
);
9248 SET_PopName(table
, save_PopName
);
9249 SET_PushAttrib(table
, save_PushAttrib
);
9250 SET_PushMatrix(table
, save_PushMatrix
);
9251 SET_PushName(table
, save_PushName
);
9252 SET_RasterPos2d(table
, save_RasterPos2d
);
9253 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9254 SET_RasterPos2f(table
, save_RasterPos2f
);
9255 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9256 SET_RasterPos2i(table
, save_RasterPos2i
);
9257 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9258 SET_RasterPos2s(table
, save_RasterPos2s
);
9259 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9260 SET_RasterPos3d(table
, save_RasterPos3d
);
9261 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9262 SET_RasterPos3f(table
, save_RasterPos3f
);
9263 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9264 SET_RasterPos3i(table
, save_RasterPos3i
);
9265 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9266 SET_RasterPos3s(table
, save_RasterPos3s
);
9267 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9268 SET_RasterPos4d(table
, save_RasterPos4d
);
9269 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9270 SET_RasterPos4f(table
, save_RasterPos4f
);
9271 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9272 SET_RasterPos4i(table
, save_RasterPos4i
);
9273 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9274 SET_RasterPos4s(table
, save_RasterPos4s
);
9275 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9276 SET_ReadBuffer(table
, save_ReadBuffer
);
9277 SET_Rectf(table
, save_Rectf
);
9278 SET_Rotated(table
, save_Rotated
);
9279 SET_Rotatef(table
, save_Rotatef
);
9280 SET_Scaled(table
, save_Scaled
);
9281 SET_Scalef(table
, save_Scalef
);
9282 SET_Scissor(table
, save_Scissor
);
9283 SET_ShadeModel(table
, save_ShadeModel
);
9284 SET_StencilFunc(table
, save_StencilFunc
);
9285 SET_StencilMask(table
, save_StencilMask
);
9286 SET_StencilOp(table
, save_StencilOp
);
9287 SET_TexEnvf(table
, save_TexEnvf
);
9288 SET_TexEnvfv(table
, save_TexEnvfv
);
9289 SET_TexEnvi(table
, save_TexEnvi
);
9290 SET_TexEnviv(table
, save_TexEnviv
);
9291 SET_TexGend(table
, save_TexGend
);
9292 SET_TexGendv(table
, save_TexGendv
);
9293 SET_TexGenf(table
, save_TexGenf
);
9294 SET_TexGenfv(table
, save_TexGenfv
);
9295 SET_TexGeni(table
, save_TexGeni
);
9296 SET_TexGeniv(table
, save_TexGeniv
);
9297 SET_TexImage1D(table
, save_TexImage1D
);
9298 SET_TexImage2D(table
, save_TexImage2D
);
9299 SET_TexParameterf(table
, save_TexParameterf
);
9300 SET_TexParameterfv(table
, save_TexParameterfv
);
9301 SET_TexParameteri(table
, save_TexParameteri
);
9302 SET_TexParameteriv(table
, save_TexParameteriv
);
9303 SET_Translated(table
, save_Translated
);
9304 SET_Translatef(table
, save_Translatef
);
9305 SET_Viewport(table
, save_Viewport
);
9308 SET_BindTexture(table
, save_BindTexture
);
9309 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9310 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9311 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9312 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9313 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9314 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9315 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9318 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9319 SET_TexImage3D(table
, save_TexImage3D
);
9320 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9323 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9324 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9325 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9327 /* ATI_separate_stencil */
9328 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9330 /* GL_ARB_imaging */
9331 /* Not all are supported */
9332 SET_BlendColor(table
, save_BlendColor
);
9333 SET_BlendEquation(table
, save_BlendEquation
);
9335 /* 2. GL_EXT_blend_color */
9337 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9340 /* 3. GL_EXT_polygon_offset */
9341 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9343 /* 6. GL_EXT_texture3d */
9345 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9346 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9347 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9350 /* 37. GL_EXT_blend_minmax */
9352 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9355 /* 54. GL_EXT_point_parameters */
9356 SET_PointParameterf(table
, save_PointParameterfEXT
);
9357 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9359 /* 173. GL_EXT_blend_func_separate */
9360 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9362 /* 197. GL_MESA_window_pos */
9363 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9364 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9365 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9366 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9367 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9368 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9369 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9370 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9371 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9372 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9373 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9374 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9375 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9376 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9377 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9378 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9379 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9380 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9381 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9382 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9383 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9384 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9385 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9386 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9388 /* 233. GL_NV_vertex_program */
9389 /* The following commands DO NOT go into display lists:
9390 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9391 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9393 SET_BindProgramARB(table
, save_BindProgramNV
);
9395 /* 245. GL_ATI_fragment_shader */
9396 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9397 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9399 /* 262. GL_NV_point_sprite */
9400 SET_PointParameteri(table
, save_PointParameteriNV
);
9401 SET_PointParameteriv(table
, save_PointParameterivNV
);
9403 /* 268. GL_EXT_stencil_two_side */
9404 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9406 /* ???. GL_EXT_depth_bounds_test */
9407 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9409 /* ARB 1. GL_ARB_multitexture */
9410 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9412 /* ARB 3. GL_ARB_transpose_matrix */
9413 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9414 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9415 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9416 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9418 /* ARB 5. GL_ARB_multisample */
9419 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9421 /* ARB 12. GL_ARB_texture_compression */
9422 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9423 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9424 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9425 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9426 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9427 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9429 /* ARB 14. GL_ARB_point_parameters */
9430 /* aliased with EXT_point_parameters functions */
9432 /* ARB 25. GL_ARB_window_pos */
9433 /* aliased with MESA_window_pos functions */
9435 /* ARB 26. GL_ARB_vertex_program */
9436 /* ARB 27. GL_ARB_fragment_program */
9437 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9438 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9439 SET_BindProgramARB(table
, save_BindProgramNV
);
9440 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9441 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9442 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9443 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9444 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9445 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9446 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9447 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9449 SET_BeginQuery(table
, save_BeginQueryARB
);
9450 SET_EndQuery(table
, save_EndQueryARB
);
9451 SET_QueryCounter(table
, save_QueryCounter
);
9453 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9455 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9457 SET_UseProgram(table
, save_UseProgramObjectARB
);
9458 SET_Uniform1f(table
, save_Uniform1fARB
);
9459 SET_Uniform2f(table
, save_Uniform2fARB
);
9460 SET_Uniform3f(table
, save_Uniform3fARB
);
9461 SET_Uniform4f(table
, save_Uniform4fARB
);
9462 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9463 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9464 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9465 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9466 SET_Uniform1i(table
, save_Uniform1iARB
);
9467 SET_Uniform2i(table
, save_Uniform2iARB
);
9468 SET_Uniform3i(table
, save_Uniform3iARB
);
9469 SET_Uniform4i(table
, save_Uniform4iARB
);
9470 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9471 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9472 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9473 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9474 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9475 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9476 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9477 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9478 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9479 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9480 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9481 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9482 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9484 /* 299. GL_EXT_blend_equation_separate */
9485 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9487 /* GL_EXT_gpu_program_parameters */
9488 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9489 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9491 /* 364. GL_EXT_provoking_vertex */
9492 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9494 /* GL_EXT_texture_integer */
9495 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9496 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9497 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9498 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9500 /* GL_ARB_clip_control */
9501 SET_ClipControl(table
, save_ClipControl
);
9503 /* GL_ARB_color_buffer_float */
9504 SET_ClampColor(table
, save_ClampColorARB
);
9507 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9508 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9509 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9510 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9512 SET_Uniform1ui(table
, save_Uniform1ui
);
9513 SET_Uniform2ui(table
, save_Uniform2ui
);
9514 SET_Uniform3ui(table
, save_Uniform3ui
);
9515 SET_Uniform4ui(table
, save_Uniform4ui
);
9516 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9517 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9518 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9519 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9521 (void) save_Uniform1ui
;
9522 (void) save_Uniform2ui
;
9523 (void) save_Uniform3ui
;
9524 (void) save_Uniform4ui
;
9525 (void) save_Uniform1uiv
;
9526 (void) save_Uniform2uiv
;
9527 (void) save_Uniform3uiv
;
9528 (void) save_Uniform4uiv
;
9532 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9533 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9534 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9535 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9536 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9537 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9538 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9539 SET_DrawTransformFeedbackInstanced(table
,
9540 save_DrawTransformFeedbackInstanced
);
9541 SET_DrawTransformFeedbackStreamInstanced(table
,
9542 save_DrawTransformFeedbackStreamInstanced
);
9543 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9544 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9546 /* GL_ARB_instanced_arrays */
9547 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9549 /* GL_NV_texture_barrier */
9550 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9552 SET_BindSampler(table
, save_BindSampler
);
9553 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9554 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9555 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9556 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9557 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9558 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9560 /* GL_ARB_draw_buffer_blend */
9561 SET_BlendFunciARB(table
, save_BlendFunci
);
9562 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9563 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9564 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9566 /* GL_NV_conditional_render */
9567 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9568 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9571 SET_WaitSync(table
, save_WaitSync
);
9573 /* GL_ARB_uniform_buffer_object */
9574 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9576 /* GL_ARB_draw_instanced */
9577 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9578 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9580 /* GL_ARB_draw_elements_base_vertex */
9581 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9583 /* GL_ARB_base_instance */
9584 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9585 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9586 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9588 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9589 SET_UseProgramStages(table
, save_UseProgramStages
);
9590 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9591 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9592 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9593 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9594 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9595 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9596 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9597 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9598 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9599 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9600 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9601 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9602 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9603 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9604 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9605 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9606 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9607 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9608 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9609 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9610 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9611 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9612 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9613 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9614 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9615 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9616 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9617 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9618 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9619 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9620 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9621 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9622 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9624 /* GL_EXT_polygon_offset_clamp */
9625 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
9631 enum_string(GLenum k
)
9633 return _mesa_enum_to_string(k
);
9638 * Print the commands in a display list. For debugging only.
9639 * TODO: many commands aren't handled yet.
9640 * \param fname filename to write display list to. If null, use stdout.
9642 static void GLAPIENTRY
9643 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9645 struct gl_display_list
*dlist
;
9651 f
= fopen(fname
, "w");
9656 if (!islist(ctx
, list
)) {
9657 fprintf(f
, "%u is not a display list ID\n", list
);
9661 dlist
= _mesa_lookup_list(ctx
, list
);
9667 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9669 done
= n
? GL_FALSE
: GL_TRUE
;
9671 const OpCode opcode
= n
[0].opcode
;
9673 if (is_ext_opcode(opcode
)) {
9674 n
+= ext_opcode_print(ctx
, n
, f
);
9679 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9681 case OPCODE_ACTIVE_TEXTURE
:
9682 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9685 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9686 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9687 get_pointer(&n
[7]));
9689 case OPCODE_BLEND_COLOR
:
9690 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
9691 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9693 case OPCODE_BLEND_EQUATION
:
9694 fprintf(f
, "BlendEquation %s\n",
9695 enum_string(n
[1].e
));
9697 case OPCODE_BLEND_EQUATION_SEPARATE
:
9698 fprintf(f
, "BlendEquationSeparate %s, %s\n",
9699 enum_string(n
[1].e
),
9700 enum_string(n
[2].e
));
9702 case OPCODE_BLEND_FUNC_SEPARATE
:
9703 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
9704 enum_string(n
[1].e
),
9705 enum_string(n
[2].e
),
9706 enum_string(n
[3].e
),
9707 enum_string(n
[4].e
));
9709 case OPCODE_BLEND_EQUATION_I
:
9710 fprintf(f
, "BlendEquationi %u, %s\n",
9711 n
[1].ui
, enum_string(n
[2].e
));
9713 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
9714 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
9715 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9717 case OPCODE_BLEND_FUNC_I
:
9718 fprintf(f
, "BlendFunci %u, %s, %s\n",
9719 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9721 case OPCODE_BLEND_FUNC_SEPARATE_I
:
9722 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
9724 enum_string(n
[2].e
),
9725 enum_string(n
[3].e
),
9726 enum_string(n
[4].e
),
9727 enum_string(n
[5].e
));
9729 case OPCODE_CALL_LIST
:
9730 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9732 case OPCODE_CALL_LIST_OFFSET
:
9733 fprintf(f
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9734 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9736 case OPCODE_DISABLE
:
9737 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9740 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9742 case OPCODE_FRUSTUM
:
9743 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9744 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9746 case OPCODE_LINE_STIPPLE
:
9747 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9749 case OPCODE_LINE_WIDTH
:
9750 fprintf(f
, "LineWidth %f\n", n
[1].f
);
9752 case OPCODE_LOAD_IDENTITY
:
9753 fprintf(f
, "LoadIdentity\n");
9755 case OPCODE_LOAD_MATRIX
:
9756 fprintf(f
, "LoadMatrix\n");
9757 fprintf(f
, " %8f %8f %8f %8f\n",
9758 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9759 fprintf(f
, " %8f %8f %8f %8f\n",
9760 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9761 fprintf(f
, " %8f %8f %8f %8f\n",
9762 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9763 fprintf(f
, " %8f %8f %8f %8f\n",
9764 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9766 case OPCODE_MULT_MATRIX
:
9767 fprintf(f
, "MultMatrix (or Rotate)\n");
9768 fprintf(f
, " %8f %8f %8f %8f\n",
9769 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9770 fprintf(f
, " %8f %8f %8f %8f\n",
9771 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9772 fprintf(f
, " %8f %8f %8f %8f\n",
9773 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9774 fprintf(f
, " %8f %8f %8f %8f\n",
9775 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9778 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9779 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9781 case OPCODE_POINT_SIZE
:
9782 fprintf(f
, "PointSize %f\n", n
[1].f
);
9784 case OPCODE_POP_ATTRIB
:
9785 fprintf(f
, "PopAttrib\n");
9787 case OPCODE_POP_MATRIX
:
9788 fprintf(f
, "PopMatrix\n");
9790 case OPCODE_POP_NAME
:
9791 fprintf(f
, "PopName\n");
9793 case OPCODE_PUSH_ATTRIB
:
9794 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9796 case OPCODE_PUSH_MATRIX
:
9797 fprintf(f
, "PushMatrix\n");
9799 case OPCODE_PUSH_NAME
:
9800 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9802 case OPCODE_RASTER_POS
:
9803 fprintf(f
, "RasterPos %g %g %g %g\n",
9804 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9807 fprintf(f
, "Rotate %g %g %g %g\n",
9808 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9811 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9813 case OPCODE_TRANSLATE
:
9814 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9816 case OPCODE_BIND_TEXTURE
:
9817 fprintf(f
, "BindTexture %s %d\n",
9818 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
9820 case OPCODE_SHADE_MODEL
:
9821 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
9824 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9825 _mesa_enum_to_string(n
[1].ui
),
9826 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9829 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9830 _mesa_enum_to_string(n
[1].ui
),
9831 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9832 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9834 case OPCODE_MAPGRID1
:
9835 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9837 case OPCODE_MAPGRID2
:
9838 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9839 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9841 case OPCODE_EVALMESH1
:
9842 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9844 case OPCODE_EVALMESH2
:
9845 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9846 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9849 case OPCODE_ATTR_1F_NV
:
9850 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9852 case OPCODE_ATTR_2F_NV
:
9853 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9854 n
[1].i
, n
[2].f
, n
[3].f
);
9856 case OPCODE_ATTR_3F_NV
:
9857 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9858 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9860 case OPCODE_ATTR_4F_NV
:
9861 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9862 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9864 case OPCODE_ATTR_1F_ARB
:
9865 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9867 case OPCODE_ATTR_2F_ARB
:
9868 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9869 n
[1].i
, n
[2].f
, n
[3].f
);
9871 case OPCODE_ATTR_3F_ARB
:
9872 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9873 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9875 case OPCODE_ATTR_4F_ARB
:
9876 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9877 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9880 case OPCODE_MATERIAL
:
9881 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9882 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9885 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9888 fprintf(f
, "END\n");
9891 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9894 case OPCODE_EVAL_C1
:
9895 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9897 case OPCODE_EVAL_C2
:
9898 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9900 case OPCODE_EVAL_P1
:
9901 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9903 case OPCODE_EVAL_P2
:
9904 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9907 case OPCODE_PROVOKING_VERTEX
:
9908 fprintf(f
, "ProvokingVertex %s\n",
9909 _mesa_enum_to_string(n
[1].ui
));
9913 * meta opcodes/commands
9916 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
9917 (const char *) get_pointer(&n
[2]));
9919 case OPCODE_CONTINUE
:
9920 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
9921 n
= (Node
*) get_pointer(&n
[1]);
9924 fprintf(f
, "NOP\n");
9926 case OPCODE_END_OF_LIST
:
9927 fprintf(f
, "END-LIST %u\n", list
);
9931 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9933 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9934 opcode
, (void *) n
);
9938 fprintf(f
, "command %d, %u operands\n", opcode
,
9942 /* increment n to point to next compiled command */
9943 if (opcode
!= OPCODE_CONTINUE
) {
9944 n
+= InstSize
[opcode
];
9957 * Clients may call this function to help debug display list problems.
9958 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9959 * changed, or break in the future without notice.
9962 mesa_print_display_list(GLuint list
)
9964 GET_CURRENT_CONTEXT(ctx
);
9965 print_list(ctx
, list
, NULL
);
9969 /**********************************************************************/
9970 /***** Initialization *****/
9971 /**********************************************************************/
9974 save_vtxfmt_init(GLvertexformat
* vfmt
)
9976 vfmt
->ArrayElement
= _ae_ArrayElement
;
9978 vfmt
->Begin
= save_Begin
;
9980 vfmt
->CallList
= save_CallList
;
9981 vfmt
->CallLists
= save_CallLists
;
9983 vfmt
->Color3f
= save_Color3f
;
9984 vfmt
->Color3fv
= save_Color3fv
;
9985 vfmt
->Color4f
= save_Color4f
;
9986 vfmt
->Color4fv
= save_Color4fv
;
9987 vfmt
->EdgeFlag
= save_EdgeFlag
;
9988 vfmt
->End
= save_End
;
9990 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9991 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9992 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9993 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9994 vfmt
->EvalPoint1
= save_EvalPoint1
;
9995 vfmt
->EvalPoint2
= save_EvalPoint2
;
9997 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9998 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9999 vfmt
->Indexf
= save_Indexf
;
10000 vfmt
->Indexfv
= save_Indexfv
;
10001 vfmt
->Materialfv
= save_Materialfv
;
10002 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10003 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10004 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10005 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10006 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10007 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10008 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10009 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10010 vfmt
->Normal3f
= save_Normal3f
;
10011 vfmt
->Normal3fv
= save_Normal3fv
;
10012 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10013 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10014 vfmt
->TexCoord1f
= save_TexCoord1f
;
10015 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10016 vfmt
->TexCoord2f
= save_TexCoord2f
;
10017 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10018 vfmt
->TexCoord3f
= save_TexCoord3f
;
10019 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10020 vfmt
->TexCoord4f
= save_TexCoord4f
;
10021 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10022 vfmt
->Vertex2f
= save_Vertex2f
;
10023 vfmt
->Vertex2fv
= save_Vertex2fv
;
10024 vfmt
->Vertex3f
= save_Vertex3f
;
10025 vfmt
->Vertex3fv
= save_Vertex3fv
;
10026 vfmt
->Vertex4f
= save_Vertex4f
;
10027 vfmt
->Vertex4fv
= save_Vertex4fv
;
10028 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10029 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10030 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10031 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10032 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10033 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10034 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10035 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10040 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10041 const GLvertexformat
*vfmt
)
10043 SET_CallList(disp
, vfmt
->CallList
);
10044 SET_CallLists(disp
, vfmt
->CallLists
);
10049 * Initialize display list state for given context.
10052 _mesa_init_display_list(struct gl_context
*ctx
)
10054 static GLboolean tableInitialized
= GL_FALSE
;
10056 /* zero-out the instruction size table, just once */
10057 if (!tableInitialized
) {
10058 memset(InstSize
, 0, sizeof(InstSize
));
10059 tableInitialized
= GL_TRUE
;
10062 /* extension info */
10063 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10066 ctx
->ListState
.CallDepth
= 0;
10067 ctx
->ExecuteFlag
= GL_TRUE
;
10068 ctx
->CompileFlag
= GL_FALSE
;
10069 ctx
->ListState
.CurrentBlock
= NULL
;
10070 ctx
->ListState
.CurrentPos
= 0;
10072 /* Display List group */
10073 ctx
->List
.ListBase
= 0;
10075 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10077 InstSize
[OPCODE_NOP
] = 1;
10082 _mesa_free_display_list_data(struct gl_context
*ctx
)
10084 free(ctx
->ListExt
);
10085 ctx
->ListExt
= NULL
;