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
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COPY_TEX_IMAGE1D
,
214 OPCODE_COPY_TEX_IMAGE2D
,
215 OPCODE_COPY_TEX_SUB_IMAGE1D
,
216 OPCODE_COPY_TEX_SUB_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE3D
,
223 OPCODE_DISABLE_INDEXED
,
227 OPCODE_ENABLE_INDEXED
,
241 OPCODE_LOAD_IDENTITY
,
254 OPCODE_PIXEL_TRANSFER
,
257 OPCODE_POINT_PARAMETERS
,
259 OPCODE_POLYGON_STIPPLE
,
260 OPCODE_POLYGON_OFFSET
,
264 OPCODE_PRIORITIZE_TEXTURE
,
273 OPCODE_SELECT_TEXTURE_SGIS
,
274 OPCODE_SELECT_TEXTURE_COORD_SET
,
285 OPCODE_TEX_SUB_IMAGE1D
,
286 OPCODE_TEX_SUB_IMAGE2D
,
287 OPCODE_TEX_SUB_IMAGE3D
,
291 /* GL_ARB_multitexture */
292 OPCODE_ACTIVE_TEXTURE
,
293 /* GL_ARB_texture_compression */
294 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
300 /* GL_ARB_multisample */
301 OPCODE_SAMPLE_COVERAGE
,
302 /* GL_ARB_window_pos */
303 OPCODE_WINDOW_POS_ARB
,
304 /* GL_NV_fragment_program */
305 OPCODE_BIND_PROGRAM_NV
,
306 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
307 /* GL_EXT_stencil_two_side */
308 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
309 /* GL_EXT_depth_bounds_test */
310 OPCODE_DEPTH_BOUNDS_EXT
,
311 /* GL_ARB_vertex/fragment_program */
312 OPCODE_PROGRAM_STRING_ARB
,
313 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
314 /* GL_ARB_occlusion_query */
315 OPCODE_BEGIN_QUERY_ARB
,
316 OPCODE_END_QUERY_ARB
,
317 /* GL_ARB_draw_buffers */
318 OPCODE_DRAW_BUFFERS_ARB
,
319 /* GL_ATI_fragment_shader */
320 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
321 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
323 OPCODE_STENCIL_FUNC_SEPARATE
,
324 OPCODE_STENCIL_OP_SEPARATE
,
325 OPCODE_STENCIL_MASK_SEPARATE
,
327 /* GL_ARB_shader_objects */
345 OPCODE_UNIFORM_MATRIX22
,
346 OPCODE_UNIFORM_MATRIX33
,
347 OPCODE_UNIFORM_MATRIX44
,
348 OPCODE_UNIFORM_MATRIX23
,
349 OPCODE_UNIFORM_MATRIX32
,
350 OPCODE_UNIFORM_MATRIX24
,
351 OPCODE_UNIFORM_MATRIX42
,
352 OPCODE_UNIFORM_MATRIX34
,
353 OPCODE_UNIFORM_MATRIX43
,
365 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
366 OPCODE_USE_PROGRAM_STAGES
,
367 OPCODE_PROGRAM_UNIFORM_1F
,
368 OPCODE_PROGRAM_UNIFORM_2F
,
369 OPCODE_PROGRAM_UNIFORM_3F
,
370 OPCODE_PROGRAM_UNIFORM_4F
,
371 OPCODE_PROGRAM_UNIFORM_1FV
,
372 OPCODE_PROGRAM_UNIFORM_2FV
,
373 OPCODE_PROGRAM_UNIFORM_3FV
,
374 OPCODE_PROGRAM_UNIFORM_4FV
,
375 OPCODE_PROGRAM_UNIFORM_1I
,
376 OPCODE_PROGRAM_UNIFORM_2I
,
377 OPCODE_PROGRAM_UNIFORM_3I
,
378 OPCODE_PROGRAM_UNIFORM_4I
,
379 OPCODE_PROGRAM_UNIFORM_1IV
,
380 OPCODE_PROGRAM_UNIFORM_2IV
,
381 OPCODE_PROGRAM_UNIFORM_3IV
,
382 OPCODE_PROGRAM_UNIFORM_4IV
,
383 OPCODE_PROGRAM_UNIFORM_1UI
,
384 OPCODE_PROGRAM_UNIFORM_2UI
,
385 OPCODE_PROGRAM_UNIFORM_3UI
,
386 OPCODE_PROGRAM_UNIFORM_4UI
,
387 OPCODE_PROGRAM_UNIFORM_1UIV
,
388 OPCODE_PROGRAM_UNIFORM_2UIV
,
389 OPCODE_PROGRAM_UNIFORM_3UIV
,
390 OPCODE_PROGRAM_UNIFORM_4UIV
,
391 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
392 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
401 /* GL_ARB_clip_control */
404 /* GL_ARB_color_buffer_float */
407 /* GL_EXT_framebuffer_blit */
408 OPCODE_BLIT_FRAMEBUFFER
,
410 /* Vertex attributes -- fallback for when optimized display
411 * list build isn't active.
430 /* GL_EXT_provoking_vertex */
431 OPCODE_PROVOKING_VERTEX
,
433 /* GL_EXT_transform_feedback */
434 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
435 OPCODE_END_TRANSFORM_FEEDBACK
,
436 OPCODE_BIND_TRANSFORM_FEEDBACK
,
437 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
438 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
439 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
441 /* GL_EXT_texture_integer */
443 OPCODE_CLEARCOLOR_UI
,
444 OPCODE_TEXPARAMETER_I
,
445 OPCODE_TEXPARAMETER_UI
,
447 /* GL_ARB_instanced_arrays */
448 OPCODE_VERTEX_ATTRIB_DIVISOR
,
450 /* GL_NV_texture_barrier */
451 OPCODE_TEXTURE_BARRIER_NV
,
453 /* GL_ARB_sampler_object */
455 OPCODE_SAMPLER_PARAMETERIV
,
456 OPCODE_SAMPLER_PARAMETERFV
,
457 OPCODE_SAMPLER_PARAMETERIIV
,
458 OPCODE_SAMPLER_PARAMETERUIV
,
463 /* GL_NV_conditional_render */
464 OPCODE_BEGIN_CONDITIONAL_RENDER
,
465 OPCODE_END_CONDITIONAL_RENDER
,
467 /* ARB_timer_query */
468 OPCODE_QUERY_COUNTER
,
470 /* ARB_transform_feedback3 */
471 OPCODE_BEGIN_QUERY_INDEXED
,
472 OPCODE_END_QUERY_INDEXED
,
473 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
475 /* ARB_transform_feedback_instanced */
476 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
477 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
479 /* ARB_uniform_buffer_object */
480 OPCODE_UNIFORM_BLOCK_BINDING
,
482 /* EXT_polygon_offset_clamp */
483 OPCODE_POLYGON_OFFSET_CLAMP
,
485 /* The following three are meta instructions */
486 OPCODE_ERROR
, /* raise compiled-in error */
488 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
498 * Display list instructions are stored as sequences of "nodes". Nodes
499 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
500 * are linked together with a pointer.
502 * Each instruction in the display list is stored as a sequence of
503 * contiguous nodes in memory.
504 * Each node is the union of a variety of data types.
506 * Note, all of these members should be 4 bytes in size or less for the
507 * sake of compact display lists. We store 8-byte pointers in a pair of
508 * these nodes using the save/get_pointer() functions below.
526 typedef union gl_dlist_node Node
;
529 /** How many 4-byte dwords to store a pointer */
530 #define POINTER_DWORDS (sizeof(void *) / 4)
532 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
533 * space for display lists. The following types and functions are
534 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
539 GLuint dwords
[POINTER_DWORDS
];
544 * Save a 4 or 8-byte pointer at dest (and dest+1).
547 save_pointer(Node
*dest
, void *src
)
552 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
553 STATIC_ASSERT(sizeof(Node
) == 4);
557 for (i
= 0; i
< POINTER_DWORDS
; i
++)
558 dest
[i
].ui
= p
.dwords
[i
];
563 * Retrieve a 4 or 8-byte pointer from node (node+1).
566 get_pointer(const Node
*node
)
571 for (i
= 0; i
< POINTER_DWORDS
; i
++)
572 p
.dwords
[i
] = node
[i
].ui
;
579 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
590 * How many nodes to allocate at a time. Note that bulk vertex data
591 * from glBegin/glVertex/glEnd primitives will typically wind up in
592 * a VBO, and not directly in the display list itself.
594 #define BLOCK_SIZE 256
599 * Number of nodes of storage needed for each instruction.
600 * Sizes for dynamically allocated opcodes are stored in the context struct.
602 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
605 void mesa_print_display_list(GLuint list
);
609 * Allocate a gl_display_list object with an initial block of storage.
610 * \param count how many display list nodes/tokes to allocate
612 static struct gl_display_list
*
613 make_list(GLuint name
, GLuint count
)
615 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
617 dlist
->Head
= malloc(sizeof(Node
) * count
);
618 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
624 * Lookup function to just encapsulate casting.
626 struct gl_display_list
*
627 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
629 return (struct gl_display_list
*)
630 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
634 /** Is the given opcode an extension code? */
635 static inline GLboolean
636 is_ext_opcode(OpCode opcode
)
638 return (opcode
>= OPCODE_EXT_0
);
642 /** Destroy an extended opcode instruction */
644 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
646 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
648 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
649 step
= ctx
->ListExt
->Opcode
[i
].Size
;
654 /** Execute an extended opcode instruction */
656 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
658 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
660 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
661 step
= ctx
->ListExt
->Opcode
[i
].Size
;
666 /** Print an extended opcode instruction */
668 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
670 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
672 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
673 step
= ctx
->ListExt
->Opcode
[i
].Size
;
679 * Delete the named display list, but don't remove from hash table.
680 * \param dlist - display list pointer
683 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
688 n
= block
= dlist
->Head
;
690 done
= block
? GL_FALSE
: GL_TRUE
;
692 const OpCode opcode
= n
[0].opcode
;
694 /* check for extension opcodes first */
695 if (is_ext_opcode(opcode
)) {
696 n
+= ext_opcode_destroy(ctx
, n
);
700 /* for some commands, we need to free malloc'd memory */
702 free(get_pointer(&n
[6]));
703 n
+= InstSize
[n
[0].opcode
];
706 free(get_pointer(&n
[10]));
707 n
+= InstSize
[n
[0].opcode
];
709 case OPCODE_CALL_LISTS
:
710 free(get_pointer(&n
[3]));
711 n
+= InstSize
[n
[0].opcode
];
713 case OPCODE_DRAW_PIXELS
:
714 free(get_pointer(&n
[5]));
715 n
+= InstSize
[n
[0].opcode
];
718 free(get_pointer(&n
[7]));
719 n
+= InstSize
[n
[0].opcode
];
721 case OPCODE_POLYGON_STIPPLE
:
722 free(get_pointer(&n
[1]));
723 n
+= InstSize
[n
[0].opcode
];
725 case OPCODE_TEX_IMAGE1D
:
726 free(get_pointer(&n
[8]));
727 n
+= InstSize
[n
[0].opcode
];
729 case OPCODE_TEX_IMAGE2D
:
730 free(get_pointer(&n
[9]));
731 n
+= InstSize
[n
[0].opcode
];
733 case OPCODE_TEX_IMAGE3D
:
734 free(get_pointer(&n
[10]));
735 n
+= InstSize
[n
[0].opcode
];
737 case OPCODE_TEX_SUB_IMAGE1D
:
738 free(get_pointer(&n
[7]));
739 n
+= InstSize
[n
[0].opcode
];
741 case OPCODE_TEX_SUB_IMAGE2D
:
742 free(get_pointer(&n
[9]));
743 n
+= InstSize
[n
[0].opcode
];
745 case OPCODE_TEX_SUB_IMAGE3D
:
746 free(get_pointer(&n
[11]));
747 n
+= InstSize
[n
[0].opcode
];
749 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
750 free(get_pointer(&n
[7]));
751 n
+= InstSize
[n
[0].opcode
];
753 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
754 free(get_pointer(&n
[8]));
755 n
+= InstSize
[n
[0].opcode
];
757 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
758 free(get_pointer(&n
[9]));
759 n
+= InstSize
[n
[0].opcode
];
761 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
762 free(get_pointer(&n
[7]));
763 n
+= InstSize
[n
[0].opcode
];
765 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
766 free(get_pointer(&n
[9]));
767 n
+= InstSize
[n
[0].opcode
];
769 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
770 free(get_pointer(&n
[11]));
771 n
+= InstSize
[n
[0].opcode
];
773 case OPCODE_PROGRAM_STRING_ARB
:
774 free(get_pointer(&n
[4])); /* program string */
775 n
+= InstSize
[n
[0].opcode
];
777 case OPCODE_UNIFORM_1FV
:
778 case OPCODE_UNIFORM_2FV
:
779 case OPCODE_UNIFORM_3FV
:
780 case OPCODE_UNIFORM_4FV
:
781 case OPCODE_UNIFORM_1IV
:
782 case OPCODE_UNIFORM_2IV
:
783 case OPCODE_UNIFORM_3IV
:
784 case OPCODE_UNIFORM_4IV
:
785 case OPCODE_UNIFORM_1UIV
:
786 case OPCODE_UNIFORM_2UIV
:
787 case OPCODE_UNIFORM_3UIV
:
788 case OPCODE_UNIFORM_4UIV
:
789 free(get_pointer(&n
[3]));
790 n
+= InstSize
[n
[0].opcode
];
792 case OPCODE_UNIFORM_MATRIX22
:
793 case OPCODE_UNIFORM_MATRIX33
:
794 case OPCODE_UNIFORM_MATRIX44
:
795 case OPCODE_UNIFORM_MATRIX24
:
796 case OPCODE_UNIFORM_MATRIX42
:
797 case OPCODE_UNIFORM_MATRIX23
:
798 case OPCODE_UNIFORM_MATRIX32
:
799 case OPCODE_UNIFORM_MATRIX34
:
800 case OPCODE_UNIFORM_MATRIX43
:
801 free(get_pointer(&n
[4]));
802 n
+= InstSize
[n
[0].opcode
];
804 case OPCODE_PROGRAM_UNIFORM_1FV
:
805 case OPCODE_PROGRAM_UNIFORM_2FV
:
806 case OPCODE_PROGRAM_UNIFORM_3FV
:
807 case OPCODE_PROGRAM_UNIFORM_4FV
:
808 case OPCODE_PROGRAM_UNIFORM_1IV
:
809 case OPCODE_PROGRAM_UNIFORM_2IV
:
810 case OPCODE_PROGRAM_UNIFORM_3IV
:
811 case OPCODE_PROGRAM_UNIFORM_4IV
:
812 case OPCODE_PROGRAM_UNIFORM_1UIV
:
813 case OPCODE_PROGRAM_UNIFORM_2UIV
:
814 case OPCODE_PROGRAM_UNIFORM_3UIV
:
815 case OPCODE_PROGRAM_UNIFORM_4UIV
:
816 free(get_pointer(&n
[4]));
817 n
+= InstSize
[n
[0].opcode
];
819 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
820 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
821 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
824 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
825 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
826 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
827 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
828 free(get_pointer(&n
[5]));
829 n
+= InstSize
[n
[0].opcode
];
831 case OPCODE_PIXEL_MAP
:
832 free(get_pointer(&n
[3]));
833 n
+= InstSize
[n
[0].opcode
];
836 case OPCODE_CONTINUE
:
837 n
= (Node
*) get_pointer(&n
[1]);
841 case OPCODE_END_OF_LIST
:
846 /* Most frequent case */
847 n
+= InstSize
[n
[0].opcode
];
859 * Destroy a display list and remove from hash table.
860 * \param list - display list number
863 destroy_list(struct gl_context
*ctx
, GLuint list
)
865 struct gl_display_list
*dlist
;
870 dlist
= _mesa_lookup_list(ctx
, list
);
874 _mesa_delete_list(ctx
, dlist
);
875 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
880 * Translate the nth element of list from <type> to GLint.
883 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
895 bptr
= (GLbyte
*) list
;
896 return (GLint
) bptr
[n
];
897 case GL_UNSIGNED_BYTE
:
898 ubptr
= (GLubyte
*) list
;
899 return (GLint
) ubptr
[n
];
901 sptr
= (GLshort
*) list
;
902 return (GLint
) sptr
[n
];
903 case GL_UNSIGNED_SHORT
:
904 usptr
= (GLushort
*) list
;
905 return (GLint
) usptr
[n
];
907 iptr
= (GLint
*) list
;
909 case GL_UNSIGNED_INT
:
910 uiptr
= (GLuint
*) list
;
911 return (GLint
) uiptr
[n
];
913 fptr
= (GLfloat
*) list
;
914 return (GLint
) floorf(fptr
[n
]);
916 ubptr
= ((GLubyte
*) list
) + 2 * n
;
917 return (GLint
) ubptr
[0] * 256
920 ubptr
= ((GLubyte
*) list
) + 3 * n
;
921 return (GLint
) ubptr
[0] * 65536
922 + (GLint
) ubptr
[1] * 256
925 ubptr
= ((GLubyte
*) list
) + 4 * n
;
926 return (GLint
) ubptr
[0] * 16777216
927 + (GLint
) ubptr
[1] * 65536
928 + (GLint
) ubptr
[2] * 256
937 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
938 * If width < 0 or height < 0 or format or type are invalid we'll just
939 * return NULL. We will not generate an error since OpenGL command
940 * arguments aren't error-checked until the command is actually executed
941 * (not when they're compiled).
942 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
945 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
946 GLsizei width
, GLsizei height
, GLsizei depth
,
947 GLenum format
, GLenum type
, const GLvoid
* pixels
,
948 const struct gl_pixelstore_attrib
*unpack
)
950 if (width
<= 0 || height
<= 0) {
954 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
955 /* bad format and/or type */
959 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
963 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
964 format
, type
, pixels
, unpack
);
965 if (pixels
&& !image
) {
966 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
970 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
971 depth
, format
, type
, INT_MAX
, pixels
)) {
972 const GLubyte
*map
, *src
;
976 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
977 GL_MAP_READ_BIT
, unpack
->BufferObj
,
980 /* unable to map src buffer! */
981 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
985 src
= ADD_POINTERS(map
, pixels
);
986 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
987 format
, type
, src
, unpack
);
989 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
992 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
998 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1003 /** Return copy of memory */
1005 memdup(const void *src
, GLsizei bytes
)
1007 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1009 memcpy(b
, src
, bytes
);
1015 * Allocate space for a display list instruction (opcode + payload space).
1016 * \param opcode the instruction opcode (OPCODE_* value)
1017 * \param bytes instruction payload size (not counting opcode)
1018 * \param align8 does the payload need to be 8-byte aligned?
1019 * This is only relevant in 64-bit environments.
1020 * \return pointer to allocated memory (the payload will be at pointer+1)
1023 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1025 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1026 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1030 if (opcode
< OPCODE_EXT_0
) {
1031 if (InstSize
[opcode
] == 0) {
1032 /* save instruction size now */
1033 InstSize
[opcode
] = numNodes
;
1036 /* make sure instruction size agrees */
1037 assert(numNodes
== InstSize
[opcode
]);
1041 if (sizeof(void *) > sizeof(Node
) && align8
1042 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1043 /* The opcode would get placed at node[0] and the payload would start
1044 * at node[1]. But the payload needs to be at an even offset (8-byte
1053 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1055 /* This block is full. Allocate a new block and chain to it */
1057 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1058 n
[0].opcode
= OPCODE_CONTINUE
;
1059 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1061 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1065 /* a fresh block should be 8-byte aligned on 64-bit systems */
1066 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1068 save_pointer(&n
[1], newblock
);
1069 ctx
->ListState
.CurrentBlock
= newblock
;
1070 ctx
->ListState
.CurrentPos
= 0;
1072 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1073 * we have to insert a NOP so that the payload of the real opcode lands
1074 * on an even location:
1075 * node[0] = OPCODE_NOP
1076 * node[1] = OPCODE_x;
1077 * node[2] = start of payload
1079 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1082 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1084 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1085 n
[0].opcode
= OPCODE_NOP
;
1087 /* The "real" opcode will now be at an odd location and the payload
1088 * will be at an even location.
1091 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1093 n
[0].opcode
= opcode
;
1101 * Allocate space for a display list instruction. Used by callers outside
1102 * this file for things like VBO vertex data.
1104 * \param opcode the instruction opcode (OPCODE_* value)
1105 * \param bytes instruction size in bytes, not counting opcode.
1106 * \return pointer to the usable data area (not including the internal
1110 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1112 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1114 return n
+ 1; /* return pointer to payload area, after opcode */
1121 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1122 * aligned in 64-bit environments, 4-byte aligned otherwise.
1125 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1127 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1129 return n
+ 1; /* return pointer to payload area, after opcode */
1136 * This function allows modules and drivers to get their own opcodes
1137 * for extending display list functionality.
1138 * \param ctx the rendering context
1139 * \param size number of bytes for storing the new display list command
1140 * \param execute function to execute the new display list command
1141 * \param destroy function to destroy the new display list command
1142 * \param print function to print the new display list command
1143 * \return the new opcode number or -1 if error
1146 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1148 void (*execute
) (struct gl_context
*, void *),
1149 void (*destroy
) (struct gl_context
*, void *),
1150 void (*print
) (struct gl_context
*, void *, FILE *))
1152 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1153 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1154 ctx
->ListExt
->Opcode
[i
].Size
=
1155 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1156 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1157 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1158 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1159 return i
+ OPCODE_EXT_0
;
1166 * Allocate space for a display list instruction. The space is basically
1167 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1168 * function parameter, node[2] is the second parameter, etc.
1170 * \param opcode one of OPCODE_x
1171 * \param nparams number of function parameters
1172 * \return pointer to start of instruction space
1174 static inline Node
*
1175 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1177 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1182 * Called by EndList to try to reduce memory used for the list.
1185 trim_list(struct gl_context
*ctx
)
1187 /* If the list we're ending only has one allocated block of nodes/tokens
1188 * and its size isn't a full block size, realloc the block to use less
1189 * memory. This is important for apps that create many small display
1190 * lists and apps that use glXUseXFont (many lists each containing one
1192 * Note: we currently only trim display lists that allocated one block
1193 * of tokens. That hits the short list case which is what we're mainly
1194 * concerned with. Trimming longer lists would involve traversing the
1195 * linked list of blocks.
1197 struct gl_dlist_state
*list
= &ctx
->ListState
;
1199 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1200 (list
->CurrentPos
< BLOCK_SIZE
)) {
1201 /* There's only one block and it's not full, so realloc */
1202 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1203 list
->CurrentList
->Head
=
1204 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1205 if (!list
->CurrentBlock
) {
1206 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1214 * Display List compilation functions
1216 static void GLAPIENTRY
1217 save_Accum(GLenum op
, GLfloat value
)
1219 GET_CURRENT_CONTEXT(ctx
);
1221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1222 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1227 if (ctx
->ExecuteFlag
) {
1228 CALL_Accum(ctx
->Exec
, (op
, value
));
1233 static void GLAPIENTRY
1234 save_AlphaFunc(GLenum func
, GLclampf ref
)
1236 GET_CURRENT_CONTEXT(ctx
);
1238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1239 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1242 n
[2].f
= (GLfloat
) ref
;
1244 if (ctx
->ExecuteFlag
) {
1245 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1250 static void GLAPIENTRY
1251 save_BindTexture(GLenum target
, GLuint texture
)
1253 GET_CURRENT_CONTEXT(ctx
);
1255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1256 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1261 if (ctx
->ExecuteFlag
) {
1262 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1267 static void GLAPIENTRY
1268 save_Bitmap(GLsizei width
, GLsizei height
,
1269 GLfloat xorig
, GLfloat yorig
,
1270 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1272 GET_CURRENT_CONTEXT(ctx
);
1274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1275 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1277 n
[1].i
= (GLint
) width
;
1278 n
[2].i
= (GLint
) height
;
1284 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1285 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1287 if (ctx
->ExecuteFlag
) {
1288 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1289 xorig
, yorig
, xmove
, ymove
, pixels
));
1294 static void GLAPIENTRY
1295 save_BlendEquation(GLenum mode
)
1297 GET_CURRENT_CONTEXT(ctx
);
1299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1300 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1304 if (ctx
->ExecuteFlag
) {
1305 CALL_BlendEquation(ctx
->Exec
, (mode
));
1310 static void GLAPIENTRY
1311 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1313 GET_CURRENT_CONTEXT(ctx
);
1315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1316 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1321 if (ctx
->ExecuteFlag
) {
1322 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1327 static void GLAPIENTRY
1328 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1329 GLenum sfactorA
, GLenum dfactorA
)
1331 GET_CURRENT_CONTEXT(ctx
);
1333 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1334 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1336 n
[1].e
= sfactorRGB
;
1337 n
[2].e
= dfactorRGB
;
1341 if (ctx
->ExecuteFlag
) {
1342 CALL_BlendFuncSeparate(ctx
->Exec
,
1343 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1348 static void GLAPIENTRY
1349 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1351 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1355 static void GLAPIENTRY
1356 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1358 GET_CURRENT_CONTEXT(ctx
);
1360 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1361 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1368 if (ctx
->ExecuteFlag
) {
1369 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1373 /* GL_ARB_draw_buffers_blend */
1374 static void GLAPIENTRY
1375 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1376 GLenum sfactorA
, GLenum dfactorA
)
1378 GET_CURRENT_CONTEXT(ctx
);
1380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1381 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1384 n
[2].e
= sfactorRGB
;
1385 n
[3].e
= dfactorRGB
;
1389 if (ctx
->ExecuteFlag
) {
1390 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1391 sfactorA
, dfactorA
));
1395 /* GL_ARB_draw_buffers_blend */
1396 static void GLAPIENTRY
1397 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1399 GET_CURRENT_CONTEXT(ctx
);
1401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1402 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_I
, 3);
1408 if (ctx
->ExecuteFlag
) {
1409 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1413 /* GL_ARB_draw_buffers_blend */
1414 static void GLAPIENTRY
1415 save_BlendEquationi(GLuint buf
, GLenum mode
)
1417 GET_CURRENT_CONTEXT(ctx
);
1419 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1420 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1425 if (ctx
->ExecuteFlag
) {
1426 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1430 /* GL_ARB_draw_buffers_blend */
1431 static void GLAPIENTRY
1432 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1434 GET_CURRENT_CONTEXT(ctx
);
1436 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1437 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1443 if (ctx
->ExecuteFlag
) {
1444 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1449 /* GL_ARB_draw_instanced. */
1450 static void GLAPIENTRY
1451 save_DrawArraysInstancedARB(GLenum mode
,
1456 GET_CURRENT_CONTEXT(ctx
);
1457 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1458 "glDrawArraysInstanced() during display list compile");
1461 static void GLAPIENTRY
1462 save_DrawElementsInstancedARB(GLenum mode
,
1465 const GLvoid
*indices
,
1468 GET_CURRENT_CONTEXT(ctx
);
1469 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1470 "glDrawElementsInstanced() during display list compile");
1473 static void GLAPIENTRY
1474 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1477 const GLvoid
*indices
,
1481 GET_CURRENT_CONTEXT(ctx
);
1482 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1483 "glDrawElementsInstancedBaseVertex() during display list compile");
1486 /* GL_ARB_base_instance. */
1487 static void GLAPIENTRY
1488 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1492 GLuint baseinstance
)
1494 GET_CURRENT_CONTEXT(ctx
);
1495 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1496 "glDrawArraysInstancedBaseInstance() during display list compile");
1499 static void APIENTRY
1500 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1503 const void *indices
,
1505 GLuint baseinstance
)
1507 GET_CURRENT_CONTEXT(ctx
);
1508 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1509 "glDrawElementsInstancedBaseInstance() during display list compile");
1512 static void APIENTRY
1513 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1516 const void *indices
,
1519 GLuint baseinstance
)
1521 GET_CURRENT_CONTEXT(ctx
);
1522 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1523 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1528 * While building a display list we cache some OpenGL state.
1529 * Under some circumstances we need to invalidate that state (immediately
1530 * when we start compiling a list, or after glCallList(s)).
1533 invalidate_saved_current_state(struct gl_context
*ctx
)
1537 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1538 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1540 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1541 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1543 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1545 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1549 static void GLAPIENTRY
1550 save_CallList(GLuint list
)
1552 GET_CURRENT_CONTEXT(ctx
);
1554 SAVE_FLUSH_VERTICES(ctx
);
1556 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1561 /* After this, we don't know what state we're in. Invalidate all
1562 * cached information previously gathered:
1564 invalidate_saved_current_state( ctx
);
1566 if (ctx
->ExecuteFlag
) {
1567 _mesa_CallList(list
);
1572 static void GLAPIENTRY
1573 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1575 GET_CURRENT_CONTEXT(ctx
);
1580 SAVE_FLUSH_VERTICES(ctx
);
1584 case GL_UNSIGNED_BYTE
:
1588 case GL_UNSIGNED_SHORT
:
1596 case GL_UNSIGNED_INT
:
1605 if (num
> 0 && type_size
> 0) {
1606 /* create a copy of the array of list IDs to save in the display list */
1607 lists_copy
= memdup(lists
, num
* type_size
);
1612 n
= alloc_instruction(ctx
, OPCODE_CALL_LISTS
, 2 + POINTER_DWORDS
);
1616 save_pointer(&n
[3], lists_copy
);
1619 /* After this, we don't know what state we're in. Invalidate all
1620 * cached information previously gathered:
1622 invalidate_saved_current_state( ctx
);
1624 if (ctx
->ExecuteFlag
) {
1625 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1630 static void GLAPIENTRY
1631 save_Clear(GLbitfield mask
)
1633 GET_CURRENT_CONTEXT(ctx
);
1635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1636 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1640 if (ctx
->ExecuteFlag
) {
1641 CALL_Clear(ctx
->Exec
, (mask
));
1646 static void GLAPIENTRY
1647 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1649 GET_CURRENT_CONTEXT(ctx
);
1651 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1652 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1655 n
[2].i
= drawbuffer
;
1657 if (buffer
== GL_COLOR
) {
1668 if (ctx
->ExecuteFlag
) {
1669 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1674 static void GLAPIENTRY
1675 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1677 GET_CURRENT_CONTEXT(ctx
);
1679 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1680 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1683 n
[2].i
= drawbuffer
;
1685 if (buffer
== GL_COLOR
) {
1696 if (ctx
->ExecuteFlag
) {
1697 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1702 static void GLAPIENTRY
1703 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1705 GET_CURRENT_CONTEXT(ctx
);
1707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1708 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1711 n
[2].i
= drawbuffer
;
1713 if (buffer
== GL_COLOR
) {
1724 if (ctx
->ExecuteFlag
) {
1725 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1730 static void GLAPIENTRY
1731 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1732 GLfloat depth
, GLint stencil
)
1734 GET_CURRENT_CONTEXT(ctx
);
1736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1737 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1740 n
[2].i
= drawbuffer
;
1744 if (ctx
->ExecuteFlag
) {
1745 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1750 static void GLAPIENTRY
1751 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1753 GET_CURRENT_CONTEXT(ctx
);
1755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1756 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1763 if (ctx
->ExecuteFlag
) {
1764 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1769 static void GLAPIENTRY
1770 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1772 GET_CURRENT_CONTEXT(ctx
);
1774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1775 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1782 if (ctx
->ExecuteFlag
) {
1783 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1788 static void GLAPIENTRY
1789 save_ClearDepth(GLclampd depth
)
1791 GET_CURRENT_CONTEXT(ctx
);
1793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1794 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1796 n
[1].f
= (GLfloat
) depth
;
1798 if (ctx
->ExecuteFlag
) {
1799 CALL_ClearDepth(ctx
->Exec
, (depth
));
1804 static void GLAPIENTRY
1805 save_ClearIndex(GLfloat c
)
1807 GET_CURRENT_CONTEXT(ctx
);
1809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1810 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1814 if (ctx
->ExecuteFlag
) {
1815 CALL_ClearIndex(ctx
->Exec
, (c
));
1820 static void GLAPIENTRY
1821 save_ClearStencil(GLint s
)
1823 GET_CURRENT_CONTEXT(ctx
);
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1826 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1830 if (ctx
->ExecuteFlag
) {
1831 CALL_ClearStencil(ctx
->Exec
, (s
));
1836 static void GLAPIENTRY
1837 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1839 GET_CURRENT_CONTEXT(ctx
);
1841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1842 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1845 n
[2].f
= (GLfloat
) equ
[0];
1846 n
[3].f
= (GLfloat
) equ
[1];
1847 n
[4].f
= (GLfloat
) equ
[2];
1848 n
[5].f
= (GLfloat
) equ
[3];
1850 if (ctx
->ExecuteFlag
) {
1851 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1857 static void GLAPIENTRY
1858 save_ColorMask(GLboolean red
, GLboolean green
,
1859 GLboolean blue
, GLboolean alpha
)
1861 GET_CURRENT_CONTEXT(ctx
);
1863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1864 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1871 if (ctx
->ExecuteFlag
) {
1872 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1877 static void GLAPIENTRY
1878 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1879 GLboolean blue
, GLboolean alpha
)
1881 GET_CURRENT_CONTEXT(ctx
);
1883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1884 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1892 if (ctx
->ExecuteFlag
) {
1893 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1898 static void GLAPIENTRY
1899 save_ColorMaterial(GLenum face
, GLenum mode
)
1901 GET_CURRENT_CONTEXT(ctx
);
1903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1905 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1910 if (ctx
->ExecuteFlag
) {
1911 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1916 static void GLAPIENTRY
1917 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1919 GET_CURRENT_CONTEXT(ctx
);
1921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1922 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1926 n
[3].i
= (GLint
) width
;
1927 n
[4].i
= (GLint
) height
;
1930 if (ctx
->ExecuteFlag
) {
1931 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1937 static void GLAPIENTRY
1938 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1939 GLint x
, GLint y
, GLsizei width
, GLint border
)
1941 GET_CURRENT_CONTEXT(ctx
);
1943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1944 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1948 n
[3].e
= internalformat
;
1954 if (ctx
->ExecuteFlag
) {
1955 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1956 x
, y
, width
, border
));
1961 static void GLAPIENTRY
1962 save_CopyTexImage2D(GLenum target
, GLint level
,
1963 GLenum internalformat
,
1964 GLint x
, GLint y
, GLsizei width
,
1965 GLsizei height
, GLint border
)
1967 GET_CURRENT_CONTEXT(ctx
);
1969 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1970 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1974 n
[3].e
= internalformat
;
1981 if (ctx
->ExecuteFlag
) {
1982 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1983 x
, y
, width
, height
, border
));
1989 static void GLAPIENTRY
1990 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1991 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1993 GET_CURRENT_CONTEXT(ctx
);
1995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1996 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2005 if (ctx
->ExecuteFlag
) {
2006 CALL_CopyTexSubImage1D(ctx
->Exec
,
2007 (target
, level
, xoffset
, x
, y
, width
));
2012 static void GLAPIENTRY
2013 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2014 GLint xoffset
, GLint yoffset
,
2015 GLint x
, GLint y
, GLsizei width
, GLint height
)
2017 GET_CURRENT_CONTEXT(ctx
);
2019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2020 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2031 if (ctx
->ExecuteFlag
) {
2032 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2033 x
, y
, width
, height
));
2038 static void GLAPIENTRY
2039 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2040 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2041 GLint x
, GLint y
, GLsizei width
, GLint height
)
2043 GET_CURRENT_CONTEXT(ctx
);
2045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2046 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2058 if (ctx
->ExecuteFlag
) {
2059 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2060 xoffset
, yoffset
, zoffset
,
2061 x
, y
, width
, height
));
2066 static void GLAPIENTRY
2067 save_CullFace(GLenum mode
)
2069 GET_CURRENT_CONTEXT(ctx
);
2071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2072 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2076 if (ctx
->ExecuteFlag
) {
2077 CALL_CullFace(ctx
->Exec
, (mode
));
2082 static void GLAPIENTRY
2083 save_DepthFunc(GLenum func
)
2085 GET_CURRENT_CONTEXT(ctx
);
2087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2088 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2092 if (ctx
->ExecuteFlag
) {
2093 CALL_DepthFunc(ctx
->Exec
, (func
));
2098 static void GLAPIENTRY
2099 save_DepthMask(GLboolean mask
)
2101 GET_CURRENT_CONTEXT(ctx
);
2103 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2104 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2108 if (ctx
->ExecuteFlag
) {
2109 CALL_DepthMask(ctx
->Exec
, (mask
));
2114 static void GLAPIENTRY
2115 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2117 GET_CURRENT_CONTEXT(ctx
);
2119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2120 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2122 n
[1].f
= (GLfloat
) nearval
;
2123 n
[2].f
= (GLfloat
) farval
;
2125 if (ctx
->ExecuteFlag
) {
2126 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2131 static void GLAPIENTRY
2132 save_Disable(GLenum cap
)
2134 GET_CURRENT_CONTEXT(ctx
);
2136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2137 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2141 if (ctx
->ExecuteFlag
) {
2142 CALL_Disable(ctx
->Exec
, (cap
));
2147 static void GLAPIENTRY
2148 save_DisableIndexed(GLuint index
, GLenum cap
)
2150 GET_CURRENT_CONTEXT(ctx
);
2152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2153 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2158 if (ctx
->ExecuteFlag
) {
2159 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2164 static void GLAPIENTRY
2165 save_DrawBuffer(GLenum mode
)
2167 GET_CURRENT_CONTEXT(ctx
);
2169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2170 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2174 if (ctx
->ExecuteFlag
) {
2175 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2180 static void GLAPIENTRY
2181 save_DrawPixels(GLsizei width
, GLsizei height
,
2182 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2184 GET_CURRENT_CONTEXT(ctx
);
2187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2189 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2196 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2197 pixels
, &ctx
->Unpack
));
2199 if (ctx
->ExecuteFlag
) {
2200 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2206 static void GLAPIENTRY
2207 save_Enable(GLenum cap
)
2209 GET_CURRENT_CONTEXT(ctx
);
2211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2212 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2216 if (ctx
->ExecuteFlag
) {
2217 CALL_Enable(ctx
->Exec
, (cap
));
2223 static void GLAPIENTRY
2224 save_EnableIndexed(GLuint index
, GLenum cap
)
2226 GET_CURRENT_CONTEXT(ctx
);
2228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2229 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2234 if (ctx
->ExecuteFlag
) {
2235 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2241 static void GLAPIENTRY
2242 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2244 GET_CURRENT_CONTEXT(ctx
);
2246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2247 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2253 if (ctx
->ExecuteFlag
) {
2254 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2259 static void GLAPIENTRY
2260 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2262 GET_CURRENT_CONTEXT(ctx
);
2264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2265 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2273 if (ctx
->ExecuteFlag
) {
2274 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2281 static void GLAPIENTRY
2282 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2284 GET_CURRENT_CONTEXT(ctx
);
2286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2287 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2295 if (ctx
->ExecuteFlag
) {
2296 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2301 static void GLAPIENTRY
2302 save_Fogf(GLenum pname
, GLfloat param
)
2306 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2307 save_Fogfv(pname
, parray
);
2311 static void GLAPIENTRY
2312 save_Fogiv(GLenum pname
, const GLint
*params
)
2317 case GL_FOG_DENSITY
:
2321 p
[0] = (GLfloat
) *params
;
2327 p
[0] = INT_TO_FLOAT(params
[0]);
2328 p
[1] = INT_TO_FLOAT(params
[1]);
2329 p
[2] = INT_TO_FLOAT(params
[2]);
2330 p
[3] = INT_TO_FLOAT(params
[3]);
2333 /* Error will be caught later in gl_Fogfv */
2334 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2336 save_Fogfv(pname
, p
);
2340 static void GLAPIENTRY
2341 save_Fogi(GLenum pname
, GLint param
)
2345 parray
[1] = parray
[2] = parray
[3] = 0;
2346 save_Fogiv(pname
, parray
);
2350 static void GLAPIENTRY
2351 save_FrontFace(GLenum mode
)
2353 GET_CURRENT_CONTEXT(ctx
);
2355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2356 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2360 if (ctx
->ExecuteFlag
) {
2361 CALL_FrontFace(ctx
->Exec
, (mode
));
2366 static void GLAPIENTRY
2367 save_Frustum(GLdouble left
, GLdouble right
,
2368 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2370 GET_CURRENT_CONTEXT(ctx
);
2372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2373 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2375 n
[1].f
= (GLfloat
) left
;
2376 n
[2].f
= (GLfloat
) right
;
2377 n
[3].f
= (GLfloat
) bottom
;
2378 n
[4].f
= (GLfloat
) top
;
2379 n
[5].f
= (GLfloat
) nearval
;
2380 n
[6].f
= (GLfloat
) farval
;
2382 if (ctx
->ExecuteFlag
) {
2383 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2388 static void GLAPIENTRY
2389 save_Hint(GLenum target
, GLenum mode
)
2391 GET_CURRENT_CONTEXT(ctx
);
2393 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2394 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2399 if (ctx
->ExecuteFlag
) {
2400 CALL_Hint(ctx
->Exec
, (target
, mode
));
2405 static void GLAPIENTRY
2406 save_IndexMask(GLuint mask
)
2408 GET_CURRENT_CONTEXT(ctx
);
2410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2411 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2415 if (ctx
->ExecuteFlag
) {
2416 CALL_IndexMask(ctx
->Exec
, (mask
));
2421 static void GLAPIENTRY
2422 save_InitNames(void)
2424 GET_CURRENT_CONTEXT(ctx
);
2425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2426 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2427 if (ctx
->ExecuteFlag
) {
2428 CALL_InitNames(ctx
->Exec
, ());
2433 static void GLAPIENTRY
2434 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2436 GET_CURRENT_CONTEXT(ctx
);
2438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2439 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2457 case GL_SPOT_DIRECTION
:
2460 case GL_SPOT_EXPONENT
:
2463 case GL_SPOT_CUTOFF
:
2466 case GL_CONSTANT_ATTENUATION
:
2469 case GL_LINEAR_ATTENUATION
:
2472 case GL_QUADRATIC_ATTENUATION
:
2478 for (i
= 0; i
< nParams
; i
++) {
2479 n
[3 + i
].f
= params
[i
];
2482 if (ctx
->ExecuteFlag
) {
2483 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2488 static void GLAPIENTRY
2489 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2493 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2494 save_Lightfv(light
, pname
, parray
);
2498 static void GLAPIENTRY
2499 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2506 fparam
[0] = INT_TO_FLOAT(params
[0]);
2507 fparam
[1] = INT_TO_FLOAT(params
[1]);
2508 fparam
[2] = INT_TO_FLOAT(params
[2]);
2509 fparam
[3] = INT_TO_FLOAT(params
[3]);
2512 fparam
[0] = (GLfloat
) params
[0];
2513 fparam
[1] = (GLfloat
) params
[1];
2514 fparam
[2] = (GLfloat
) params
[2];
2515 fparam
[3] = (GLfloat
) params
[3];
2517 case GL_SPOT_DIRECTION
:
2518 fparam
[0] = (GLfloat
) params
[0];
2519 fparam
[1] = (GLfloat
) params
[1];
2520 fparam
[2] = (GLfloat
) params
[2];
2522 case GL_SPOT_EXPONENT
:
2523 case GL_SPOT_CUTOFF
:
2524 case GL_CONSTANT_ATTENUATION
:
2525 case GL_LINEAR_ATTENUATION
:
2526 case GL_QUADRATIC_ATTENUATION
:
2527 fparam
[0] = (GLfloat
) params
[0];
2530 /* error will be caught later in gl_Lightfv */
2533 save_Lightfv(light
, pname
, fparam
);
2537 static void GLAPIENTRY
2538 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2542 parray
[1] = parray
[2] = parray
[3] = 0;
2543 save_Lightiv(light
, pname
, parray
);
2547 static void GLAPIENTRY
2548 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2550 GET_CURRENT_CONTEXT(ctx
);
2552 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2553 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2561 if (ctx
->ExecuteFlag
) {
2562 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2567 static void GLAPIENTRY
2568 save_LightModelf(GLenum pname
, GLfloat param
)
2572 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2573 save_LightModelfv(pname
, parray
);
2577 static void GLAPIENTRY
2578 save_LightModeliv(GLenum pname
, const GLint
*params
)
2582 case GL_LIGHT_MODEL_AMBIENT
:
2583 fparam
[0] = INT_TO_FLOAT(params
[0]);
2584 fparam
[1] = INT_TO_FLOAT(params
[1]);
2585 fparam
[2] = INT_TO_FLOAT(params
[2]);
2586 fparam
[3] = INT_TO_FLOAT(params
[3]);
2588 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2589 case GL_LIGHT_MODEL_TWO_SIDE
:
2590 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2591 fparam
[0] = (GLfloat
) params
[0];
2597 /* Error will be caught later in gl_LightModelfv */
2598 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2600 save_LightModelfv(pname
, fparam
);
2604 static void GLAPIENTRY
2605 save_LightModeli(GLenum pname
, GLint param
)
2609 parray
[1] = parray
[2] = parray
[3] = 0;
2610 save_LightModeliv(pname
, parray
);
2614 static void GLAPIENTRY
2615 save_LineStipple(GLint factor
, GLushort pattern
)
2617 GET_CURRENT_CONTEXT(ctx
);
2619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2620 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2625 if (ctx
->ExecuteFlag
) {
2626 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2631 static void GLAPIENTRY
2632 save_LineWidth(GLfloat width
)
2634 GET_CURRENT_CONTEXT(ctx
);
2636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2637 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2641 if (ctx
->ExecuteFlag
) {
2642 CALL_LineWidth(ctx
->Exec
, (width
));
2647 static void GLAPIENTRY
2648 save_ListBase(GLuint base
)
2650 GET_CURRENT_CONTEXT(ctx
);
2652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2653 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2657 if (ctx
->ExecuteFlag
) {
2658 CALL_ListBase(ctx
->Exec
, (base
));
2663 static void GLAPIENTRY
2664 save_LoadIdentity(void)
2666 GET_CURRENT_CONTEXT(ctx
);
2667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2668 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2669 if (ctx
->ExecuteFlag
) {
2670 CALL_LoadIdentity(ctx
->Exec
, ());
2675 static void GLAPIENTRY
2676 save_LoadMatrixf(const GLfloat
* m
)
2678 GET_CURRENT_CONTEXT(ctx
);
2680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2681 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2684 for (i
= 0; i
< 16; i
++) {
2688 if (ctx
->ExecuteFlag
) {
2689 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2694 static void GLAPIENTRY
2695 save_LoadMatrixd(const GLdouble
* m
)
2699 for (i
= 0; i
< 16; i
++) {
2700 f
[i
] = (GLfloat
) m
[i
];
2702 save_LoadMatrixf(f
);
2706 static void GLAPIENTRY
2707 save_LoadName(GLuint name
)
2709 GET_CURRENT_CONTEXT(ctx
);
2711 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2712 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2716 if (ctx
->ExecuteFlag
) {
2717 CALL_LoadName(ctx
->Exec
, (name
));
2722 static void GLAPIENTRY
2723 save_LogicOp(GLenum opcode
)
2725 GET_CURRENT_CONTEXT(ctx
);
2727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2728 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2732 if (ctx
->ExecuteFlag
) {
2733 CALL_LogicOp(ctx
->Exec
, (opcode
));
2738 static void GLAPIENTRY
2739 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2740 GLint order
, const GLdouble
* points
)
2742 GET_CURRENT_CONTEXT(ctx
);
2744 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2745 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2747 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2749 n
[2].f
= (GLfloat
) u1
;
2750 n
[3].f
= (GLfloat
) u2
;
2751 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2753 save_pointer(&n
[6], pnts
);
2755 if (ctx
->ExecuteFlag
) {
2756 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2760 static void GLAPIENTRY
2761 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2762 GLint order
, const GLfloat
* points
)
2764 GET_CURRENT_CONTEXT(ctx
);
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2767 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2769 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2773 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2775 save_pointer(&n
[6], pnts
);
2777 if (ctx
->ExecuteFlag
) {
2778 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2783 static void GLAPIENTRY
2784 save_Map2d(GLenum target
,
2785 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2786 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2787 const GLdouble
* points
)
2789 GET_CURRENT_CONTEXT(ctx
);
2791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2792 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2794 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2795 vstride
, vorder
, points
);
2797 n
[2].f
= (GLfloat
) u1
;
2798 n
[3].f
= (GLfloat
) u2
;
2799 n
[4].f
= (GLfloat
) v1
;
2800 n
[5].f
= (GLfloat
) v2
;
2801 /* XXX verify these strides are correct */
2802 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2803 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2806 save_pointer(&n
[10], pnts
);
2808 if (ctx
->ExecuteFlag
) {
2809 CALL_Map2d(ctx
->Exec
, (target
,
2810 u1
, u2
, ustride
, uorder
,
2811 v1
, v2
, vstride
, vorder
, points
));
2816 static void GLAPIENTRY
2817 save_Map2f(GLenum target
,
2818 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2819 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2820 const GLfloat
* points
)
2822 GET_CURRENT_CONTEXT(ctx
);
2824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2825 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2827 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2828 vstride
, vorder
, points
);
2834 /* XXX verify these strides are correct */
2835 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2836 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2839 save_pointer(&n
[10], pnts
);
2841 if (ctx
->ExecuteFlag
) {
2842 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2843 v1
, v2
, vstride
, vorder
, points
));
2848 static void GLAPIENTRY
2849 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2851 GET_CURRENT_CONTEXT(ctx
);
2853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2854 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2860 if (ctx
->ExecuteFlag
) {
2861 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2866 static void GLAPIENTRY
2867 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2869 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2873 static void GLAPIENTRY
2874 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2875 GLint vn
, GLfloat v1
, GLfloat v2
)
2877 GET_CURRENT_CONTEXT(ctx
);
2879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2880 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2889 if (ctx
->ExecuteFlag
) {
2890 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2896 static void GLAPIENTRY
2897 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2898 GLint vn
, GLdouble v1
, GLdouble v2
)
2900 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2901 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2905 static void GLAPIENTRY
2906 save_MatrixMode(GLenum mode
)
2908 GET_CURRENT_CONTEXT(ctx
);
2910 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2911 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2915 if (ctx
->ExecuteFlag
) {
2916 CALL_MatrixMode(ctx
->Exec
, (mode
));
2921 static void GLAPIENTRY
2922 save_MultMatrixf(const GLfloat
* m
)
2924 GET_CURRENT_CONTEXT(ctx
);
2926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2927 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2930 for (i
= 0; i
< 16; i
++) {
2934 if (ctx
->ExecuteFlag
) {
2935 CALL_MultMatrixf(ctx
->Exec
, (m
));
2940 static void GLAPIENTRY
2941 save_MultMatrixd(const GLdouble
* m
)
2945 for (i
= 0; i
< 16; i
++) {
2946 f
[i
] = (GLfloat
) m
[i
];
2948 save_MultMatrixf(f
);
2952 static void GLAPIENTRY
2953 save_NewList(GLuint name
, GLenum mode
)
2955 GET_CURRENT_CONTEXT(ctx
);
2956 /* It's an error to call this function while building a display list */
2957 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2964 static void GLAPIENTRY
2965 save_Ortho(GLdouble left
, GLdouble right
,
2966 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2968 GET_CURRENT_CONTEXT(ctx
);
2970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2971 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2973 n
[1].f
= (GLfloat
) left
;
2974 n
[2].f
= (GLfloat
) right
;
2975 n
[3].f
= (GLfloat
) bottom
;
2976 n
[4].f
= (GLfloat
) top
;
2977 n
[5].f
= (GLfloat
) nearval
;
2978 n
[6].f
= (GLfloat
) farval
;
2980 if (ctx
->ExecuteFlag
) {
2981 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2986 static void GLAPIENTRY
2987 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2989 GET_CURRENT_CONTEXT(ctx
);
2991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2992 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2996 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2998 if (ctx
->ExecuteFlag
) {
2999 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3004 static void GLAPIENTRY
3005 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3007 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3009 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3010 for (i
= 0; i
< mapsize
; i
++) {
3011 fvalues
[i
] = (GLfloat
) values
[i
];
3015 for (i
= 0; i
< mapsize
; i
++) {
3016 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3019 save_PixelMapfv(map
, mapsize
, fvalues
);
3023 static void GLAPIENTRY
3024 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3026 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3028 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3029 for (i
= 0; i
< mapsize
; i
++) {
3030 fvalues
[i
] = (GLfloat
) values
[i
];
3034 for (i
= 0; i
< mapsize
; i
++) {
3035 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3038 save_PixelMapfv(map
, mapsize
, fvalues
);
3042 static void GLAPIENTRY
3043 save_PixelTransferf(GLenum pname
, GLfloat param
)
3045 GET_CURRENT_CONTEXT(ctx
);
3047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3048 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3053 if (ctx
->ExecuteFlag
) {
3054 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3059 static void GLAPIENTRY
3060 save_PixelTransferi(GLenum pname
, GLint param
)
3062 save_PixelTransferf(pname
, (GLfloat
) param
);
3066 static void GLAPIENTRY
3067 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3069 GET_CURRENT_CONTEXT(ctx
);
3071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3072 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3077 if (ctx
->ExecuteFlag
) {
3078 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3083 static void GLAPIENTRY
3084 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3086 GET_CURRENT_CONTEXT(ctx
);
3088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3089 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3096 if (ctx
->ExecuteFlag
) {
3097 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3102 static void GLAPIENTRY
3103 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3107 parray
[1] = parray
[2] = 0.0F
;
3108 save_PointParameterfvEXT(pname
, parray
);
3111 static void GLAPIENTRY
3112 save_PointParameteriNV(GLenum pname
, GLint param
)
3115 parray
[0] = (GLfloat
) param
;
3116 parray
[1] = parray
[2] = 0.0F
;
3117 save_PointParameterfvEXT(pname
, parray
);
3120 static void GLAPIENTRY
3121 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3124 parray
[0] = (GLfloat
) param
[0];
3125 parray
[1] = parray
[2] = 0.0F
;
3126 save_PointParameterfvEXT(pname
, parray
);
3130 static void GLAPIENTRY
3131 save_PointSize(GLfloat size
)
3133 GET_CURRENT_CONTEXT(ctx
);
3135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3136 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3140 if (ctx
->ExecuteFlag
) {
3141 CALL_PointSize(ctx
->Exec
, (size
));
3146 static void GLAPIENTRY
3147 save_PolygonMode(GLenum face
, GLenum mode
)
3149 GET_CURRENT_CONTEXT(ctx
);
3151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3152 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3157 if (ctx
->ExecuteFlag
) {
3158 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3163 static void GLAPIENTRY
3164 save_PolygonStipple(const GLubyte
* pattern
)
3166 GET_CURRENT_CONTEXT(ctx
);
3169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3171 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3174 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3175 pattern
, &ctx
->Unpack
));
3177 if (ctx
->ExecuteFlag
) {
3178 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3183 static void GLAPIENTRY
3184 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3186 GET_CURRENT_CONTEXT(ctx
);
3188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3189 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3194 if (ctx
->ExecuteFlag
) {
3195 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3200 static void GLAPIENTRY
3201 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3203 GET_CURRENT_CONTEXT(ctx
);
3204 /* XXX mult by DepthMaxF here??? */
3205 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3208 static void GLAPIENTRY
3209 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3211 GET_CURRENT_CONTEXT(ctx
);
3213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3214 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3220 if (ctx
->ExecuteFlag
) {
3221 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3225 static void GLAPIENTRY
3226 save_PopAttrib(void)
3228 GET_CURRENT_CONTEXT(ctx
);
3229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3230 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3231 if (ctx
->ExecuteFlag
) {
3232 CALL_PopAttrib(ctx
->Exec
, ());
3237 static void GLAPIENTRY
3238 save_PopMatrix(void)
3240 GET_CURRENT_CONTEXT(ctx
);
3241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3242 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3243 if (ctx
->ExecuteFlag
) {
3244 CALL_PopMatrix(ctx
->Exec
, ());
3249 static void GLAPIENTRY
3252 GET_CURRENT_CONTEXT(ctx
);
3253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3254 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3255 if (ctx
->ExecuteFlag
) {
3256 CALL_PopName(ctx
->Exec
, ());
3261 static void GLAPIENTRY
3262 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3263 const GLclampf
* priorities
)
3265 GET_CURRENT_CONTEXT(ctx
);
3267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3269 for (i
= 0; i
< num
; i
++) {
3271 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3273 n
[1].ui
= textures
[i
];
3274 n
[2].f
= priorities
[i
];
3277 if (ctx
->ExecuteFlag
) {
3278 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3283 static void GLAPIENTRY
3284 save_PushAttrib(GLbitfield mask
)
3286 GET_CURRENT_CONTEXT(ctx
);
3288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3289 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3293 if (ctx
->ExecuteFlag
) {
3294 CALL_PushAttrib(ctx
->Exec
, (mask
));
3299 static void GLAPIENTRY
3300 save_PushMatrix(void)
3302 GET_CURRENT_CONTEXT(ctx
);
3303 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3304 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3305 if (ctx
->ExecuteFlag
) {
3306 CALL_PushMatrix(ctx
->Exec
, ());
3311 static void GLAPIENTRY
3312 save_PushName(GLuint name
)
3314 GET_CURRENT_CONTEXT(ctx
);
3316 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3317 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3321 if (ctx
->ExecuteFlag
) {
3322 CALL_PushName(ctx
->Exec
, (name
));
3327 static void GLAPIENTRY
3328 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3330 GET_CURRENT_CONTEXT(ctx
);
3332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3333 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3340 if (ctx
->ExecuteFlag
) {
3341 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3345 static void GLAPIENTRY
3346 save_RasterPos2d(GLdouble x
, GLdouble y
)
3348 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3351 static void GLAPIENTRY
3352 save_RasterPos2f(GLfloat x
, GLfloat y
)
3354 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3357 static void GLAPIENTRY
3358 save_RasterPos2i(GLint x
, GLint y
)
3360 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3363 static void GLAPIENTRY
3364 save_RasterPos2s(GLshort x
, GLshort y
)
3366 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3369 static void GLAPIENTRY
3370 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3372 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3375 static void GLAPIENTRY
3376 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3378 save_RasterPos4f(x
, y
, z
, 1.0F
);
3381 static void GLAPIENTRY
3382 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3384 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3387 static void GLAPIENTRY
3388 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3390 save_RasterPos4f(x
, y
, z
, 1.0F
);
3393 static void GLAPIENTRY
3394 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3396 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3399 static void GLAPIENTRY
3400 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3402 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3405 static void GLAPIENTRY
3406 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3408 save_RasterPos4f(x
, y
, z
, w
);
3411 static void GLAPIENTRY
3412 save_RasterPos2dv(const GLdouble
* v
)
3414 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3417 static void GLAPIENTRY
3418 save_RasterPos2fv(const GLfloat
* v
)
3420 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3423 static void GLAPIENTRY
3424 save_RasterPos2iv(const GLint
* v
)
3426 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3429 static void GLAPIENTRY
3430 save_RasterPos2sv(const GLshort
* v
)
3432 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3435 static void GLAPIENTRY
3436 save_RasterPos3dv(const GLdouble
* v
)
3438 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3441 static void GLAPIENTRY
3442 save_RasterPos3fv(const GLfloat
* v
)
3444 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3447 static void GLAPIENTRY
3448 save_RasterPos3iv(const GLint
* v
)
3450 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3453 static void GLAPIENTRY
3454 save_RasterPos3sv(const GLshort
* v
)
3456 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3459 static void GLAPIENTRY
3460 save_RasterPos4dv(const GLdouble
* v
)
3462 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3463 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3466 static void GLAPIENTRY
3467 save_RasterPos4fv(const GLfloat
* v
)
3469 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3472 static void GLAPIENTRY
3473 save_RasterPos4iv(const GLint
* v
)
3475 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3476 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3479 static void GLAPIENTRY
3480 save_RasterPos4sv(const GLshort
* v
)
3482 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3486 static void GLAPIENTRY
3487 save_PassThrough(GLfloat token
)
3489 GET_CURRENT_CONTEXT(ctx
);
3491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3492 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3496 if (ctx
->ExecuteFlag
) {
3497 CALL_PassThrough(ctx
->Exec
, (token
));
3502 static void GLAPIENTRY
3503 save_ReadBuffer(GLenum mode
)
3505 GET_CURRENT_CONTEXT(ctx
);
3507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3508 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3512 if (ctx
->ExecuteFlag
) {
3513 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3518 static void GLAPIENTRY
3519 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3521 GET_CURRENT_CONTEXT(ctx
);
3523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3524 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3531 if (ctx
->ExecuteFlag
) {
3532 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3537 static void GLAPIENTRY
3538 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3540 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3544 static void GLAPIENTRY
3545 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3547 GET_CURRENT_CONTEXT(ctx
);
3549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3550 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3556 if (ctx
->ExecuteFlag
) {
3557 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3562 static void GLAPIENTRY
3563 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3565 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3569 static void GLAPIENTRY
3570 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3572 GET_CURRENT_CONTEXT(ctx
);
3574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3575 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3582 if (ctx
->ExecuteFlag
) {
3583 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3588 static void GLAPIENTRY
3589 save_ShadeModel(GLenum mode
)
3591 GET_CURRENT_CONTEXT(ctx
);
3593 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3595 if (ctx
->ExecuteFlag
) {
3596 CALL_ShadeModel(ctx
->Exec
, (mode
));
3599 /* Don't compile this call if it's a no-op.
3600 * By avoiding this state change we have a better chance of
3601 * coalescing subsequent drawing commands into one batch.
3603 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3606 SAVE_FLUSH_VERTICES(ctx
);
3608 ctx
->ListState
.Current
.ShadeModel
= mode
;
3610 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3617 static void GLAPIENTRY
3618 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3620 GET_CURRENT_CONTEXT(ctx
);
3622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3623 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3629 if (ctx
->ExecuteFlag
) {
3630 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3635 static void GLAPIENTRY
3636 save_StencilMask(GLuint mask
)
3638 GET_CURRENT_CONTEXT(ctx
);
3640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3641 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3645 if (ctx
->ExecuteFlag
) {
3646 CALL_StencilMask(ctx
->Exec
, (mask
));
3651 static void GLAPIENTRY
3652 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3654 GET_CURRENT_CONTEXT(ctx
);
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3657 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3663 if (ctx
->ExecuteFlag
) {
3664 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3669 static void GLAPIENTRY
3670 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3672 GET_CURRENT_CONTEXT(ctx
);
3674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3675 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3682 if (ctx
->ExecuteFlag
) {
3683 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3688 static void GLAPIENTRY
3689 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3692 GET_CURRENT_CONTEXT(ctx
);
3694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3696 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3704 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3711 if (ctx
->ExecuteFlag
) {
3712 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3713 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3718 static void GLAPIENTRY
3719 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3721 GET_CURRENT_CONTEXT(ctx
);
3723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3724 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3729 if (ctx
->ExecuteFlag
) {
3730 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3735 static void GLAPIENTRY
3736 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3738 GET_CURRENT_CONTEXT(ctx
);
3740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3741 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3748 if (ctx
->ExecuteFlag
) {
3749 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3754 static void GLAPIENTRY
3755 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3757 GET_CURRENT_CONTEXT(ctx
);
3759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3760 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3764 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3772 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3775 if (ctx
->ExecuteFlag
) {
3776 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3781 static void GLAPIENTRY
3782 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3785 parray
[0] = (GLfloat
) param
;
3786 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3787 save_TexEnvfv(target
, pname
, parray
);
3791 static void GLAPIENTRY
3792 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3795 p
[0] = (GLfloat
) param
;
3796 p
[1] = p
[2] = p
[3] = 0.0F
;
3797 save_TexEnvfv(target
, pname
, p
);
3801 static void GLAPIENTRY
3802 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3805 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3806 p
[0] = INT_TO_FLOAT(param
[0]);
3807 p
[1] = INT_TO_FLOAT(param
[1]);
3808 p
[2] = INT_TO_FLOAT(param
[2]);
3809 p
[3] = INT_TO_FLOAT(param
[3]);
3812 p
[0] = (GLfloat
) param
[0];
3813 p
[1] = p
[2] = p
[3] = 0.0F
;
3815 save_TexEnvfv(target
, pname
, p
);
3819 static void GLAPIENTRY
3820 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3822 GET_CURRENT_CONTEXT(ctx
);
3824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3825 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3834 if (ctx
->ExecuteFlag
) {
3835 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3840 static void GLAPIENTRY
3841 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3844 p
[0] = (GLfloat
) params
[0];
3845 p
[1] = (GLfloat
) params
[1];
3846 p
[2] = (GLfloat
) params
[2];
3847 p
[3] = (GLfloat
) params
[3];
3848 save_TexGenfv(coord
, pname
, p
);
3852 static void GLAPIENTRY
3853 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3856 parray
[0] = (GLfloat
) param
;
3857 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3858 save_TexGenfv(coord
, pname
, parray
);
3862 static void GLAPIENTRY
3863 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3866 p
[0] = (GLfloat
) params
[0];
3867 p
[1] = (GLfloat
) params
[1];
3868 p
[2] = (GLfloat
) params
[2];
3869 p
[3] = (GLfloat
) params
[3];
3870 save_TexGenfv(coord
, pname
, p
);
3874 static void GLAPIENTRY
3875 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3879 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3880 save_TexGenfv(coord
, pname
, parray
);
3884 static void GLAPIENTRY
3885 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3889 parray
[1] = parray
[2] = parray
[3] = 0;
3890 save_TexGeniv(coord
, pname
, parray
);
3894 static void GLAPIENTRY
3895 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3897 GET_CURRENT_CONTEXT(ctx
);
3899 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3900 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3909 if (ctx
->ExecuteFlag
) {
3910 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3915 static void GLAPIENTRY
3916 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3920 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3921 save_TexParameterfv(target
, pname
, parray
);
3925 static void GLAPIENTRY
3926 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3929 fparam
[0] = (GLfloat
) param
;
3930 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3931 save_TexParameterfv(target
, pname
, fparam
);
3935 static void GLAPIENTRY
3936 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3939 fparam
[0] = (GLfloat
) params
[0];
3940 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3941 save_TexParameterfv(target
, pname
, fparam
);
3945 static void GLAPIENTRY
3946 save_TexImage1D(GLenum target
,
3947 GLint level
, GLint components
,
3948 GLsizei width
, GLint border
,
3949 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3951 GET_CURRENT_CONTEXT(ctx
);
3952 if (target
== GL_PROXY_TEXTURE_1D
) {
3953 /* don't compile, execute immediately */
3954 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3955 border
, format
, type
, pixels
));
3959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3960 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3964 n
[3].i
= components
;
3965 n
[4].i
= (GLint
) width
;
3970 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3971 pixels
, &ctx
->Unpack
));
3973 if (ctx
->ExecuteFlag
) {
3974 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3975 border
, format
, type
, pixels
));
3981 static void GLAPIENTRY
3982 save_TexImage2D(GLenum target
,
3983 GLint level
, GLint components
,
3984 GLsizei width
, GLsizei height
, GLint border
,
3985 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3987 GET_CURRENT_CONTEXT(ctx
);
3988 if (target
== GL_PROXY_TEXTURE_2D
) {
3989 /* don't compile, execute immediately */
3990 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3991 height
, border
, format
, type
, pixels
));
3995 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3996 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
4000 n
[3].i
= components
;
4001 n
[4].i
= (GLint
) width
;
4002 n
[5].i
= (GLint
) height
;
4007 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4008 pixels
, &ctx
->Unpack
));
4010 if (ctx
->ExecuteFlag
) {
4011 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4012 height
, border
, format
, type
, pixels
));
4018 static void GLAPIENTRY
4019 save_TexImage3D(GLenum target
,
4020 GLint level
, GLint internalFormat
,
4021 GLsizei width
, GLsizei height
, GLsizei depth
,
4023 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4025 GET_CURRENT_CONTEXT(ctx
);
4026 if (target
== GL_PROXY_TEXTURE_3D
) {
4027 /* don't compile, execute immediately */
4028 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4029 height
, depth
, border
, format
, type
,
4034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4035 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4039 n
[3].i
= (GLint
) internalFormat
;
4040 n
[4].i
= (GLint
) width
;
4041 n
[5].i
= (GLint
) height
;
4042 n
[6].i
= (GLint
) depth
;
4046 save_pointer(&n
[10],
4047 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4048 pixels
, &ctx
->Unpack
));
4050 if (ctx
->ExecuteFlag
) {
4051 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4052 height
, depth
, border
, format
, type
,
4059 static void GLAPIENTRY
4060 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4061 GLsizei width
, GLenum format
, GLenum type
,
4062 const GLvoid
* pixels
)
4064 GET_CURRENT_CONTEXT(ctx
);
4067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4069 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4074 n
[4].i
= (GLint
) width
;
4078 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4079 pixels
, &ctx
->Unpack
));
4081 if (ctx
->ExecuteFlag
) {
4082 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4083 format
, type
, pixels
));
4088 static void GLAPIENTRY
4089 save_TexSubImage2D(GLenum target
, GLint level
,
4090 GLint xoffset
, GLint yoffset
,
4091 GLsizei width
, GLsizei height
,
4092 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4094 GET_CURRENT_CONTEXT(ctx
);
4097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4099 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4105 n
[5].i
= (GLint
) width
;
4106 n
[6].i
= (GLint
) height
;
4110 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4111 pixels
, &ctx
->Unpack
));
4113 if (ctx
->ExecuteFlag
) {
4114 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4115 width
, height
, format
, type
, pixels
));
4120 static void GLAPIENTRY
4121 save_TexSubImage3D(GLenum target
, GLint level
,
4122 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4123 GLsizei width
, GLsizei height
, GLsizei depth
,
4124 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4126 GET_CURRENT_CONTEXT(ctx
);
4129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4131 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4138 n
[6].i
= (GLint
) width
;
4139 n
[7].i
= (GLint
) height
;
4140 n
[8].i
= (GLint
) depth
;
4143 save_pointer(&n
[11],
4144 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4145 pixels
, &ctx
->Unpack
));
4147 if (ctx
->ExecuteFlag
) {
4148 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4149 xoffset
, yoffset
, zoffset
,
4150 width
, height
, depth
, format
, type
,
4156 static void GLAPIENTRY
4157 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4159 GET_CURRENT_CONTEXT(ctx
);
4161 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4162 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4168 if (ctx
->ExecuteFlag
) {
4169 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4174 static void GLAPIENTRY
4175 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4177 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4182 static void GLAPIENTRY
4183 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4185 GET_CURRENT_CONTEXT(ctx
);
4187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4188 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4192 n
[3].i
= (GLint
) width
;
4193 n
[4].i
= (GLint
) height
;
4195 if (ctx
->ExecuteFlag
) {
4196 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4201 static void GLAPIENTRY
4202 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4204 GET_CURRENT_CONTEXT(ctx
);
4206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4207 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4214 if (ctx
->ExecuteFlag
) {
4215 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4219 static void GLAPIENTRY
4220 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4222 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4225 static void GLAPIENTRY
4226 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4228 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4231 static void GLAPIENTRY
4232 save_WindowPos2iMESA(GLint x
, GLint y
)
4234 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4237 static void GLAPIENTRY
4238 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4240 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4243 static void GLAPIENTRY
4244 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4246 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4249 static void GLAPIENTRY
4250 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4252 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4255 static void GLAPIENTRY
4256 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4258 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4261 static void GLAPIENTRY
4262 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4264 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4267 static void GLAPIENTRY
4268 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4270 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4273 static void GLAPIENTRY
4274 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4276 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4279 static void GLAPIENTRY
4280 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4282 save_WindowPos4fMESA(x
, y
, z
, w
);
4285 static void GLAPIENTRY
4286 save_WindowPos2dvMESA(const GLdouble
* v
)
4288 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4291 static void GLAPIENTRY
4292 save_WindowPos2fvMESA(const GLfloat
* v
)
4294 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4297 static void GLAPIENTRY
4298 save_WindowPos2ivMESA(const GLint
* v
)
4300 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4303 static void GLAPIENTRY
4304 save_WindowPos2svMESA(const GLshort
* v
)
4306 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4309 static void GLAPIENTRY
4310 save_WindowPos3dvMESA(const GLdouble
* v
)
4312 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4315 static void GLAPIENTRY
4316 save_WindowPos3fvMESA(const GLfloat
* v
)
4318 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4321 static void GLAPIENTRY
4322 save_WindowPos3ivMESA(const GLint
* v
)
4324 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4327 static void GLAPIENTRY
4328 save_WindowPos3svMESA(const GLshort
* v
)
4330 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4333 static void GLAPIENTRY
4334 save_WindowPos4dvMESA(const GLdouble
* v
)
4336 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4337 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4340 static void GLAPIENTRY
4341 save_WindowPos4fvMESA(const GLfloat
* v
)
4343 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4346 static void GLAPIENTRY
4347 save_WindowPos4ivMESA(const GLint
* v
)
4349 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4350 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4353 static void GLAPIENTRY
4354 save_WindowPos4svMESA(const GLshort
* v
)
4356 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4361 /* GL_ARB_multitexture */
4362 static void GLAPIENTRY
4363 save_ActiveTextureARB(GLenum target
)
4365 GET_CURRENT_CONTEXT(ctx
);
4367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4368 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4372 if (ctx
->ExecuteFlag
) {
4373 CALL_ActiveTexture(ctx
->Exec
, (target
));
4378 /* GL_ARB_transpose_matrix */
4380 static void GLAPIENTRY
4381 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4384 _math_transposefd(tm
, m
);
4385 save_LoadMatrixf(tm
);
4389 static void GLAPIENTRY
4390 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4393 _math_transposef(tm
, m
);
4394 save_LoadMatrixf(tm
);
4398 static void GLAPIENTRY
4399 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4402 _math_transposefd(tm
, m
);
4403 save_MultMatrixf(tm
);
4407 static void GLAPIENTRY
4408 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4411 _math_transposef(tm
, m
);
4412 save_MultMatrixf(tm
);
4415 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4417 GET_CURRENT_CONTEXT(ctx
);
4423 image
= malloc(size
);
4425 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4428 memcpy(image
, data
, size
);
4434 /* GL_ARB_texture_compression */
4435 static void GLAPIENTRY
4436 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4437 GLenum internalFormat
, GLsizei width
,
4438 GLint border
, GLsizei imageSize
,
4439 const GLvoid
* data
)
4441 GET_CURRENT_CONTEXT(ctx
);
4442 if (target
== GL_PROXY_TEXTURE_1D
) {
4443 /* don't compile, execute immediately */
4444 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4445 width
, border
, imageSize
,
4450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4452 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4453 6 + POINTER_DWORDS
);
4457 n
[3].e
= internalFormat
;
4458 n
[4].i
= (GLint
) width
;
4462 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4464 if (ctx
->ExecuteFlag
) {
4465 CALL_CompressedTexImage1D(ctx
->Exec
,
4466 (target
, level
, internalFormat
, width
,
4467 border
, imageSize
, data
));
4473 static void GLAPIENTRY
4474 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4475 GLenum internalFormat
, GLsizei width
,
4476 GLsizei height
, GLint border
, GLsizei imageSize
,
4477 const GLvoid
* data
)
4479 GET_CURRENT_CONTEXT(ctx
);
4480 if (target
== GL_PROXY_TEXTURE_2D
) {
4481 /* don't compile, execute immediately */
4482 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4483 width
, height
, border
,
4488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4490 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4491 7 + POINTER_DWORDS
);
4495 n
[3].e
= internalFormat
;
4496 n
[4].i
= (GLint
) width
;
4497 n
[5].i
= (GLint
) height
;
4501 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4503 if (ctx
->ExecuteFlag
) {
4504 CALL_CompressedTexImage2D(ctx
->Exec
,
4505 (target
, level
, internalFormat
, width
,
4506 height
, border
, imageSize
, data
));
4512 static void GLAPIENTRY
4513 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4514 GLenum internalFormat
, GLsizei width
,
4515 GLsizei height
, GLsizei depth
, GLint border
,
4516 GLsizei imageSize
, const GLvoid
* data
)
4518 GET_CURRENT_CONTEXT(ctx
);
4519 if (target
== GL_PROXY_TEXTURE_3D
) {
4520 /* don't compile, execute immediately */
4521 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4522 width
, height
, depth
, border
,
4527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4529 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4530 8 + POINTER_DWORDS
);
4534 n
[3].e
= internalFormat
;
4535 n
[4].i
= (GLint
) width
;
4536 n
[5].i
= (GLint
) height
;
4537 n
[6].i
= (GLint
) depth
;
4541 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4543 if (ctx
->ExecuteFlag
) {
4544 CALL_CompressedTexImage3D(ctx
->Exec
,
4545 (target
, level
, internalFormat
, width
,
4546 height
, depth
, border
, imageSize
,
4553 static void GLAPIENTRY
4554 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4555 GLsizei width
, GLenum format
,
4556 GLsizei imageSize
, const GLvoid
* data
)
4559 GET_CURRENT_CONTEXT(ctx
);
4560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4562 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4563 6 + POINTER_DWORDS
);
4568 n
[4].i
= (GLint
) width
;
4572 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4574 if (ctx
->ExecuteFlag
) {
4575 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4576 width
, format
, imageSize
,
4582 static void GLAPIENTRY
4583 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4584 GLint yoffset
, GLsizei width
, GLsizei height
,
4585 GLenum format
, GLsizei imageSize
,
4586 const GLvoid
* data
)
4589 GET_CURRENT_CONTEXT(ctx
);
4590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4592 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4593 8 + POINTER_DWORDS
);
4599 n
[5].i
= (GLint
) width
;
4600 n
[6].i
= (GLint
) height
;
4604 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4606 if (ctx
->ExecuteFlag
) {
4607 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4608 (target
, level
, xoffset
, yoffset
, width
,
4609 height
, format
, imageSize
, data
));
4614 static void GLAPIENTRY
4615 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4616 GLint yoffset
, GLint zoffset
, GLsizei width
,
4617 GLsizei height
, GLsizei depth
, GLenum format
,
4618 GLsizei imageSize
, const GLvoid
* data
)
4621 GET_CURRENT_CONTEXT(ctx
);
4622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4624 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4625 10 + POINTER_DWORDS
);
4632 n
[6].i
= (GLint
) width
;
4633 n
[7].i
= (GLint
) height
;
4634 n
[8].i
= (GLint
) depth
;
4636 n
[10].i
= imageSize
;
4637 save_pointer(&n
[11],
4638 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4640 if (ctx
->ExecuteFlag
) {
4641 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4642 (target
, level
, xoffset
, yoffset
,
4643 zoffset
, width
, height
, depth
, format
,
4649 /* GL_ARB_multisample */
4650 static void GLAPIENTRY
4651 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4653 GET_CURRENT_CONTEXT(ctx
);
4655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4656 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4661 if (ctx
->ExecuteFlag
) {
4662 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4668 * GL_NV_fragment_program
4670 static void GLAPIENTRY
4671 save_BindProgramNV(GLenum target
, GLuint id
)
4673 GET_CURRENT_CONTEXT(ctx
);
4675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4676 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4681 if (ctx
->ExecuteFlag
) {
4682 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4686 static void GLAPIENTRY
4687 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4688 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4690 GET_CURRENT_CONTEXT(ctx
);
4692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4693 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4702 if (ctx
->ExecuteFlag
) {
4703 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4708 static void GLAPIENTRY
4709 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4710 const GLfloat
*params
)
4712 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4713 params
[2], params
[3]);
4717 static void GLAPIENTRY
4718 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4719 const GLfloat
* params
)
4721 GET_CURRENT_CONTEXT(ctx
);
4723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4727 const GLfloat
* p
= params
;
4729 for (i
= 0 ; i
< count
; i
++) {
4730 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4743 if (ctx
->ExecuteFlag
) {
4744 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4749 static void GLAPIENTRY
4750 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4751 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4753 save_ProgramEnvParameter4fARB(target
, index
,
4755 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4759 static void GLAPIENTRY
4760 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4761 const GLdouble
*params
)
4763 save_ProgramEnvParameter4fARB(target
, index
,
4764 (GLfloat
) params
[0],
4765 (GLfloat
) params
[1],
4766 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4770 static void GLAPIENTRY
4771 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4772 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4774 GET_CURRENT_CONTEXT(ctx
);
4776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4777 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4786 if (ctx
->ExecuteFlag
) {
4787 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4792 static void GLAPIENTRY
4793 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4794 const GLfloat
*params
)
4796 GET_CURRENT_CONTEXT(ctx
);
4798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4799 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4808 if (ctx
->ExecuteFlag
) {
4809 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4814 static void GLAPIENTRY
4815 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4816 const GLfloat
*params
)
4818 GET_CURRENT_CONTEXT(ctx
);
4820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4824 const GLfloat
* p
= params
;
4826 for (i
= 0 ; i
< count
; i
++) {
4827 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4840 if (ctx
->ExecuteFlag
) {
4841 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4846 static void GLAPIENTRY
4847 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4848 GLdouble x
, GLdouble y
,
4849 GLdouble z
, GLdouble w
)
4851 GET_CURRENT_CONTEXT(ctx
);
4853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4854 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4858 n
[3].f
= (GLfloat
) x
;
4859 n
[4].f
= (GLfloat
) y
;
4860 n
[5].f
= (GLfloat
) z
;
4861 n
[6].f
= (GLfloat
) w
;
4863 if (ctx
->ExecuteFlag
) {
4864 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4869 static void GLAPIENTRY
4870 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4871 const GLdouble
*params
)
4873 GET_CURRENT_CONTEXT(ctx
);
4875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4876 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4880 n
[3].f
= (GLfloat
) params
[0];
4881 n
[4].f
= (GLfloat
) params
[1];
4882 n
[5].f
= (GLfloat
) params
[2];
4883 n
[6].f
= (GLfloat
) params
[3];
4885 if (ctx
->ExecuteFlag
) {
4886 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4891 /* GL_EXT_stencil_two_side */
4892 static void GLAPIENTRY
4893 save_ActiveStencilFaceEXT(GLenum face
)
4895 GET_CURRENT_CONTEXT(ctx
);
4897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4898 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4902 if (ctx
->ExecuteFlag
) {
4903 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4908 /* GL_EXT_depth_bounds_test */
4909 static void GLAPIENTRY
4910 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4912 GET_CURRENT_CONTEXT(ctx
);
4914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4915 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4917 n
[1].f
= (GLfloat
) zmin
;
4918 n
[2].f
= (GLfloat
) zmax
;
4920 if (ctx
->ExecuteFlag
) {
4921 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4927 static void GLAPIENTRY
4928 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4929 const GLvoid
* string
)
4931 GET_CURRENT_CONTEXT(ctx
);
4934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4936 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4938 GLubyte
*programCopy
= malloc(len
);
4940 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4943 memcpy(programCopy
, string
, len
);
4947 save_pointer(&n
[4], programCopy
);
4949 if (ctx
->ExecuteFlag
) {
4950 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4955 static void GLAPIENTRY
4956 save_BeginQueryARB(GLenum target
, GLuint id
)
4958 GET_CURRENT_CONTEXT(ctx
);
4960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4961 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4966 if (ctx
->ExecuteFlag
) {
4967 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4971 static void GLAPIENTRY
4972 save_EndQueryARB(GLenum target
)
4974 GET_CURRENT_CONTEXT(ctx
);
4976 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4977 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4981 if (ctx
->ExecuteFlag
) {
4982 CALL_EndQuery(ctx
->Exec
, (target
));
4986 static void GLAPIENTRY
4987 save_QueryCounter(GLuint id
, GLenum target
)
4989 GET_CURRENT_CONTEXT(ctx
);
4991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4992 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4997 if (ctx
->ExecuteFlag
) {
4998 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5002 static void GLAPIENTRY
5003 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5005 GET_CURRENT_CONTEXT(ctx
);
5007 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5008 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5014 if (ctx
->ExecuteFlag
) {
5015 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5019 static void GLAPIENTRY
5020 save_EndQueryIndexed(GLenum target
, GLuint index
)
5022 GET_CURRENT_CONTEXT(ctx
);
5024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5025 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5030 if (ctx
->ExecuteFlag
) {
5031 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5036 static void GLAPIENTRY
5037 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5039 GET_CURRENT_CONTEXT(ctx
);
5041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5042 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5046 if (count
> MAX_DRAW_BUFFERS
)
5047 count
= MAX_DRAW_BUFFERS
;
5048 for (i
= 0; i
< count
; i
++) {
5049 n
[2 + i
].e
= buffers
[i
];
5052 if (ctx
->ExecuteFlag
) {
5053 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5057 static void GLAPIENTRY
5058 save_BindFragmentShaderATI(GLuint id
)
5060 GET_CURRENT_CONTEXT(ctx
);
5063 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5067 if (ctx
->ExecuteFlag
) {
5068 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5072 static void GLAPIENTRY
5073 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5075 GET_CURRENT_CONTEXT(ctx
);
5078 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5086 if (ctx
->ExecuteFlag
) {
5087 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5091 static void GLAPIENTRY
5092 save_Attr1fNV(GLenum attr
, GLfloat x
)
5094 GET_CURRENT_CONTEXT(ctx
);
5096 SAVE_FLUSH_VERTICES(ctx
);
5097 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5103 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5104 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5105 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5107 if (ctx
->ExecuteFlag
) {
5108 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5112 static void GLAPIENTRY
5113 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5115 GET_CURRENT_CONTEXT(ctx
);
5117 SAVE_FLUSH_VERTICES(ctx
);
5118 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5125 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5126 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5127 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5129 if (ctx
->ExecuteFlag
) {
5130 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5134 static void GLAPIENTRY
5135 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5137 GET_CURRENT_CONTEXT(ctx
);
5139 SAVE_FLUSH_VERTICES(ctx
);
5140 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5148 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5149 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5150 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5152 if (ctx
->ExecuteFlag
) {
5153 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5157 static void GLAPIENTRY
5158 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5160 GET_CURRENT_CONTEXT(ctx
);
5162 SAVE_FLUSH_VERTICES(ctx
);
5163 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5172 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5173 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5174 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5176 if (ctx
->ExecuteFlag
) {
5177 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5182 static void GLAPIENTRY
5183 save_Attr1fARB(GLenum attr
, GLfloat x
)
5185 GET_CURRENT_CONTEXT(ctx
);
5187 SAVE_FLUSH_VERTICES(ctx
);
5188 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5194 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5195 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5196 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5198 if (ctx
->ExecuteFlag
) {
5199 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5203 static void GLAPIENTRY
5204 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5206 GET_CURRENT_CONTEXT(ctx
);
5208 SAVE_FLUSH_VERTICES(ctx
);
5209 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5216 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5217 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5218 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5220 if (ctx
->ExecuteFlag
) {
5221 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5225 static void GLAPIENTRY
5226 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5228 GET_CURRENT_CONTEXT(ctx
);
5230 SAVE_FLUSH_VERTICES(ctx
);
5231 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5239 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5240 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5241 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5243 if (ctx
->ExecuteFlag
) {
5244 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5248 static void GLAPIENTRY
5249 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5251 GET_CURRENT_CONTEXT(ctx
);
5253 SAVE_FLUSH_VERTICES(ctx
);
5254 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5263 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5264 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5265 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5267 if (ctx
->ExecuteFlag
) {
5268 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5273 static void GLAPIENTRY
5274 save_EvalCoord1f(GLfloat x
)
5276 GET_CURRENT_CONTEXT(ctx
);
5278 SAVE_FLUSH_VERTICES(ctx
);
5279 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5283 if (ctx
->ExecuteFlag
) {
5284 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5288 static void GLAPIENTRY
5289 save_EvalCoord1fv(const GLfloat
* v
)
5291 save_EvalCoord1f(v
[0]);
5294 static void GLAPIENTRY
5295 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5297 GET_CURRENT_CONTEXT(ctx
);
5299 SAVE_FLUSH_VERTICES(ctx
);
5300 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5305 if (ctx
->ExecuteFlag
) {
5306 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5310 static void GLAPIENTRY
5311 save_EvalCoord2fv(const GLfloat
* v
)
5313 save_EvalCoord2f(v
[0], v
[1]);
5317 static void GLAPIENTRY
5318 save_EvalPoint1(GLint x
)
5320 GET_CURRENT_CONTEXT(ctx
);
5322 SAVE_FLUSH_VERTICES(ctx
);
5323 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5327 if (ctx
->ExecuteFlag
) {
5328 CALL_EvalPoint1(ctx
->Exec
, (x
));
5332 static void GLAPIENTRY
5333 save_EvalPoint2(GLint x
, GLint y
)
5335 GET_CURRENT_CONTEXT(ctx
);
5337 SAVE_FLUSH_VERTICES(ctx
);
5338 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5343 if (ctx
->ExecuteFlag
) {
5344 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5348 static void GLAPIENTRY
5349 save_Indexf(GLfloat x
)
5351 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5354 static void GLAPIENTRY
5355 save_Indexfv(const GLfloat
* v
)
5357 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5360 static void GLAPIENTRY
5361 save_EdgeFlag(GLboolean x
)
5363 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5368 * Compare 'count' elements of vectors 'a' and 'b'.
5369 * \return GL_TRUE if equal, GL_FALSE if different.
5371 static inline GLboolean
5372 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5374 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5379 * This glMaterial function is used for glMaterial calls that are outside
5380 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5382 static void GLAPIENTRY
5383 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5385 GET_CURRENT_CONTEXT(ctx
);
5393 case GL_FRONT_AND_BACK
:
5396 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5405 case GL_AMBIENT_AND_DIFFUSE
:
5411 case GL_COLOR_INDEXES
:
5415 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5419 if (ctx
->ExecuteFlag
) {
5420 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5423 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5425 /* Try to eliminate redundant statechanges. Because it is legal to
5426 * call glMaterial even inside begin/end calls, don't need to worry
5427 * about ctx->Driver.CurrentSavePrimitive here.
5429 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5430 if (bitmask
& (1 << i
)) {
5431 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5432 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5433 /* no change in material value */
5434 bitmask
&= ~(1 << i
);
5437 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5438 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5443 /* If this call has no effect, return early */
5447 SAVE_FLUSH_VERTICES(ctx
);
5449 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5453 for (i
= 0; i
< args
; i
++)
5454 n
[3 + i
].f
= param
[i
];
5458 static void GLAPIENTRY
5459 save_Begin(GLenum mode
)
5461 GET_CURRENT_CONTEXT(ctx
);
5463 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5464 /* compile this error into the display list */
5465 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5467 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5468 /* compile this error into the display list */
5469 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5474 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5476 /* Give the driver an opportunity to hook in an optimized
5477 * display list compiler.
5479 if (vbo_save_NotifyBegin(ctx
, mode
))
5482 SAVE_FLUSH_VERTICES(ctx
);
5483 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5488 if (ctx
->ExecuteFlag
) {
5489 CALL_Begin(ctx
->Exec
, (mode
));
5494 static void GLAPIENTRY
5497 GET_CURRENT_CONTEXT(ctx
);
5498 SAVE_FLUSH_VERTICES(ctx
);
5499 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5500 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5501 if (ctx
->ExecuteFlag
) {
5502 CALL_End(ctx
->Exec
, ());
5506 static void GLAPIENTRY
5507 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5509 GET_CURRENT_CONTEXT(ctx
);
5511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5512 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5519 if (ctx
->ExecuteFlag
) {
5520 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5525 static void GLAPIENTRY
5526 save_Vertex2f(GLfloat x
, GLfloat y
)
5528 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5531 static void GLAPIENTRY
5532 save_Vertex2fv(const GLfloat
* v
)
5534 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5537 static void GLAPIENTRY
5538 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5540 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5543 static void GLAPIENTRY
5544 save_Vertex3fv(const GLfloat
* v
)
5546 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5549 static void GLAPIENTRY
5550 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5552 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5555 static void GLAPIENTRY
5556 save_Vertex4fv(const GLfloat
* v
)
5558 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5561 static void GLAPIENTRY
5562 save_TexCoord1f(GLfloat x
)
5564 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5567 static void GLAPIENTRY
5568 save_TexCoord1fv(const GLfloat
* v
)
5570 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5573 static void GLAPIENTRY
5574 save_TexCoord2f(GLfloat x
, GLfloat y
)
5576 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5579 static void GLAPIENTRY
5580 save_TexCoord2fv(const GLfloat
* v
)
5582 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5585 static void GLAPIENTRY
5586 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5588 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5591 static void GLAPIENTRY
5592 save_TexCoord3fv(const GLfloat
* v
)
5594 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5597 static void GLAPIENTRY
5598 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5600 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5603 static void GLAPIENTRY
5604 save_TexCoord4fv(const GLfloat
* v
)
5606 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5609 static void GLAPIENTRY
5610 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5612 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5615 static void GLAPIENTRY
5616 save_Normal3fv(const GLfloat
* v
)
5618 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5621 static void GLAPIENTRY
5622 save_FogCoordfEXT(GLfloat x
)
5624 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5627 static void GLAPIENTRY
5628 save_FogCoordfvEXT(const GLfloat
* v
)
5630 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5633 static void GLAPIENTRY
5634 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5636 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5639 static void GLAPIENTRY
5640 save_Color3fv(const GLfloat
* v
)
5642 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5645 static void GLAPIENTRY
5646 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5648 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5651 static void GLAPIENTRY
5652 save_Color4fv(const GLfloat
* v
)
5654 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5657 static void GLAPIENTRY
5658 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5660 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5663 static void GLAPIENTRY
5664 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5666 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5670 /* Just call the respective ATTR for texcoord
5672 static void GLAPIENTRY
5673 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5675 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5676 save_Attr1fNV(attr
, x
);
5679 static void GLAPIENTRY
5680 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5682 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5683 save_Attr1fNV(attr
, v
[0]);
5686 static void GLAPIENTRY
5687 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5689 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5690 save_Attr2fNV(attr
, x
, y
);
5693 static void GLAPIENTRY
5694 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5696 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5697 save_Attr2fNV(attr
, v
[0], v
[1]);
5700 static void GLAPIENTRY
5701 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5703 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5704 save_Attr3fNV(attr
, x
, y
, z
);
5707 static void GLAPIENTRY
5708 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5710 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5711 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5714 static void GLAPIENTRY
5715 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5716 GLfloat z
, GLfloat w
)
5718 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5719 save_Attr4fNV(attr
, x
, y
, z
, w
);
5722 static void GLAPIENTRY
5723 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5725 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5726 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5731 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5737 GET_CURRENT_CONTEXT(ctx
);
5738 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5743 static void GLAPIENTRY
5744 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5746 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5747 save_Attr1fARB(index
, x
);
5752 static void GLAPIENTRY
5753 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5755 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5756 save_Attr1fARB(index
, v
[0]);
5761 static void GLAPIENTRY
5762 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5764 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5765 save_Attr2fARB(index
, x
, y
);
5770 static void GLAPIENTRY
5771 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5773 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5774 save_Attr2fARB(index
, v
[0], v
[1]);
5779 static void GLAPIENTRY
5780 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5782 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5783 save_Attr3fARB(index
, x
, y
, z
);
5788 static void GLAPIENTRY
5789 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5791 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5792 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5797 static void GLAPIENTRY
5798 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5801 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5802 save_Attr4fARB(index
, x
, y
, z
, w
);
5807 static void GLAPIENTRY
5808 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5810 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5811 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5816 static void GLAPIENTRY
5817 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5818 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5819 GLbitfield mask
, GLenum filter
)
5821 GET_CURRENT_CONTEXT(ctx
);
5823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5824 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5837 if (ctx
->ExecuteFlag
) {
5838 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5839 dstX0
, dstY0
, dstX1
, dstY1
,
5845 /** GL_EXT_provoking_vertex */
5846 static void GLAPIENTRY
5847 save_ProvokingVertexEXT(GLenum mode
)
5849 GET_CURRENT_CONTEXT(ctx
);
5851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5852 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5856 if (ctx
->ExecuteFlag
) {
5857 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5858 _mesa_ProvokingVertex(mode
);
5863 /** GL_EXT_transform_feedback */
5864 static void GLAPIENTRY
5865 save_BeginTransformFeedback(GLenum mode
)
5867 GET_CURRENT_CONTEXT(ctx
);
5869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5870 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5874 if (ctx
->ExecuteFlag
) {
5875 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5880 /** GL_EXT_transform_feedback */
5881 static void GLAPIENTRY
5882 save_EndTransformFeedback(void)
5884 GET_CURRENT_CONTEXT(ctx
);
5885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5886 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5887 if (ctx
->ExecuteFlag
) {
5888 CALL_EndTransformFeedback(ctx
->Exec
, ());
5892 static void GLAPIENTRY
5893 save_BindTransformFeedback(GLenum target
, GLuint name
)
5895 GET_CURRENT_CONTEXT(ctx
);
5897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5898 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5903 if (ctx
->ExecuteFlag
) {
5904 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5908 static void GLAPIENTRY
5909 save_PauseTransformFeedback(void)
5911 GET_CURRENT_CONTEXT(ctx
);
5912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5913 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5914 if (ctx
->ExecuteFlag
) {
5915 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5919 static void GLAPIENTRY
5920 save_ResumeTransformFeedback(void)
5922 GET_CURRENT_CONTEXT(ctx
);
5923 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5924 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5925 if (ctx
->ExecuteFlag
) {
5926 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5930 static void GLAPIENTRY
5931 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5933 GET_CURRENT_CONTEXT(ctx
);
5935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5936 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5941 if (ctx
->ExecuteFlag
) {
5942 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5946 static void GLAPIENTRY
5947 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5949 GET_CURRENT_CONTEXT(ctx
);
5951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5952 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5958 if (ctx
->ExecuteFlag
) {
5959 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5963 static void GLAPIENTRY
5964 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5967 GET_CURRENT_CONTEXT(ctx
);
5969 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5970 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5974 n
[3].si
= primcount
;
5976 if (ctx
->ExecuteFlag
) {
5977 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5981 static void GLAPIENTRY
5982 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5983 GLuint stream
, GLsizei primcount
)
5985 GET_CURRENT_CONTEXT(ctx
);
5987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5988 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5993 n
[4].si
= primcount
;
5995 if (ctx
->ExecuteFlag
) {
5996 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6001 static void GLAPIENTRY
6002 save_UseProgram(GLuint program
)
6004 GET_CURRENT_CONTEXT(ctx
);
6006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6007 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6011 if (ctx
->ExecuteFlag
) {
6012 CALL_UseProgram(ctx
->Exec
, (program
));
6017 static void GLAPIENTRY
6018 save_Uniform1fARB(GLint location
, GLfloat x
)
6020 GET_CURRENT_CONTEXT(ctx
);
6022 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6023 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6028 if (ctx
->ExecuteFlag
) {
6029 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6034 static void GLAPIENTRY
6035 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6037 GET_CURRENT_CONTEXT(ctx
);
6039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6040 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6046 if (ctx
->ExecuteFlag
) {
6047 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6052 static void GLAPIENTRY
6053 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6055 GET_CURRENT_CONTEXT(ctx
);
6057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6058 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6065 if (ctx
->ExecuteFlag
) {
6066 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6071 static void GLAPIENTRY
6072 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6074 GET_CURRENT_CONTEXT(ctx
);
6076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6077 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6085 if (ctx
->ExecuteFlag
) {
6086 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6091 static void GLAPIENTRY
6092 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6094 GET_CURRENT_CONTEXT(ctx
);
6096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6097 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6101 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6103 if (ctx
->ExecuteFlag
) {
6104 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6108 static void GLAPIENTRY
6109 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6111 GET_CURRENT_CONTEXT(ctx
);
6113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6114 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6118 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6120 if (ctx
->ExecuteFlag
) {
6121 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6125 static void GLAPIENTRY
6126 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6128 GET_CURRENT_CONTEXT(ctx
);
6130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6131 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6135 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6137 if (ctx
->ExecuteFlag
) {
6138 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6142 static void GLAPIENTRY
6143 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6145 GET_CURRENT_CONTEXT(ctx
);
6147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6148 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6152 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6154 if (ctx
->ExecuteFlag
) {
6155 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6160 static void GLAPIENTRY
6161 save_Uniform1iARB(GLint location
, GLint x
)
6163 GET_CURRENT_CONTEXT(ctx
);
6165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6166 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6171 if (ctx
->ExecuteFlag
) {
6172 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6176 static void GLAPIENTRY
6177 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6179 GET_CURRENT_CONTEXT(ctx
);
6181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6182 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6188 if (ctx
->ExecuteFlag
) {
6189 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6193 static void GLAPIENTRY
6194 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6196 GET_CURRENT_CONTEXT(ctx
);
6198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6199 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6206 if (ctx
->ExecuteFlag
) {
6207 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6211 static void GLAPIENTRY
6212 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6214 GET_CURRENT_CONTEXT(ctx
);
6216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6217 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6225 if (ctx
->ExecuteFlag
) {
6226 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6232 static void GLAPIENTRY
6233 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6235 GET_CURRENT_CONTEXT(ctx
);
6237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6238 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6242 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6244 if (ctx
->ExecuteFlag
) {
6245 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6249 static void GLAPIENTRY
6250 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6252 GET_CURRENT_CONTEXT(ctx
);
6254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6255 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6259 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6261 if (ctx
->ExecuteFlag
) {
6262 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6266 static void GLAPIENTRY
6267 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6269 GET_CURRENT_CONTEXT(ctx
);
6271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6272 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6276 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6278 if (ctx
->ExecuteFlag
) {
6279 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6283 static void GLAPIENTRY
6284 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6286 GET_CURRENT_CONTEXT(ctx
);
6288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6289 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6293 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6295 if (ctx
->ExecuteFlag
) {
6296 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6302 static void GLAPIENTRY
6303 save_Uniform1ui(GLint location
, GLuint x
)
6305 GET_CURRENT_CONTEXT(ctx
);
6307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6308 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6313 if (ctx
->ExecuteFlag
) {
6314 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6318 static void GLAPIENTRY
6319 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6321 GET_CURRENT_CONTEXT(ctx
);
6323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6324 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6330 if (ctx
->ExecuteFlag
) {
6331 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6335 static void GLAPIENTRY
6336 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6338 GET_CURRENT_CONTEXT(ctx
);
6340 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6341 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6348 if (ctx
->ExecuteFlag
) {
6349 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6353 static void GLAPIENTRY
6354 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6356 GET_CURRENT_CONTEXT(ctx
);
6358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6359 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6367 if (ctx
->ExecuteFlag
) {
6368 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6374 static void GLAPIENTRY
6375 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6377 GET_CURRENT_CONTEXT(ctx
);
6379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6380 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6384 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6386 if (ctx
->ExecuteFlag
) {
6387 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6391 static void GLAPIENTRY
6392 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6394 GET_CURRENT_CONTEXT(ctx
);
6396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6397 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6401 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6403 if (ctx
->ExecuteFlag
) {
6404 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6408 static void GLAPIENTRY
6409 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6411 GET_CURRENT_CONTEXT(ctx
);
6413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6414 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6418 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6420 if (ctx
->ExecuteFlag
) {
6421 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6425 static void GLAPIENTRY
6426 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6428 GET_CURRENT_CONTEXT(ctx
);
6430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6431 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6435 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6437 if (ctx
->ExecuteFlag
) {
6438 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6444 static void GLAPIENTRY
6445 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6448 GET_CURRENT_CONTEXT(ctx
);
6450 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6451 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6456 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6458 if (ctx
->ExecuteFlag
) {
6459 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6463 static void GLAPIENTRY
6464 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6467 GET_CURRENT_CONTEXT(ctx
);
6469 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6470 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6475 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6477 if (ctx
->ExecuteFlag
) {
6478 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6482 static void GLAPIENTRY
6483 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6486 GET_CURRENT_CONTEXT(ctx
);
6488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6489 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6494 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6496 if (ctx
->ExecuteFlag
) {
6497 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6502 static void GLAPIENTRY
6503 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6506 GET_CURRENT_CONTEXT(ctx
);
6508 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6509 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6514 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6516 if (ctx
->ExecuteFlag
) {
6517 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6521 static void GLAPIENTRY
6522 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6525 GET_CURRENT_CONTEXT(ctx
);
6527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6528 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6533 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6535 if (ctx
->ExecuteFlag
) {
6536 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6541 static void GLAPIENTRY
6542 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6545 GET_CURRENT_CONTEXT(ctx
);
6547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6548 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6553 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6555 if (ctx
->ExecuteFlag
) {
6556 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6560 static void GLAPIENTRY
6561 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6564 GET_CURRENT_CONTEXT(ctx
);
6566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6567 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6572 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6574 if (ctx
->ExecuteFlag
) {
6575 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6580 static void GLAPIENTRY
6581 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6584 GET_CURRENT_CONTEXT(ctx
);
6586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6587 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6592 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6594 if (ctx
->ExecuteFlag
) {
6595 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6599 static void GLAPIENTRY
6600 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6603 GET_CURRENT_CONTEXT(ctx
);
6605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6606 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6611 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6613 if (ctx
->ExecuteFlag
) {
6614 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6618 static void GLAPIENTRY
6619 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6621 GET_CURRENT_CONTEXT(ctx
);
6623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6624 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6630 if (ctx
->ExecuteFlag
) {
6631 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6635 static void GLAPIENTRY
6636 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6638 GET_CURRENT_CONTEXT(ctx
);
6640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6641 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6647 if (ctx
->ExecuteFlag
) {
6648 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6652 static void GLAPIENTRY
6653 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6655 GET_CURRENT_CONTEXT(ctx
);
6657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6658 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6665 if (ctx
->ExecuteFlag
) {
6666 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6670 static void GLAPIENTRY
6671 save_ProgramUniform3f(GLuint program
, GLint location
,
6672 GLfloat x
, GLfloat y
, GLfloat z
)
6674 GET_CURRENT_CONTEXT(ctx
);
6676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6677 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6685 if (ctx
->ExecuteFlag
) {
6686 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6690 static void GLAPIENTRY
6691 save_ProgramUniform4f(GLuint program
, GLint location
,
6692 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6694 GET_CURRENT_CONTEXT(ctx
);
6696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6697 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6706 if (ctx
->ExecuteFlag
) {
6707 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6711 static void GLAPIENTRY
6712 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6715 GET_CURRENT_CONTEXT(ctx
);
6717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6718 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6723 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6725 if (ctx
->ExecuteFlag
) {
6726 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6730 static void GLAPIENTRY
6731 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6734 GET_CURRENT_CONTEXT(ctx
);
6736 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6737 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6742 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6744 if (ctx
->ExecuteFlag
) {
6745 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6749 static void GLAPIENTRY
6750 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6753 GET_CURRENT_CONTEXT(ctx
);
6755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6756 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6761 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6763 if (ctx
->ExecuteFlag
) {
6764 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6768 static void GLAPIENTRY
6769 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6772 GET_CURRENT_CONTEXT(ctx
);
6774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6775 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6780 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6782 if (ctx
->ExecuteFlag
) {
6783 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6787 static void GLAPIENTRY
6788 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6790 GET_CURRENT_CONTEXT(ctx
);
6792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6793 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6799 if (ctx
->ExecuteFlag
) {
6800 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6804 static void GLAPIENTRY
6805 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6807 GET_CURRENT_CONTEXT(ctx
);
6809 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6810 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6817 if (ctx
->ExecuteFlag
) {
6818 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6822 static void GLAPIENTRY
6823 save_ProgramUniform3i(GLuint program
, GLint location
,
6824 GLint x
, GLint y
, GLint z
)
6826 GET_CURRENT_CONTEXT(ctx
);
6828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6829 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6837 if (ctx
->ExecuteFlag
) {
6838 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6842 static void GLAPIENTRY
6843 save_ProgramUniform4i(GLuint program
, GLint location
,
6844 GLint x
, GLint y
, GLint z
, GLint w
)
6846 GET_CURRENT_CONTEXT(ctx
);
6848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6849 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6858 if (ctx
->ExecuteFlag
) {
6859 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6863 static void GLAPIENTRY
6864 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6867 GET_CURRENT_CONTEXT(ctx
);
6869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6870 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6875 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6877 if (ctx
->ExecuteFlag
) {
6878 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6882 static void GLAPIENTRY
6883 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6886 GET_CURRENT_CONTEXT(ctx
);
6888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6889 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6894 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6896 if (ctx
->ExecuteFlag
) {
6897 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6901 static void GLAPIENTRY
6902 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6905 GET_CURRENT_CONTEXT(ctx
);
6907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6908 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6913 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6915 if (ctx
->ExecuteFlag
) {
6916 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6920 static void GLAPIENTRY
6921 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6924 GET_CURRENT_CONTEXT(ctx
);
6926 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6927 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6932 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6934 if (ctx
->ExecuteFlag
) {
6935 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6939 static void GLAPIENTRY
6940 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6942 GET_CURRENT_CONTEXT(ctx
);
6944 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6945 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6951 if (ctx
->ExecuteFlag
) {
6952 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6956 static void GLAPIENTRY
6957 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6959 GET_CURRENT_CONTEXT(ctx
);
6961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6962 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6969 if (ctx
->ExecuteFlag
) {
6970 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6974 static void GLAPIENTRY
6975 save_ProgramUniform3ui(GLuint program
, GLint location
,
6976 GLuint x
, GLuint y
, GLuint z
)
6978 GET_CURRENT_CONTEXT(ctx
);
6980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6981 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6989 if (ctx
->ExecuteFlag
) {
6990 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6994 static void GLAPIENTRY
6995 save_ProgramUniform4ui(GLuint program
, GLint location
,
6996 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6998 GET_CURRENT_CONTEXT(ctx
);
7000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7001 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7010 if (ctx
->ExecuteFlag
) {
7011 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7015 static void GLAPIENTRY
7016 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7019 GET_CURRENT_CONTEXT(ctx
);
7021 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7022 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7027 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7029 if (ctx
->ExecuteFlag
) {
7030 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7034 static void GLAPIENTRY
7035 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7038 GET_CURRENT_CONTEXT(ctx
);
7040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7041 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7046 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7048 if (ctx
->ExecuteFlag
) {
7049 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7053 static void GLAPIENTRY
7054 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7057 GET_CURRENT_CONTEXT(ctx
);
7059 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7060 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7065 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7067 if (ctx
->ExecuteFlag
) {
7068 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7072 static void GLAPIENTRY
7073 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7076 GET_CURRENT_CONTEXT(ctx
);
7078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7079 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7084 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7086 if (ctx
->ExecuteFlag
) {
7087 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7091 static void GLAPIENTRY
7092 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7093 GLboolean transpose
, const GLfloat
*v
)
7095 GET_CURRENT_CONTEXT(ctx
);
7097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7098 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7099 4 + POINTER_DWORDS
);
7105 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7107 if (ctx
->ExecuteFlag
) {
7108 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7109 (program
, location
, count
, transpose
, v
));
7113 static void GLAPIENTRY
7114 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7115 GLboolean transpose
, const GLfloat
*v
)
7117 GET_CURRENT_CONTEXT(ctx
);
7119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7120 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7121 4 + POINTER_DWORDS
);
7127 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7129 if (ctx
->ExecuteFlag
) {
7130 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7131 (program
, location
, count
, transpose
, v
));
7135 static void GLAPIENTRY
7136 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7137 GLboolean transpose
, const GLfloat
*v
)
7139 GET_CURRENT_CONTEXT(ctx
);
7141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7142 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7143 4 + POINTER_DWORDS
);
7149 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7151 if (ctx
->ExecuteFlag
) {
7152 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7153 (program
, location
, count
, transpose
, v
));
7157 static void GLAPIENTRY
7158 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7159 GLboolean transpose
, const GLfloat
*v
)
7161 GET_CURRENT_CONTEXT(ctx
);
7163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7164 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7165 4 + POINTER_DWORDS
);
7171 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7173 if (ctx
->ExecuteFlag
) {
7174 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7175 (program
, location
, count
, transpose
, v
));
7179 static void GLAPIENTRY
7180 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7181 GLboolean transpose
, const GLfloat
*v
)
7183 GET_CURRENT_CONTEXT(ctx
);
7185 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7186 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7187 4 + POINTER_DWORDS
);
7193 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7195 if (ctx
->ExecuteFlag
) {
7196 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7197 (program
, location
, count
, transpose
, v
));
7201 static void GLAPIENTRY
7202 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7203 GLboolean transpose
, const GLfloat
*v
)
7205 GET_CURRENT_CONTEXT(ctx
);
7207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7208 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7209 4 + POINTER_DWORDS
);
7215 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7217 if (ctx
->ExecuteFlag
) {
7218 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7219 (program
, location
, count
, transpose
, v
));
7223 static void GLAPIENTRY
7224 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7225 GLboolean transpose
, const GLfloat
*v
)
7227 GET_CURRENT_CONTEXT(ctx
);
7229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7230 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7231 4 + POINTER_DWORDS
);
7237 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7239 if (ctx
->ExecuteFlag
) {
7240 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7241 (program
, location
, count
, transpose
, v
));
7245 static void GLAPIENTRY
7246 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7247 GLboolean transpose
, const GLfloat
*v
)
7249 GET_CURRENT_CONTEXT(ctx
);
7251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7252 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7253 4 + POINTER_DWORDS
);
7259 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7261 if (ctx
->ExecuteFlag
) {
7262 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7263 (program
, location
, count
, transpose
, v
));
7267 static void GLAPIENTRY
7268 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7269 GLboolean transpose
, const GLfloat
*v
)
7271 GET_CURRENT_CONTEXT(ctx
);
7273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7274 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7275 4 + POINTER_DWORDS
);
7281 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7283 if (ctx
->ExecuteFlag
) {
7284 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7285 (program
, location
, count
, transpose
, v
));
7289 static void GLAPIENTRY
7290 save_ClipControl(GLenum origin
, GLenum depth
)
7292 GET_CURRENT_CONTEXT(ctx
);
7294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7295 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7300 if (ctx
->ExecuteFlag
) {
7301 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7305 static void GLAPIENTRY
7306 save_ClampColorARB(GLenum target
, GLenum clamp
)
7308 GET_CURRENT_CONTEXT(ctx
);
7310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7311 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7316 if (ctx
->ExecuteFlag
) {
7317 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7321 /** GL_EXT_texture_integer */
7322 static void GLAPIENTRY
7323 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7325 GET_CURRENT_CONTEXT(ctx
);
7327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7328 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7335 if (ctx
->ExecuteFlag
) {
7336 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7340 /** GL_EXT_texture_integer */
7341 static void GLAPIENTRY
7342 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7344 GET_CURRENT_CONTEXT(ctx
);
7346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7347 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7354 if (ctx
->ExecuteFlag
) {
7355 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7359 /** GL_EXT_texture_integer */
7360 static void GLAPIENTRY
7361 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7363 GET_CURRENT_CONTEXT(ctx
);
7365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7366 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7375 if (ctx
->ExecuteFlag
) {
7376 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7380 /** GL_EXT_texture_integer */
7381 static void GLAPIENTRY
7382 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7384 GET_CURRENT_CONTEXT(ctx
);
7386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7387 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7391 n
[3].ui
= params
[0];
7392 n
[4].ui
= params
[1];
7393 n
[5].ui
= params
[2];
7394 n
[6].ui
= params
[3];
7396 if (ctx
->ExecuteFlag
) {
7397 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7401 /* GL_ARB_instanced_arrays */
7402 static void GLAPIENTRY
7403 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7405 GET_CURRENT_CONTEXT(ctx
);
7407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7408 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7413 if (ctx
->ExecuteFlag
) {
7414 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7419 /* GL_NV_texture_barrier */
7420 static void GLAPIENTRY
7421 save_TextureBarrierNV(void)
7423 GET_CURRENT_CONTEXT(ctx
);
7424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7425 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7426 if (ctx
->ExecuteFlag
) {
7427 CALL_TextureBarrierNV(ctx
->Exec
, ());
7432 /* GL_ARB_sampler_objects */
7433 static void GLAPIENTRY
7434 save_BindSampler(GLuint unit
, GLuint sampler
)
7437 GET_CURRENT_CONTEXT(ctx
);
7438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7439 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7444 if (ctx
->ExecuteFlag
) {
7445 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7449 static void GLAPIENTRY
7450 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7453 GET_CURRENT_CONTEXT(ctx
);
7454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7455 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7460 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7466 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7469 if (ctx
->ExecuteFlag
) {
7470 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7474 static void GLAPIENTRY
7475 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7479 parray
[1] = parray
[2] = parray
[3] = 0;
7480 save_SamplerParameteriv(sampler
, pname
, parray
);
7483 static void GLAPIENTRY
7484 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7487 GET_CURRENT_CONTEXT(ctx
);
7488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7489 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7494 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7500 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7503 if (ctx
->ExecuteFlag
) {
7504 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7508 static void GLAPIENTRY
7509 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7513 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7514 save_SamplerParameterfv(sampler
, pname
, parray
);
7517 static void GLAPIENTRY
7518 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7521 GET_CURRENT_CONTEXT(ctx
);
7522 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7523 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7528 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7534 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7537 if (ctx
->ExecuteFlag
) {
7538 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7542 static void GLAPIENTRY
7543 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7546 GET_CURRENT_CONTEXT(ctx
);
7547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7548 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7552 n
[3].ui
= params
[0];
7553 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7554 n
[4].ui
= params
[1];
7555 n
[5].ui
= params
[2];
7556 n
[6].ui
= params
[3];
7559 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7562 if (ctx
->ExecuteFlag
) {
7563 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7567 static void GLAPIENTRY
7568 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7571 GET_CURRENT_CONTEXT(ctx
);
7572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7573 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7575 union uint64_pair p
;
7578 n
[2].ui
= p
.uint32
[0];
7579 n
[3].ui
= p
.uint32
[1];
7580 save_pointer(&n
[4], sync
);
7582 if (ctx
->ExecuteFlag
) {
7583 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7588 /** GL_NV_conditional_render */
7589 static void GLAPIENTRY
7590 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7592 GET_CURRENT_CONTEXT(ctx
);
7594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7595 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7600 if (ctx
->ExecuteFlag
) {
7601 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7605 static void GLAPIENTRY
7606 save_EndConditionalRender(void)
7608 GET_CURRENT_CONTEXT(ctx
);
7609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7610 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7611 if (ctx
->ExecuteFlag
) {
7612 CALL_EndConditionalRender(ctx
->Exec
, ());
7616 static void GLAPIENTRY
7617 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7619 GET_CURRENT_CONTEXT(ctx
);
7621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7622 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7628 if (ctx
->ExecuteFlag
) {
7629 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7635 * Save an error-generating command into display list.
7637 * KW: Will appear in the list before the vertex buffer containing the
7638 * command that provoked the error. I don't see this as a problem.
7641 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7644 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7647 save_pointer(&n
[2], (void *) s
);
7648 /* note: the data/string here doesn't have to be freed in
7649 * _mesa_delete_list() since the string is never dynamically
7657 * Compile an error into current display list.
7660 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7662 if (ctx
->CompileFlag
)
7663 save_error(ctx
, error
, s
);
7664 if (ctx
->ExecuteFlag
)
7665 _mesa_error(ctx
, error
, "%s", s
);
7670 * Test if ID names a display list.
7673 islist(struct gl_context
*ctx
, GLuint list
)
7675 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7685 /**********************************************************************/
7686 /* Display list execution */
7687 /**********************************************************************/
7691 * Execute a display list. Note that the ListBase offset must have already
7692 * been added before calling this function. I.e. the list argument is
7693 * the absolute list number, not relative to ListBase.
7694 * \param list - display list number
7697 execute_list(struct gl_context
*ctx
, GLuint list
)
7699 struct gl_display_list
*dlist
;
7703 if (list
== 0 || !islist(ctx
, list
))
7706 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7707 /* raise an error? */
7711 dlist
= _mesa_lookup_list(ctx
, list
);
7715 ctx
->ListState
.CallDepth
++;
7717 vbo_save_BeginCallList(ctx
, dlist
);
7723 const OpCode opcode
= n
[0].opcode
;
7725 if (is_ext_opcode(opcode
)) {
7726 n
+= ext_opcode_execute(ctx
, n
);
7731 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7734 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7736 case OPCODE_ALPHA_FUNC
:
7737 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7739 case OPCODE_BIND_TEXTURE
:
7740 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7744 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7745 ctx
->Unpack
= ctx
->DefaultPacking
;
7746 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7747 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7748 get_pointer(&n
[7])));
7749 ctx
->Unpack
= save
; /* restore */
7752 case OPCODE_BLEND_COLOR
:
7753 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7755 case OPCODE_BLEND_EQUATION
:
7756 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7758 case OPCODE_BLEND_EQUATION_SEPARATE
:
7759 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7761 case OPCODE_BLEND_FUNC_SEPARATE
:
7762 CALL_BlendFuncSeparate(ctx
->Exec
,
7763 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7766 case OPCODE_BLEND_FUNC_I
:
7767 /* GL_ARB_draw_buffers_blend */
7768 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7770 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7771 /* GL_ARB_draw_buffers_blend */
7772 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7775 case OPCODE_BLEND_EQUATION_I
:
7776 /* GL_ARB_draw_buffers_blend */
7777 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7779 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7780 /* GL_ARB_draw_buffers_blend */
7781 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7782 (n
[1].ui
, n
[2].e
, n
[3].e
));
7785 case OPCODE_CALL_LIST
:
7786 /* Generated by glCallList(), don't add ListBase */
7787 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7788 execute_list(ctx
, n
[1].ui
);
7791 case OPCODE_CALL_LISTS
:
7792 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7793 CALL_CallLists(ctx
->Exec
, (n
[1].i
, n
[2].e
, get_pointer(&n
[3])));
7797 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7799 case OPCODE_CLEAR_BUFFER_IV
:
7806 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7809 case OPCODE_CLEAR_BUFFER_UIV
:
7816 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7819 case OPCODE_CLEAR_BUFFER_FV
:
7826 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7829 case OPCODE_CLEAR_BUFFER_FI
:
7830 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7832 case OPCODE_CLEAR_COLOR
:
7833 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7835 case OPCODE_CLEAR_ACCUM
:
7836 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7838 case OPCODE_CLEAR_DEPTH
:
7839 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7841 case OPCODE_CLEAR_INDEX
:
7842 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7844 case OPCODE_CLEAR_STENCIL
:
7845 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7847 case OPCODE_CLIP_PLANE
:
7854 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7857 case OPCODE_COLOR_MASK
:
7858 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7860 case OPCODE_COLOR_MASK_INDEXED
:
7861 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7864 case OPCODE_COLOR_MATERIAL
:
7865 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7867 case OPCODE_COPY_PIXELS
:
7868 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7869 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7872 case OPCODE_COPY_TEX_IMAGE1D
:
7873 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7874 n
[5].i
, n
[6].i
, n
[7].i
));
7876 case OPCODE_COPY_TEX_IMAGE2D
:
7877 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7878 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7880 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7881 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7882 n
[4].i
, n
[5].i
, n
[6].i
));
7884 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7885 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7886 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7889 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7890 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7891 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7894 case OPCODE_CULL_FACE
:
7895 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7897 case OPCODE_DEPTH_FUNC
:
7898 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7900 case OPCODE_DEPTH_MASK
:
7901 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7903 case OPCODE_DEPTH_RANGE
:
7904 CALL_DepthRange(ctx
->Exec
,
7905 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7907 case OPCODE_DISABLE
:
7908 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7910 case OPCODE_DISABLE_INDEXED
:
7911 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7913 case OPCODE_DRAW_BUFFER
:
7914 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7916 case OPCODE_DRAW_PIXELS
:
7918 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7919 ctx
->Unpack
= ctx
->DefaultPacking
;
7920 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7921 get_pointer(&n
[5])));
7922 ctx
->Unpack
= save
; /* restore */
7926 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7928 case OPCODE_ENABLE_INDEXED
:
7929 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7931 case OPCODE_EVALMESH1
:
7932 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7934 case OPCODE_EVALMESH2
:
7935 CALL_EvalMesh2(ctx
->Exec
,
7936 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7945 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7948 case OPCODE_FRONT_FACE
:
7949 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7951 case OPCODE_FRUSTUM
:
7952 CALL_Frustum(ctx
->Exec
,
7953 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7956 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7958 case OPCODE_INDEX_MASK
:
7959 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7961 case OPCODE_INIT_NAMES
:
7962 CALL_InitNames(ctx
->Exec
, ());
7971 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7974 case OPCODE_LIGHT_MODEL
:
7981 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7984 case OPCODE_LINE_STIPPLE
:
7985 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7987 case OPCODE_LINE_WIDTH
:
7988 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7990 case OPCODE_LIST_BASE
:
7991 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7993 case OPCODE_LOAD_IDENTITY
:
7994 CALL_LoadIdentity(ctx
->Exec
, ());
7996 case OPCODE_LOAD_MATRIX
:
7997 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
7998 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8000 case OPCODE_LOAD_NAME
:
8001 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8003 case OPCODE_LOGIC_OP
:
8004 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8008 GLenum target
= n
[1].e
;
8009 GLint ustride
= _mesa_evaluator_components(target
);
8010 GLint uorder
= n
[5].i
;
8011 GLfloat u1
= n
[2].f
;
8012 GLfloat u2
= n
[3].f
;
8013 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8014 (GLfloat
*) get_pointer(&n
[6])));
8019 GLenum target
= n
[1].e
;
8020 GLfloat u1
= n
[2].f
;
8021 GLfloat u2
= n
[3].f
;
8022 GLfloat v1
= n
[4].f
;
8023 GLfloat v2
= n
[5].f
;
8024 GLint ustride
= n
[6].i
;
8025 GLint vstride
= n
[7].i
;
8026 GLint uorder
= n
[8].i
;
8027 GLint vorder
= n
[9].i
;
8028 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8029 v1
, v2
, vstride
, vorder
,
8030 (GLfloat
*) get_pointer(&n
[10])));
8033 case OPCODE_MAPGRID1
:
8034 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8036 case OPCODE_MAPGRID2
:
8037 CALL_MapGrid2f(ctx
->Exec
,
8038 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8040 case OPCODE_MATRIX_MODE
:
8041 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8043 case OPCODE_MULT_MATRIX
:
8044 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8047 CALL_Ortho(ctx
->Exec
,
8048 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8050 case OPCODE_PASSTHROUGH
:
8051 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8053 case OPCODE_PIXEL_MAP
:
8054 CALL_PixelMapfv(ctx
->Exec
,
8055 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8057 case OPCODE_PIXEL_TRANSFER
:
8058 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8060 case OPCODE_PIXEL_ZOOM
:
8061 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8063 case OPCODE_POINT_SIZE
:
8064 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8066 case OPCODE_POINT_PARAMETERS
:
8072 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8075 case OPCODE_POLYGON_MODE
:
8076 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8078 case OPCODE_POLYGON_STIPPLE
:
8080 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8081 ctx
->Unpack
= ctx
->DefaultPacking
;
8082 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8083 ctx
->Unpack
= save
; /* restore */
8086 case OPCODE_POLYGON_OFFSET
:
8087 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8089 case OPCODE_POLYGON_OFFSET_CLAMP
:
8090 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8092 case OPCODE_POP_ATTRIB
:
8093 CALL_PopAttrib(ctx
->Exec
, ());
8095 case OPCODE_POP_MATRIX
:
8096 CALL_PopMatrix(ctx
->Exec
, ());
8098 case OPCODE_POP_NAME
:
8099 CALL_PopName(ctx
->Exec
, ());
8101 case OPCODE_PRIORITIZE_TEXTURE
:
8102 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8104 case OPCODE_PUSH_ATTRIB
:
8105 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8107 case OPCODE_PUSH_MATRIX
:
8108 CALL_PushMatrix(ctx
->Exec
, ());
8110 case OPCODE_PUSH_NAME
:
8111 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8113 case OPCODE_RASTER_POS
:
8114 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8116 case OPCODE_READ_BUFFER
:
8117 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8120 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8123 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8125 case OPCODE_SCISSOR
:
8126 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8128 case OPCODE_SHADE_MODEL
:
8129 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8131 case OPCODE_PROVOKING_VERTEX
:
8132 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8134 case OPCODE_STENCIL_FUNC
:
8135 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8137 case OPCODE_STENCIL_MASK
:
8138 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8140 case OPCODE_STENCIL_OP
:
8141 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8143 case OPCODE_STENCIL_FUNC_SEPARATE
:
8144 CALL_StencilFuncSeparate(ctx
->Exec
,
8145 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8147 case OPCODE_STENCIL_MASK_SEPARATE
:
8148 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8150 case OPCODE_STENCIL_OP_SEPARATE
:
8151 CALL_StencilOpSeparate(ctx
->Exec
,
8152 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8161 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8171 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8174 case OPCODE_TEXPARAMETER
:
8181 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8184 case OPCODE_TEX_IMAGE1D
:
8186 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8187 ctx
->Unpack
= ctx
->DefaultPacking
;
8188 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8190 n
[3].i
, /* components */
8192 n
[5].e
, /* border */
8193 n
[6].e
, /* format */
8195 get_pointer(&n
[8])));
8196 ctx
->Unpack
= save
; /* restore */
8199 case OPCODE_TEX_IMAGE2D
:
8201 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8202 ctx
->Unpack
= ctx
->DefaultPacking
;
8203 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8205 n
[3].i
, /* components */
8207 n
[5].i
, /* height */
8208 n
[6].e
, /* border */
8209 n
[7].e
, /* format */
8211 get_pointer(&n
[9])));
8212 ctx
->Unpack
= save
; /* restore */
8215 case OPCODE_TEX_IMAGE3D
:
8217 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8218 ctx
->Unpack
= ctx
->DefaultPacking
;
8219 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8221 n
[3].i
, /* components */
8223 n
[5].i
, /* height */
8225 n
[7].e
, /* border */
8226 n
[8].e
, /* format */
8228 get_pointer(&n
[10])));
8229 ctx
->Unpack
= save
; /* restore */
8232 case OPCODE_TEX_SUB_IMAGE1D
:
8234 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8235 ctx
->Unpack
= ctx
->DefaultPacking
;
8236 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8238 n
[6].e
, get_pointer(&n
[7])));
8239 ctx
->Unpack
= save
; /* restore */
8242 case OPCODE_TEX_SUB_IMAGE2D
:
8244 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8245 ctx
->Unpack
= ctx
->DefaultPacking
;
8246 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8248 n
[6].i
, n
[7].e
, n
[8].e
,
8249 get_pointer(&n
[9])));
8250 ctx
->Unpack
= save
; /* restore */
8253 case OPCODE_TEX_SUB_IMAGE3D
:
8255 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8256 ctx
->Unpack
= ctx
->DefaultPacking
;
8257 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8258 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8259 n
[8].i
, n
[9].e
, n
[10].e
,
8260 get_pointer(&n
[11])));
8261 ctx
->Unpack
= save
; /* restore */
8264 case OPCODE_TRANSLATE
:
8265 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8267 case OPCODE_VIEWPORT
:
8268 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8269 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8271 case OPCODE_WINDOW_POS
:
8272 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8274 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8275 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8277 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8278 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8279 n
[4].i
, n
[5].i
, n
[6].i
,
8280 get_pointer(&n
[7])));
8282 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8283 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8284 n
[4].i
, n
[5].i
, n
[6].i
,
8285 n
[7].i
, get_pointer(&n
[8])));
8287 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8288 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8289 n
[4].i
, n
[5].i
, n
[6].i
,
8291 get_pointer(&n
[9])));
8293 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8294 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8295 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8297 get_pointer(&n
[7])));
8299 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8300 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8301 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8302 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8303 get_pointer(&n
[9])));
8305 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8306 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8307 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8308 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8310 get_pointer(&n
[11])));
8312 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8313 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8315 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8316 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8318 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8319 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8321 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8322 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8323 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8326 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8327 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8329 case OPCODE_DEPTH_BOUNDS_EXT
:
8330 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8332 case OPCODE_PROGRAM_STRING_ARB
:
8333 CALL_ProgramStringARB(ctx
->Exec
,
8334 (n
[1].e
, n
[2].e
, n
[3].i
,
8335 get_pointer(&n
[4])));
8337 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8338 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8342 case OPCODE_BEGIN_QUERY_ARB
:
8343 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8345 case OPCODE_END_QUERY_ARB
:
8346 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8348 case OPCODE_QUERY_COUNTER
:
8349 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8351 case OPCODE_BEGIN_QUERY_INDEXED
:
8352 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8354 case OPCODE_END_QUERY_INDEXED
:
8355 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8357 case OPCODE_DRAW_BUFFERS_ARB
:
8359 GLenum buffers
[MAX_DRAW_BUFFERS
];
8360 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8361 for (i
= 0; i
< count
; i
++)
8362 buffers
[i
] = n
[2 + i
].e
;
8363 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8366 case OPCODE_BLIT_FRAMEBUFFER
:
8367 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8368 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8371 case OPCODE_USE_PROGRAM
:
8372 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8374 case OPCODE_UNIFORM_1F
:
8375 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8377 case OPCODE_UNIFORM_2F
:
8378 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8380 case OPCODE_UNIFORM_3F
:
8381 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8383 case OPCODE_UNIFORM_4F
:
8384 CALL_Uniform4f(ctx
->Exec
,
8385 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8387 case OPCODE_UNIFORM_1FV
:
8388 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8390 case OPCODE_UNIFORM_2FV
:
8391 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8393 case OPCODE_UNIFORM_3FV
:
8394 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8396 case OPCODE_UNIFORM_4FV
:
8397 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8399 case OPCODE_UNIFORM_1I
:
8400 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8402 case OPCODE_UNIFORM_2I
:
8403 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8405 case OPCODE_UNIFORM_3I
:
8406 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8408 case OPCODE_UNIFORM_4I
:
8409 CALL_Uniform4i(ctx
->Exec
,
8410 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8412 case OPCODE_UNIFORM_1IV
:
8413 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8415 case OPCODE_UNIFORM_2IV
:
8416 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8418 case OPCODE_UNIFORM_3IV
:
8419 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8421 case OPCODE_UNIFORM_4IV
:
8422 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8424 case OPCODE_UNIFORM_1UI
:
8425 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8427 case OPCODE_UNIFORM_2UI
:
8428 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8430 case OPCODE_UNIFORM_3UI
:
8431 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8433 case OPCODE_UNIFORM_4UI
:
8434 /*CALL_Uniform4uiARB(ctx->Exec,
8435 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8438 case OPCODE_UNIFORM_1UIV
:
8439 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8440 get_pointer(&n[3])));*/
8442 case OPCODE_UNIFORM_2UIV
:
8443 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8444 get_pointer(&n[3])));*/
8446 case OPCODE_UNIFORM_3UIV
:
8447 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8448 get_pointer(&n[3])));*/
8450 case OPCODE_UNIFORM_4UIV
:
8451 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8452 get_pointer(&n[3])));*/
8454 case OPCODE_UNIFORM_MATRIX22
:
8455 CALL_UniformMatrix2fv(ctx
->Exec
,
8456 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8458 case OPCODE_UNIFORM_MATRIX33
:
8459 CALL_UniformMatrix3fv(ctx
->Exec
,
8460 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8462 case OPCODE_UNIFORM_MATRIX44
:
8463 CALL_UniformMatrix4fv(ctx
->Exec
,
8464 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8466 case OPCODE_UNIFORM_MATRIX23
:
8467 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8468 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8470 case OPCODE_UNIFORM_MATRIX32
:
8471 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8472 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8474 case OPCODE_UNIFORM_MATRIX24
:
8475 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8476 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8478 case OPCODE_UNIFORM_MATRIX42
:
8479 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8480 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8482 case OPCODE_UNIFORM_MATRIX34
:
8483 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8484 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8486 case OPCODE_UNIFORM_MATRIX43
:
8487 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8488 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8491 case OPCODE_USE_PROGRAM_STAGES
:
8492 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8494 case OPCODE_PROGRAM_UNIFORM_1F
:
8495 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8497 case OPCODE_PROGRAM_UNIFORM_2F
:
8498 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8500 case OPCODE_PROGRAM_UNIFORM_3F
:
8501 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8502 n
[3].f
, n
[4].f
, n
[5].f
));
8504 case OPCODE_PROGRAM_UNIFORM_4F
:
8505 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8506 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8508 case OPCODE_PROGRAM_UNIFORM_1FV
:
8509 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8510 get_pointer(&n
[4])));
8512 case OPCODE_PROGRAM_UNIFORM_2FV
:
8513 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8514 get_pointer(&n
[4])));
8516 case OPCODE_PROGRAM_UNIFORM_3FV
:
8517 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8518 get_pointer(&n
[4])));
8520 case OPCODE_PROGRAM_UNIFORM_4FV
:
8521 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8522 get_pointer(&n
[4])));
8524 case OPCODE_PROGRAM_UNIFORM_1I
:
8525 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8527 case OPCODE_PROGRAM_UNIFORM_2I
:
8528 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8530 case OPCODE_PROGRAM_UNIFORM_3I
:
8531 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8532 n
[3].i
, n
[4].i
, n
[5].i
));
8534 case OPCODE_PROGRAM_UNIFORM_4I
:
8535 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8536 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8538 case OPCODE_PROGRAM_UNIFORM_1IV
:
8539 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8540 get_pointer(&n
[4])));
8542 case OPCODE_PROGRAM_UNIFORM_2IV
:
8543 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8544 get_pointer(&n
[4])));
8546 case OPCODE_PROGRAM_UNIFORM_3IV
:
8547 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8548 get_pointer(&n
[4])));
8550 case OPCODE_PROGRAM_UNIFORM_4IV
:
8551 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8552 get_pointer(&n
[4])));
8554 case OPCODE_PROGRAM_UNIFORM_1UI
:
8555 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8557 case OPCODE_PROGRAM_UNIFORM_2UI
:
8558 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8561 case OPCODE_PROGRAM_UNIFORM_3UI
:
8562 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8563 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8565 case OPCODE_PROGRAM_UNIFORM_4UI
:
8566 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8568 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8570 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8571 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8572 get_pointer(&n
[4])));
8574 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8575 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8576 get_pointer(&n
[4])));
8578 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8579 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8580 get_pointer(&n
[4])));
8582 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8583 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8584 get_pointer(&n
[4])));
8586 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8587 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8588 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8589 get_pointer(&n
[5])));
8591 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8592 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8593 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8594 get_pointer(&n
[5])));
8596 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8597 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8598 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8599 get_pointer(&n
[5])));
8601 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8602 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8603 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8604 get_pointer(&n
[5])));
8606 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8607 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8608 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8609 get_pointer(&n
[5])));
8611 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8612 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8613 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8614 get_pointer(&n
[5])));
8616 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8617 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8618 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8619 get_pointer(&n
[5])));
8621 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8622 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8623 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8624 get_pointer(&n
[5])));
8626 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8627 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8628 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8629 get_pointer(&n
[5])));
8632 case OPCODE_CLIP_CONTROL
:
8633 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8636 case OPCODE_CLAMP_COLOR
:
8637 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8640 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8641 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8643 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8644 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8646 case OPCODE_ATTR_1F_NV
:
8647 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8649 case OPCODE_ATTR_2F_NV
:
8650 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8652 case OPCODE_ATTR_3F_NV
:
8653 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8655 case OPCODE_ATTR_4F_NV
:
8656 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8658 case OPCODE_ATTR_1F_ARB
:
8659 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8661 case OPCODE_ATTR_2F_ARB
:
8662 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8664 case OPCODE_ATTR_3F_ARB
:
8665 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8667 case OPCODE_ATTR_4F_ARB
:
8668 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8670 case OPCODE_MATERIAL
:
8671 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8674 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8677 CALL_End(ctx
->Exec
, ());
8680 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8682 case OPCODE_EVAL_C1
:
8683 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8685 case OPCODE_EVAL_C2
:
8686 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8688 case OPCODE_EVAL_P1
:
8689 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8691 case OPCODE_EVAL_P2
:
8692 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8695 /* GL_EXT_texture_integer */
8696 case OPCODE_CLEARCOLOR_I
:
8697 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8699 case OPCODE_CLEARCOLOR_UI
:
8700 CALL_ClearColorIuiEXT(ctx
->Exec
,
8701 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8703 case OPCODE_TEXPARAMETER_I
:
8710 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8713 case OPCODE_TEXPARAMETER_UI
:
8716 params
[0] = n
[3].ui
;
8717 params
[1] = n
[4].ui
;
8718 params
[2] = n
[5].ui
;
8719 params
[3] = n
[6].ui
;
8720 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8724 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8725 /* GL_ARB_instanced_arrays */
8726 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8729 case OPCODE_TEXTURE_BARRIER_NV
:
8730 CALL_TextureBarrierNV(ctx
->Exec
, ());
8733 /* GL_EXT/ARB_transform_feedback */
8734 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8735 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8737 case OPCODE_END_TRANSFORM_FEEDBACK
:
8738 CALL_EndTransformFeedback(ctx
->Exec
, ());
8740 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8741 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8743 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8744 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8746 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8747 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8749 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8750 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8752 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8753 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8754 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8756 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8757 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8758 (n
[1].e
, n
[2].ui
, n
[3].si
));
8760 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8761 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8762 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8766 case OPCODE_BIND_SAMPLER
:
8767 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8769 case OPCODE_SAMPLER_PARAMETERIV
:
8776 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8779 case OPCODE_SAMPLER_PARAMETERFV
:
8786 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8789 case OPCODE_SAMPLER_PARAMETERIIV
:
8796 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8799 case OPCODE_SAMPLER_PARAMETERUIV
:
8802 params
[0] = n
[3].ui
;
8803 params
[1] = n
[4].ui
;
8804 params
[2] = n
[5].ui
;
8805 params
[3] = n
[6].ui
;
8806 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8811 case OPCODE_WAIT_SYNC
:
8813 union uint64_pair p
;
8814 p
.uint32
[0] = n
[2].ui
;
8815 p
.uint32
[1] = n
[3].ui
;
8816 CALL_WaitSync(ctx
->Exec
,
8817 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8821 /* GL_NV_conditional_render */
8822 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8823 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8825 case OPCODE_END_CONDITIONAL_RENDER
:
8826 CALL_EndConditionalRender(ctx
->Exec
, ());
8829 case OPCODE_UNIFORM_BLOCK_BINDING
:
8830 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8833 case OPCODE_CONTINUE
:
8834 n
= (Node
*) get_pointer(&n
[1]);
8839 case OPCODE_END_OF_LIST
:
8845 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8847 _mesa_problem(ctx
, "%s", msg
);
8852 /* increment n to point to next compiled command */
8853 if (opcode
!= OPCODE_CONTINUE
) {
8854 n
+= InstSize
[opcode
];
8859 vbo_save_EndCallList(ctx
);
8861 ctx
->ListState
.CallDepth
--;
8866 /**********************************************************************/
8868 /**********************************************************************/
8871 * Test if a display list number is valid.
8873 GLboolean GLAPIENTRY
8874 _mesa_IsList(GLuint list
)
8876 GET_CURRENT_CONTEXT(ctx
);
8877 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8878 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8879 return islist(ctx
, list
);
8884 * Delete a sequence of consecutive display lists.
8887 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8889 GET_CURRENT_CONTEXT(ctx
);
8891 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8892 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8895 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8898 for (i
= list
; i
< list
+ range
; i
++) {
8899 destroy_list(ctx
, i
);
8905 * Return a display list number, n, such that lists n through n+range-1
8909 _mesa_GenLists(GLsizei range
)
8911 GET_CURRENT_CONTEXT(ctx
);
8913 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8914 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8917 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8925 * Make this an atomic operation
8927 mtx_lock(&ctx
->Shared
->Mutex
);
8929 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8931 /* reserve the list IDs by with empty/dummy lists */
8933 for (i
= 0; i
< range
; i
++) {
8934 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8935 make_list(base
+ i
, 1));
8939 mtx_unlock(&ctx
->Shared
->Mutex
);
8946 * Begin a new display list.
8949 _mesa_NewList(GLuint name
, GLenum mode
)
8951 GET_CURRENT_CONTEXT(ctx
);
8953 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8954 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8956 if (MESA_VERBOSE
& VERBOSE_API
)
8957 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8958 _mesa_enum_to_string(mode
));
8961 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8965 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8966 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8970 if (ctx
->ListState
.CurrentList
) {
8971 /* already compiling a display list */
8972 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8976 ctx
->CompileFlag
= GL_TRUE
;
8977 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8979 /* Reset accumulated list state */
8980 invalidate_saved_current_state( ctx
);
8982 /* Allocate new display list */
8983 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8984 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8985 ctx
->ListState
.CurrentPos
= 0;
8987 vbo_save_NewList(ctx
, name
, mode
);
8989 ctx
->CurrentDispatch
= ctx
->Save
;
8990 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8995 * End definition of current display list.
9000 GET_CURRENT_CONTEXT(ctx
);
9001 SAVE_FLUSH_VERTICES(ctx
);
9002 FLUSH_VERTICES(ctx
, 0);
9004 if (MESA_VERBOSE
& VERBOSE_API
)
9005 _mesa_debug(ctx
, "glEndList\n");
9007 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9008 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9009 "glEndList() called inside glBegin/End");
9012 /* Check that a list is under construction */
9013 if (!ctx
->ListState
.CurrentList
) {
9014 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9018 /* Call before emitting END_OF_LIST, in case the driver wants to
9019 * emit opcodes itself.
9021 vbo_save_EndList(ctx
);
9023 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9027 /* Destroy old list, if any */
9028 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9030 /* Install the new list */
9031 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9032 ctx
->ListState
.CurrentList
->Name
,
9033 ctx
->ListState
.CurrentList
);
9036 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9037 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9039 ctx
->ListState
.CurrentList
= NULL
;
9040 ctx
->ListState
.CurrentBlock
= NULL
;
9041 ctx
->ListState
.CurrentPos
= 0;
9042 ctx
->ExecuteFlag
= GL_TRUE
;
9043 ctx
->CompileFlag
= GL_FALSE
;
9045 ctx
->CurrentDispatch
= ctx
->Exec
;
9046 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9051 _mesa_CallList(GLuint list
)
9053 GLboolean save_compile_flag
;
9054 GET_CURRENT_CONTEXT(ctx
);
9055 FLUSH_CURRENT(ctx
, 0);
9057 if (MESA_VERBOSE
& VERBOSE_API
)
9058 _mesa_debug(ctx
, "glCallList %d\n", list
);
9061 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9066 mesa_print_display_list( list
);
9068 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9069 * execute the display list, and restore the CompileFlag.
9071 save_compile_flag
= ctx
->CompileFlag
;
9072 if (save_compile_flag
) {
9073 ctx
->CompileFlag
= GL_FALSE
;
9076 execute_list(ctx
, list
);
9077 ctx
->CompileFlag
= save_compile_flag
;
9079 /* also restore API function pointers to point to "save" versions */
9080 if (save_compile_flag
) {
9081 ctx
->CurrentDispatch
= ctx
->Save
;
9082 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9088 * Execute glCallLists: call multiple display lists.
9091 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9093 GET_CURRENT_CONTEXT(ctx
);
9095 GLboolean save_compile_flag
;
9097 if (MESA_VERBOSE
& VERBOSE_API
)
9098 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9102 case GL_UNSIGNED_BYTE
:
9104 case GL_UNSIGNED_SHORT
:
9106 case GL_UNSIGNED_INT
:
9114 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9119 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallLists(n < 0)");
9121 } else if (n
== 0 || lists
== NULL
) {
9126 /* Save the CompileFlag status, turn it off, execute display list,
9127 * and restore the CompileFlag.
9129 save_compile_flag
= ctx
->CompileFlag
;
9130 ctx
->CompileFlag
= GL_FALSE
;
9132 for (i
= 0; i
< n
; i
++) {
9133 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9134 execute_list(ctx
, list
);
9137 ctx
->CompileFlag
= save_compile_flag
;
9139 /* also restore API function pointers to point to "save" versions */
9140 if (save_compile_flag
) {
9141 ctx
->CurrentDispatch
= ctx
->Save
;
9142 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9148 * Set the offset added to list numbers in glCallLists.
9151 _mesa_ListBase(GLuint base
)
9153 GET_CURRENT_CONTEXT(ctx
);
9154 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9155 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9156 ctx
->List
.ListBase
= base
;
9160 * Setup the given dispatch table to point to Mesa's display list
9161 * building functions.
9163 * This does not include any of the tnl functions - they are
9164 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9168 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9170 struct _glapi_table
*table
= ctx
->Save
;
9171 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9173 /* Initially populate the dispatch table with the contents of the
9174 * normal-execution dispatch table. This lets us skip populating functions
9175 * that should be called directly instead of compiled into display lists.
9177 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9179 _mesa_loopback_init_api_table(ctx
, table
);
9182 vbo_initialize_save_dispatch(ctx
, table
);
9185 SET_Accum(table
, save_Accum
);
9186 SET_AlphaFunc(table
, save_AlphaFunc
);
9187 SET_Bitmap(table
, save_Bitmap
);
9188 SET_BlendFunc(table
, save_BlendFunc
);
9189 SET_CallList(table
, save_CallList
);
9190 SET_CallLists(table
, save_CallLists
);
9191 SET_Clear(table
, save_Clear
);
9192 SET_ClearAccum(table
, save_ClearAccum
);
9193 SET_ClearColor(table
, save_ClearColor
);
9194 SET_ClearDepth(table
, save_ClearDepth
);
9195 SET_ClearIndex(table
, save_ClearIndex
);
9196 SET_ClearStencil(table
, save_ClearStencil
);
9197 SET_ClipPlane(table
, save_ClipPlane
);
9198 SET_ColorMask(table
, save_ColorMask
);
9199 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9200 SET_ColorMaterial(table
, save_ColorMaterial
);
9201 SET_CopyPixels(table
, save_CopyPixels
);
9202 SET_CullFace(table
, save_CullFace
);
9203 SET_DepthFunc(table
, save_DepthFunc
);
9204 SET_DepthMask(table
, save_DepthMask
);
9205 SET_DepthRange(table
, save_DepthRange
);
9206 SET_Disable(table
, save_Disable
);
9207 SET_Disablei(table
, save_DisableIndexed
);
9208 SET_DrawBuffer(table
, save_DrawBuffer
);
9209 SET_DrawPixels(table
, save_DrawPixels
);
9210 SET_Enable(table
, save_Enable
);
9211 SET_Enablei(table
, save_EnableIndexed
);
9212 SET_EvalMesh1(table
, save_EvalMesh1
);
9213 SET_EvalMesh2(table
, save_EvalMesh2
);
9214 SET_Fogf(table
, save_Fogf
);
9215 SET_Fogfv(table
, save_Fogfv
);
9216 SET_Fogi(table
, save_Fogi
);
9217 SET_Fogiv(table
, save_Fogiv
);
9218 SET_FrontFace(table
, save_FrontFace
);
9219 SET_Frustum(table
, save_Frustum
);
9220 SET_Hint(table
, save_Hint
);
9221 SET_IndexMask(table
, save_IndexMask
);
9222 SET_InitNames(table
, save_InitNames
);
9223 SET_LightModelf(table
, save_LightModelf
);
9224 SET_LightModelfv(table
, save_LightModelfv
);
9225 SET_LightModeli(table
, save_LightModeli
);
9226 SET_LightModeliv(table
, save_LightModeliv
);
9227 SET_Lightf(table
, save_Lightf
);
9228 SET_Lightfv(table
, save_Lightfv
);
9229 SET_Lighti(table
, save_Lighti
);
9230 SET_Lightiv(table
, save_Lightiv
);
9231 SET_LineStipple(table
, save_LineStipple
);
9232 SET_LineWidth(table
, save_LineWidth
);
9233 SET_ListBase(table
, save_ListBase
);
9234 SET_LoadIdentity(table
, save_LoadIdentity
);
9235 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9236 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9237 SET_LoadName(table
, save_LoadName
);
9238 SET_LogicOp(table
, save_LogicOp
);
9239 SET_Map1d(table
, save_Map1d
);
9240 SET_Map1f(table
, save_Map1f
);
9241 SET_Map2d(table
, save_Map2d
);
9242 SET_Map2f(table
, save_Map2f
);
9243 SET_MapGrid1d(table
, save_MapGrid1d
);
9244 SET_MapGrid1f(table
, save_MapGrid1f
);
9245 SET_MapGrid2d(table
, save_MapGrid2d
);
9246 SET_MapGrid2f(table
, save_MapGrid2f
);
9247 SET_MatrixMode(table
, save_MatrixMode
);
9248 SET_MultMatrixd(table
, save_MultMatrixd
);
9249 SET_MultMatrixf(table
, save_MultMatrixf
);
9250 SET_NewList(table
, save_NewList
);
9251 SET_Ortho(table
, save_Ortho
);
9252 SET_PassThrough(table
, save_PassThrough
);
9253 SET_PixelMapfv(table
, save_PixelMapfv
);
9254 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9255 SET_PixelMapusv(table
, save_PixelMapusv
);
9256 SET_PixelTransferf(table
, save_PixelTransferf
);
9257 SET_PixelTransferi(table
, save_PixelTransferi
);
9258 SET_PixelZoom(table
, save_PixelZoom
);
9259 SET_PointSize(table
, save_PointSize
);
9260 SET_PolygonMode(table
, save_PolygonMode
);
9261 SET_PolygonOffset(table
, save_PolygonOffset
);
9262 SET_PolygonStipple(table
, save_PolygonStipple
);
9263 SET_PopAttrib(table
, save_PopAttrib
);
9264 SET_PopMatrix(table
, save_PopMatrix
);
9265 SET_PopName(table
, save_PopName
);
9266 SET_PushAttrib(table
, save_PushAttrib
);
9267 SET_PushMatrix(table
, save_PushMatrix
);
9268 SET_PushName(table
, save_PushName
);
9269 SET_RasterPos2d(table
, save_RasterPos2d
);
9270 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9271 SET_RasterPos2f(table
, save_RasterPos2f
);
9272 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9273 SET_RasterPos2i(table
, save_RasterPos2i
);
9274 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9275 SET_RasterPos2s(table
, save_RasterPos2s
);
9276 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9277 SET_RasterPos3d(table
, save_RasterPos3d
);
9278 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9279 SET_RasterPos3f(table
, save_RasterPos3f
);
9280 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9281 SET_RasterPos3i(table
, save_RasterPos3i
);
9282 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9283 SET_RasterPos3s(table
, save_RasterPos3s
);
9284 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9285 SET_RasterPos4d(table
, save_RasterPos4d
);
9286 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9287 SET_RasterPos4f(table
, save_RasterPos4f
);
9288 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9289 SET_RasterPos4i(table
, save_RasterPos4i
);
9290 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9291 SET_RasterPos4s(table
, save_RasterPos4s
);
9292 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9293 SET_ReadBuffer(table
, save_ReadBuffer
);
9294 SET_Rectf(table
, save_Rectf
);
9295 SET_Rotated(table
, save_Rotated
);
9296 SET_Rotatef(table
, save_Rotatef
);
9297 SET_Scaled(table
, save_Scaled
);
9298 SET_Scalef(table
, save_Scalef
);
9299 SET_Scissor(table
, save_Scissor
);
9300 SET_ShadeModel(table
, save_ShadeModel
);
9301 SET_StencilFunc(table
, save_StencilFunc
);
9302 SET_StencilMask(table
, save_StencilMask
);
9303 SET_StencilOp(table
, save_StencilOp
);
9304 SET_TexEnvf(table
, save_TexEnvf
);
9305 SET_TexEnvfv(table
, save_TexEnvfv
);
9306 SET_TexEnvi(table
, save_TexEnvi
);
9307 SET_TexEnviv(table
, save_TexEnviv
);
9308 SET_TexGend(table
, save_TexGend
);
9309 SET_TexGendv(table
, save_TexGendv
);
9310 SET_TexGenf(table
, save_TexGenf
);
9311 SET_TexGenfv(table
, save_TexGenfv
);
9312 SET_TexGeni(table
, save_TexGeni
);
9313 SET_TexGeniv(table
, save_TexGeniv
);
9314 SET_TexImage1D(table
, save_TexImage1D
);
9315 SET_TexImage2D(table
, save_TexImage2D
);
9316 SET_TexParameterf(table
, save_TexParameterf
);
9317 SET_TexParameterfv(table
, save_TexParameterfv
);
9318 SET_TexParameteri(table
, save_TexParameteri
);
9319 SET_TexParameteriv(table
, save_TexParameteriv
);
9320 SET_Translated(table
, save_Translated
);
9321 SET_Translatef(table
, save_Translatef
);
9322 SET_Viewport(table
, save_Viewport
);
9325 SET_BindTexture(table
, save_BindTexture
);
9326 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9327 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9328 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9329 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9330 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9331 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9332 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9335 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9336 SET_TexImage3D(table
, save_TexImage3D
);
9337 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9340 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9341 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9342 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9344 /* ATI_separate_stencil */
9345 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9347 /* GL_ARB_imaging */
9348 /* Not all are supported */
9349 SET_BlendColor(table
, save_BlendColor
);
9350 SET_BlendEquation(table
, save_BlendEquation
);
9352 /* 2. GL_EXT_blend_color */
9354 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9357 /* 3. GL_EXT_polygon_offset */
9358 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9360 /* 6. GL_EXT_texture3d */
9362 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9363 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9364 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9367 /* 37. GL_EXT_blend_minmax */
9369 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9372 /* 54. GL_EXT_point_parameters */
9373 SET_PointParameterf(table
, save_PointParameterfEXT
);
9374 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9376 /* 173. GL_EXT_blend_func_separate */
9377 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9379 /* 197. GL_MESA_window_pos */
9380 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9381 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9382 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9383 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9384 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9385 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9386 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9387 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9388 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9389 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9390 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9391 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9392 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9393 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9394 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9395 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9396 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9397 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9398 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9399 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9400 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9401 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9402 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9403 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9405 /* 233. GL_NV_vertex_program */
9406 /* The following commands DO NOT go into display lists:
9407 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9408 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9410 SET_BindProgramARB(table
, save_BindProgramNV
);
9412 /* 245. GL_ATI_fragment_shader */
9413 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9414 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9416 /* 262. GL_NV_point_sprite */
9417 SET_PointParameteri(table
, save_PointParameteriNV
);
9418 SET_PointParameteriv(table
, save_PointParameterivNV
);
9420 /* 268. GL_EXT_stencil_two_side */
9421 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9423 /* ???. GL_EXT_depth_bounds_test */
9424 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9426 /* ARB 1. GL_ARB_multitexture */
9427 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9429 /* ARB 3. GL_ARB_transpose_matrix */
9430 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9431 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9432 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9433 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9435 /* ARB 5. GL_ARB_multisample */
9436 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9438 /* ARB 12. GL_ARB_texture_compression */
9439 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9440 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9441 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9442 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9443 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9444 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9446 /* ARB 14. GL_ARB_point_parameters */
9447 /* aliased with EXT_point_parameters functions */
9449 /* ARB 25. GL_ARB_window_pos */
9450 /* aliased with MESA_window_pos functions */
9452 /* ARB 26. GL_ARB_vertex_program */
9453 /* ARB 27. GL_ARB_fragment_program */
9454 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9455 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9456 SET_BindProgramARB(table
, save_BindProgramNV
);
9457 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9458 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9459 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9460 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9461 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9462 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9463 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9464 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9466 SET_BeginQuery(table
, save_BeginQueryARB
);
9467 SET_EndQuery(table
, save_EndQueryARB
);
9468 SET_QueryCounter(table
, save_QueryCounter
);
9470 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9472 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9474 SET_UseProgram(table
, save_UseProgram
);
9475 SET_Uniform1f(table
, save_Uniform1fARB
);
9476 SET_Uniform2f(table
, save_Uniform2fARB
);
9477 SET_Uniform3f(table
, save_Uniform3fARB
);
9478 SET_Uniform4f(table
, save_Uniform4fARB
);
9479 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9480 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9481 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9482 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9483 SET_Uniform1i(table
, save_Uniform1iARB
);
9484 SET_Uniform2i(table
, save_Uniform2iARB
);
9485 SET_Uniform3i(table
, save_Uniform3iARB
);
9486 SET_Uniform4i(table
, save_Uniform4iARB
);
9487 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9488 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9489 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9490 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9491 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9492 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9493 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9494 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9495 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9496 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9497 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9498 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9499 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9501 /* 299. GL_EXT_blend_equation_separate */
9502 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9504 /* GL_EXT_gpu_program_parameters */
9505 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9506 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9508 /* 364. GL_EXT_provoking_vertex */
9509 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9511 /* GL_EXT_texture_integer */
9512 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9513 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9514 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9515 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9517 /* GL_ARB_clip_control */
9518 SET_ClipControl(table
, save_ClipControl
);
9520 /* GL_ARB_color_buffer_float */
9521 SET_ClampColor(table
, save_ClampColorARB
);
9524 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9525 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9526 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9527 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9529 SET_Uniform1ui(table
, save_Uniform1ui
);
9530 SET_Uniform2ui(table
, save_Uniform2ui
);
9531 SET_Uniform3ui(table
, save_Uniform3ui
);
9532 SET_Uniform4ui(table
, save_Uniform4ui
);
9533 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9534 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9535 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9536 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9538 (void) save_Uniform1ui
;
9539 (void) save_Uniform2ui
;
9540 (void) save_Uniform3ui
;
9541 (void) save_Uniform4ui
;
9542 (void) save_Uniform1uiv
;
9543 (void) save_Uniform2uiv
;
9544 (void) save_Uniform3uiv
;
9545 (void) save_Uniform4uiv
;
9549 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9550 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9551 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9552 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9553 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9554 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9555 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9556 SET_DrawTransformFeedbackInstanced(table
,
9557 save_DrawTransformFeedbackInstanced
);
9558 SET_DrawTransformFeedbackStreamInstanced(table
,
9559 save_DrawTransformFeedbackStreamInstanced
);
9560 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9561 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9563 /* GL_ARB_instanced_arrays */
9564 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9566 /* GL_NV_texture_barrier */
9567 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9569 SET_BindSampler(table
, save_BindSampler
);
9570 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9571 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9572 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9573 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9574 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9575 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9577 /* GL_ARB_draw_buffer_blend */
9578 SET_BlendFunciARB(table
, save_BlendFunci
);
9579 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9580 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9581 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9583 /* GL_NV_conditional_render */
9584 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9585 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9588 SET_WaitSync(table
, save_WaitSync
);
9590 /* GL_ARB_uniform_buffer_object */
9591 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9593 /* GL_ARB_draw_instanced */
9594 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9595 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9597 /* GL_ARB_draw_elements_base_vertex */
9598 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9600 /* GL_ARB_base_instance */
9601 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9602 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9603 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9605 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9606 SET_UseProgramStages(table
, save_UseProgramStages
);
9607 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9608 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9609 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9610 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9611 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9612 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9613 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9614 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9615 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9616 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9617 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9618 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9619 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9620 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9621 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9622 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9623 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9624 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9625 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9626 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9627 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9628 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9629 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9630 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9631 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9632 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9633 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9634 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9635 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9636 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9637 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9638 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9639 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9641 /* GL_EXT_polygon_offset_clamp */
9642 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
9648 enum_string(GLenum k
)
9650 return _mesa_enum_to_string(k
);
9655 * Print the commands in a display list. For debugging only.
9656 * TODO: many commands aren't handled yet.
9657 * \param fname filename to write display list to. If null, use stdout.
9659 static void GLAPIENTRY
9660 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9662 struct gl_display_list
*dlist
;
9668 f
= fopen(fname
, "w");
9673 if (!islist(ctx
, list
)) {
9674 fprintf(f
, "%u is not a display list ID\n", list
);
9678 dlist
= _mesa_lookup_list(ctx
, list
);
9684 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9686 done
= n
? GL_FALSE
: GL_TRUE
;
9688 const OpCode opcode
= n
[0].opcode
;
9690 if (is_ext_opcode(opcode
)) {
9691 n
+= ext_opcode_print(ctx
, n
, f
);
9696 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9698 case OPCODE_ACTIVE_TEXTURE
:
9699 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9702 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9703 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9704 get_pointer(&n
[7]));
9706 case OPCODE_BLEND_COLOR
:
9707 fprintf(f
, "BlendColor %f, %f, %f, %f\n",
9708 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9710 case OPCODE_BLEND_EQUATION
:
9711 fprintf(f
, "BlendEquation %s\n",
9712 enum_string(n
[1].e
));
9714 case OPCODE_BLEND_EQUATION_SEPARATE
:
9715 fprintf(f
, "BlendEquationSeparate %s, %s\n",
9716 enum_string(n
[1].e
),
9717 enum_string(n
[2].e
));
9719 case OPCODE_BLEND_FUNC_SEPARATE
:
9720 fprintf(f
, "BlendFuncSeparate %s, %s, %s, %s\n",
9721 enum_string(n
[1].e
),
9722 enum_string(n
[2].e
),
9723 enum_string(n
[3].e
),
9724 enum_string(n
[4].e
));
9726 case OPCODE_BLEND_EQUATION_I
:
9727 fprintf(f
, "BlendEquationi %u, %s\n",
9728 n
[1].ui
, enum_string(n
[2].e
));
9730 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
9731 fprintf(f
, "BlendEquationSeparatei %u, %s, %s\n",
9732 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9734 case OPCODE_BLEND_FUNC_I
:
9735 fprintf(f
, "BlendFunci %u, %s, %s\n",
9736 n
[1].ui
, enum_string(n
[2].e
), enum_string(n
[3].e
));
9738 case OPCODE_BLEND_FUNC_SEPARATE_I
:
9739 fprintf(f
, "BlendFuncSeparatei %u, %s, %s, %s, %s\n",
9741 enum_string(n
[2].e
),
9742 enum_string(n
[3].e
),
9743 enum_string(n
[4].e
),
9744 enum_string(n
[5].e
));
9746 case OPCODE_CALL_LIST
:
9747 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9749 case OPCODE_CALL_LISTS
:
9750 fprintf(f
, "CallLists %d, %s\n", n
[1].i
, enum_string(n
[1].e
));
9752 case OPCODE_DISABLE
:
9753 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9756 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9758 case OPCODE_FRUSTUM
:
9759 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9760 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9762 case OPCODE_LINE_STIPPLE
:
9763 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9765 case OPCODE_LINE_WIDTH
:
9766 fprintf(f
, "LineWidth %f\n", n
[1].f
);
9768 case OPCODE_LOAD_IDENTITY
:
9769 fprintf(f
, "LoadIdentity\n");
9771 case OPCODE_LOAD_MATRIX
:
9772 fprintf(f
, "LoadMatrix\n");
9773 fprintf(f
, " %8f %8f %8f %8f\n",
9774 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9775 fprintf(f
, " %8f %8f %8f %8f\n",
9776 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9777 fprintf(f
, " %8f %8f %8f %8f\n",
9778 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9779 fprintf(f
, " %8f %8f %8f %8f\n",
9780 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9782 case OPCODE_MULT_MATRIX
:
9783 fprintf(f
, "MultMatrix (or Rotate)\n");
9784 fprintf(f
, " %8f %8f %8f %8f\n",
9785 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9786 fprintf(f
, " %8f %8f %8f %8f\n",
9787 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9788 fprintf(f
, " %8f %8f %8f %8f\n",
9789 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9790 fprintf(f
, " %8f %8f %8f %8f\n",
9791 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9794 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9795 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9797 case OPCODE_POINT_SIZE
:
9798 fprintf(f
, "PointSize %f\n", n
[1].f
);
9800 case OPCODE_POP_ATTRIB
:
9801 fprintf(f
, "PopAttrib\n");
9803 case OPCODE_POP_MATRIX
:
9804 fprintf(f
, "PopMatrix\n");
9806 case OPCODE_POP_NAME
:
9807 fprintf(f
, "PopName\n");
9809 case OPCODE_PUSH_ATTRIB
:
9810 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9812 case OPCODE_PUSH_MATRIX
:
9813 fprintf(f
, "PushMatrix\n");
9815 case OPCODE_PUSH_NAME
:
9816 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9818 case OPCODE_RASTER_POS
:
9819 fprintf(f
, "RasterPos %g %g %g %g\n",
9820 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9823 fprintf(f
, "Rotate %g %g %g %g\n",
9824 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9827 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9829 case OPCODE_TRANSLATE
:
9830 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9832 case OPCODE_BIND_TEXTURE
:
9833 fprintf(f
, "BindTexture %s %d\n",
9834 _mesa_enum_to_string(n
[1].ui
), n
[2].ui
);
9836 case OPCODE_SHADE_MODEL
:
9837 fprintf(f
, "ShadeModel %s\n", _mesa_enum_to_string(n
[1].ui
));
9840 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9841 _mesa_enum_to_string(n
[1].ui
),
9842 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9845 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9846 _mesa_enum_to_string(n
[1].ui
),
9847 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9848 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9850 case OPCODE_MAPGRID1
:
9851 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9853 case OPCODE_MAPGRID2
:
9854 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9855 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9857 case OPCODE_EVALMESH1
:
9858 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9860 case OPCODE_EVALMESH2
:
9861 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9862 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9865 case OPCODE_ATTR_1F_NV
:
9866 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9868 case OPCODE_ATTR_2F_NV
:
9869 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9870 n
[1].i
, n
[2].f
, n
[3].f
);
9872 case OPCODE_ATTR_3F_NV
:
9873 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9874 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9876 case OPCODE_ATTR_4F_NV
:
9877 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9878 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9880 case OPCODE_ATTR_1F_ARB
:
9881 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9883 case OPCODE_ATTR_2F_ARB
:
9884 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9885 n
[1].i
, n
[2].f
, n
[3].f
);
9887 case OPCODE_ATTR_3F_ARB
:
9888 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9889 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9891 case OPCODE_ATTR_4F_ARB
:
9892 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9893 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9896 case OPCODE_MATERIAL
:
9897 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9898 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9901 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9904 fprintf(f
, "END\n");
9907 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9910 case OPCODE_EVAL_C1
:
9911 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9913 case OPCODE_EVAL_C2
:
9914 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9916 case OPCODE_EVAL_P1
:
9917 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9919 case OPCODE_EVAL_P2
:
9920 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9923 case OPCODE_PROVOKING_VERTEX
:
9924 fprintf(f
, "ProvokingVertex %s\n",
9925 _mesa_enum_to_string(n
[1].ui
));
9929 * meta opcodes/commands
9932 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
9933 (const char *) get_pointer(&n
[2]));
9935 case OPCODE_CONTINUE
:
9936 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
9937 n
= (Node
*) get_pointer(&n
[1]);
9940 fprintf(f
, "NOP\n");
9942 case OPCODE_END_OF_LIST
:
9943 fprintf(f
, "END-LIST %u\n", list
);
9947 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9949 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9950 opcode
, (void *) n
);
9954 fprintf(f
, "command %d, %u operands\n", opcode
,
9958 /* increment n to point to next compiled command */
9959 if (opcode
!= OPCODE_CONTINUE
) {
9960 n
+= InstSize
[opcode
];
9973 * Clients may call this function to help debug display list problems.
9974 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9975 * changed, or break in the future without notice.
9978 mesa_print_display_list(GLuint list
)
9980 GET_CURRENT_CONTEXT(ctx
);
9981 print_list(ctx
, list
, NULL
);
9985 /**********************************************************************/
9986 /***** Initialization *****/
9987 /**********************************************************************/
9990 save_vtxfmt_init(GLvertexformat
* vfmt
)
9992 vfmt
->ArrayElement
= _ae_ArrayElement
;
9994 vfmt
->Begin
= save_Begin
;
9996 vfmt
->CallList
= save_CallList
;
9997 vfmt
->CallLists
= save_CallLists
;
9999 vfmt
->Color3f
= save_Color3f
;
10000 vfmt
->Color3fv
= save_Color3fv
;
10001 vfmt
->Color4f
= save_Color4f
;
10002 vfmt
->Color4fv
= save_Color4fv
;
10003 vfmt
->EdgeFlag
= save_EdgeFlag
;
10004 vfmt
->End
= save_End
;
10006 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10007 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10008 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10009 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10010 vfmt
->EvalPoint1
= save_EvalPoint1
;
10011 vfmt
->EvalPoint2
= save_EvalPoint2
;
10013 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10014 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10015 vfmt
->Indexf
= save_Indexf
;
10016 vfmt
->Indexfv
= save_Indexfv
;
10017 vfmt
->Materialfv
= save_Materialfv
;
10018 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10019 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10020 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10021 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10022 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10023 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10024 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10025 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10026 vfmt
->Normal3f
= save_Normal3f
;
10027 vfmt
->Normal3fv
= save_Normal3fv
;
10028 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10029 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10030 vfmt
->TexCoord1f
= save_TexCoord1f
;
10031 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10032 vfmt
->TexCoord2f
= save_TexCoord2f
;
10033 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10034 vfmt
->TexCoord3f
= save_TexCoord3f
;
10035 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10036 vfmt
->TexCoord4f
= save_TexCoord4f
;
10037 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10038 vfmt
->Vertex2f
= save_Vertex2f
;
10039 vfmt
->Vertex2fv
= save_Vertex2fv
;
10040 vfmt
->Vertex3f
= save_Vertex3f
;
10041 vfmt
->Vertex3fv
= save_Vertex3fv
;
10042 vfmt
->Vertex4f
= save_Vertex4f
;
10043 vfmt
->Vertex4fv
= save_Vertex4fv
;
10044 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10045 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10046 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10047 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10048 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10049 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10050 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10051 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10056 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10057 const GLvertexformat
*vfmt
)
10059 SET_CallList(disp
, vfmt
->CallList
);
10060 SET_CallLists(disp
, vfmt
->CallLists
);
10065 * Initialize display list state for given context.
10068 _mesa_init_display_list(struct gl_context
*ctx
)
10070 static GLboolean tableInitialized
= GL_FALSE
;
10072 /* zero-out the instruction size table, just once */
10073 if (!tableInitialized
) {
10074 memset(InstSize
, 0, sizeof(InstSize
));
10075 tableInitialized
= GL_TRUE
;
10078 /* extension info */
10079 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10082 ctx
->ListState
.CallDepth
= 0;
10083 ctx
->ExecuteFlag
= GL_TRUE
;
10084 ctx
->CompileFlag
= GL_FALSE
;
10085 ctx
->ListState
.CurrentBlock
= NULL
;
10086 ctx
->ListState
.CurrentPos
= 0;
10088 /* Display List group */
10089 ctx
->List
.ListBase
= 0;
10091 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10093 InstSize
[OPCODE_NOP
] = 1;
10098 _mesa_free_display_list_data(struct gl_context
*ctx
)
10100 free(ctx
->ListExt
);
10101 ctx
->ListExt
= NULL
;