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
,
460 /* GL_ARB_geometry_shader4 */
461 OPCODE_PROGRAM_PARAMETERI
,
462 OPCODE_FRAMEBUFFER_TEXTURE
,
463 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
468 /* GL_NV_conditional_render */
469 OPCODE_BEGIN_CONDITIONAL_RENDER
,
470 OPCODE_END_CONDITIONAL_RENDER
,
472 /* ARB_timer_query */
473 OPCODE_QUERY_COUNTER
,
475 /* ARB_transform_feedback3 */
476 OPCODE_BEGIN_QUERY_INDEXED
,
477 OPCODE_END_QUERY_INDEXED
,
478 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
480 /* ARB_transform_feedback_instanced */
481 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
482 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
484 /* ARB_uniform_buffer_object */
485 OPCODE_UNIFORM_BLOCK_BINDING
,
487 /* EXT_polygon_offset_clamp */
488 OPCODE_POLYGON_OFFSET_CLAMP
,
490 /* The following three are meta instructions */
491 OPCODE_ERROR
, /* raise compiled-in error */
493 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
503 * Display list instructions are stored as sequences of "nodes". Nodes
504 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
505 * are linked together with a pointer.
507 * Each instruction in the display list is stored as a sequence of
508 * contiguous nodes in memory.
509 * Each node is the union of a variety of data types.
511 * Note, all of these members should be 4 bytes in size or less for the
512 * sake of compact display lists. We store 8-byte pointers in a pair of
513 * these nodes using the save/get_pointer() functions below.
531 typedef union gl_dlist_node Node
;
534 /** How many 4-byte dwords to store a pointer */
535 #define POINTER_DWORDS (sizeof(void *) / 4)
537 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
538 * space for display lists. The following types and functions are
539 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
544 GLuint dwords
[POINTER_DWORDS
];
549 * Save a 4 or 8-byte pointer at dest (and dest+1).
552 save_pointer(Node
*dest
, void *src
)
557 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
558 STATIC_ASSERT(sizeof(Node
) == 4);
562 for (i
= 0; i
< POINTER_DWORDS
; i
++)
563 dest
[i
].ui
= p
.dwords
[i
];
568 * Retrieve a 4 or 8-byte pointer from node (node+1).
571 get_pointer(const Node
*node
)
576 for (i
= 0; i
< POINTER_DWORDS
; i
++)
577 p
.dwords
[i
] = node
[i
].ui
;
584 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
595 * How many nodes to allocate at a time. Note that bulk vertex data
596 * from glBegin/glVertex/glEnd primitives will typically wind up in
597 * a VBO, and not directly in the display list itself.
599 #define BLOCK_SIZE 256
604 * Number of nodes of storage needed for each instruction.
605 * Sizes for dynamically allocated opcodes are stored in the context struct.
607 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
610 void mesa_print_display_list(GLuint list
);
614 * Allocate a gl_display_list object with an initial block of storage.
615 * \param count how many display list nodes/tokes to allocate
617 static struct gl_display_list
*
618 make_list(GLuint name
, GLuint count
)
620 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
622 dlist
->Head
= malloc(sizeof(Node
) * count
);
623 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
629 * Lookup function to just encapsulate casting.
631 struct gl_display_list
*
632 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
634 return (struct gl_display_list
*)
635 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
639 /** Is the given opcode an extension code? */
640 static inline GLboolean
641 is_ext_opcode(OpCode opcode
)
643 return (opcode
>= OPCODE_EXT_0
);
647 /** Destroy an extended opcode instruction */
649 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
651 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
653 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
654 step
= ctx
->ListExt
->Opcode
[i
].Size
;
659 /** Execute an extended opcode instruction */
661 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
663 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
665 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
666 step
= ctx
->ListExt
->Opcode
[i
].Size
;
671 /** Print an extended opcode instruction */
673 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
675 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
677 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
678 step
= ctx
->ListExt
->Opcode
[i
].Size
;
684 * Delete the named display list, but don't remove from hash table.
685 * \param dlist - display list pointer
688 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
693 n
= block
= dlist
->Head
;
695 done
= block
? GL_FALSE
: GL_TRUE
;
697 const OpCode opcode
= n
[0].opcode
;
699 /* check for extension opcodes first */
700 if (is_ext_opcode(opcode
)) {
701 n
+= ext_opcode_destroy(ctx
, n
);
705 /* for some commands, we need to free malloc'd memory */
707 free(get_pointer(&n
[6]));
708 n
+= InstSize
[n
[0].opcode
];
711 free(get_pointer(&n
[10]));
712 n
+= InstSize
[n
[0].opcode
];
714 case OPCODE_DRAW_PIXELS
:
715 free(get_pointer(&n
[5]));
716 n
+= InstSize
[n
[0].opcode
];
719 free(get_pointer(&n
[7]));
720 n
+= InstSize
[n
[0].opcode
];
722 case OPCODE_POLYGON_STIPPLE
:
723 free(get_pointer(&n
[1]));
724 n
+= InstSize
[n
[0].opcode
];
726 case OPCODE_TEX_IMAGE1D
:
727 free(get_pointer(&n
[8]));
728 n
+= InstSize
[n
[0].opcode
];
730 case OPCODE_TEX_IMAGE2D
:
731 free(get_pointer(&n
[9]));
732 n
+= InstSize
[n
[0].opcode
];
734 case OPCODE_TEX_IMAGE3D
:
735 free(get_pointer(&n
[10]));
736 n
+= InstSize
[n
[0].opcode
];
738 case OPCODE_TEX_SUB_IMAGE1D
:
739 free(get_pointer(&n
[7]));
740 n
+= InstSize
[n
[0].opcode
];
742 case OPCODE_TEX_SUB_IMAGE2D
:
743 free(get_pointer(&n
[9]));
744 n
+= InstSize
[n
[0].opcode
];
746 case OPCODE_TEX_SUB_IMAGE3D
:
747 free(get_pointer(&n
[11]));
748 n
+= InstSize
[n
[0].opcode
];
750 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
751 free(get_pointer(&n
[7]));
752 n
+= InstSize
[n
[0].opcode
];
754 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
755 free(get_pointer(&n
[8]));
756 n
+= InstSize
[n
[0].opcode
];
758 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
759 free(get_pointer(&n
[9]));
760 n
+= InstSize
[n
[0].opcode
];
762 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
763 free(get_pointer(&n
[7]));
764 n
+= InstSize
[n
[0].opcode
];
766 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
767 free(get_pointer(&n
[9]));
768 n
+= InstSize
[n
[0].opcode
];
770 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
771 free(get_pointer(&n
[11]));
772 n
+= InstSize
[n
[0].opcode
];
774 case OPCODE_PROGRAM_STRING_ARB
:
775 free(get_pointer(&n
[4])); /* program string */
776 n
+= InstSize
[n
[0].opcode
];
778 case OPCODE_UNIFORM_1FV
:
779 case OPCODE_UNIFORM_2FV
:
780 case OPCODE_UNIFORM_3FV
:
781 case OPCODE_UNIFORM_4FV
:
782 case OPCODE_UNIFORM_1IV
:
783 case OPCODE_UNIFORM_2IV
:
784 case OPCODE_UNIFORM_3IV
:
785 case OPCODE_UNIFORM_4IV
:
786 case OPCODE_UNIFORM_1UIV
:
787 case OPCODE_UNIFORM_2UIV
:
788 case OPCODE_UNIFORM_3UIV
:
789 case OPCODE_UNIFORM_4UIV
:
790 free(get_pointer(&n
[3]));
791 n
+= InstSize
[n
[0].opcode
];
793 case OPCODE_UNIFORM_MATRIX22
:
794 case OPCODE_UNIFORM_MATRIX33
:
795 case OPCODE_UNIFORM_MATRIX44
:
796 case OPCODE_UNIFORM_MATRIX24
:
797 case OPCODE_UNIFORM_MATRIX42
:
798 case OPCODE_UNIFORM_MATRIX23
:
799 case OPCODE_UNIFORM_MATRIX32
:
800 case OPCODE_UNIFORM_MATRIX34
:
801 case OPCODE_UNIFORM_MATRIX43
:
802 free(get_pointer(&n
[4]));
803 n
+= InstSize
[n
[0].opcode
];
805 case OPCODE_PROGRAM_UNIFORM_1FV
:
806 case OPCODE_PROGRAM_UNIFORM_2FV
:
807 case OPCODE_PROGRAM_UNIFORM_3FV
:
808 case OPCODE_PROGRAM_UNIFORM_4FV
:
809 case OPCODE_PROGRAM_UNIFORM_1IV
:
810 case OPCODE_PROGRAM_UNIFORM_2IV
:
811 case OPCODE_PROGRAM_UNIFORM_3IV
:
812 case OPCODE_PROGRAM_UNIFORM_4IV
:
813 case OPCODE_PROGRAM_UNIFORM_1UIV
:
814 case OPCODE_PROGRAM_UNIFORM_2UIV
:
815 case OPCODE_PROGRAM_UNIFORM_3UIV
:
816 case OPCODE_PROGRAM_UNIFORM_4UIV
:
817 free(get_pointer(&n
[4]));
818 n
+= InstSize
[n
[0].opcode
];
820 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
821 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
824 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
825 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
826 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
827 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
828 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
829 free(get_pointer(&n
[5]));
830 n
+= InstSize
[n
[0].opcode
];
832 case OPCODE_PIXEL_MAP
:
833 free(get_pointer(&n
[3]));
834 n
+= InstSize
[n
[0].opcode
];
837 case OPCODE_CONTINUE
:
838 n
= (Node
*) get_pointer(&n
[1]);
842 case OPCODE_END_OF_LIST
:
847 /* Most frequent case */
848 n
+= InstSize
[n
[0].opcode
];
860 * Destroy a display list and remove from hash table.
861 * \param list - display list number
864 destroy_list(struct gl_context
*ctx
, GLuint list
)
866 struct gl_display_list
*dlist
;
871 dlist
= _mesa_lookup_list(ctx
, list
);
875 _mesa_delete_list(ctx
, dlist
);
876 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
881 * Translate the nth element of list from <type> to GLint.
884 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
896 bptr
= (GLbyte
*) list
;
897 return (GLint
) bptr
[n
];
898 case GL_UNSIGNED_BYTE
:
899 ubptr
= (GLubyte
*) list
;
900 return (GLint
) ubptr
[n
];
902 sptr
= (GLshort
*) list
;
903 return (GLint
) sptr
[n
];
904 case GL_UNSIGNED_SHORT
:
905 usptr
= (GLushort
*) list
;
906 return (GLint
) usptr
[n
];
908 iptr
= (GLint
*) list
;
910 case GL_UNSIGNED_INT
:
911 uiptr
= (GLuint
*) list
;
912 return (GLint
) uiptr
[n
];
914 fptr
= (GLfloat
*) list
;
915 return (GLint
) floorf(fptr
[n
]);
917 ubptr
= ((GLubyte
*) list
) + 2 * n
;
918 return (GLint
) ubptr
[0] * 256
921 ubptr
= ((GLubyte
*) list
) + 3 * n
;
922 return (GLint
) ubptr
[0] * 65536
923 + (GLint
) ubptr
[1] * 256
926 ubptr
= ((GLubyte
*) list
) + 4 * n
;
927 return (GLint
) ubptr
[0] * 16777216
928 + (GLint
) ubptr
[1] * 65536
929 + (GLint
) ubptr
[2] * 256
938 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
939 * If width < 0 or height < 0 or format or type are invalid we'll just
940 * return NULL. We will not generate an error since OpenGL command
941 * arguments aren't error-checked until the command is actually executed
942 * (not when they're compiled).
943 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
946 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
947 GLsizei width
, GLsizei height
, GLsizei depth
,
948 GLenum format
, GLenum type
, const GLvoid
* pixels
,
949 const struct gl_pixelstore_attrib
*unpack
)
951 if (width
<= 0 || height
<= 0) {
955 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
956 /* bad format and/or type */
960 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
964 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
965 format
, type
, pixels
, unpack
);
966 if (pixels
&& !image
) {
967 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
971 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
972 depth
, format
, type
, INT_MAX
, pixels
)) {
973 const GLubyte
*map
, *src
;
977 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
978 GL_MAP_READ_BIT
, unpack
->BufferObj
,
981 /* unable to map src buffer! */
982 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
986 src
= ADD_POINTERS(map
, pixels
);
987 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
988 format
, type
, src
, unpack
);
990 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
993 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
999 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1004 /** Return copy of memory */
1006 memdup(const void *src
, GLsizei bytes
)
1008 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1010 memcpy(b
, src
, bytes
);
1016 * Allocate space for a display list instruction (opcode + payload space).
1017 * \param opcode the instruction opcode (OPCODE_* value)
1018 * \param bytes instruction payload size (not counting opcode)
1019 * \param align8 does the payload need to be 8-byte aligned?
1020 * This is only relevant in 64-bit environments.
1021 * \return pointer to allocated memory (the payload will be at pointer+1)
1024 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1026 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1027 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1031 if (opcode
< OPCODE_EXT_0
) {
1032 if (InstSize
[opcode
] == 0) {
1033 /* save instruction size now */
1034 InstSize
[opcode
] = numNodes
;
1037 /* make sure instruction size agrees */
1038 assert(numNodes
== InstSize
[opcode
]);
1042 if (sizeof(void *) > sizeof(Node
) && align8
1043 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1044 /* The opcode would get placed at node[0] and the payload would start
1045 * at node[1]. But the payload needs to be at an even offset (8-byte
1054 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1056 /* This block is full. Allocate a new block and chain to it */
1058 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1059 n
[0].opcode
= OPCODE_CONTINUE
;
1060 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1062 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1066 /* a fresh block should be 8-byte aligned on 64-bit systems */
1067 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1069 save_pointer(&n
[1], newblock
);
1070 ctx
->ListState
.CurrentBlock
= newblock
;
1071 ctx
->ListState
.CurrentPos
= 0;
1073 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1074 * we have to insert a NOP so that the payload of the real opcode lands
1075 * on an even location:
1076 * node[0] = OPCODE_NOP
1077 * node[1] = OPCODE_x;
1078 * node[2] = start of payload
1080 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1083 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1085 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1086 n
[0].opcode
= OPCODE_NOP
;
1088 /* The "real" opcode will now be at an odd location and the payload
1089 * will be at an even location.
1092 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1094 n
[0].opcode
= opcode
;
1102 * Allocate space for a display list instruction. Used by callers outside
1103 * this file for things like VBO vertex data.
1105 * \param opcode the instruction opcode (OPCODE_* value)
1106 * \param bytes instruction size in bytes, not counting opcode.
1107 * \return pointer to the usable data area (not including the internal
1111 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1113 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1115 return n
+ 1; /* return pointer to payload area, after opcode */
1122 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1123 * aligned in 64-bit environments, 4-byte aligned otherwise.
1126 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1128 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1130 return n
+ 1; /* return pointer to payload area, after opcode */
1137 * This function allows modules and drivers to get their own opcodes
1138 * for extending display list functionality.
1139 * \param ctx the rendering context
1140 * \param size number of bytes for storing the new display list command
1141 * \param execute function to execute the new display list command
1142 * \param destroy function to destroy the new display list command
1143 * \param print function to print the new display list command
1144 * \return the new opcode number or -1 if error
1147 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1149 void (*execute
) (struct gl_context
*, void *),
1150 void (*destroy
) (struct gl_context
*, void *),
1151 void (*print
) (struct gl_context
*, void *, FILE *))
1153 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1154 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1155 ctx
->ListExt
->Opcode
[i
].Size
=
1156 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1157 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1158 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1159 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1160 return i
+ OPCODE_EXT_0
;
1167 * Allocate space for a display list instruction. The space is basically
1168 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1169 * function parameter, node[2] is the second parameter, etc.
1171 * \param opcode one of OPCODE_x
1172 * \param nparams number of function parameters
1173 * \return pointer to start of instruction space
1175 static inline Node
*
1176 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1178 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1183 * Called by EndList to try to reduce memory used for the list.
1186 trim_list(struct gl_context
*ctx
)
1188 /* If the list we're ending only has one allocated block of nodes/tokens
1189 * and its size isn't a full block size, realloc the block to use less
1190 * memory. This is important for apps that create many small display
1191 * lists and apps that use glXUseXFont (many lists each containing one
1193 * Note: we currently only trim display lists that allocated one block
1194 * of tokens. That hits the short list case which is what we're mainly
1195 * concerned with. Trimming longer lists would involve traversing the
1196 * linked list of blocks.
1198 struct gl_dlist_state
*list
= &ctx
->ListState
;
1200 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1201 (list
->CurrentPos
< BLOCK_SIZE
)) {
1202 /* There's only one block and it's not full, so realloc */
1203 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1204 list
->CurrentList
->Head
=
1205 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1206 if (!list
->CurrentBlock
) {
1207 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1215 * Display List compilation functions
1217 static void GLAPIENTRY
1218 save_Accum(GLenum op
, GLfloat value
)
1220 GET_CURRENT_CONTEXT(ctx
);
1222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1223 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1228 if (ctx
->ExecuteFlag
) {
1229 CALL_Accum(ctx
->Exec
, (op
, value
));
1234 static void GLAPIENTRY
1235 save_AlphaFunc(GLenum func
, GLclampf ref
)
1237 GET_CURRENT_CONTEXT(ctx
);
1239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1240 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1243 n
[2].f
= (GLfloat
) ref
;
1245 if (ctx
->ExecuteFlag
) {
1246 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1251 static void GLAPIENTRY
1252 save_BindTexture(GLenum target
, GLuint texture
)
1254 GET_CURRENT_CONTEXT(ctx
);
1256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1257 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1262 if (ctx
->ExecuteFlag
) {
1263 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1268 static void GLAPIENTRY
1269 save_Bitmap(GLsizei width
, GLsizei height
,
1270 GLfloat xorig
, GLfloat yorig
,
1271 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1273 GET_CURRENT_CONTEXT(ctx
);
1275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1276 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1278 n
[1].i
= (GLint
) width
;
1279 n
[2].i
= (GLint
) height
;
1285 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1286 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1288 if (ctx
->ExecuteFlag
) {
1289 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1290 xorig
, yorig
, xmove
, ymove
, pixels
));
1295 static void GLAPIENTRY
1296 save_BlendEquation(GLenum mode
)
1298 GET_CURRENT_CONTEXT(ctx
);
1300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1301 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1305 if (ctx
->ExecuteFlag
) {
1306 CALL_BlendEquation(ctx
->Exec
, (mode
));
1311 static void GLAPIENTRY
1312 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1314 GET_CURRENT_CONTEXT(ctx
);
1316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1317 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1322 if (ctx
->ExecuteFlag
) {
1323 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1328 static void GLAPIENTRY
1329 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1330 GLenum sfactorA
, GLenum dfactorA
)
1332 GET_CURRENT_CONTEXT(ctx
);
1334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1335 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1337 n
[1].e
= sfactorRGB
;
1338 n
[2].e
= dfactorRGB
;
1342 if (ctx
->ExecuteFlag
) {
1343 CALL_BlendFuncSeparate(ctx
->Exec
,
1344 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1349 static void GLAPIENTRY
1350 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1352 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1356 static void GLAPIENTRY
1357 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1359 GET_CURRENT_CONTEXT(ctx
);
1361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1362 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1369 if (ctx
->ExecuteFlag
) {
1370 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1374 /* GL_ARB_draw_buffers_blend */
1375 static void GLAPIENTRY
1376 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1377 GLenum sfactorA
, GLenum dfactorA
)
1379 GET_CURRENT_CONTEXT(ctx
);
1381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1382 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1385 n
[2].e
= sfactorRGB
;
1386 n
[3].e
= dfactorRGB
;
1390 if (ctx
->ExecuteFlag
) {
1391 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1392 sfactorA
, dfactorA
));
1396 /* GL_ARB_draw_buffers_blend */
1397 static void GLAPIENTRY
1398 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1400 GET_CURRENT_CONTEXT(ctx
);
1402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1403 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1409 if (ctx
->ExecuteFlag
) {
1410 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1414 /* GL_ARB_draw_buffers_blend */
1415 static void GLAPIENTRY
1416 save_BlendEquationi(GLuint buf
, GLenum mode
)
1418 GET_CURRENT_CONTEXT(ctx
);
1420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1421 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1426 if (ctx
->ExecuteFlag
) {
1427 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1431 /* GL_ARB_draw_buffers_blend */
1432 static void GLAPIENTRY
1433 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1435 GET_CURRENT_CONTEXT(ctx
);
1437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1438 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1444 if (ctx
->ExecuteFlag
) {
1445 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1450 /* GL_ARB_draw_instanced. */
1451 static void GLAPIENTRY
1452 save_DrawArraysInstancedARB(GLenum mode
,
1457 GET_CURRENT_CONTEXT(ctx
);
1458 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1459 "glDrawArraysInstanced() during display list compile");
1462 static void GLAPIENTRY
1463 save_DrawElementsInstancedARB(GLenum mode
,
1466 const GLvoid
*indices
,
1469 GET_CURRENT_CONTEXT(ctx
);
1470 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1471 "glDrawElementsInstanced() during display list compile");
1474 static void GLAPIENTRY
1475 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1478 const GLvoid
*indices
,
1482 GET_CURRENT_CONTEXT(ctx
);
1483 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1484 "glDrawElementsInstancedBaseVertex() during display list compile");
1487 /* GL_ARB_base_instance. */
1488 static void GLAPIENTRY
1489 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1493 GLuint baseinstance
)
1495 GET_CURRENT_CONTEXT(ctx
);
1496 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1497 "glDrawArraysInstancedBaseInstance() during display list compile");
1500 static void APIENTRY
1501 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1504 const void *indices
,
1506 GLuint baseinstance
)
1508 GET_CURRENT_CONTEXT(ctx
);
1509 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1510 "glDrawElementsInstancedBaseInstance() during display list compile");
1513 static void APIENTRY
1514 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1517 const void *indices
,
1520 GLuint baseinstance
)
1522 GET_CURRENT_CONTEXT(ctx
);
1523 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1524 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1529 * While building a display list we cache some OpenGL state.
1530 * Under some circumstances we need to invalidate that state (immediately
1531 * when we start compiling a list, or after glCallList(s)).
1534 invalidate_saved_current_state(struct gl_context
*ctx
)
1538 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1539 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1541 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1542 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1544 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1546 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1550 static void GLAPIENTRY
1551 save_CallList(GLuint list
)
1553 GET_CURRENT_CONTEXT(ctx
);
1555 SAVE_FLUSH_VERTICES(ctx
);
1557 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1562 /* After this, we don't know what state we're in. Invalidate all
1563 * cached information previously gathered:
1565 invalidate_saved_current_state( ctx
);
1567 if (ctx
->ExecuteFlag
) {
1568 _mesa_CallList(list
);
1573 static void GLAPIENTRY
1574 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1576 GET_CURRENT_CONTEXT(ctx
);
1578 GLboolean typeErrorFlag
;
1580 SAVE_FLUSH_VERTICES(ctx
);
1584 case GL_UNSIGNED_BYTE
:
1586 case GL_UNSIGNED_SHORT
:
1588 case GL_UNSIGNED_INT
:
1593 typeErrorFlag
= GL_FALSE
;
1596 typeErrorFlag
= GL_TRUE
;
1599 for (i
= 0; i
< num
; i
++) {
1600 GLint list
= translate_id(i
, type
, lists
);
1601 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1604 n
[2].b
= typeErrorFlag
;
1608 /* After this, we don't know what state we're in. Invalidate all
1609 * cached information previously gathered:
1611 invalidate_saved_current_state( ctx
);
1613 if (ctx
->ExecuteFlag
) {
1614 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1619 static void GLAPIENTRY
1620 save_Clear(GLbitfield mask
)
1622 GET_CURRENT_CONTEXT(ctx
);
1624 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1625 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1629 if (ctx
->ExecuteFlag
) {
1630 CALL_Clear(ctx
->Exec
, (mask
));
1635 static void GLAPIENTRY
1636 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1638 GET_CURRENT_CONTEXT(ctx
);
1640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1641 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1644 n
[2].i
= drawbuffer
;
1646 if (buffer
== GL_COLOR
) {
1657 if (ctx
->ExecuteFlag
) {
1658 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1663 static void GLAPIENTRY
1664 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1666 GET_CURRENT_CONTEXT(ctx
);
1668 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1669 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1672 n
[2].i
= drawbuffer
;
1674 if (buffer
== GL_COLOR
) {
1685 if (ctx
->ExecuteFlag
) {
1686 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1691 static void GLAPIENTRY
1692 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1694 GET_CURRENT_CONTEXT(ctx
);
1696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1697 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1700 n
[2].i
= drawbuffer
;
1702 if (buffer
== GL_COLOR
) {
1713 if (ctx
->ExecuteFlag
) {
1714 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1719 static void GLAPIENTRY
1720 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1721 GLfloat depth
, GLint stencil
)
1723 GET_CURRENT_CONTEXT(ctx
);
1725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1726 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1729 n
[2].i
= drawbuffer
;
1733 if (ctx
->ExecuteFlag
) {
1734 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1739 static void GLAPIENTRY
1740 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1742 GET_CURRENT_CONTEXT(ctx
);
1744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1745 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1752 if (ctx
->ExecuteFlag
) {
1753 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1758 static void GLAPIENTRY
1759 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1761 GET_CURRENT_CONTEXT(ctx
);
1763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1764 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1771 if (ctx
->ExecuteFlag
) {
1772 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1777 static void GLAPIENTRY
1778 save_ClearDepth(GLclampd depth
)
1780 GET_CURRENT_CONTEXT(ctx
);
1782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1783 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1785 n
[1].f
= (GLfloat
) depth
;
1787 if (ctx
->ExecuteFlag
) {
1788 CALL_ClearDepth(ctx
->Exec
, (depth
));
1793 static void GLAPIENTRY
1794 save_ClearIndex(GLfloat c
)
1796 GET_CURRENT_CONTEXT(ctx
);
1798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1799 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1803 if (ctx
->ExecuteFlag
) {
1804 CALL_ClearIndex(ctx
->Exec
, (c
));
1809 static void GLAPIENTRY
1810 save_ClearStencil(GLint s
)
1812 GET_CURRENT_CONTEXT(ctx
);
1814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1815 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1819 if (ctx
->ExecuteFlag
) {
1820 CALL_ClearStencil(ctx
->Exec
, (s
));
1825 static void GLAPIENTRY
1826 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1828 GET_CURRENT_CONTEXT(ctx
);
1830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1831 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1834 n
[2].f
= (GLfloat
) equ
[0];
1835 n
[3].f
= (GLfloat
) equ
[1];
1836 n
[4].f
= (GLfloat
) equ
[2];
1837 n
[5].f
= (GLfloat
) equ
[3];
1839 if (ctx
->ExecuteFlag
) {
1840 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1846 static void GLAPIENTRY
1847 save_ColorMask(GLboolean red
, GLboolean green
,
1848 GLboolean blue
, GLboolean alpha
)
1850 GET_CURRENT_CONTEXT(ctx
);
1852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1853 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1860 if (ctx
->ExecuteFlag
) {
1861 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1866 static void GLAPIENTRY
1867 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1868 GLboolean blue
, GLboolean alpha
)
1870 GET_CURRENT_CONTEXT(ctx
);
1872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1873 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1881 if (ctx
->ExecuteFlag
) {
1882 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1887 static void GLAPIENTRY
1888 save_ColorMaterial(GLenum face
, GLenum mode
)
1890 GET_CURRENT_CONTEXT(ctx
);
1892 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1894 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1899 if (ctx
->ExecuteFlag
) {
1900 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1905 static void GLAPIENTRY
1906 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1908 GET_CURRENT_CONTEXT(ctx
);
1910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1911 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1915 n
[3].i
= (GLint
) width
;
1916 n
[4].i
= (GLint
) height
;
1919 if (ctx
->ExecuteFlag
) {
1920 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1926 static void GLAPIENTRY
1927 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1928 GLint x
, GLint y
, GLsizei width
, GLint border
)
1930 GET_CURRENT_CONTEXT(ctx
);
1932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1933 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1937 n
[3].e
= internalformat
;
1943 if (ctx
->ExecuteFlag
) {
1944 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1945 x
, y
, width
, border
));
1950 static void GLAPIENTRY
1951 save_CopyTexImage2D(GLenum target
, GLint level
,
1952 GLenum internalformat
,
1953 GLint x
, GLint y
, GLsizei width
,
1954 GLsizei height
, GLint border
)
1956 GET_CURRENT_CONTEXT(ctx
);
1958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1959 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1963 n
[3].e
= internalformat
;
1970 if (ctx
->ExecuteFlag
) {
1971 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1972 x
, y
, width
, height
, border
));
1978 static void GLAPIENTRY
1979 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1980 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1982 GET_CURRENT_CONTEXT(ctx
);
1984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1985 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1994 if (ctx
->ExecuteFlag
) {
1995 CALL_CopyTexSubImage1D(ctx
->Exec
,
1996 (target
, level
, xoffset
, x
, y
, width
));
2001 static void GLAPIENTRY
2002 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2003 GLint xoffset
, GLint yoffset
,
2004 GLint x
, GLint y
, GLsizei width
, GLint height
)
2006 GET_CURRENT_CONTEXT(ctx
);
2008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2009 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2020 if (ctx
->ExecuteFlag
) {
2021 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2022 x
, y
, width
, height
));
2027 static void GLAPIENTRY
2028 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2029 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2030 GLint x
, GLint y
, GLsizei width
, GLint height
)
2032 GET_CURRENT_CONTEXT(ctx
);
2034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2035 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2047 if (ctx
->ExecuteFlag
) {
2048 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2049 xoffset
, yoffset
, zoffset
,
2050 x
, y
, width
, height
));
2055 static void GLAPIENTRY
2056 save_CullFace(GLenum mode
)
2058 GET_CURRENT_CONTEXT(ctx
);
2060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2061 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2065 if (ctx
->ExecuteFlag
) {
2066 CALL_CullFace(ctx
->Exec
, (mode
));
2071 static void GLAPIENTRY
2072 save_DepthFunc(GLenum func
)
2074 GET_CURRENT_CONTEXT(ctx
);
2076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2077 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2081 if (ctx
->ExecuteFlag
) {
2082 CALL_DepthFunc(ctx
->Exec
, (func
));
2087 static void GLAPIENTRY
2088 save_DepthMask(GLboolean mask
)
2090 GET_CURRENT_CONTEXT(ctx
);
2092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2093 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2097 if (ctx
->ExecuteFlag
) {
2098 CALL_DepthMask(ctx
->Exec
, (mask
));
2103 static void GLAPIENTRY
2104 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2106 GET_CURRENT_CONTEXT(ctx
);
2108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2109 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2111 n
[1].f
= (GLfloat
) nearval
;
2112 n
[2].f
= (GLfloat
) farval
;
2114 if (ctx
->ExecuteFlag
) {
2115 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2120 static void GLAPIENTRY
2121 save_Disable(GLenum cap
)
2123 GET_CURRENT_CONTEXT(ctx
);
2125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2126 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2130 if (ctx
->ExecuteFlag
) {
2131 CALL_Disable(ctx
->Exec
, (cap
));
2136 static void GLAPIENTRY
2137 save_DisableIndexed(GLuint index
, GLenum cap
)
2139 GET_CURRENT_CONTEXT(ctx
);
2141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2142 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2147 if (ctx
->ExecuteFlag
) {
2148 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2153 static void GLAPIENTRY
2154 save_DrawBuffer(GLenum mode
)
2156 GET_CURRENT_CONTEXT(ctx
);
2158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2159 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2163 if (ctx
->ExecuteFlag
) {
2164 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2169 static void GLAPIENTRY
2170 save_DrawPixels(GLsizei width
, GLsizei height
,
2171 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2173 GET_CURRENT_CONTEXT(ctx
);
2176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2178 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2185 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2186 pixels
, &ctx
->Unpack
));
2188 if (ctx
->ExecuteFlag
) {
2189 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2195 static void GLAPIENTRY
2196 save_Enable(GLenum cap
)
2198 GET_CURRENT_CONTEXT(ctx
);
2200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2201 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2205 if (ctx
->ExecuteFlag
) {
2206 CALL_Enable(ctx
->Exec
, (cap
));
2212 static void GLAPIENTRY
2213 save_EnableIndexed(GLuint index
, GLenum cap
)
2215 GET_CURRENT_CONTEXT(ctx
);
2217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2218 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2223 if (ctx
->ExecuteFlag
) {
2224 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2230 static void GLAPIENTRY
2231 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2233 GET_CURRENT_CONTEXT(ctx
);
2235 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2236 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2242 if (ctx
->ExecuteFlag
) {
2243 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2248 static void GLAPIENTRY
2249 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2251 GET_CURRENT_CONTEXT(ctx
);
2253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2254 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2262 if (ctx
->ExecuteFlag
) {
2263 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2270 static void GLAPIENTRY
2271 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2273 GET_CURRENT_CONTEXT(ctx
);
2275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2276 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2284 if (ctx
->ExecuteFlag
) {
2285 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2290 static void GLAPIENTRY
2291 save_Fogf(GLenum pname
, GLfloat param
)
2295 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2296 save_Fogfv(pname
, parray
);
2300 static void GLAPIENTRY
2301 save_Fogiv(GLenum pname
, const GLint
*params
)
2306 case GL_FOG_DENSITY
:
2310 p
[0] = (GLfloat
) *params
;
2316 p
[0] = INT_TO_FLOAT(params
[0]);
2317 p
[1] = INT_TO_FLOAT(params
[1]);
2318 p
[2] = INT_TO_FLOAT(params
[2]);
2319 p
[3] = INT_TO_FLOAT(params
[3]);
2322 /* Error will be caught later in gl_Fogfv */
2323 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2325 save_Fogfv(pname
, p
);
2329 static void GLAPIENTRY
2330 save_Fogi(GLenum pname
, GLint param
)
2334 parray
[1] = parray
[2] = parray
[3] = 0;
2335 save_Fogiv(pname
, parray
);
2339 static void GLAPIENTRY
2340 save_FrontFace(GLenum mode
)
2342 GET_CURRENT_CONTEXT(ctx
);
2344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2345 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2349 if (ctx
->ExecuteFlag
) {
2350 CALL_FrontFace(ctx
->Exec
, (mode
));
2355 static void GLAPIENTRY
2356 save_Frustum(GLdouble left
, GLdouble right
,
2357 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2359 GET_CURRENT_CONTEXT(ctx
);
2361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2362 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2364 n
[1].f
= (GLfloat
) left
;
2365 n
[2].f
= (GLfloat
) right
;
2366 n
[3].f
= (GLfloat
) bottom
;
2367 n
[4].f
= (GLfloat
) top
;
2368 n
[5].f
= (GLfloat
) nearval
;
2369 n
[6].f
= (GLfloat
) farval
;
2371 if (ctx
->ExecuteFlag
) {
2372 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2377 static void GLAPIENTRY
2378 save_Hint(GLenum target
, GLenum mode
)
2380 GET_CURRENT_CONTEXT(ctx
);
2382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2383 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2388 if (ctx
->ExecuteFlag
) {
2389 CALL_Hint(ctx
->Exec
, (target
, mode
));
2394 static void GLAPIENTRY
2395 save_IndexMask(GLuint mask
)
2397 GET_CURRENT_CONTEXT(ctx
);
2399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2400 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2404 if (ctx
->ExecuteFlag
) {
2405 CALL_IndexMask(ctx
->Exec
, (mask
));
2410 static void GLAPIENTRY
2411 save_InitNames(void)
2413 GET_CURRENT_CONTEXT(ctx
);
2414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2415 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2416 if (ctx
->ExecuteFlag
) {
2417 CALL_InitNames(ctx
->Exec
, ());
2422 static void GLAPIENTRY
2423 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2425 GET_CURRENT_CONTEXT(ctx
);
2427 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2428 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2446 case GL_SPOT_DIRECTION
:
2449 case GL_SPOT_EXPONENT
:
2452 case GL_SPOT_CUTOFF
:
2455 case GL_CONSTANT_ATTENUATION
:
2458 case GL_LINEAR_ATTENUATION
:
2461 case GL_QUADRATIC_ATTENUATION
:
2467 for (i
= 0; i
< nParams
; i
++) {
2468 n
[3 + i
].f
= params
[i
];
2471 if (ctx
->ExecuteFlag
) {
2472 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2477 static void GLAPIENTRY
2478 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2482 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2483 save_Lightfv(light
, pname
, parray
);
2487 static void GLAPIENTRY
2488 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2495 fparam
[0] = INT_TO_FLOAT(params
[0]);
2496 fparam
[1] = INT_TO_FLOAT(params
[1]);
2497 fparam
[2] = INT_TO_FLOAT(params
[2]);
2498 fparam
[3] = INT_TO_FLOAT(params
[3]);
2501 fparam
[0] = (GLfloat
) params
[0];
2502 fparam
[1] = (GLfloat
) params
[1];
2503 fparam
[2] = (GLfloat
) params
[2];
2504 fparam
[3] = (GLfloat
) params
[3];
2506 case GL_SPOT_DIRECTION
:
2507 fparam
[0] = (GLfloat
) params
[0];
2508 fparam
[1] = (GLfloat
) params
[1];
2509 fparam
[2] = (GLfloat
) params
[2];
2511 case GL_SPOT_EXPONENT
:
2512 case GL_SPOT_CUTOFF
:
2513 case GL_CONSTANT_ATTENUATION
:
2514 case GL_LINEAR_ATTENUATION
:
2515 case GL_QUADRATIC_ATTENUATION
:
2516 fparam
[0] = (GLfloat
) params
[0];
2519 /* error will be caught later in gl_Lightfv */
2522 save_Lightfv(light
, pname
, fparam
);
2526 static void GLAPIENTRY
2527 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2531 parray
[1] = parray
[2] = parray
[3] = 0;
2532 save_Lightiv(light
, pname
, parray
);
2536 static void GLAPIENTRY
2537 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2539 GET_CURRENT_CONTEXT(ctx
);
2541 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2542 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2550 if (ctx
->ExecuteFlag
) {
2551 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2556 static void GLAPIENTRY
2557 save_LightModelf(GLenum pname
, GLfloat param
)
2561 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2562 save_LightModelfv(pname
, parray
);
2566 static void GLAPIENTRY
2567 save_LightModeliv(GLenum pname
, const GLint
*params
)
2571 case GL_LIGHT_MODEL_AMBIENT
:
2572 fparam
[0] = INT_TO_FLOAT(params
[0]);
2573 fparam
[1] = INT_TO_FLOAT(params
[1]);
2574 fparam
[2] = INT_TO_FLOAT(params
[2]);
2575 fparam
[3] = INT_TO_FLOAT(params
[3]);
2577 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2578 case GL_LIGHT_MODEL_TWO_SIDE
:
2579 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2580 fparam
[0] = (GLfloat
) params
[0];
2586 /* Error will be caught later in gl_LightModelfv */
2587 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2589 save_LightModelfv(pname
, fparam
);
2593 static void GLAPIENTRY
2594 save_LightModeli(GLenum pname
, GLint param
)
2598 parray
[1] = parray
[2] = parray
[3] = 0;
2599 save_LightModeliv(pname
, parray
);
2603 static void GLAPIENTRY
2604 save_LineStipple(GLint factor
, GLushort pattern
)
2606 GET_CURRENT_CONTEXT(ctx
);
2608 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2609 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2614 if (ctx
->ExecuteFlag
) {
2615 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2620 static void GLAPIENTRY
2621 save_LineWidth(GLfloat width
)
2623 GET_CURRENT_CONTEXT(ctx
);
2625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2626 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2630 if (ctx
->ExecuteFlag
) {
2631 CALL_LineWidth(ctx
->Exec
, (width
));
2636 static void GLAPIENTRY
2637 save_ListBase(GLuint base
)
2639 GET_CURRENT_CONTEXT(ctx
);
2641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2642 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2646 if (ctx
->ExecuteFlag
) {
2647 CALL_ListBase(ctx
->Exec
, (base
));
2652 static void GLAPIENTRY
2653 save_LoadIdentity(void)
2655 GET_CURRENT_CONTEXT(ctx
);
2656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2657 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2658 if (ctx
->ExecuteFlag
) {
2659 CALL_LoadIdentity(ctx
->Exec
, ());
2664 static void GLAPIENTRY
2665 save_LoadMatrixf(const GLfloat
* m
)
2667 GET_CURRENT_CONTEXT(ctx
);
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2670 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2673 for (i
= 0; i
< 16; i
++) {
2677 if (ctx
->ExecuteFlag
) {
2678 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2683 static void GLAPIENTRY
2684 save_LoadMatrixd(const GLdouble
* m
)
2688 for (i
= 0; i
< 16; i
++) {
2689 f
[i
] = (GLfloat
) m
[i
];
2691 save_LoadMatrixf(f
);
2695 static void GLAPIENTRY
2696 save_LoadName(GLuint name
)
2698 GET_CURRENT_CONTEXT(ctx
);
2700 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2701 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2705 if (ctx
->ExecuteFlag
) {
2706 CALL_LoadName(ctx
->Exec
, (name
));
2711 static void GLAPIENTRY
2712 save_LogicOp(GLenum opcode
)
2714 GET_CURRENT_CONTEXT(ctx
);
2716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2717 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2721 if (ctx
->ExecuteFlag
) {
2722 CALL_LogicOp(ctx
->Exec
, (opcode
));
2727 static void GLAPIENTRY
2728 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2729 GLint order
, const GLdouble
* points
)
2731 GET_CURRENT_CONTEXT(ctx
);
2733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2734 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2736 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2738 n
[2].f
= (GLfloat
) u1
;
2739 n
[3].f
= (GLfloat
) u2
;
2740 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2742 save_pointer(&n
[6], pnts
);
2744 if (ctx
->ExecuteFlag
) {
2745 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2749 static void GLAPIENTRY
2750 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2751 GLint order
, const GLfloat
* points
)
2753 GET_CURRENT_CONTEXT(ctx
);
2755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2756 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2758 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2762 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2764 save_pointer(&n
[6], pnts
);
2766 if (ctx
->ExecuteFlag
) {
2767 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2772 static void GLAPIENTRY
2773 save_Map2d(GLenum target
,
2774 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2775 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2776 const GLdouble
* points
)
2778 GET_CURRENT_CONTEXT(ctx
);
2780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2781 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2783 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2784 vstride
, vorder
, points
);
2786 n
[2].f
= (GLfloat
) u1
;
2787 n
[3].f
= (GLfloat
) u2
;
2788 n
[4].f
= (GLfloat
) v1
;
2789 n
[5].f
= (GLfloat
) v2
;
2790 /* XXX verify these strides are correct */
2791 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2792 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2795 save_pointer(&n
[10], pnts
);
2797 if (ctx
->ExecuteFlag
) {
2798 CALL_Map2d(ctx
->Exec
, (target
,
2799 u1
, u2
, ustride
, uorder
,
2800 v1
, v2
, vstride
, vorder
, points
));
2805 static void GLAPIENTRY
2806 save_Map2f(GLenum target
,
2807 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2808 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2809 const GLfloat
* points
)
2811 GET_CURRENT_CONTEXT(ctx
);
2813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2814 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2816 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2817 vstride
, vorder
, points
);
2823 /* XXX verify these strides are correct */
2824 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2825 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2828 save_pointer(&n
[10], pnts
);
2830 if (ctx
->ExecuteFlag
) {
2831 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2832 v1
, v2
, vstride
, vorder
, points
));
2837 static void GLAPIENTRY
2838 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2840 GET_CURRENT_CONTEXT(ctx
);
2842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2843 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2849 if (ctx
->ExecuteFlag
) {
2850 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2855 static void GLAPIENTRY
2856 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2858 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2862 static void GLAPIENTRY
2863 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2864 GLint vn
, GLfloat v1
, GLfloat v2
)
2866 GET_CURRENT_CONTEXT(ctx
);
2868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2869 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2878 if (ctx
->ExecuteFlag
) {
2879 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2885 static void GLAPIENTRY
2886 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2887 GLint vn
, GLdouble v1
, GLdouble v2
)
2889 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2890 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2894 static void GLAPIENTRY
2895 save_MatrixMode(GLenum mode
)
2897 GET_CURRENT_CONTEXT(ctx
);
2899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2900 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2904 if (ctx
->ExecuteFlag
) {
2905 CALL_MatrixMode(ctx
->Exec
, (mode
));
2910 static void GLAPIENTRY
2911 save_MultMatrixf(const GLfloat
* m
)
2913 GET_CURRENT_CONTEXT(ctx
);
2915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2916 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2919 for (i
= 0; i
< 16; i
++) {
2923 if (ctx
->ExecuteFlag
) {
2924 CALL_MultMatrixf(ctx
->Exec
, (m
));
2929 static void GLAPIENTRY
2930 save_MultMatrixd(const GLdouble
* m
)
2934 for (i
= 0; i
< 16; i
++) {
2935 f
[i
] = (GLfloat
) m
[i
];
2937 save_MultMatrixf(f
);
2941 static void GLAPIENTRY
2942 save_NewList(GLuint name
, GLenum mode
)
2944 GET_CURRENT_CONTEXT(ctx
);
2945 /* It's an error to call this function while building a display list */
2946 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2953 static void GLAPIENTRY
2954 save_Ortho(GLdouble left
, GLdouble right
,
2955 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2957 GET_CURRENT_CONTEXT(ctx
);
2959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2960 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2962 n
[1].f
= (GLfloat
) left
;
2963 n
[2].f
= (GLfloat
) right
;
2964 n
[3].f
= (GLfloat
) bottom
;
2965 n
[4].f
= (GLfloat
) top
;
2966 n
[5].f
= (GLfloat
) nearval
;
2967 n
[6].f
= (GLfloat
) farval
;
2969 if (ctx
->ExecuteFlag
) {
2970 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2975 static void GLAPIENTRY
2976 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2978 GET_CURRENT_CONTEXT(ctx
);
2980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2981 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2985 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2987 if (ctx
->ExecuteFlag
) {
2988 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2993 static void GLAPIENTRY
2994 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2996 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2998 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2999 for (i
= 0; i
< mapsize
; i
++) {
3000 fvalues
[i
] = (GLfloat
) values
[i
];
3004 for (i
= 0; i
< mapsize
; i
++) {
3005 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3008 save_PixelMapfv(map
, mapsize
, fvalues
);
3012 static void GLAPIENTRY
3013 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3015 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3017 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3018 for (i
= 0; i
< mapsize
; i
++) {
3019 fvalues
[i
] = (GLfloat
) values
[i
];
3023 for (i
= 0; i
< mapsize
; i
++) {
3024 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3027 save_PixelMapfv(map
, mapsize
, fvalues
);
3031 static void GLAPIENTRY
3032 save_PixelTransferf(GLenum pname
, GLfloat param
)
3034 GET_CURRENT_CONTEXT(ctx
);
3036 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3037 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3042 if (ctx
->ExecuteFlag
) {
3043 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3048 static void GLAPIENTRY
3049 save_PixelTransferi(GLenum pname
, GLint param
)
3051 save_PixelTransferf(pname
, (GLfloat
) param
);
3055 static void GLAPIENTRY
3056 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3058 GET_CURRENT_CONTEXT(ctx
);
3060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3061 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3066 if (ctx
->ExecuteFlag
) {
3067 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3072 static void GLAPIENTRY
3073 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3075 GET_CURRENT_CONTEXT(ctx
);
3077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3078 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3085 if (ctx
->ExecuteFlag
) {
3086 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3091 static void GLAPIENTRY
3092 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3096 parray
[1] = parray
[2] = 0.0F
;
3097 save_PointParameterfvEXT(pname
, parray
);
3100 static void GLAPIENTRY
3101 save_PointParameteriNV(GLenum pname
, GLint param
)
3104 parray
[0] = (GLfloat
) param
;
3105 parray
[1] = parray
[2] = 0.0F
;
3106 save_PointParameterfvEXT(pname
, parray
);
3109 static void GLAPIENTRY
3110 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3113 parray
[0] = (GLfloat
) param
[0];
3114 parray
[1] = parray
[2] = 0.0F
;
3115 save_PointParameterfvEXT(pname
, parray
);
3119 static void GLAPIENTRY
3120 save_PointSize(GLfloat size
)
3122 GET_CURRENT_CONTEXT(ctx
);
3124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3125 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3129 if (ctx
->ExecuteFlag
) {
3130 CALL_PointSize(ctx
->Exec
, (size
));
3135 static void GLAPIENTRY
3136 save_PolygonMode(GLenum face
, GLenum mode
)
3138 GET_CURRENT_CONTEXT(ctx
);
3140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3141 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3146 if (ctx
->ExecuteFlag
) {
3147 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3152 static void GLAPIENTRY
3153 save_PolygonStipple(const GLubyte
* pattern
)
3155 GET_CURRENT_CONTEXT(ctx
);
3158 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3160 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3163 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3164 pattern
, &ctx
->Unpack
));
3166 if (ctx
->ExecuteFlag
) {
3167 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3172 static void GLAPIENTRY
3173 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3175 GET_CURRENT_CONTEXT(ctx
);
3177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3178 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3183 if (ctx
->ExecuteFlag
) {
3184 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3189 static void GLAPIENTRY
3190 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3192 GET_CURRENT_CONTEXT(ctx
);
3193 /* XXX mult by DepthMaxF here??? */
3194 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3197 static void GLAPIENTRY
3198 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3200 GET_CURRENT_CONTEXT(ctx
);
3202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3203 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3209 if (ctx
->ExecuteFlag
) {
3210 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3214 static void GLAPIENTRY
3215 save_PopAttrib(void)
3217 GET_CURRENT_CONTEXT(ctx
);
3218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3219 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3220 if (ctx
->ExecuteFlag
) {
3221 CALL_PopAttrib(ctx
->Exec
, ());
3226 static void GLAPIENTRY
3227 save_PopMatrix(void)
3229 GET_CURRENT_CONTEXT(ctx
);
3230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3231 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3232 if (ctx
->ExecuteFlag
) {
3233 CALL_PopMatrix(ctx
->Exec
, ());
3238 static void GLAPIENTRY
3241 GET_CURRENT_CONTEXT(ctx
);
3242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3243 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3244 if (ctx
->ExecuteFlag
) {
3245 CALL_PopName(ctx
->Exec
, ());
3250 static void GLAPIENTRY
3251 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3252 const GLclampf
* priorities
)
3254 GET_CURRENT_CONTEXT(ctx
);
3256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3258 for (i
= 0; i
< num
; i
++) {
3260 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3262 n
[1].ui
= textures
[i
];
3263 n
[2].f
= priorities
[i
];
3266 if (ctx
->ExecuteFlag
) {
3267 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3272 static void GLAPIENTRY
3273 save_PushAttrib(GLbitfield mask
)
3275 GET_CURRENT_CONTEXT(ctx
);
3277 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3278 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3282 if (ctx
->ExecuteFlag
) {
3283 CALL_PushAttrib(ctx
->Exec
, (mask
));
3288 static void GLAPIENTRY
3289 save_PushMatrix(void)
3291 GET_CURRENT_CONTEXT(ctx
);
3292 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3293 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3294 if (ctx
->ExecuteFlag
) {
3295 CALL_PushMatrix(ctx
->Exec
, ());
3300 static void GLAPIENTRY
3301 save_PushName(GLuint name
)
3303 GET_CURRENT_CONTEXT(ctx
);
3305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3306 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3310 if (ctx
->ExecuteFlag
) {
3311 CALL_PushName(ctx
->Exec
, (name
));
3316 static void GLAPIENTRY
3317 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3319 GET_CURRENT_CONTEXT(ctx
);
3321 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3322 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3329 if (ctx
->ExecuteFlag
) {
3330 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3334 static void GLAPIENTRY
3335 save_RasterPos2d(GLdouble x
, GLdouble y
)
3337 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3340 static void GLAPIENTRY
3341 save_RasterPos2f(GLfloat x
, GLfloat y
)
3343 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3346 static void GLAPIENTRY
3347 save_RasterPos2i(GLint x
, GLint y
)
3349 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3352 static void GLAPIENTRY
3353 save_RasterPos2s(GLshort x
, GLshort y
)
3355 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3358 static void GLAPIENTRY
3359 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3361 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3364 static void GLAPIENTRY
3365 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3367 save_RasterPos4f(x
, y
, z
, 1.0F
);
3370 static void GLAPIENTRY
3371 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3373 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3376 static void GLAPIENTRY
3377 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3379 save_RasterPos4f(x
, y
, z
, 1.0F
);
3382 static void GLAPIENTRY
3383 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3385 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3388 static void GLAPIENTRY
3389 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3391 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3394 static void GLAPIENTRY
3395 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3397 save_RasterPos4f(x
, y
, z
, w
);
3400 static void GLAPIENTRY
3401 save_RasterPos2dv(const GLdouble
* v
)
3403 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3406 static void GLAPIENTRY
3407 save_RasterPos2fv(const GLfloat
* v
)
3409 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3412 static void GLAPIENTRY
3413 save_RasterPos2iv(const GLint
* v
)
3415 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3418 static void GLAPIENTRY
3419 save_RasterPos2sv(const GLshort
* v
)
3421 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3424 static void GLAPIENTRY
3425 save_RasterPos3dv(const GLdouble
* v
)
3427 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3430 static void GLAPIENTRY
3431 save_RasterPos3fv(const GLfloat
* v
)
3433 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3436 static void GLAPIENTRY
3437 save_RasterPos3iv(const GLint
* v
)
3439 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3442 static void GLAPIENTRY
3443 save_RasterPos3sv(const GLshort
* v
)
3445 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3448 static void GLAPIENTRY
3449 save_RasterPos4dv(const GLdouble
* v
)
3451 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3452 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3455 static void GLAPIENTRY
3456 save_RasterPos4fv(const GLfloat
* v
)
3458 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3461 static void GLAPIENTRY
3462 save_RasterPos4iv(const GLint
* v
)
3464 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3465 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3468 static void GLAPIENTRY
3469 save_RasterPos4sv(const GLshort
* v
)
3471 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3475 static void GLAPIENTRY
3476 save_PassThrough(GLfloat token
)
3478 GET_CURRENT_CONTEXT(ctx
);
3480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3481 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3485 if (ctx
->ExecuteFlag
) {
3486 CALL_PassThrough(ctx
->Exec
, (token
));
3491 static void GLAPIENTRY
3492 save_ReadBuffer(GLenum mode
)
3494 GET_CURRENT_CONTEXT(ctx
);
3496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3497 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3501 if (ctx
->ExecuteFlag
) {
3502 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3507 static void GLAPIENTRY
3508 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3510 GET_CURRENT_CONTEXT(ctx
);
3512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3513 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3520 if (ctx
->ExecuteFlag
) {
3521 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3526 static void GLAPIENTRY
3527 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3529 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3533 static void GLAPIENTRY
3534 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3536 GET_CURRENT_CONTEXT(ctx
);
3538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3539 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3545 if (ctx
->ExecuteFlag
) {
3546 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3551 static void GLAPIENTRY
3552 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3554 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3558 static void GLAPIENTRY
3559 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3561 GET_CURRENT_CONTEXT(ctx
);
3563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3564 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3571 if (ctx
->ExecuteFlag
) {
3572 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3577 static void GLAPIENTRY
3578 save_ShadeModel(GLenum mode
)
3580 GET_CURRENT_CONTEXT(ctx
);
3582 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3584 if (ctx
->ExecuteFlag
) {
3585 CALL_ShadeModel(ctx
->Exec
, (mode
));
3588 /* Don't compile this call if it's a no-op.
3589 * By avoiding this state change we have a better chance of
3590 * coalescing subsequent drawing commands into one batch.
3592 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3595 SAVE_FLUSH_VERTICES(ctx
);
3597 ctx
->ListState
.Current
.ShadeModel
= mode
;
3599 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3606 static void GLAPIENTRY
3607 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3609 GET_CURRENT_CONTEXT(ctx
);
3611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3612 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3618 if (ctx
->ExecuteFlag
) {
3619 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3624 static void GLAPIENTRY
3625 save_StencilMask(GLuint mask
)
3627 GET_CURRENT_CONTEXT(ctx
);
3629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3630 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3634 if (ctx
->ExecuteFlag
) {
3635 CALL_StencilMask(ctx
->Exec
, (mask
));
3640 static void GLAPIENTRY
3641 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3643 GET_CURRENT_CONTEXT(ctx
);
3645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3646 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3652 if (ctx
->ExecuteFlag
) {
3653 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3658 static void GLAPIENTRY
3659 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3661 GET_CURRENT_CONTEXT(ctx
);
3663 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3664 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3671 if (ctx
->ExecuteFlag
) {
3672 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3677 static void GLAPIENTRY
3678 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3681 GET_CURRENT_CONTEXT(ctx
);
3683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3685 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3693 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3700 if (ctx
->ExecuteFlag
) {
3701 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3702 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3707 static void GLAPIENTRY
3708 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3710 GET_CURRENT_CONTEXT(ctx
);
3712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3713 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3718 if (ctx
->ExecuteFlag
) {
3719 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3724 static void GLAPIENTRY
3725 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3727 GET_CURRENT_CONTEXT(ctx
);
3729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3730 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3737 if (ctx
->ExecuteFlag
) {
3738 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3743 static void GLAPIENTRY
3744 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3746 GET_CURRENT_CONTEXT(ctx
);
3748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3749 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3753 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3761 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3764 if (ctx
->ExecuteFlag
) {
3765 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3770 static void GLAPIENTRY
3771 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3774 parray
[0] = (GLfloat
) param
;
3775 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3776 save_TexEnvfv(target
, pname
, parray
);
3780 static void GLAPIENTRY
3781 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3784 p
[0] = (GLfloat
) param
;
3785 p
[1] = p
[2] = p
[3] = 0.0F
;
3786 save_TexEnvfv(target
, pname
, p
);
3790 static void GLAPIENTRY
3791 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3794 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3795 p
[0] = INT_TO_FLOAT(param
[0]);
3796 p
[1] = INT_TO_FLOAT(param
[1]);
3797 p
[2] = INT_TO_FLOAT(param
[2]);
3798 p
[3] = INT_TO_FLOAT(param
[3]);
3801 p
[0] = (GLfloat
) param
[0];
3802 p
[1] = p
[2] = p
[3] = 0.0F
;
3804 save_TexEnvfv(target
, pname
, p
);
3808 static void GLAPIENTRY
3809 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3811 GET_CURRENT_CONTEXT(ctx
);
3813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3814 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3823 if (ctx
->ExecuteFlag
) {
3824 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3829 static void GLAPIENTRY
3830 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3833 p
[0] = (GLfloat
) params
[0];
3834 p
[1] = (GLfloat
) params
[1];
3835 p
[2] = (GLfloat
) params
[2];
3836 p
[3] = (GLfloat
) params
[3];
3837 save_TexGenfv(coord
, pname
, p
);
3841 static void GLAPIENTRY
3842 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3845 parray
[0] = (GLfloat
) param
;
3846 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3847 save_TexGenfv(coord
, pname
, parray
);
3851 static void GLAPIENTRY
3852 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3855 p
[0] = (GLfloat
) params
[0];
3856 p
[1] = (GLfloat
) params
[1];
3857 p
[2] = (GLfloat
) params
[2];
3858 p
[3] = (GLfloat
) params
[3];
3859 save_TexGenfv(coord
, pname
, p
);
3863 static void GLAPIENTRY
3864 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3868 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3869 save_TexGenfv(coord
, pname
, parray
);
3873 static void GLAPIENTRY
3874 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3878 parray
[1] = parray
[2] = parray
[3] = 0;
3879 save_TexGeniv(coord
, pname
, parray
);
3883 static void GLAPIENTRY
3884 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3886 GET_CURRENT_CONTEXT(ctx
);
3888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3889 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3898 if (ctx
->ExecuteFlag
) {
3899 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3904 static void GLAPIENTRY
3905 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3909 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3910 save_TexParameterfv(target
, pname
, parray
);
3914 static void GLAPIENTRY
3915 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3918 fparam
[0] = (GLfloat
) param
;
3919 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3920 save_TexParameterfv(target
, pname
, fparam
);
3924 static void GLAPIENTRY
3925 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3928 fparam
[0] = (GLfloat
) params
[0];
3929 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3930 save_TexParameterfv(target
, pname
, fparam
);
3934 static void GLAPIENTRY
3935 save_TexImage1D(GLenum target
,
3936 GLint level
, GLint components
,
3937 GLsizei width
, GLint border
,
3938 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3940 GET_CURRENT_CONTEXT(ctx
);
3941 if (target
== GL_PROXY_TEXTURE_1D
) {
3942 /* don't compile, execute immediately */
3943 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3944 border
, format
, type
, pixels
));
3948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3949 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3953 n
[3].i
= components
;
3954 n
[4].i
= (GLint
) width
;
3959 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3960 pixels
, &ctx
->Unpack
));
3962 if (ctx
->ExecuteFlag
) {
3963 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3964 border
, format
, type
, pixels
));
3970 static void GLAPIENTRY
3971 save_TexImage2D(GLenum target
,
3972 GLint level
, GLint components
,
3973 GLsizei width
, GLsizei height
, GLint border
,
3974 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3976 GET_CURRENT_CONTEXT(ctx
);
3977 if (target
== GL_PROXY_TEXTURE_2D
) {
3978 /* don't compile, execute immediately */
3979 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3980 height
, border
, format
, type
, pixels
));
3984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3985 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3989 n
[3].i
= components
;
3990 n
[4].i
= (GLint
) width
;
3991 n
[5].i
= (GLint
) height
;
3996 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3997 pixels
, &ctx
->Unpack
));
3999 if (ctx
->ExecuteFlag
) {
4000 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4001 height
, border
, format
, type
, pixels
));
4007 static void GLAPIENTRY
4008 save_TexImage3D(GLenum target
,
4009 GLint level
, GLint internalFormat
,
4010 GLsizei width
, GLsizei height
, GLsizei depth
,
4012 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4014 GET_CURRENT_CONTEXT(ctx
);
4015 if (target
== GL_PROXY_TEXTURE_3D
) {
4016 /* don't compile, execute immediately */
4017 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4018 height
, depth
, border
, format
, type
,
4023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4024 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4028 n
[3].i
= (GLint
) internalFormat
;
4029 n
[4].i
= (GLint
) width
;
4030 n
[5].i
= (GLint
) height
;
4031 n
[6].i
= (GLint
) depth
;
4035 save_pointer(&n
[10],
4036 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4037 pixels
, &ctx
->Unpack
));
4039 if (ctx
->ExecuteFlag
) {
4040 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4041 height
, depth
, border
, format
, type
,
4048 static void GLAPIENTRY
4049 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4050 GLsizei width
, GLenum format
, GLenum type
,
4051 const GLvoid
* pixels
)
4053 GET_CURRENT_CONTEXT(ctx
);
4056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4058 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4063 n
[4].i
= (GLint
) width
;
4067 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4068 pixels
, &ctx
->Unpack
));
4070 if (ctx
->ExecuteFlag
) {
4071 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4072 format
, type
, pixels
));
4077 static void GLAPIENTRY
4078 save_TexSubImage2D(GLenum target
, GLint level
,
4079 GLint xoffset
, GLint yoffset
,
4080 GLsizei width
, GLsizei height
,
4081 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4083 GET_CURRENT_CONTEXT(ctx
);
4086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4088 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4094 n
[5].i
= (GLint
) width
;
4095 n
[6].i
= (GLint
) height
;
4099 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4100 pixels
, &ctx
->Unpack
));
4102 if (ctx
->ExecuteFlag
) {
4103 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4104 width
, height
, format
, type
, pixels
));
4109 static void GLAPIENTRY
4110 save_TexSubImage3D(GLenum target
, GLint level
,
4111 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4112 GLsizei width
, GLsizei height
, GLsizei depth
,
4113 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4115 GET_CURRENT_CONTEXT(ctx
);
4118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4120 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4127 n
[6].i
= (GLint
) width
;
4128 n
[7].i
= (GLint
) height
;
4129 n
[8].i
= (GLint
) depth
;
4132 save_pointer(&n
[11],
4133 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4134 pixels
, &ctx
->Unpack
));
4136 if (ctx
->ExecuteFlag
) {
4137 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4138 xoffset
, yoffset
, zoffset
,
4139 width
, height
, depth
, format
, type
,
4145 static void GLAPIENTRY
4146 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4148 GET_CURRENT_CONTEXT(ctx
);
4150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4151 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4157 if (ctx
->ExecuteFlag
) {
4158 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4163 static void GLAPIENTRY
4164 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4166 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4171 static void GLAPIENTRY
4172 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4174 GET_CURRENT_CONTEXT(ctx
);
4176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4177 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4181 n
[3].i
= (GLint
) width
;
4182 n
[4].i
= (GLint
) height
;
4184 if (ctx
->ExecuteFlag
) {
4185 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4190 static void GLAPIENTRY
4191 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4193 GET_CURRENT_CONTEXT(ctx
);
4195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4196 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4203 if (ctx
->ExecuteFlag
) {
4204 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4208 static void GLAPIENTRY
4209 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4211 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4214 static void GLAPIENTRY
4215 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4217 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4220 static void GLAPIENTRY
4221 save_WindowPos2iMESA(GLint x
, GLint y
)
4223 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4226 static void GLAPIENTRY
4227 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4229 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4232 static void GLAPIENTRY
4233 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4235 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4238 static void GLAPIENTRY
4239 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4241 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4244 static void GLAPIENTRY
4245 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4247 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4250 static void GLAPIENTRY
4251 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4253 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4256 static void GLAPIENTRY
4257 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4259 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4262 static void GLAPIENTRY
4263 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4265 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4268 static void GLAPIENTRY
4269 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4271 save_WindowPos4fMESA(x
, y
, z
, w
);
4274 static void GLAPIENTRY
4275 save_WindowPos2dvMESA(const GLdouble
* v
)
4277 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4280 static void GLAPIENTRY
4281 save_WindowPos2fvMESA(const GLfloat
* v
)
4283 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4286 static void GLAPIENTRY
4287 save_WindowPos2ivMESA(const GLint
* v
)
4289 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4292 static void GLAPIENTRY
4293 save_WindowPos2svMESA(const GLshort
* v
)
4295 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4298 static void GLAPIENTRY
4299 save_WindowPos3dvMESA(const GLdouble
* v
)
4301 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4304 static void GLAPIENTRY
4305 save_WindowPos3fvMESA(const GLfloat
* v
)
4307 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4310 static void GLAPIENTRY
4311 save_WindowPos3ivMESA(const GLint
* v
)
4313 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4316 static void GLAPIENTRY
4317 save_WindowPos3svMESA(const GLshort
* v
)
4319 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4322 static void GLAPIENTRY
4323 save_WindowPos4dvMESA(const GLdouble
* v
)
4325 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4326 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4329 static void GLAPIENTRY
4330 save_WindowPos4fvMESA(const GLfloat
* v
)
4332 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4335 static void GLAPIENTRY
4336 save_WindowPos4ivMESA(const GLint
* v
)
4338 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4339 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4342 static void GLAPIENTRY
4343 save_WindowPos4svMESA(const GLshort
* v
)
4345 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4350 /* GL_ARB_multitexture */
4351 static void GLAPIENTRY
4352 save_ActiveTextureARB(GLenum target
)
4354 GET_CURRENT_CONTEXT(ctx
);
4356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4357 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4361 if (ctx
->ExecuteFlag
) {
4362 CALL_ActiveTexture(ctx
->Exec
, (target
));
4367 /* GL_ARB_transpose_matrix */
4369 static void GLAPIENTRY
4370 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4373 _math_transposefd(tm
, m
);
4374 save_LoadMatrixf(tm
);
4378 static void GLAPIENTRY
4379 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4382 _math_transposef(tm
, m
);
4383 save_LoadMatrixf(tm
);
4387 static void GLAPIENTRY
4388 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4391 _math_transposefd(tm
, m
);
4392 save_MultMatrixf(tm
);
4396 static void GLAPIENTRY
4397 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4400 _math_transposef(tm
, m
);
4401 save_MultMatrixf(tm
);
4404 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4406 GET_CURRENT_CONTEXT(ctx
);
4412 image
= malloc(size
);
4414 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4417 memcpy(image
, data
, size
);
4423 /* GL_ARB_texture_compression */
4424 static void GLAPIENTRY
4425 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4426 GLenum internalFormat
, GLsizei width
,
4427 GLint border
, GLsizei imageSize
,
4428 const GLvoid
* data
)
4430 GET_CURRENT_CONTEXT(ctx
);
4431 if (target
== GL_PROXY_TEXTURE_1D
) {
4432 /* don't compile, execute immediately */
4433 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4434 width
, border
, imageSize
,
4439 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4441 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4442 6 + POINTER_DWORDS
);
4446 n
[3].e
= internalFormat
;
4447 n
[4].i
= (GLint
) width
;
4451 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4453 if (ctx
->ExecuteFlag
) {
4454 CALL_CompressedTexImage1D(ctx
->Exec
,
4455 (target
, level
, internalFormat
, width
,
4456 border
, imageSize
, data
));
4462 static void GLAPIENTRY
4463 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4464 GLenum internalFormat
, GLsizei width
,
4465 GLsizei height
, GLint border
, GLsizei imageSize
,
4466 const GLvoid
* data
)
4468 GET_CURRENT_CONTEXT(ctx
);
4469 if (target
== GL_PROXY_TEXTURE_2D
) {
4470 /* don't compile, execute immediately */
4471 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4472 width
, height
, border
,
4477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4479 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4480 7 + POINTER_DWORDS
);
4484 n
[3].e
= internalFormat
;
4485 n
[4].i
= (GLint
) width
;
4486 n
[5].i
= (GLint
) height
;
4490 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4492 if (ctx
->ExecuteFlag
) {
4493 CALL_CompressedTexImage2D(ctx
->Exec
,
4494 (target
, level
, internalFormat
, width
,
4495 height
, border
, imageSize
, data
));
4501 static void GLAPIENTRY
4502 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4503 GLenum internalFormat
, GLsizei width
,
4504 GLsizei height
, GLsizei depth
, GLint border
,
4505 GLsizei imageSize
, const GLvoid
* data
)
4507 GET_CURRENT_CONTEXT(ctx
);
4508 if (target
== GL_PROXY_TEXTURE_3D
) {
4509 /* don't compile, execute immediately */
4510 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4511 width
, height
, depth
, border
,
4516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4518 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4519 8 + POINTER_DWORDS
);
4523 n
[3].e
= internalFormat
;
4524 n
[4].i
= (GLint
) width
;
4525 n
[5].i
= (GLint
) height
;
4526 n
[6].i
= (GLint
) depth
;
4530 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4532 if (ctx
->ExecuteFlag
) {
4533 CALL_CompressedTexImage3D(ctx
->Exec
,
4534 (target
, level
, internalFormat
, width
,
4535 height
, depth
, border
, imageSize
,
4542 static void GLAPIENTRY
4543 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4544 GLsizei width
, GLenum format
,
4545 GLsizei imageSize
, const GLvoid
* data
)
4548 GET_CURRENT_CONTEXT(ctx
);
4549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4551 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4552 6 + POINTER_DWORDS
);
4557 n
[4].i
= (GLint
) width
;
4561 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4563 if (ctx
->ExecuteFlag
) {
4564 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4565 width
, format
, imageSize
,
4571 static void GLAPIENTRY
4572 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4573 GLint yoffset
, GLsizei width
, GLsizei height
,
4574 GLenum format
, GLsizei imageSize
,
4575 const GLvoid
* data
)
4578 GET_CURRENT_CONTEXT(ctx
);
4579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4581 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4582 8 + POINTER_DWORDS
);
4588 n
[5].i
= (GLint
) width
;
4589 n
[6].i
= (GLint
) height
;
4593 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4595 if (ctx
->ExecuteFlag
) {
4596 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4597 (target
, level
, xoffset
, yoffset
, width
,
4598 height
, format
, imageSize
, data
));
4603 static void GLAPIENTRY
4604 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4605 GLint yoffset
, GLint zoffset
, GLsizei width
,
4606 GLsizei height
, GLsizei depth
, GLenum format
,
4607 GLsizei imageSize
, const GLvoid
* data
)
4610 GET_CURRENT_CONTEXT(ctx
);
4611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4613 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4614 10 + POINTER_DWORDS
);
4621 n
[6].i
= (GLint
) width
;
4622 n
[7].i
= (GLint
) height
;
4623 n
[8].i
= (GLint
) depth
;
4625 n
[10].i
= imageSize
;
4626 save_pointer(&n
[11],
4627 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4629 if (ctx
->ExecuteFlag
) {
4630 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4631 (target
, level
, xoffset
, yoffset
,
4632 zoffset
, width
, height
, depth
, format
,
4638 /* GL_ARB_multisample */
4639 static void GLAPIENTRY
4640 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4642 GET_CURRENT_CONTEXT(ctx
);
4644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4645 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4650 if (ctx
->ExecuteFlag
) {
4651 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4657 * GL_NV_fragment_program
4659 static void GLAPIENTRY
4660 save_BindProgramNV(GLenum target
, GLuint id
)
4662 GET_CURRENT_CONTEXT(ctx
);
4664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4665 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4670 if (ctx
->ExecuteFlag
) {
4671 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4675 static void GLAPIENTRY
4676 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4677 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4679 GET_CURRENT_CONTEXT(ctx
);
4681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4682 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4691 if (ctx
->ExecuteFlag
) {
4692 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4697 static void GLAPIENTRY
4698 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4699 const GLfloat
*params
)
4701 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4702 params
[2], params
[3]);
4706 static void GLAPIENTRY
4707 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4708 const GLfloat
* params
)
4710 GET_CURRENT_CONTEXT(ctx
);
4712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4716 const GLfloat
* p
= params
;
4718 for (i
= 0 ; i
< count
; i
++) {
4719 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4732 if (ctx
->ExecuteFlag
) {
4733 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4738 static void GLAPIENTRY
4739 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4740 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4742 save_ProgramEnvParameter4fARB(target
, index
,
4744 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4748 static void GLAPIENTRY
4749 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4750 const GLdouble
*params
)
4752 save_ProgramEnvParameter4fARB(target
, index
,
4753 (GLfloat
) params
[0],
4754 (GLfloat
) params
[1],
4755 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4759 static void GLAPIENTRY
4760 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4761 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4763 GET_CURRENT_CONTEXT(ctx
);
4765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4766 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4775 if (ctx
->ExecuteFlag
) {
4776 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4781 static void GLAPIENTRY
4782 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4783 const GLfloat
*params
)
4785 GET_CURRENT_CONTEXT(ctx
);
4787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4788 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4797 if (ctx
->ExecuteFlag
) {
4798 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4803 static void GLAPIENTRY
4804 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4805 const GLfloat
*params
)
4807 GET_CURRENT_CONTEXT(ctx
);
4809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4813 const GLfloat
* p
= params
;
4815 for (i
= 0 ; i
< count
; i
++) {
4816 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4829 if (ctx
->ExecuteFlag
) {
4830 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4835 static void GLAPIENTRY
4836 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4837 GLdouble x
, GLdouble y
,
4838 GLdouble z
, GLdouble w
)
4840 GET_CURRENT_CONTEXT(ctx
);
4842 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4843 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4847 n
[3].f
= (GLfloat
) x
;
4848 n
[4].f
= (GLfloat
) y
;
4849 n
[5].f
= (GLfloat
) z
;
4850 n
[6].f
= (GLfloat
) w
;
4852 if (ctx
->ExecuteFlag
) {
4853 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4858 static void GLAPIENTRY
4859 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4860 const GLdouble
*params
)
4862 GET_CURRENT_CONTEXT(ctx
);
4864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4865 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4869 n
[3].f
= (GLfloat
) params
[0];
4870 n
[4].f
= (GLfloat
) params
[1];
4871 n
[5].f
= (GLfloat
) params
[2];
4872 n
[6].f
= (GLfloat
) params
[3];
4874 if (ctx
->ExecuteFlag
) {
4875 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4880 /* GL_EXT_stencil_two_side */
4881 static void GLAPIENTRY
4882 save_ActiveStencilFaceEXT(GLenum face
)
4884 GET_CURRENT_CONTEXT(ctx
);
4886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4887 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4891 if (ctx
->ExecuteFlag
) {
4892 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4897 /* GL_EXT_depth_bounds_test */
4898 static void GLAPIENTRY
4899 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4901 GET_CURRENT_CONTEXT(ctx
);
4903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4904 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4906 n
[1].f
= (GLfloat
) zmin
;
4907 n
[2].f
= (GLfloat
) zmax
;
4909 if (ctx
->ExecuteFlag
) {
4910 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4916 static void GLAPIENTRY
4917 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4918 const GLvoid
* string
)
4920 GET_CURRENT_CONTEXT(ctx
);
4923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4925 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4927 GLubyte
*programCopy
= malloc(len
);
4929 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4932 memcpy(programCopy
, string
, len
);
4936 save_pointer(&n
[4], programCopy
);
4938 if (ctx
->ExecuteFlag
) {
4939 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4944 static void GLAPIENTRY
4945 save_BeginQueryARB(GLenum target
, GLuint id
)
4947 GET_CURRENT_CONTEXT(ctx
);
4949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4950 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4955 if (ctx
->ExecuteFlag
) {
4956 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4960 static void GLAPIENTRY
4961 save_EndQueryARB(GLenum target
)
4963 GET_CURRENT_CONTEXT(ctx
);
4965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4966 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4970 if (ctx
->ExecuteFlag
) {
4971 CALL_EndQuery(ctx
->Exec
, (target
));
4975 static void GLAPIENTRY
4976 save_QueryCounter(GLuint id
, GLenum target
)
4978 GET_CURRENT_CONTEXT(ctx
);
4980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4981 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4986 if (ctx
->ExecuteFlag
) {
4987 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4991 static void GLAPIENTRY
4992 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4994 GET_CURRENT_CONTEXT(ctx
);
4996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4997 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5003 if (ctx
->ExecuteFlag
) {
5004 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5008 static void GLAPIENTRY
5009 save_EndQueryIndexed(GLenum target
, GLuint index
)
5011 GET_CURRENT_CONTEXT(ctx
);
5013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5014 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5019 if (ctx
->ExecuteFlag
) {
5020 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5025 static void GLAPIENTRY
5026 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5028 GET_CURRENT_CONTEXT(ctx
);
5030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5031 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5035 if (count
> MAX_DRAW_BUFFERS
)
5036 count
= MAX_DRAW_BUFFERS
;
5037 for (i
= 0; i
< count
; i
++) {
5038 n
[2 + i
].e
= buffers
[i
];
5041 if (ctx
->ExecuteFlag
) {
5042 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5046 static void GLAPIENTRY
5047 save_BindFragmentShaderATI(GLuint id
)
5049 GET_CURRENT_CONTEXT(ctx
);
5052 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5056 if (ctx
->ExecuteFlag
) {
5057 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5061 static void GLAPIENTRY
5062 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5064 GET_CURRENT_CONTEXT(ctx
);
5067 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5075 if (ctx
->ExecuteFlag
) {
5076 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5080 static void GLAPIENTRY
5081 save_Attr1fNV(GLenum attr
, GLfloat x
)
5083 GET_CURRENT_CONTEXT(ctx
);
5085 SAVE_FLUSH_VERTICES(ctx
);
5086 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5092 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5093 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5094 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5096 if (ctx
->ExecuteFlag
) {
5097 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5101 static void GLAPIENTRY
5102 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5104 GET_CURRENT_CONTEXT(ctx
);
5106 SAVE_FLUSH_VERTICES(ctx
);
5107 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5114 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5115 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5116 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5118 if (ctx
->ExecuteFlag
) {
5119 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5123 static void GLAPIENTRY
5124 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5126 GET_CURRENT_CONTEXT(ctx
);
5128 SAVE_FLUSH_VERTICES(ctx
);
5129 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5137 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5138 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5139 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5141 if (ctx
->ExecuteFlag
) {
5142 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5146 static void GLAPIENTRY
5147 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5149 GET_CURRENT_CONTEXT(ctx
);
5151 SAVE_FLUSH_VERTICES(ctx
);
5152 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5161 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5162 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5163 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5165 if (ctx
->ExecuteFlag
) {
5166 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5171 static void GLAPIENTRY
5172 save_Attr1fARB(GLenum attr
, GLfloat x
)
5174 GET_CURRENT_CONTEXT(ctx
);
5176 SAVE_FLUSH_VERTICES(ctx
);
5177 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5183 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5184 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5185 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5187 if (ctx
->ExecuteFlag
) {
5188 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5192 static void GLAPIENTRY
5193 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5195 GET_CURRENT_CONTEXT(ctx
);
5197 SAVE_FLUSH_VERTICES(ctx
);
5198 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5205 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5206 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5207 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5209 if (ctx
->ExecuteFlag
) {
5210 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5214 static void GLAPIENTRY
5215 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5217 GET_CURRENT_CONTEXT(ctx
);
5219 SAVE_FLUSH_VERTICES(ctx
);
5220 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5228 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5229 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5230 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5232 if (ctx
->ExecuteFlag
) {
5233 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5237 static void GLAPIENTRY
5238 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5240 GET_CURRENT_CONTEXT(ctx
);
5242 SAVE_FLUSH_VERTICES(ctx
);
5243 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5252 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5253 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5254 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5256 if (ctx
->ExecuteFlag
) {
5257 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5262 static void GLAPIENTRY
5263 save_EvalCoord1f(GLfloat x
)
5265 GET_CURRENT_CONTEXT(ctx
);
5267 SAVE_FLUSH_VERTICES(ctx
);
5268 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5272 if (ctx
->ExecuteFlag
) {
5273 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5277 static void GLAPIENTRY
5278 save_EvalCoord1fv(const GLfloat
* v
)
5280 save_EvalCoord1f(v
[0]);
5283 static void GLAPIENTRY
5284 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5286 GET_CURRENT_CONTEXT(ctx
);
5288 SAVE_FLUSH_VERTICES(ctx
);
5289 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5294 if (ctx
->ExecuteFlag
) {
5295 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5299 static void GLAPIENTRY
5300 save_EvalCoord2fv(const GLfloat
* v
)
5302 save_EvalCoord2f(v
[0], v
[1]);
5306 static void GLAPIENTRY
5307 save_EvalPoint1(GLint x
)
5309 GET_CURRENT_CONTEXT(ctx
);
5311 SAVE_FLUSH_VERTICES(ctx
);
5312 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5316 if (ctx
->ExecuteFlag
) {
5317 CALL_EvalPoint1(ctx
->Exec
, (x
));
5321 static void GLAPIENTRY
5322 save_EvalPoint2(GLint x
, GLint y
)
5324 GET_CURRENT_CONTEXT(ctx
);
5326 SAVE_FLUSH_VERTICES(ctx
);
5327 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5332 if (ctx
->ExecuteFlag
) {
5333 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5337 static void GLAPIENTRY
5338 save_Indexf(GLfloat x
)
5340 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5343 static void GLAPIENTRY
5344 save_Indexfv(const GLfloat
* v
)
5346 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5349 static void GLAPIENTRY
5350 save_EdgeFlag(GLboolean x
)
5352 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5357 * Compare 'count' elements of vectors 'a' and 'b'.
5358 * \return GL_TRUE if equal, GL_FALSE if different.
5360 static inline GLboolean
5361 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5363 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5368 * This glMaterial function is used for glMaterial calls that are outside
5369 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5371 static void GLAPIENTRY
5372 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5374 GET_CURRENT_CONTEXT(ctx
);
5382 case GL_FRONT_AND_BACK
:
5385 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5394 case GL_AMBIENT_AND_DIFFUSE
:
5400 case GL_COLOR_INDEXES
:
5404 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5408 if (ctx
->ExecuteFlag
) {
5409 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5412 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5414 /* Try to eliminate redundant statechanges. Because it is legal to
5415 * call glMaterial even inside begin/end calls, don't need to worry
5416 * about ctx->Driver.CurrentSavePrimitive here.
5418 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5419 if (bitmask
& (1 << i
)) {
5420 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5421 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5422 /* no change in material value */
5423 bitmask
&= ~(1 << i
);
5426 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5427 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5432 /* If this call has no effect, return early */
5436 SAVE_FLUSH_VERTICES(ctx
);
5438 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5442 for (i
= 0; i
< args
; i
++)
5443 n
[3 + i
].f
= param
[i
];
5447 static void GLAPIENTRY
5448 save_Begin(GLenum mode
)
5450 GET_CURRENT_CONTEXT(ctx
);
5452 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5453 /* compile this error into the display list */
5454 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5456 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5457 /* compile this error into the display list */
5458 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5463 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5465 /* Give the driver an opportunity to hook in an optimized
5466 * display list compiler.
5468 if (vbo_save_NotifyBegin(ctx
, mode
))
5471 SAVE_FLUSH_VERTICES(ctx
);
5472 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5477 if (ctx
->ExecuteFlag
) {
5478 CALL_Begin(ctx
->Exec
, (mode
));
5483 static void GLAPIENTRY
5486 GET_CURRENT_CONTEXT(ctx
);
5487 SAVE_FLUSH_VERTICES(ctx
);
5488 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5489 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5490 if (ctx
->ExecuteFlag
) {
5491 CALL_End(ctx
->Exec
, ());
5495 static void GLAPIENTRY
5496 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5498 GET_CURRENT_CONTEXT(ctx
);
5500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5501 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5508 if (ctx
->ExecuteFlag
) {
5509 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5514 static void GLAPIENTRY
5515 save_Vertex2f(GLfloat x
, GLfloat y
)
5517 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5520 static void GLAPIENTRY
5521 save_Vertex2fv(const GLfloat
* v
)
5523 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5526 static void GLAPIENTRY
5527 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5529 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5532 static void GLAPIENTRY
5533 save_Vertex3fv(const GLfloat
* v
)
5535 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5538 static void GLAPIENTRY
5539 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5541 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5544 static void GLAPIENTRY
5545 save_Vertex4fv(const GLfloat
* v
)
5547 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5550 static void GLAPIENTRY
5551 save_TexCoord1f(GLfloat x
)
5553 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5556 static void GLAPIENTRY
5557 save_TexCoord1fv(const GLfloat
* v
)
5559 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5562 static void GLAPIENTRY
5563 save_TexCoord2f(GLfloat x
, GLfloat y
)
5565 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5568 static void GLAPIENTRY
5569 save_TexCoord2fv(const GLfloat
* v
)
5571 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5574 static void GLAPIENTRY
5575 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5577 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5580 static void GLAPIENTRY
5581 save_TexCoord3fv(const GLfloat
* v
)
5583 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5586 static void GLAPIENTRY
5587 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5589 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5592 static void GLAPIENTRY
5593 save_TexCoord4fv(const GLfloat
* v
)
5595 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5598 static void GLAPIENTRY
5599 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5601 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5604 static void GLAPIENTRY
5605 save_Normal3fv(const GLfloat
* v
)
5607 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5610 static void GLAPIENTRY
5611 save_FogCoordfEXT(GLfloat x
)
5613 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5616 static void GLAPIENTRY
5617 save_FogCoordfvEXT(const GLfloat
* v
)
5619 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5622 static void GLAPIENTRY
5623 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5625 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5628 static void GLAPIENTRY
5629 save_Color3fv(const GLfloat
* v
)
5631 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5634 static void GLAPIENTRY
5635 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5637 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5640 static void GLAPIENTRY
5641 save_Color4fv(const GLfloat
* v
)
5643 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5646 static void GLAPIENTRY
5647 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5649 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5652 static void GLAPIENTRY
5653 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5655 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5659 /* Just call the respective ATTR for texcoord
5661 static void GLAPIENTRY
5662 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5664 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5665 save_Attr1fNV(attr
, x
);
5668 static void GLAPIENTRY
5669 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5671 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5672 save_Attr1fNV(attr
, v
[0]);
5675 static void GLAPIENTRY
5676 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5678 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5679 save_Attr2fNV(attr
, x
, y
);
5682 static void GLAPIENTRY
5683 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5685 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5686 save_Attr2fNV(attr
, v
[0], v
[1]);
5689 static void GLAPIENTRY
5690 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5692 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5693 save_Attr3fNV(attr
, x
, y
, z
);
5696 static void GLAPIENTRY
5697 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5699 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5700 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5703 static void GLAPIENTRY
5704 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5705 GLfloat z
, GLfloat w
)
5707 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5708 save_Attr4fNV(attr
, x
, y
, z
, w
);
5711 static void GLAPIENTRY
5712 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5714 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5715 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5720 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5726 GET_CURRENT_CONTEXT(ctx
);
5727 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5732 static void GLAPIENTRY
5733 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5735 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5736 save_Attr1fARB(index
, x
);
5741 static void GLAPIENTRY
5742 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5744 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5745 save_Attr1fARB(index
, v
[0]);
5750 static void GLAPIENTRY
5751 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5753 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5754 save_Attr2fARB(index
, x
, y
);
5759 static void GLAPIENTRY
5760 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5762 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5763 save_Attr2fARB(index
, v
[0], v
[1]);
5768 static void GLAPIENTRY
5769 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5771 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5772 save_Attr3fARB(index
, x
, y
, z
);
5777 static void GLAPIENTRY
5778 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5780 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5781 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5786 static void GLAPIENTRY
5787 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5790 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5791 save_Attr4fARB(index
, x
, y
, z
, w
);
5796 static void GLAPIENTRY
5797 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5799 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5800 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5805 static void GLAPIENTRY
5806 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5807 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5808 GLbitfield mask
, GLenum filter
)
5810 GET_CURRENT_CONTEXT(ctx
);
5812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5813 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5826 if (ctx
->ExecuteFlag
) {
5827 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5828 dstX0
, dstY0
, dstX1
, dstY1
,
5834 /** GL_EXT_provoking_vertex */
5835 static void GLAPIENTRY
5836 save_ProvokingVertexEXT(GLenum mode
)
5838 GET_CURRENT_CONTEXT(ctx
);
5840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5841 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5845 if (ctx
->ExecuteFlag
) {
5846 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5847 _mesa_ProvokingVertex(mode
);
5852 /** GL_EXT_transform_feedback */
5853 static void GLAPIENTRY
5854 save_BeginTransformFeedback(GLenum mode
)
5856 GET_CURRENT_CONTEXT(ctx
);
5858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5859 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5863 if (ctx
->ExecuteFlag
) {
5864 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5869 /** GL_EXT_transform_feedback */
5870 static void GLAPIENTRY
5871 save_EndTransformFeedback(void)
5873 GET_CURRENT_CONTEXT(ctx
);
5874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5875 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5876 if (ctx
->ExecuteFlag
) {
5877 CALL_EndTransformFeedback(ctx
->Exec
, ());
5881 static void GLAPIENTRY
5882 save_BindTransformFeedback(GLenum target
, GLuint name
)
5884 GET_CURRENT_CONTEXT(ctx
);
5886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5887 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5892 if (ctx
->ExecuteFlag
) {
5893 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5897 static void GLAPIENTRY
5898 save_PauseTransformFeedback(void)
5900 GET_CURRENT_CONTEXT(ctx
);
5901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5902 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5903 if (ctx
->ExecuteFlag
) {
5904 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5908 static void GLAPIENTRY
5909 save_ResumeTransformFeedback(void)
5911 GET_CURRENT_CONTEXT(ctx
);
5912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5913 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5914 if (ctx
->ExecuteFlag
) {
5915 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5919 static void GLAPIENTRY
5920 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5922 GET_CURRENT_CONTEXT(ctx
);
5924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5925 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5930 if (ctx
->ExecuteFlag
) {
5931 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5935 static void GLAPIENTRY
5936 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5938 GET_CURRENT_CONTEXT(ctx
);
5940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5941 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5947 if (ctx
->ExecuteFlag
) {
5948 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5952 static void GLAPIENTRY
5953 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5956 GET_CURRENT_CONTEXT(ctx
);
5958 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5959 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5963 n
[3].si
= primcount
;
5965 if (ctx
->ExecuteFlag
) {
5966 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5970 static void GLAPIENTRY
5971 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5972 GLuint stream
, GLsizei primcount
)
5974 GET_CURRENT_CONTEXT(ctx
);
5976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5977 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5982 n
[4].si
= primcount
;
5984 if (ctx
->ExecuteFlag
) {
5985 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5990 /* aka UseProgram() */
5991 static void GLAPIENTRY
5992 save_UseProgramObjectARB(GLhandleARB program
)
5994 GET_CURRENT_CONTEXT(ctx
);
5996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5997 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6001 if (ctx
->ExecuteFlag
) {
6002 CALL_UseProgram(ctx
->Exec
, (program
));
6007 static void GLAPIENTRY
6008 save_Uniform1fARB(GLint location
, GLfloat x
)
6010 GET_CURRENT_CONTEXT(ctx
);
6012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6013 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6018 if (ctx
->ExecuteFlag
) {
6019 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6024 static void GLAPIENTRY
6025 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6027 GET_CURRENT_CONTEXT(ctx
);
6029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6030 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6036 if (ctx
->ExecuteFlag
) {
6037 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6042 static void GLAPIENTRY
6043 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6045 GET_CURRENT_CONTEXT(ctx
);
6047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6048 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6055 if (ctx
->ExecuteFlag
) {
6056 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6061 static void GLAPIENTRY
6062 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6064 GET_CURRENT_CONTEXT(ctx
);
6066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6067 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6075 if (ctx
->ExecuteFlag
) {
6076 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6081 static void GLAPIENTRY
6082 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6084 GET_CURRENT_CONTEXT(ctx
);
6086 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6087 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6091 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6093 if (ctx
->ExecuteFlag
) {
6094 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6098 static void GLAPIENTRY
6099 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6101 GET_CURRENT_CONTEXT(ctx
);
6103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6104 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6108 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6110 if (ctx
->ExecuteFlag
) {
6111 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6115 static void GLAPIENTRY
6116 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6118 GET_CURRENT_CONTEXT(ctx
);
6120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6121 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6125 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6127 if (ctx
->ExecuteFlag
) {
6128 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6132 static void GLAPIENTRY
6133 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6135 GET_CURRENT_CONTEXT(ctx
);
6137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6138 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6142 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6144 if (ctx
->ExecuteFlag
) {
6145 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6150 static void GLAPIENTRY
6151 save_Uniform1iARB(GLint location
, GLint x
)
6153 GET_CURRENT_CONTEXT(ctx
);
6155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6156 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6161 if (ctx
->ExecuteFlag
) {
6162 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6166 static void GLAPIENTRY
6167 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6169 GET_CURRENT_CONTEXT(ctx
);
6171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6172 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6178 if (ctx
->ExecuteFlag
) {
6179 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6183 static void GLAPIENTRY
6184 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6186 GET_CURRENT_CONTEXT(ctx
);
6188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6189 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6196 if (ctx
->ExecuteFlag
) {
6197 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6201 static void GLAPIENTRY
6202 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6204 GET_CURRENT_CONTEXT(ctx
);
6206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6207 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6215 if (ctx
->ExecuteFlag
) {
6216 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6222 static void GLAPIENTRY
6223 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6225 GET_CURRENT_CONTEXT(ctx
);
6227 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6228 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6232 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6234 if (ctx
->ExecuteFlag
) {
6235 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6239 static void GLAPIENTRY
6240 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6242 GET_CURRENT_CONTEXT(ctx
);
6244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6245 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6249 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6251 if (ctx
->ExecuteFlag
) {
6252 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6256 static void GLAPIENTRY
6257 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6259 GET_CURRENT_CONTEXT(ctx
);
6261 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6262 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6266 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6268 if (ctx
->ExecuteFlag
) {
6269 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6273 static void GLAPIENTRY
6274 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6276 GET_CURRENT_CONTEXT(ctx
);
6278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6279 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6283 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6285 if (ctx
->ExecuteFlag
) {
6286 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6292 static void GLAPIENTRY
6293 save_Uniform1ui(GLint location
, GLuint x
)
6295 GET_CURRENT_CONTEXT(ctx
);
6297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6298 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6303 if (ctx
->ExecuteFlag
) {
6304 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6308 static void GLAPIENTRY
6309 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6311 GET_CURRENT_CONTEXT(ctx
);
6313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6314 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6320 if (ctx
->ExecuteFlag
) {
6321 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6325 static void GLAPIENTRY
6326 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6328 GET_CURRENT_CONTEXT(ctx
);
6330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6331 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6338 if (ctx
->ExecuteFlag
) {
6339 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6343 static void GLAPIENTRY
6344 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6346 GET_CURRENT_CONTEXT(ctx
);
6348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6349 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6357 if (ctx
->ExecuteFlag
) {
6358 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6364 static void GLAPIENTRY
6365 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6367 GET_CURRENT_CONTEXT(ctx
);
6369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6370 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6374 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6376 if (ctx
->ExecuteFlag
) {
6377 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6381 static void GLAPIENTRY
6382 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6384 GET_CURRENT_CONTEXT(ctx
);
6386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6387 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6391 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6393 if (ctx
->ExecuteFlag
) {
6394 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6398 static void GLAPIENTRY
6399 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6401 GET_CURRENT_CONTEXT(ctx
);
6403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6404 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6408 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6410 if (ctx
->ExecuteFlag
) {
6411 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6415 static void GLAPIENTRY
6416 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6418 GET_CURRENT_CONTEXT(ctx
);
6420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6421 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6425 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6427 if (ctx
->ExecuteFlag
) {
6428 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6434 static void GLAPIENTRY
6435 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6438 GET_CURRENT_CONTEXT(ctx
);
6440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6441 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6446 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6448 if (ctx
->ExecuteFlag
) {
6449 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6453 static void GLAPIENTRY
6454 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6457 GET_CURRENT_CONTEXT(ctx
);
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6460 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6465 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6467 if (ctx
->ExecuteFlag
) {
6468 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6472 static void GLAPIENTRY
6473 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6476 GET_CURRENT_CONTEXT(ctx
);
6478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6479 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6484 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6486 if (ctx
->ExecuteFlag
) {
6487 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6492 static void GLAPIENTRY
6493 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6496 GET_CURRENT_CONTEXT(ctx
);
6498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6499 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6504 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6506 if (ctx
->ExecuteFlag
) {
6507 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6511 static void GLAPIENTRY
6512 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6515 GET_CURRENT_CONTEXT(ctx
);
6517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6518 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6523 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6525 if (ctx
->ExecuteFlag
) {
6526 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6531 static void GLAPIENTRY
6532 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6535 GET_CURRENT_CONTEXT(ctx
);
6537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6538 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6543 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6545 if (ctx
->ExecuteFlag
) {
6546 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6550 static void GLAPIENTRY
6551 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6554 GET_CURRENT_CONTEXT(ctx
);
6556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6557 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6562 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6564 if (ctx
->ExecuteFlag
) {
6565 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6570 static void GLAPIENTRY
6571 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6574 GET_CURRENT_CONTEXT(ctx
);
6576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6577 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6582 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6584 if (ctx
->ExecuteFlag
) {
6585 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6589 static void GLAPIENTRY
6590 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6593 GET_CURRENT_CONTEXT(ctx
);
6595 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6596 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6601 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6603 if (ctx
->ExecuteFlag
) {
6604 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6608 static void GLAPIENTRY
6609 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6611 GET_CURRENT_CONTEXT(ctx
);
6613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6614 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6620 if (ctx
->ExecuteFlag
) {
6621 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6625 static void GLAPIENTRY
6626 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6628 GET_CURRENT_CONTEXT(ctx
);
6630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6631 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6637 if (ctx
->ExecuteFlag
) {
6638 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6642 static void GLAPIENTRY
6643 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6645 GET_CURRENT_CONTEXT(ctx
);
6647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6648 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6655 if (ctx
->ExecuteFlag
) {
6656 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6660 static void GLAPIENTRY
6661 save_ProgramUniform3f(GLuint program
, GLint location
,
6662 GLfloat x
, GLfloat y
, GLfloat z
)
6664 GET_CURRENT_CONTEXT(ctx
);
6666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6667 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6675 if (ctx
->ExecuteFlag
) {
6676 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6680 static void GLAPIENTRY
6681 save_ProgramUniform4f(GLuint program
, GLint location
,
6682 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6684 GET_CURRENT_CONTEXT(ctx
);
6686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6687 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6696 if (ctx
->ExecuteFlag
) {
6697 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6701 static void GLAPIENTRY
6702 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6705 GET_CURRENT_CONTEXT(ctx
);
6707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6708 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6713 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6715 if (ctx
->ExecuteFlag
) {
6716 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6720 static void GLAPIENTRY
6721 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6724 GET_CURRENT_CONTEXT(ctx
);
6726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6727 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6732 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6734 if (ctx
->ExecuteFlag
) {
6735 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6739 static void GLAPIENTRY
6740 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6743 GET_CURRENT_CONTEXT(ctx
);
6745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6746 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6751 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6753 if (ctx
->ExecuteFlag
) {
6754 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6758 static void GLAPIENTRY
6759 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6762 GET_CURRENT_CONTEXT(ctx
);
6764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6765 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6770 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6772 if (ctx
->ExecuteFlag
) {
6773 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6777 static void GLAPIENTRY
6778 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6780 GET_CURRENT_CONTEXT(ctx
);
6782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6783 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6789 if (ctx
->ExecuteFlag
) {
6790 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6794 static void GLAPIENTRY
6795 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6797 GET_CURRENT_CONTEXT(ctx
);
6799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6800 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6807 if (ctx
->ExecuteFlag
) {
6808 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6812 static void GLAPIENTRY
6813 save_ProgramUniform3i(GLuint program
, GLint location
,
6814 GLint x
, GLint y
, GLint z
)
6816 GET_CURRENT_CONTEXT(ctx
);
6818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6819 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6827 if (ctx
->ExecuteFlag
) {
6828 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6832 static void GLAPIENTRY
6833 save_ProgramUniform4i(GLuint program
, GLint location
,
6834 GLint x
, GLint y
, GLint z
, GLint w
)
6836 GET_CURRENT_CONTEXT(ctx
);
6838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6839 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6848 if (ctx
->ExecuteFlag
) {
6849 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6853 static void GLAPIENTRY
6854 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6857 GET_CURRENT_CONTEXT(ctx
);
6859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6860 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6865 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6867 if (ctx
->ExecuteFlag
) {
6868 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6872 static void GLAPIENTRY
6873 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6876 GET_CURRENT_CONTEXT(ctx
);
6878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6879 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6884 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6886 if (ctx
->ExecuteFlag
) {
6887 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6891 static void GLAPIENTRY
6892 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6895 GET_CURRENT_CONTEXT(ctx
);
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6898 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6903 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6905 if (ctx
->ExecuteFlag
) {
6906 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6910 static void GLAPIENTRY
6911 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6914 GET_CURRENT_CONTEXT(ctx
);
6916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6917 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6922 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6924 if (ctx
->ExecuteFlag
) {
6925 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6929 static void GLAPIENTRY
6930 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6932 GET_CURRENT_CONTEXT(ctx
);
6934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6935 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6941 if (ctx
->ExecuteFlag
) {
6942 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6946 static void GLAPIENTRY
6947 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6949 GET_CURRENT_CONTEXT(ctx
);
6951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6952 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6959 if (ctx
->ExecuteFlag
) {
6960 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6964 static void GLAPIENTRY
6965 save_ProgramUniform3ui(GLuint program
, GLint location
,
6966 GLuint x
, GLuint y
, GLuint z
)
6968 GET_CURRENT_CONTEXT(ctx
);
6970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6971 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6979 if (ctx
->ExecuteFlag
) {
6980 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6984 static void GLAPIENTRY
6985 save_ProgramUniform4ui(GLuint program
, GLint location
,
6986 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6988 GET_CURRENT_CONTEXT(ctx
);
6990 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6991 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7000 if (ctx
->ExecuteFlag
) {
7001 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7005 static void GLAPIENTRY
7006 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7009 GET_CURRENT_CONTEXT(ctx
);
7011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7012 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7017 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7019 if (ctx
->ExecuteFlag
) {
7020 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7024 static void GLAPIENTRY
7025 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7028 GET_CURRENT_CONTEXT(ctx
);
7030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7031 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7036 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7038 if (ctx
->ExecuteFlag
) {
7039 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7043 static void GLAPIENTRY
7044 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7047 GET_CURRENT_CONTEXT(ctx
);
7049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7050 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7055 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7057 if (ctx
->ExecuteFlag
) {
7058 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7062 static void GLAPIENTRY
7063 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7066 GET_CURRENT_CONTEXT(ctx
);
7068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7069 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7074 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7076 if (ctx
->ExecuteFlag
) {
7077 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7081 static void GLAPIENTRY
7082 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7083 GLboolean transpose
, const GLfloat
*v
)
7085 GET_CURRENT_CONTEXT(ctx
);
7087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7088 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7089 4 + POINTER_DWORDS
);
7095 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7097 if (ctx
->ExecuteFlag
) {
7098 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7099 (program
, location
, count
, transpose
, v
));
7103 static void GLAPIENTRY
7104 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7105 GLboolean transpose
, const GLfloat
*v
)
7107 GET_CURRENT_CONTEXT(ctx
);
7109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7110 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7111 4 + POINTER_DWORDS
);
7117 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7119 if (ctx
->ExecuteFlag
) {
7120 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7121 (program
, location
, count
, transpose
, v
));
7125 static void GLAPIENTRY
7126 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7127 GLboolean transpose
, const GLfloat
*v
)
7129 GET_CURRENT_CONTEXT(ctx
);
7131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7132 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7133 4 + POINTER_DWORDS
);
7139 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7141 if (ctx
->ExecuteFlag
) {
7142 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7143 (program
, location
, count
, transpose
, v
));
7147 static void GLAPIENTRY
7148 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7149 GLboolean transpose
, const GLfloat
*v
)
7151 GET_CURRENT_CONTEXT(ctx
);
7153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7154 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7155 4 + POINTER_DWORDS
);
7161 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7163 if (ctx
->ExecuteFlag
) {
7164 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7165 (program
, location
, count
, transpose
, v
));
7169 static void GLAPIENTRY
7170 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7171 GLboolean transpose
, const GLfloat
*v
)
7173 GET_CURRENT_CONTEXT(ctx
);
7175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7176 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7177 4 + POINTER_DWORDS
);
7183 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7185 if (ctx
->ExecuteFlag
) {
7186 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7187 (program
, location
, count
, transpose
, v
));
7191 static void GLAPIENTRY
7192 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7193 GLboolean transpose
, const GLfloat
*v
)
7195 GET_CURRENT_CONTEXT(ctx
);
7197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7198 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7199 4 + POINTER_DWORDS
);
7205 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7207 if (ctx
->ExecuteFlag
) {
7208 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7209 (program
, location
, count
, transpose
, v
));
7213 static void GLAPIENTRY
7214 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7215 GLboolean transpose
, const GLfloat
*v
)
7217 GET_CURRENT_CONTEXT(ctx
);
7219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7220 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7221 4 + POINTER_DWORDS
);
7227 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7229 if (ctx
->ExecuteFlag
) {
7230 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7231 (program
, location
, count
, transpose
, v
));
7235 static void GLAPIENTRY
7236 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7237 GLboolean transpose
, const GLfloat
*v
)
7239 GET_CURRENT_CONTEXT(ctx
);
7241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7242 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7243 4 + POINTER_DWORDS
);
7249 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7251 if (ctx
->ExecuteFlag
) {
7252 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7253 (program
, location
, count
, transpose
, v
));
7257 static void GLAPIENTRY
7258 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7259 GLboolean transpose
, const GLfloat
*v
)
7261 GET_CURRENT_CONTEXT(ctx
);
7263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7264 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7265 4 + POINTER_DWORDS
);
7271 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7273 if (ctx
->ExecuteFlag
) {
7274 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7275 (program
, location
, count
, transpose
, v
));
7279 static void GLAPIENTRY
7280 save_ClipControl(GLenum origin
, GLenum depth
)
7282 GET_CURRENT_CONTEXT(ctx
);
7284 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7285 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7290 if (ctx
->ExecuteFlag
) {
7291 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7295 static void GLAPIENTRY
7296 save_ClampColorARB(GLenum target
, GLenum clamp
)
7298 GET_CURRENT_CONTEXT(ctx
);
7300 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7301 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7306 if (ctx
->ExecuteFlag
) {
7307 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7311 /** GL_EXT_texture_integer */
7312 static void GLAPIENTRY
7313 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7315 GET_CURRENT_CONTEXT(ctx
);
7317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7318 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7325 if (ctx
->ExecuteFlag
) {
7326 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7330 /** GL_EXT_texture_integer */
7331 static void GLAPIENTRY
7332 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7334 GET_CURRENT_CONTEXT(ctx
);
7336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7337 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7344 if (ctx
->ExecuteFlag
) {
7345 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7349 /** GL_EXT_texture_integer */
7350 static void GLAPIENTRY
7351 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7353 GET_CURRENT_CONTEXT(ctx
);
7355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7356 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7365 if (ctx
->ExecuteFlag
) {
7366 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7370 /** GL_EXT_texture_integer */
7371 static void GLAPIENTRY
7372 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7374 GET_CURRENT_CONTEXT(ctx
);
7376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7377 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7381 n
[3].ui
= params
[0];
7382 n
[4].ui
= params
[1];
7383 n
[5].ui
= params
[2];
7384 n
[6].ui
= params
[3];
7386 if (ctx
->ExecuteFlag
) {
7387 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7391 /* GL_ARB_instanced_arrays */
7392 static void GLAPIENTRY
7393 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7395 GET_CURRENT_CONTEXT(ctx
);
7397 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7398 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7403 if (ctx
->ExecuteFlag
) {
7404 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7409 /* GL_NV_texture_barrier */
7410 static void GLAPIENTRY
7411 save_TextureBarrierNV(void)
7413 GET_CURRENT_CONTEXT(ctx
);
7414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7415 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7416 if (ctx
->ExecuteFlag
) {
7417 CALL_TextureBarrierNV(ctx
->Exec
, ());
7422 /* GL_ARB_sampler_objects */
7423 static void GLAPIENTRY
7424 save_BindSampler(GLuint unit
, GLuint sampler
)
7427 GET_CURRENT_CONTEXT(ctx
);
7428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7429 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7434 if (ctx
->ExecuteFlag
) {
7435 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7439 static void GLAPIENTRY
7440 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7443 GET_CURRENT_CONTEXT(ctx
);
7444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7445 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7450 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7456 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7459 if (ctx
->ExecuteFlag
) {
7460 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7464 static void GLAPIENTRY
7465 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7469 parray
[1] = parray
[2] = parray
[3] = 0;
7470 save_SamplerParameteriv(sampler
, pname
, parray
);
7473 static void GLAPIENTRY
7474 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7477 GET_CURRENT_CONTEXT(ctx
);
7478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7479 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7484 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7490 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7493 if (ctx
->ExecuteFlag
) {
7494 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7498 static void GLAPIENTRY
7499 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7503 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7504 save_SamplerParameterfv(sampler
, pname
, parray
);
7507 static void GLAPIENTRY
7508 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7511 GET_CURRENT_CONTEXT(ctx
);
7512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7513 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7518 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7524 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7527 if (ctx
->ExecuteFlag
) {
7528 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7532 static void GLAPIENTRY
7533 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7536 GET_CURRENT_CONTEXT(ctx
);
7537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7538 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7542 n
[3].ui
= params
[0];
7543 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7544 n
[4].ui
= params
[1];
7545 n
[5].ui
= params
[2];
7546 n
[6].ui
= params
[3];
7549 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7552 if (ctx
->ExecuteFlag
) {
7553 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7557 /* GL_ARB_geometry_shader4 */
7558 static void GLAPIENTRY
7559 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7562 GET_CURRENT_CONTEXT(ctx
);
7563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7564 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7570 if (ctx
->ExecuteFlag
) {
7571 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7575 static void GLAPIENTRY
7576 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7577 GLuint texture
, GLint level
)
7580 GET_CURRENT_CONTEXT(ctx
);
7581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7582 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7585 n
[2].e
= attachment
;
7589 if (ctx
->ExecuteFlag
) {
7590 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7595 static void GLAPIENTRY
7596 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7599 GET_CURRENT_CONTEXT(ctx
);
7600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7601 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7603 union uint64_pair p
;
7606 n
[2].ui
= p
.uint32
[0];
7607 n
[3].ui
= p
.uint32
[1];
7608 save_pointer(&n
[4], sync
);
7610 if (ctx
->ExecuteFlag
) {
7611 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7616 /** GL_NV_conditional_render */
7617 static void GLAPIENTRY
7618 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7620 GET_CURRENT_CONTEXT(ctx
);
7622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7623 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7628 if (ctx
->ExecuteFlag
) {
7629 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7633 static void GLAPIENTRY
7634 save_EndConditionalRender(void)
7636 GET_CURRENT_CONTEXT(ctx
);
7637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7638 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7639 if (ctx
->ExecuteFlag
) {
7640 CALL_EndConditionalRender(ctx
->Exec
, ());
7644 static void GLAPIENTRY
7645 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7647 GET_CURRENT_CONTEXT(ctx
);
7649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7650 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7656 if (ctx
->ExecuteFlag
) {
7657 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7663 * Save an error-generating command into display list.
7665 * KW: Will appear in the list before the vertex buffer containing the
7666 * command that provoked the error. I don't see this as a problem.
7669 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7672 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7675 save_pointer(&n
[2], (void *) s
);
7676 /* note: the data/string here doesn't have to be freed in
7677 * _mesa_delete_list() since the string is never dynamically
7685 * Compile an error into current display list.
7688 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7690 if (ctx
->CompileFlag
)
7691 save_error(ctx
, error
, s
);
7692 if (ctx
->ExecuteFlag
)
7693 _mesa_error(ctx
, error
, "%s", s
);
7698 * Test if ID names a display list.
7701 islist(struct gl_context
*ctx
, GLuint list
)
7703 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7713 /**********************************************************************/
7714 /* Display list execution */
7715 /**********************************************************************/
7719 * Execute a display list. Note that the ListBase offset must have already
7720 * been added before calling this function. I.e. the list argument is
7721 * the absolute list number, not relative to ListBase.
7722 * \param list - display list number
7725 execute_list(struct gl_context
*ctx
, GLuint list
)
7727 struct gl_display_list
*dlist
;
7731 if (list
== 0 || !islist(ctx
, list
))
7734 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7735 /* raise an error? */
7739 dlist
= _mesa_lookup_list(ctx
, list
);
7743 ctx
->ListState
.CallDepth
++;
7745 vbo_save_BeginCallList(ctx
, dlist
);
7751 const OpCode opcode
= n
[0].opcode
;
7753 if (is_ext_opcode(opcode
)) {
7754 n
+= ext_opcode_execute(ctx
, n
);
7759 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7762 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7764 case OPCODE_ALPHA_FUNC
:
7765 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7767 case OPCODE_BIND_TEXTURE
:
7768 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7772 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7773 ctx
->Unpack
= ctx
->DefaultPacking
;
7774 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7775 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7776 get_pointer(&n
[7])));
7777 ctx
->Unpack
= save
; /* restore */
7780 case OPCODE_BLEND_COLOR
:
7781 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7783 case OPCODE_BLEND_EQUATION
:
7784 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7786 case OPCODE_BLEND_EQUATION_SEPARATE
:
7787 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7789 case OPCODE_BLEND_FUNC_SEPARATE
:
7790 CALL_BlendFuncSeparate(ctx
->Exec
,
7791 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7794 case OPCODE_BLEND_FUNC_I
:
7795 /* GL_ARB_draw_buffers_blend */
7796 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7798 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7799 /* GL_ARB_draw_buffers_blend */
7800 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7803 case OPCODE_BLEND_EQUATION_I
:
7804 /* GL_ARB_draw_buffers_blend */
7805 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7807 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7808 /* GL_ARB_draw_buffers_blend */
7809 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7810 (n
[1].ui
, n
[2].e
, n
[3].e
));
7813 case OPCODE_CALL_LIST
:
7814 /* Generated by glCallList(), don't add ListBase */
7815 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7816 execute_list(ctx
, n
[1].ui
);
7819 case OPCODE_CALL_LIST_OFFSET
:
7820 /* Generated by glCallLists() so we must add ListBase */
7822 /* user specified a bad data type at compile time */
7823 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7825 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7826 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7827 execute_list(ctx
, list
);
7831 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7833 case OPCODE_CLEAR_BUFFER_IV
:
7840 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7843 case OPCODE_CLEAR_BUFFER_UIV
:
7850 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7853 case OPCODE_CLEAR_BUFFER_FV
:
7860 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7863 case OPCODE_CLEAR_BUFFER_FI
:
7864 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7866 case OPCODE_CLEAR_COLOR
:
7867 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7869 case OPCODE_CLEAR_ACCUM
:
7870 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7872 case OPCODE_CLEAR_DEPTH
:
7873 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7875 case OPCODE_CLEAR_INDEX
:
7876 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7878 case OPCODE_CLEAR_STENCIL
:
7879 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7881 case OPCODE_CLIP_PLANE
:
7888 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7891 case OPCODE_COLOR_MASK
:
7892 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7894 case OPCODE_COLOR_MASK_INDEXED
:
7895 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7898 case OPCODE_COLOR_MATERIAL
:
7899 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7901 case OPCODE_COPY_PIXELS
:
7902 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7903 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7906 case OPCODE_COPY_TEX_IMAGE1D
:
7907 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7908 n
[5].i
, n
[6].i
, n
[7].i
));
7910 case OPCODE_COPY_TEX_IMAGE2D
:
7911 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7912 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7914 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7915 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7916 n
[4].i
, n
[5].i
, n
[6].i
));
7918 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7919 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7920 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7923 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7924 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7925 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7928 case OPCODE_CULL_FACE
:
7929 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7931 case OPCODE_DEPTH_FUNC
:
7932 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7934 case OPCODE_DEPTH_MASK
:
7935 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7937 case OPCODE_DEPTH_RANGE
:
7938 CALL_DepthRange(ctx
->Exec
,
7939 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7941 case OPCODE_DISABLE
:
7942 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7944 case OPCODE_DISABLE_INDEXED
:
7945 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7947 case OPCODE_DRAW_BUFFER
:
7948 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7950 case OPCODE_DRAW_PIXELS
:
7952 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7953 ctx
->Unpack
= ctx
->DefaultPacking
;
7954 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7955 get_pointer(&n
[5])));
7956 ctx
->Unpack
= save
; /* restore */
7960 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7962 case OPCODE_ENABLE_INDEXED
:
7963 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7965 case OPCODE_EVALMESH1
:
7966 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7968 case OPCODE_EVALMESH2
:
7969 CALL_EvalMesh2(ctx
->Exec
,
7970 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7979 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7982 case OPCODE_FRONT_FACE
:
7983 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7985 case OPCODE_FRUSTUM
:
7986 CALL_Frustum(ctx
->Exec
,
7987 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7990 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7992 case OPCODE_INDEX_MASK
:
7993 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7995 case OPCODE_INIT_NAMES
:
7996 CALL_InitNames(ctx
->Exec
, ());
8005 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8008 case OPCODE_LIGHT_MODEL
:
8015 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8018 case OPCODE_LINE_STIPPLE
:
8019 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8021 case OPCODE_LINE_WIDTH
:
8022 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8024 case OPCODE_LIST_BASE
:
8025 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8027 case OPCODE_LOAD_IDENTITY
:
8028 CALL_LoadIdentity(ctx
->Exec
, ());
8030 case OPCODE_LOAD_MATRIX
:
8031 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8032 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8034 case OPCODE_LOAD_NAME
:
8035 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8037 case OPCODE_LOGIC_OP
:
8038 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8042 GLenum target
= n
[1].e
;
8043 GLint ustride
= _mesa_evaluator_components(target
);
8044 GLint uorder
= n
[5].i
;
8045 GLfloat u1
= n
[2].f
;
8046 GLfloat u2
= n
[3].f
;
8047 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8048 (GLfloat
*) get_pointer(&n
[6])));
8053 GLenum target
= n
[1].e
;
8054 GLfloat u1
= n
[2].f
;
8055 GLfloat u2
= n
[3].f
;
8056 GLfloat v1
= n
[4].f
;
8057 GLfloat v2
= n
[5].f
;
8058 GLint ustride
= n
[6].i
;
8059 GLint vstride
= n
[7].i
;
8060 GLint uorder
= n
[8].i
;
8061 GLint vorder
= n
[9].i
;
8062 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8063 v1
, v2
, vstride
, vorder
,
8064 (GLfloat
*) get_pointer(&n
[10])));
8067 case OPCODE_MAPGRID1
:
8068 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8070 case OPCODE_MAPGRID2
:
8071 CALL_MapGrid2f(ctx
->Exec
,
8072 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8074 case OPCODE_MATRIX_MODE
:
8075 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8077 case OPCODE_MULT_MATRIX
:
8078 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8081 CALL_Ortho(ctx
->Exec
,
8082 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8084 case OPCODE_PASSTHROUGH
:
8085 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8087 case OPCODE_PIXEL_MAP
:
8088 CALL_PixelMapfv(ctx
->Exec
,
8089 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8091 case OPCODE_PIXEL_TRANSFER
:
8092 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8094 case OPCODE_PIXEL_ZOOM
:
8095 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8097 case OPCODE_POINT_SIZE
:
8098 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8100 case OPCODE_POINT_PARAMETERS
:
8106 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8109 case OPCODE_POLYGON_MODE
:
8110 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8112 case OPCODE_POLYGON_STIPPLE
:
8114 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8115 ctx
->Unpack
= ctx
->DefaultPacking
;
8116 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8117 ctx
->Unpack
= save
; /* restore */
8120 case OPCODE_POLYGON_OFFSET
:
8121 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8123 case OPCODE_POLYGON_OFFSET_CLAMP
:
8124 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8126 case OPCODE_POP_ATTRIB
:
8127 CALL_PopAttrib(ctx
->Exec
, ());
8129 case OPCODE_POP_MATRIX
:
8130 CALL_PopMatrix(ctx
->Exec
, ());
8132 case OPCODE_POP_NAME
:
8133 CALL_PopName(ctx
->Exec
, ());
8135 case OPCODE_PRIORITIZE_TEXTURE
:
8136 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8138 case OPCODE_PUSH_ATTRIB
:
8139 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8141 case OPCODE_PUSH_MATRIX
:
8142 CALL_PushMatrix(ctx
->Exec
, ());
8144 case OPCODE_PUSH_NAME
:
8145 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8147 case OPCODE_RASTER_POS
:
8148 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8150 case OPCODE_READ_BUFFER
:
8151 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8154 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8157 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8159 case OPCODE_SCISSOR
:
8160 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8162 case OPCODE_SHADE_MODEL
:
8163 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8165 case OPCODE_PROVOKING_VERTEX
:
8166 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8168 case OPCODE_STENCIL_FUNC
:
8169 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8171 case OPCODE_STENCIL_MASK
:
8172 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8174 case OPCODE_STENCIL_OP
:
8175 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8177 case OPCODE_STENCIL_FUNC_SEPARATE
:
8178 CALL_StencilFuncSeparate(ctx
->Exec
,
8179 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8181 case OPCODE_STENCIL_MASK_SEPARATE
:
8182 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8184 case OPCODE_STENCIL_OP_SEPARATE
:
8185 CALL_StencilOpSeparate(ctx
->Exec
,
8186 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8195 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8205 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8208 case OPCODE_TEXPARAMETER
:
8215 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8218 case OPCODE_TEX_IMAGE1D
:
8220 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8221 ctx
->Unpack
= ctx
->DefaultPacking
;
8222 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8224 n
[3].i
, /* components */
8226 n
[5].e
, /* border */
8227 n
[6].e
, /* format */
8229 get_pointer(&n
[8])));
8230 ctx
->Unpack
= save
; /* restore */
8233 case OPCODE_TEX_IMAGE2D
:
8235 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8236 ctx
->Unpack
= ctx
->DefaultPacking
;
8237 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8239 n
[3].i
, /* components */
8241 n
[5].i
, /* height */
8242 n
[6].e
, /* border */
8243 n
[7].e
, /* format */
8245 get_pointer(&n
[9])));
8246 ctx
->Unpack
= save
; /* restore */
8249 case OPCODE_TEX_IMAGE3D
:
8251 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8252 ctx
->Unpack
= ctx
->DefaultPacking
;
8253 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8255 n
[3].i
, /* components */
8257 n
[5].i
, /* height */
8259 n
[7].e
, /* border */
8260 n
[8].e
, /* format */
8262 get_pointer(&n
[10])));
8263 ctx
->Unpack
= save
; /* restore */
8266 case OPCODE_TEX_SUB_IMAGE1D
:
8268 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8269 ctx
->Unpack
= ctx
->DefaultPacking
;
8270 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8272 n
[6].e
, get_pointer(&n
[7])));
8273 ctx
->Unpack
= save
; /* restore */
8276 case OPCODE_TEX_SUB_IMAGE2D
:
8278 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8279 ctx
->Unpack
= ctx
->DefaultPacking
;
8280 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8282 n
[6].i
, n
[7].e
, n
[8].e
,
8283 get_pointer(&n
[9])));
8284 ctx
->Unpack
= save
; /* restore */
8287 case OPCODE_TEX_SUB_IMAGE3D
:
8289 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8290 ctx
->Unpack
= ctx
->DefaultPacking
;
8291 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8292 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8293 n
[8].i
, n
[9].e
, n
[10].e
,
8294 get_pointer(&n
[11])));
8295 ctx
->Unpack
= save
; /* restore */
8298 case OPCODE_TRANSLATE
:
8299 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8301 case OPCODE_VIEWPORT
:
8302 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8303 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8305 case OPCODE_WINDOW_POS
:
8306 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8308 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8309 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8311 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8312 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8313 n
[4].i
, n
[5].i
, n
[6].i
,
8314 get_pointer(&n
[7])));
8316 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8317 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8318 n
[4].i
, n
[5].i
, n
[6].i
,
8319 n
[7].i
, get_pointer(&n
[8])));
8321 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8322 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8323 n
[4].i
, n
[5].i
, n
[6].i
,
8325 get_pointer(&n
[9])));
8327 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8328 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8329 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8331 get_pointer(&n
[7])));
8333 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8334 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8335 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8336 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8337 get_pointer(&n
[9])));
8339 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8340 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8341 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8342 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8344 get_pointer(&n
[11])));
8346 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8347 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8349 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8350 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8352 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8353 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8355 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8356 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8357 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8360 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8361 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8363 case OPCODE_DEPTH_BOUNDS_EXT
:
8364 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8366 case OPCODE_PROGRAM_STRING_ARB
:
8367 CALL_ProgramStringARB(ctx
->Exec
,
8368 (n
[1].e
, n
[2].e
, n
[3].i
,
8369 get_pointer(&n
[4])));
8371 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8372 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8376 case OPCODE_BEGIN_QUERY_ARB
:
8377 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8379 case OPCODE_END_QUERY_ARB
:
8380 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8382 case OPCODE_QUERY_COUNTER
:
8383 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8385 case OPCODE_BEGIN_QUERY_INDEXED
:
8386 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8388 case OPCODE_END_QUERY_INDEXED
:
8389 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8391 case OPCODE_DRAW_BUFFERS_ARB
:
8393 GLenum buffers
[MAX_DRAW_BUFFERS
];
8394 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8395 for (i
= 0; i
< count
; i
++)
8396 buffers
[i
] = n
[2 + i
].e
;
8397 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8400 case OPCODE_BLIT_FRAMEBUFFER
:
8401 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8402 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8405 case OPCODE_USE_PROGRAM
:
8406 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8408 case OPCODE_UNIFORM_1F
:
8409 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8411 case OPCODE_UNIFORM_2F
:
8412 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8414 case OPCODE_UNIFORM_3F
:
8415 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8417 case OPCODE_UNIFORM_4F
:
8418 CALL_Uniform4f(ctx
->Exec
,
8419 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8421 case OPCODE_UNIFORM_1FV
:
8422 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8424 case OPCODE_UNIFORM_2FV
:
8425 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8427 case OPCODE_UNIFORM_3FV
:
8428 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8430 case OPCODE_UNIFORM_4FV
:
8431 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8433 case OPCODE_UNIFORM_1I
:
8434 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8436 case OPCODE_UNIFORM_2I
:
8437 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8439 case OPCODE_UNIFORM_3I
:
8440 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8442 case OPCODE_UNIFORM_4I
:
8443 CALL_Uniform4i(ctx
->Exec
,
8444 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8446 case OPCODE_UNIFORM_1IV
:
8447 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8449 case OPCODE_UNIFORM_2IV
:
8450 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8452 case OPCODE_UNIFORM_3IV
:
8453 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8455 case OPCODE_UNIFORM_4IV
:
8456 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8458 case OPCODE_UNIFORM_1UI
:
8459 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8461 case OPCODE_UNIFORM_2UI
:
8462 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8464 case OPCODE_UNIFORM_3UI
:
8465 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8467 case OPCODE_UNIFORM_4UI
:
8468 /*CALL_Uniform4uiARB(ctx->Exec,
8469 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8472 case OPCODE_UNIFORM_1UIV
:
8473 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8474 get_pointer(&n[3])));*/
8476 case OPCODE_UNIFORM_2UIV
:
8477 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8478 get_pointer(&n[3])));*/
8480 case OPCODE_UNIFORM_3UIV
:
8481 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8482 get_pointer(&n[3])));*/
8484 case OPCODE_UNIFORM_4UIV
:
8485 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8486 get_pointer(&n[3])));*/
8488 case OPCODE_UNIFORM_MATRIX22
:
8489 CALL_UniformMatrix2fv(ctx
->Exec
,
8490 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8492 case OPCODE_UNIFORM_MATRIX33
:
8493 CALL_UniformMatrix3fv(ctx
->Exec
,
8494 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8496 case OPCODE_UNIFORM_MATRIX44
:
8497 CALL_UniformMatrix4fv(ctx
->Exec
,
8498 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8500 case OPCODE_UNIFORM_MATRIX23
:
8501 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8502 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8504 case OPCODE_UNIFORM_MATRIX32
:
8505 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8506 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8508 case OPCODE_UNIFORM_MATRIX24
:
8509 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8510 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8512 case OPCODE_UNIFORM_MATRIX42
:
8513 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8514 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8516 case OPCODE_UNIFORM_MATRIX34
:
8517 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8518 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8520 case OPCODE_UNIFORM_MATRIX43
:
8521 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8522 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8525 case OPCODE_USE_PROGRAM_STAGES
:
8526 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8528 case OPCODE_PROGRAM_UNIFORM_1F
:
8529 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8531 case OPCODE_PROGRAM_UNIFORM_2F
:
8532 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8534 case OPCODE_PROGRAM_UNIFORM_3F
:
8535 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8536 n
[3].f
, n
[4].f
, n
[5].f
));
8538 case OPCODE_PROGRAM_UNIFORM_4F
:
8539 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8540 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8542 case OPCODE_PROGRAM_UNIFORM_1FV
:
8543 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8544 get_pointer(&n
[4])));
8546 case OPCODE_PROGRAM_UNIFORM_2FV
:
8547 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8548 get_pointer(&n
[4])));
8550 case OPCODE_PROGRAM_UNIFORM_3FV
:
8551 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8552 get_pointer(&n
[4])));
8554 case OPCODE_PROGRAM_UNIFORM_4FV
:
8555 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8556 get_pointer(&n
[4])));
8558 case OPCODE_PROGRAM_UNIFORM_1I
:
8559 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8561 case OPCODE_PROGRAM_UNIFORM_2I
:
8562 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8564 case OPCODE_PROGRAM_UNIFORM_3I
:
8565 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8566 n
[3].i
, n
[4].i
, n
[5].i
));
8568 case OPCODE_PROGRAM_UNIFORM_4I
:
8569 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8570 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8572 case OPCODE_PROGRAM_UNIFORM_1IV
:
8573 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8574 get_pointer(&n
[4])));
8576 case OPCODE_PROGRAM_UNIFORM_2IV
:
8577 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8578 get_pointer(&n
[4])));
8580 case OPCODE_PROGRAM_UNIFORM_3IV
:
8581 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8582 get_pointer(&n
[4])));
8584 case OPCODE_PROGRAM_UNIFORM_4IV
:
8585 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8586 get_pointer(&n
[4])));
8588 case OPCODE_PROGRAM_UNIFORM_1UI
:
8589 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8591 case OPCODE_PROGRAM_UNIFORM_2UI
:
8592 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8595 case OPCODE_PROGRAM_UNIFORM_3UI
:
8596 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8597 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8599 case OPCODE_PROGRAM_UNIFORM_4UI
:
8600 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8602 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8604 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8605 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8606 get_pointer(&n
[4])));
8608 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8609 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8610 get_pointer(&n
[4])));
8612 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8613 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8614 get_pointer(&n
[4])));
8616 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8617 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8618 get_pointer(&n
[4])));
8620 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8621 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8622 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8623 get_pointer(&n
[5])));
8625 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8626 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8627 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8628 get_pointer(&n
[5])));
8630 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8631 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8632 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8633 get_pointer(&n
[5])));
8635 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8636 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8637 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8638 get_pointer(&n
[5])));
8640 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8641 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8642 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8643 get_pointer(&n
[5])));
8645 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8646 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8647 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8648 get_pointer(&n
[5])));
8650 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8651 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8652 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8653 get_pointer(&n
[5])));
8655 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8656 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8657 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8658 get_pointer(&n
[5])));
8660 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8661 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8662 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8663 get_pointer(&n
[5])));
8666 case OPCODE_CLIP_CONTROL
:
8667 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8670 case OPCODE_CLAMP_COLOR
:
8671 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8674 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8675 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8677 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8678 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8680 case OPCODE_ATTR_1F_NV
:
8681 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8683 case OPCODE_ATTR_2F_NV
:
8684 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8686 case OPCODE_ATTR_3F_NV
:
8687 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8689 case OPCODE_ATTR_4F_NV
:
8690 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8692 case OPCODE_ATTR_1F_ARB
:
8693 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8695 case OPCODE_ATTR_2F_ARB
:
8696 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8698 case OPCODE_ATTR_3F_ARB
:
8699 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8701 case OPCODE_ATTR_4F_ARB
:
8702 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8704 case OPCODE_MATERIAL
:
8705 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8708 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8711 CALL_End(ctx
->Exec
, ());
8714 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8716 case OPCODE_EVAL_C1
:
8717 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8719 case OPCODE_EVAL_C2
:
8720 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8722 case OPCODE_EVAL_P1
:
8723 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8725 case OPCODE_EVAL_P2
:
8726 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8729 /* GL_EXT_texture_integer */
8730 case OPCODE_CLEARCOLOR_I
:
8731 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8733 case OPCODE_CLEARCOLOR_UI
:
8734 CALL_ClearColorIuiEXT(ctx
->Exec
,
8735 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8737 case OPCODE_TEXPARAMETER_I
:
8744 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8747 case OPCODE_TEXPARAMETER_UI
:
8750 params
[0] = n
[3].ui
;
8751 params
[1] = n
[4].ui
;
8752 params
[2] = n
[5].ui
;
8753 params
[3] = n
[6].ui
;
8754 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8758 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8759 /* GL_ARB_instanced_arrays */
8760 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8763 case OPCODE_TEXTURE_BARRIER_NV
:
8764 CALL_TextureBarrierNV(ctx
->Exec
, ());
8767 /* GL_EXT/ARB_transform_feedback */
8768 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8769 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8771 case OPCODE_END_TRANSFORM_FEEDBACK
:
8772 CALL_EndTransformFeedback(ctx
->Exec
, ());
8774 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8775 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8777 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8778 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8780 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8781 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8783 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8784 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8786 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8787 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8788 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8790 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8791 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8792 (n
[1].e
, n
[2].ui
, n
[3].si
));
8794 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8795 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8796 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8800 case OPCODE_BIND_SAMPLER
:
8801 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8803 case OPCODE_SAMPLER_PARAMETERIV
:
8810 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8813 case OPCODE_SAMPLER_PARAMETERFV
:
8820 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8823 case OPCODE_SAMPLER_PARAMETERIIV
:
8830 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8833 case OPCODE_SAMPLER_PARAMETERUIV
:
8836 params
[0] = n
[3].ui
;
8837 params
[1] = n
[4].ui
;
8838 params
[2] = n
[5].ui
;
8839 params
[3] = n
[6].ui
;
8840 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8844 /* GL_ARB_geometry_shader4 */
8845 case OPCODE_PROGRAM_PARAMETERI
:
8846 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8848 case OPCODE_FRAMEBUFFER_TEXTURE
:
8849 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8853 case OPCODE_WAIT_SYNC
:
8855 union uint64_pair p
;
8856 p
.uint32
[0] = n
[2].ui
;
8857 p
.uint32
[1] = n
[3].ui
;
8858 CALL_WaitSync(ctx
->Exec
,
8859 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8863 /* GL_NV_conditional_render */
8864 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8865 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8867 case OPCODE_END_CONDITIONAL_RENDER
:
8868 CALL_EndConditionalRender(ctx
->Exec
, ());
8871 case OPCODE_UNIFORM_BLOCK_BINDING
:
8872 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8875 case OPCODE_CONTINUE
:
8876 n
= (Node
*) get_pointer(&n
[1]);
8881 case OPCODE_END_OF_LIST
:
8887 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8889 _mesa_problem(ctx
, "%s", msg
);
8894 /* increment n to point to next compiled command */
8895 if (opcode
!= OPCODE_CONTINUE
) {
8896 n
+= InstSize
[opcode
];
8901 vbo_save_EndCallList(ctx
);
8903 ctx
->ListState
.CallDepth
--;
8908 /**********************************************************************/
8910 /**********************************************************************/
8913 * Test if a display list number is valid.
8915 GLboolean GLAPIENTRY
8916 _mesa_IsList(GLuint list
)
8918 GET_CURRENT_CONTEXT(ctx
);
8919 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8920 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8921 return islist(ctx
, list
);
8926 * Delete a sequence of consecutive display lists.
8929 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8931 GET_CURRENT_CONTEXT(ctx
);
8933 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8934 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8937 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8940 for (i
= list
; i
< list
+ range
; i
++) {
8941 destroy_list(ctx
, i
);
8947 * Return a display list number, n, such that lists n through n+range-1
8951 _mesa_GenLists(GLsizei range
)
8953 GET_CURRENT_CONTEXT(ctx
);
8955 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8956 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8959 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8967 * Make this an atomic operation
8969 mtx_lock(&ctx
->Shared
->Mutex
);
8971 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8973 /* reserve the list IDs by with empty/dummy lists */
8975 for (i
= 0; i
< range
; i
++) {
8976 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8977 make_list(base
+ i
, 1));
8981 mtx_unlock(&ctx
->Shared
->Mutex
);
8988 * Begin a new display list.
8991 _mesa_NewList(GLuint name
, GLenum mode
)
8993 GET_CURRENT_CONTEXT(ctx
);
8995 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8996 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8998 if (MESA_VERBOSE
& VERBOSE_API
)
8999 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9000 _mesa_enum_to_string(mode
));
9003 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9007 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9008 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9012 if (ctx
->ListState
.CurrentList
) {
9013 /* already compiling a display list */
9014 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9018 ctx
->CompileFlag
= GL_TRUE
;
9019 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9021 /* Reset accumulated list state */
9022 invalidate_saved_current_state( ctx
);
9024 /* Allocate new display list */
9025 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9026 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9027 ctx
->ListState
.CurrentPos
= 0;
9029 vbo_save_NewList(ctx
, name
, mode
);
9031 ctx
->CurrentDispatch
= ctx
->Save
;
9032 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9037 * End definition of current display list.
9042 GET_CURRENT_CONTEXT(ctx
);
9043 SAVE_FLUSH_VERTICES(ctx
);
9044 FLUSH_VERTICES(ctx
, 0);
9046 if (MESA_VERBOSE
& VERBOSE_API
)
9047 _mesa_debug(ctx
, "glEndList\n");
9049 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9050 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9051 "glEndList() called inside glBegin/End");
9054 /* Check that a list is under construction */
9055 if (!ctx
->ListState
.CurrentList
) {
9056 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9060 /* Call before emitting END_OF_LIST, in case the driver wants to
9061 * emit opcodes itself.
9063 vbo_save_EndList(ctx
);
9065 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9069 /* Destroy old list, if any */
9070 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9072 /* Install the new list */
9073 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9074 ctx
->ListState
.CurrentList
->Name
,
9075 ctx
->ListState
.CurrentList
);
9078 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9079 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9081 ctx
->ListState
.CurrentList
= NULL
;
9082 ctx
->ListState
.CurrentBlock
= NULL
;
9083 ctx
->ListState
.CurrentPos
= 0;
9084 ctx
->ExecuteFlag
= GL_TRUE
;
9085 ctx
->CompileFlag
= GL_FALSE
;
9087 ctx
->CurrentDispatch
= ctx
->Exec
;
9088 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9093 _mesa_CallList(GLuint list
)
9095 GLboolean save_compile_flag
;
9096 GET_CURRENT_CONTEXT(ctx
);
9097 FLUSH_CURRENT(ctx
, 0);
9099 if (MESA_VERBOSE
& VERBOSE_API
)
9100 _mesa_debug(ctx
, "glCallList %d\n", list
);
9103 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9108 mesa_print_display_list( list
);
9110 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9111 * execute the display list, and restore the CompileFlag.
9113 save_compile_flag
= ctx
->CompileFlag
;
9114 if (save_compile_flag
) {
9115 ctx
->CompileFlag
= GL_FALSE
;
9118 execute_list(ctx
, list
);
9119 ctx
->CompileFlag
= save_compile_flag
;
9121 /* also restore API function pointers to point to "save" versions */
9122 if (save_compile_flag
) {
9123 ctx
->CurrentDispatch
= ctx
->Save
;
9124 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9130 * Execute glCallLists: call multiple display lists.
9133 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9135 GET_CURRENT_CONTEXT(ctx
);
9137 GLboolean save_compile_flag
;
9139 if (MESA_VERBOSE
& VERBOSE_API
)
9140 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9144 case GL_UNSIGNED_BYTE
:
9146 case GL_UNSIGNED_SHORT
:
9148 case GL_UNSIGNED_INT
:
9156 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9160 /* Save the CompileFlag status, turn it off, execute display list,
9161 * and restore the CompileFlag.
9163 save_compile_flag
= ctx
->CompileFlag
;
9164 ctx
->CompileFlag
= GL_FALSE
;
9166 for (i
= 0; i
< n
; i
++) {
9167 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9168 execute_list(ctx
, list
);
9171 ctx
->CompileFlag
= save_compile_flag
;
9173 /* also restore API function pointers to point to "save" versions */
9174 if (save_compile_flag
) {
9175 ctx
->CurrentDispatch
= ctx
->Save
;
9176 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9182 * Set the offset added to list numbers in glCallLists.
9185 _mesa_ListBase(GLuint base
)
9187 GET_CURRENT_CONTEXT(ctx
);
9188 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9189 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9190 ctx
->List
.ListBase
= base
;
9194 * Setup the given dispatch table to point to Mesa's display list
9195 * building functions.
9197 * This does not include any of the tnl functions - they are
9198 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9202 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9204 struct _glapi_table
*table
= ctx
->Save
;
9205 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9207 /* Initially populate the dispatch table with the contents of the
9208 * normal-execution dispatch table. This lets us skip populating functions
9209 * that should be called directly instead of compiled into display lists.
9211 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9213 _mesa_loopback_init_api_table(ctx
, table
);
9216 vbo_initialize_save_dispatch(ctx
, table
);
9219 SET_Accum(table
, save_Accum
);
9220 SET_AlphaFunc(table
, save_AlphaFunc
);
9221 SET_Bitmap(table
, save_Bitmap
);
9222 SET_BlendFunc(table
, save_BlendFunc
);
9223 SET_CallList(table
, save_CallList
);
9224 SET_CallLists(table
, save_CallLists
);
9225 SET_Clear(table
, save_Clear
);
9226 SET_ClearAccum(table
, save_ClearAccum
);
9227 SET_ClearColor(table
, save_ClearColor
);
9228 SET_ClearDepth(table
, save_ClearDepth
);
9229 SET_ClearIndex(table
, save_ClearIndex
);
9230 SET_ClearStencil(table
, save_ClearStencil
);
9231 SET_ClipPlane(table
, save_ClipPlane
);
9232 SET_ColorMask(table
, save_ColorMask
);
9233 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9234 SET_ColorMaterial(table
, save_ColorMaterial
);
9235 SET_CopyPixels(table
, save_CopyPixels
);
9236 SET_CullFace(table
, save_CullFace
);
9237 SET_DepthFunc(table
, save_DepthFunc
);
9238 SET_DepthMask(table
, save_DepthMask
);
9239 SET_DepthRange(table
, save_DepthRange
);
9240 SET_Disable(table
, save_Disable
);
9241 SET_Disablei(table
, save_DisableIndexed
);
9242 SET_DrawBuffer(table
, save_DrawBuffer
);
9243 SET_DrawPixels(table
, save_DrawPixels
);
9244 SET_Enable(table
, save_Enable
);
9245 SET_Enablei(table
, save_EnableIndexed
);
9246 SET_EvalMesh1(table
, save_EvalMesh1
);
9247 SET_EvalMesh2(table
, save_EvalMesh2
);
9248 SET_Fogf(table
, save_Fogf
);
9249 SET_Fogfv(table
, save_Fogfv
);
9250 SET_Fogi(table
, save_Fogi
);
9251 SET_Fogiv(table
, save_Fogiv
);
9252 SET_FrontFace(table
, save_FrontFace
);
9253 SET_Frustum(table
, save_Frustum
);
9254 SET_Hint(table
, save_Hint
);
9255 SET_IndexMask(table
, save_IndexMask
);
9256 SET_InitNames(table
, save_InitNames
);
9257 SET_LightModelf(table
, save_LightModelf
);
9258 SET_LightModelfv(table
, save_LightModelfv
);
9259 SET_LightModeli(table
, save_LightModeli
);
9260 SET_LightModeliv(table
, save_LightModeliv
);
9261 SET_Lightf(table
, save_Lightf
);
9262 SET_Lightfv(table
, save_Lightfv
);
9263 SET_Lighti(table
, save_Lighti
);
9264 SET_Lightiv(table
, save_Lightiv
);
9265 SET_LineStipple(table
, save_LineStipple
);
9266 SET_LineWidth(table
, save_LineWidth
);
9267 SET_ListBase(table
, save_ListBase
);
9268 SET_LoadIdentity(table
, save_LoadIdentity
);
9269 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9270 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9271 SET_LoadName(table
, save_LoadName
);
9272 SET_LogicOp(table
, save_LogicOp
);
9273 SET_Map1d(table
, save_Map1d
);
9274 SET_Map1f(table
, save_Map1f
);
9275 SET_Map2d(table
, save_Map2d
);
9276 SET_Map2f(table
, save_Map2f
);
9277 SET_MapGrid1d(table
, save_MapGrid1d
);
9278 SET_MapGrid1f(table
, save_MapGrid1f
);
9279 SET_MapGrid2d(table
, save_MapGrid2d
);
9280 SET_MapGrid2f(table
, save_MapGrid2f
);
9281 SET_MatrixMode(table
, save_MatrixMode
);
9282 SET_MultMatrixd(table
, save_MultMatrixd
);
9283 SET_MultMatrixf(table
, save_MultMatrixf
);
9284 SET_NewList(table
, save_NewList
);
9285 SET_Ortho(table
, save_Ortho
);
9286 SET_PassThrough(table
, save_PassThrough
);
9287 SET_PixelMapfv(table
, save_PixelMapfv
);
9288 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9289 SET_PixelMapusv(table
, save_PixelMapusv
);
9290 SET_PixelTransferf(table
, save_PixelTransferf
);
9291 SET_PixelTransferi(table
, save_PixelTransferi
);
9292 SET_PixelZoom(table
, save_PixelZoom
);
9293 SET_PointSize(table
, save_PointSize
);
9294 SET_PolygonMode(table
, save_PolygonMode
);
9295 SET_PolygonOffset(table
, save_PolygonOffset
);
9296 SET_PolygonStipple(table
, save_PolygonStipple
);
9297 SET_PopAttrib(table
, save_PopAttrib
);
9298 SET_PopMatrix(table
, save_PopMatrix
);
9299 SET_PopName(table
, save_PopName
);
9300 SET_PushAttrib(table
, save_PushAttrib
);
9301 SET_PushMatrix(table
, save_PushMatrix
);
9302 SET_PushName(table
, save_PushName
);
9303 SET_RasterPos2d(table
, save_RasterPos2d
);
9304 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9305 SET_RasterPos2f(table
, save_RasterPos2f
);
9306 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9307 SET_RasterPos2i(table
, save_RasterPos2i
);
9308 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9309 SET_RasterPos2s(table
, save_RasterPos2s
);
9310 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9311 SET_RasterPos3d(table
, save_RasterPos3d
);
9312 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9313 SET_RasterPos3f(table
, save_RasterPos3f
);
9314 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9315 SET_RasterPos3i(table
, save_RasterPos3i
);
9316 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9317 SET_RasterPos3s(table
, save_RasterPos3s
);
9318 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9319 SET_RasterPos4d(table
, save_RasterPos4d
);
9320 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9321 SET_RasterPos4f(table
, save_RasterPos4f
);
9322 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9323 SET_RasterPos4i(table
, save_RasterPos4i
);
9324 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9325 SET_RasterPos4s(table
, save_RasterPos4s
);
9326 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9327 SET_ReadBuffer(table
, save_ReadBuffer
);
9328 SET_Rectf(table
, save_Rectf
);
9329 SET_Rotated(table
, save_Rotated
);
9330 SET_Rotatef(table
, save_Rotatef
);
9331 SET_Scaled(table
, save_Scaled
);
9332 SET_Scalef(table
, save_Scalef
);
9333 SET_Scissor(table
, save_Scissor
);
9334 SET_ShadeModel(table
, save_ShadeModel
);
9335 SET_StencilFunc(table
, save_StencilFunc
);
9336 SET_StencilMask(table
, save_StencilMask
);
9337 SET_StencilOp(table
, save_StencilOp
);
9338 SET_TexEnvf(table
, save_TexEnvf
);
9339 SET_TexEnvfv(table
, save_TexEnvfv
);
9340 SET_TexEnvi(table
, save_TexEnvi
);
9341 SET_TexEnviv(table
, save_TexEnviv
);
9342 SET_TexGend(table
, save_TexGend
);
9343 SET_TexGendv(table
, save_TexGendv
);
9344 SET_TexGenf(table
, save_TexGenf
);
9345 SET_TexGenfv(table
, save_TexGenfv
);
9346 SET_TexGeni(table
, save_TexGeni
);
9347 SET_TexGeniv(table
, save_TexGeniv
);
9348 SET_TexImage1D(table
, save_TexImage1D
);
9349 SET_TexImage2D(table
, save_TexImage2D
);
9350 SET_TexParameterf(table
, save_TexParameterf
);
9351 SET_TexParameterfv(table
, save_TexParameterfv
);
9352 SET_TexParameteri(table
, save_TexParameteri
);
9353 SET_TexParameteriv(table
, save_TexParameteriv
);
9354 SET_Translated(table
, save_Translated
);
9355 SET_Translatef(table
, save_Translatef
);
9356 SET_Viewport(table
, save_Viewport
);
9359 SET_BindTexture(table
, save_BindTexture
);
9360 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9361 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9362 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9363 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9364 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9365 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9366 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9369 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9370 SET_TexImage3D(table
, save_TexImage3D
);
9371 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9374 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9375 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9376 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9378 /* ATI_separate_stencil */
9379 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9381 /* GL_ARB_imaging */
9382 /* Not all are supported */
9383 SET_BlendColor(table
, save_BlendColor
);
9384 SET_BlendEquation(table
, save_BlendEquation
);
9386 /* 2. GL_EXT_blend_color */
9388 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9391 /* 3. GL_EXT_polygon_offset */
9392 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9394 /* 6. GL_EXT_texture3d */
9396 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9397 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9398 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9401 /* 37. GL_EXT_blend_minmax */
9403 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9406 /* 54. GL_EXT_point_parameters */
9407 SET_PointParameterf(table
, save_PointParameterfEXT
);
9408 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9410 /* 173. GL_EXT_blend_func_separate */
9411 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9413 /* 197. GL_MESA_window_pos */
9414 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9415 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9416 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9417 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9418 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9419 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9420 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9421 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9422 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9423 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9424 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9425 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9426 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9427 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9428 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9429 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9430 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9431 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9432 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9433 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9434 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9435 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9436 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9437 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9439 /* 233. GL_NV_vertex_program */
9440 /* The following commands DO NOT go into display lists:
9441 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9442 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9444 SET_BindProgramARB(table
, save_BindProgramNV
);
9446 /* 245. GL_ATI_fragment_shader */
9447 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9448 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9450 /* 262. GL_NV_point_sprite */
9451 SET_PointParameteri(table
, save_PointParameteriNV
);
9452 SET_PointParameteriv(table
, save_PointParameterivNV
);
9454 /* 268. GL_EXT_stencil_two_side */
9455 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9457 /* ???. GL_EXT_depth_bounds_test */
9458 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9460 /* ARB 1. GL_ARB_multitexture */
9461 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9463 /* ARB 3. GL_ARB_transpose_matrix */
9464 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9465 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9466 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9467 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9469 /* ARB 5. GL_ARB_multisample */
9470 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9472 /* ARB 12. GL_ARB_texture_compression */
9473 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9474 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9475 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9476 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9477 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9478 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9480 /* ARB 14. GL_ARB_point_parameters */
9481 /* aliased with EXT_point_parameters functions */
9483 /* ARB 25. GL_ARB_window_pos */
9484 /* aliased with MESA_window_pos functions */
9486 /* ARB 26. GL_ARB_vertex_program */
9487 /* ARB 27. GL_ARB_fragment_program */
9488 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9489 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9490 SET_BindProgramARB(table
, save_BindProgramNV
);
9491 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9492 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9493 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9494 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9495 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9496 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9497 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9498 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9500 SET_BeginQuery(table
, save_BeginQueryARB
);
9501 SET_EndQuery(table
, save_EndQueryARB
);
9502 SET_QueryCounter(table
, save_QueryCounter
);
9504 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9506 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9508 SET_UseProgram(table
, save_UseProgramObjectARB
);
9509 SET_Uniform1f(table
, save_Uniform1fARB
);
9510 SET_Uniform2f(table
, save_Uniform2fARB
);
9511 SET_Uniform3f(table
, save_Uniform3fARB
);
9512 SET_Uniform4f(table
, save_Uniform4fARB
);
9513 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9514 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9515 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9516 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9517 SET_Uniform1i(table
, save_Uniform1iARB
);
9518 SET_Uniform2i(table
, save_Uniform2iARB
);
9519 SET_Uniform3i(table
, save_Uniform3iARB
);
9520 SET_Uniform4i(table
, save_Uniform4iARB
);
9521 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9522 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9523 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9524 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9525 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9526 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9527 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9528 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9529 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9530 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9531 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9532 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9533 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9535 /* 299. GL_EXT_blend_equation_separate */
9536 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9538 /* GL_EXT_gpu_program_parameters */
9539 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9540 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9542 /* 364. GL_EXT_provoking_vertex */
9543 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9545 /* GL_EXT_texture_integer */
9546 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9547 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9548 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9549 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9551 /* GL_ARB_clip_control */
9552 SET_ClipControl(table
, save_ClipControl
);
9554 /* GL_ARB_color_buffer_float */
9555 SET_ClampColor(table
, save_ClampColorARB
);
9558 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9559 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9560 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9561 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9563 SET_Uniform1ui(table
, save_Uniform1ui
);
9564 SET_Uniform2ui(table
, save_Uniform2ui
);
9565 SET_Uniform3ui(table
, save_Uniform3ui
);
9566 SET_Uniform4ui(table
, save_Uniform4ui
);
9567 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9568 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9569 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9570 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9572 (void) save_Uniform1ui
;
9573 (void) save_Uniform2ui
;
9574 (void) save_Uniform3ui
;
9575 (void) save_Uniform4ui
;
9576 (void) save_Uniform1uiv
;
9577 (void) save_Uniform2uiv
;
9578 (void) save_Uniform3uiv
;
9579 (void) save_Uniform4uiv
;
9583 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9584 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9585 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9586 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9587 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9588 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9589 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9590 SET_DrawTransformFeedbackInstanced(table
,
9591 save_DrawTransformFeedbackInstanced
);
9592 SET_DrawTransformFeedbackStreamInstanced(table
,
9593 save_DrawTransformFeedbackStreamInstanced
);
9594 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9595 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9597 /* GL_ARB_instanced_arrays */
9598 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9600 /* GL_NV_texture_barrier */
9601 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9603 SET_BindSampler(table
, save_BindSampler
);
9604 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9605 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9606 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9607 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9608 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9609 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9611 /* GL_ARB_draw_buffer_blend */
9612 SET_BlendFunciARB(table
, save_BlendFunci
);
9613 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9614 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9615 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9618 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9619 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9621 /* GL_NV_conditional_render */
9622 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9623 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9626 SET_WaitSync(table
, save_WaitSync
);
9628 /* GL_ARB_uniform_buffer_object */
9629 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9631 /* GL_ARB_draw_instanced */
9632 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9633 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9635 /* GL_ARB_draw_elements_base_vertex */
9636 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9638 /* GL_ARB_base_instance */
9639 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9640 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9641 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9643 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9644 SET_UseProgramStages(table
, save_UseProgramStages
);
9645 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9646 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9647 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9648 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9649 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9650 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9651 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9652 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9653 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9654 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9655 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9656 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9657 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9658 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9659 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9660 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9661 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9662 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9663 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9664 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9665 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9666 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9667 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9668 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9669 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9670 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9671 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9672 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9673 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9674 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9675 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9676 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9677 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9679 /* GL_EXT_polygon_offset_clamp */
9680 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
9686 enum_string(GLenum k
)
9688 return _mesa_enum_to_string(k
);
9693 * Print the commands in a display list. For debugging only.
9694 * TODO: many commands aren't handled yet.
9695 * \param fname filename to write display list to. If null, use stdout.
9697 static void GLAPIENTRY
9698 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9700 struct gl_display_list
*dlist
;
9706 f
= fopen(fname
, "w");
9711 if (!islist(ctx
, list
)) {
9712 fprintf(f
, "%u is not a display list ID\n", list
);
9716 dlist
= _mesa_lookup_list(ctx
, list
);
9722 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9724 done
= n
? GL_FALSE
: GL_TRUE
;
9726 const OpCode opcode
= n
[0].opcode
;
9728 if (is_ext_opcode(opcode
)) {
9729 n
+= ext_opcode_print(ctx
, n
, f
);
9734 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9736 case OPCODE_ACTIVE_TEXTURE
:
9737 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9740 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9741 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9742 get_pointer(&n
[7]));
9744 case OPCODE_BLEND_COLOR
:
9745 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
9746 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9748 case OPCODE_BLEND_EQUATION
:
9749 fprintf(f
, "BlendEquation %s\n",
9750 enum_string(n
[1].e
));
9752 case OPCODE_BLEND_EQUATION_SEPARATE
:
9753 fprintf(f
, "BlendEquationSeparate %s, %s\n",
9754 enum_string(n
[1].e
),
9755 enum_string(n
[2].e
));
9757 case OPCODE_BLEND_FUNC_SEPARATE
:
9758 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
9759 enum_string(n
[1].e
),
9760 enum_string(n
[2].e
),
9761 enum_string(n
[3].e
),
9762 enum_string(n
[4].e
));
9764 case OPCODE_BLEND_EQUATION_I
:
9765 fprintf(f
, "BlendEquationi %u, %s\n",
9766 n
[1].ui
, enum_string(n
[2].e
));
9768 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
9769 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
9770 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9772 case OPCODE_BLEND_FUNC_I
:
9773 fprintf(f
, "BlendFunci %u, %s, %s\n",
9774 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9776 case OPCODE_BLEND_FUNC_SEPARATE_I
:
9777 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
9779 enum_string(n
[2].e
),
9780 enum_string(n
[3].e
),
9781 enum_string(n
[4].e
),
9782 enum_string(n
[5].e
));
9784 case OPCODE_CALL_LIST
:
9785 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9787 case OPCODE_CALL_LIST_OFFSET
:
9788 fprintf(f
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9789 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9791 case OPCODE_DISABLE
:
9792 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9795 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9797 case OPCODE_FRUSTUM
:
9798 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9799 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9801 case OPCODE_LINE_STIPPLE
:
9802 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9804 case OPCODE_LINE_WIDTH
:
9805 fprintf(f
, "LineWidth %f\n", n
[1].f
);
9807 case OPCODE_LOAD_IDENTITY
:
9808 fprintf(f
, "LoadIdentity\n");
9810 case OPCODE_LOAD_MATRIX
:
9811 fprintf(f
, "LoadMatrix\n");
9812 fprintf(f
, " %8f %8f %8f %8f\n",
9813 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9814 fprintf(f
, " %8f %8f %8f %8f\n",
9815 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9816 fprintf(f
, " %8f %8f %8f %8f\n",
9817 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9818 fprintf(f
, " %8f %8f %8f %8f\n",
9819 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9821 case OPCODE_MULT_MATRIX
:
9822 fprintf(f
, "MultMatrix (or Rotate)\n");
9823 fprintf(f
, " %8f %8f %8f %8f\n",
9824 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9825 fprintf(f
, " %8f %8f %8f %8f\n",
9826 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9827 fprintf(f
, " %8f %8f %8f %8f\n",
9828 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9829 fprintf(f
, " %8f %8f %8f %8f\n",
9830 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9833 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9834 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9836 case OPCODE_POINT_SIZE
:
9837 fprintf(f
, "PointSize %f\n", n
[1].f
);
9839 case OPCODE_POP_ATTRIB
:
9840 fprintf(f
, "PopAttrib\n");
9842 case OPCODE_POP_MATRIX
:
9843 fprintf(f
, "PopMatrix\n");
9845 case OPCODE_POP_NAME
:
9846 fprintf(f
, "PopName\n");
9848 case OPCODE_PUSH_ATTRIB
:
9849 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9851 case OPCODE_PUSH_MATRIX
:
9852 fprintf(f
, "PushMatrix\n");
9854 case OPCODE_PUSH_NAME
:
9855 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9857 case OPCODE_RASTER_POS
:
9858 fprintf(f
, "RasterPos %g %g %g %g\n",
9859 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9862 fprintf(f
, "Rotate %g %g %g %g\n",
9863 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9866 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9868 case OPCODE_TRANSLATE
:
9869 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9871 case OPCODE_BIND_TEXTURE
:
9872 fprintf(f
, "BindTexture %s %d\n",
9873 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
9875 case OPCODE_SHADE_MODEL
:
9876 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
9879 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9880 _mesa_enum_to_string(n
[1].ui
),
9881 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9884 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9885 _mesa_enum_to_string(n
[1].ui
),
9886 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9887 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9889 case OPCODE_MAPGRID1
:
9890 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9892 case OPCODE_MAPGRID2
:
9893 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9894 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9896 case OPCODE_EVALMESH1
:
9897 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9899 case OPCODE_EVALMESH2
:
9900 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9901 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9904 case OPCODE_ATTR_1F_NV
:
9905 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9907 case OPCODE_ATTR_2F_NV
:
9908 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9909 n
[1].i
, n
[2].f
, n
[3].f
);
9911 case OPCODE_ATTR_3F_NV
:
9912 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9913 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9915 case OPCODE_ATTR_4F_NV
:
9916 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9917 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9919 case OPCODE_ATTR_1F_ARB
:
9920 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9922 case OPCODE_ATTR_2F_ARB
:
9923 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9924 n
[1].i
, n
[2].f
, n
[3].f
);
9926 case OPCODE_ATTR_3F_ARB
:
9927 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9928 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9930 case OPCODE_ATTR_4F_ARB
:
9931 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9932 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9935 case OPCODE_MATERIAL
:
9936 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9937 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9940 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9943 fprintf(f
, "END\n");
9946 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9949 case OPCODE_EVAL_C1
:
9950 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9952 case OPCODE_EVAL_C2
:
9953 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9955 case OPCODE_EVAL_P1
:
9956 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9958 case OPCODE_EVAL_P2
:
9959 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9962 case OPCODE_PROVOKING_VERTEX
:
9963 fprintf(f
, "ProvokingVertex %s\n",
9964 _mesa_enum_to_string(n
[1].ui
));
9968 * meta opcodes/commands
9971 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
9972 (const char *) get_pointer(&n
[2]));
9974 case OPCODE_CONTINUE
:
9975 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
9976 n
= (Node
*) get_pointer(&n
[1]);
9979 fprintf(f
, "NOP\n");
9981 case OPCODE_END_OF_LIST
:
9982 fprintf(f
, "END-LIST %u\n", list
);
9986 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9988 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9989 opcode
, (void *) n
);
9993 fprintf(f
, "command %d, %u operands\n", opcode
,
9997 /* increment n to point to next compiled command */
9998 if (opcode
!= OPCODE_CONTINUE
) {
9999 n
+= InstSize
[opcode
];
10012 * Clients may call this function to help debug display list problems.
10013 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10014 * changed, or break in the future without notice.
10017 mesa_print_display_list(GLuint list
)
10019 GET_CURRENT_CONTEXT(ctx
);
10020 print_list(ctx
, list
, NULL
);
10024 /**********************************************************************/
10025 /***** Initialization *****/
10026 /**********************************************************************/
10029 save_vtxfmt_init(GLvertexformat
* vfmt
)
10031 vfmt
->ArrayElement
= _ae_ArrayElement
;
10033 vfmt
->Begin
= save_Begin
;
10035 vfmt
->CallList
= save_CallList
;
10036 vfmt
->CallLists
= save_CallLists
;
10038 vfmt
->Color3f
= save_Color3f
;
10039 vfmt
->Color3fv
= save_Color3fv
;
10040 vfmt
->Color4f
= save_Color4f
;
10041 vfmt
->Color4fv
= save_Color4fv
;
10042 vfmt
->EdgeFlag
= save_EdgeFlag
;
10043 vfmt
->End
= save_End
;
10045 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10046 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10047 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10048 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10049 vfmt
->EvalPoint1
= save_EvalPoint1
;
10050 vfmt
->EvalPoint2
= save_EvalPoint2
;
10052 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10053 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10054 vfmt
->Indexf
= save_Indexf
;
10055 vfmt
->Indexfv
= save_Indexfv
;
10056 vfmt
->Materialfv
= save_Materialfv
;
10057 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10058 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10059 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10060 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10061 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10062 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10063 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10064 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10065 vfmt
->Normal3f
= save_Normal3f
;
10066 vfmt
->Normal3fv
= save_Normal3fv
;
10067 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10068 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10069 vfmt
->TexCoord1f
= save_TexCoord1f
;
10070 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10071 vfmt
->TexCoord2f
= save_TexCoord2f
;
10072 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10073 vfmt
->TexCoord3f
= save_TexCoord3f
;
10074 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10075 vfmt
->TexCoord4f
= save_TexCoord4f
;
10076 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10077 vfmt
->Vertex2f
= save_Vertex2f
;
10078 vfmt
->Vertex2fv
= save_Vertex2fv
;
10079 vfmt
->Vertex3f
= save_Vertex3f
;
10080 vfmt
->Vertex3fv
= save_Vertex3fv
;
10081 vfmt
->Vertex4f
= save_Vertex4f
;
10082 vfmt
->Vertex4fv
= save_Vertex4fv
;
10083 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10084 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10085 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10086 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10087 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10088 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10089 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10090 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10095 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10096 const GLvertexformat
*vfmt
)
10098 SET_CallList(disp
, vfmt
->CallList
);
10099 SET_CallLists(disp
, vfmt
->CallLists
);
10104 * Initialize display list state for given context.
10107 _mesa_init_display_list(struct gl_context
*ctx
)
10109 static GLboolean tableInitialized
= GL_FALSE
;
10111 /* zero-out the instruction size table, just once */
10112 if (!tableInitialized
) {
10113 memset(InstSize
, 0, sizeof(InstSize
));
10114 tableInitialized
= GL_TRUE
;
10117 /* extension info */
10118 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10121 ctx
->ListState
.CallDepth
= 0;
10122 ctx
->ExecuteFlag
= GL_TRUE
;
10123 ctx
->CompileFlag
= GL_FALSE
;
10124 ctx
->ListState
.CurrentBlock
= NULL
;
10125 ctx
->ListState
.CurrentPos
= 0;
10127 /* Display List group */
10128 ctx
->List
.ListBase
= 0;
10130 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10132 InstSize
[OPCODE_NOP
] = 1;
10137 _mesa_free_display_list_data(struct gl_context
*ctx
)
10139 free(ctx
->ListExt
);
10140 ctx
->ListExt
= NULL
;