2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
36 #include "api_loopback.h"
37 #include "api_validate.h"
38 #include "atifragshader.h"
40 #include "bufferobj.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
61 #include "texstorage.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
67 #include "math/m_matrix.h"
69 #include "main/dispatch.h"
76 * Other parts of Mesa (such as the VBO module) can plug into the display
77 * list system. This structure describes new display list instructions.
79 struct gl_list_instruction
82 void (*Execute
)( struct gl_context
*ctx
, void *data
);
83 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
84 void (*Print
)( struct gl_context
*ctx
, void *data
);
88 #define MAX_DLIST_EXT_OPCODES 16
91 * Used by device drivers to hook new commands into display lists.
93 struct gl_list_extensions
95 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
104 * \param ctx GL context.
106 * Checks if dd_function_table::SaveNeedFlush is marked to flush
107 * stored (save) vertices, and calls
108 * dd_function_table::SaveFlushVertices if so.
110 #define SAVE_FLUSH_VERTICES(ctx) \
112 if (ctx->Driver.SaveNeedFlush) \
113 ctx->Driver.SaveFlushVertices(ctx); \
118 * Macro to assert that the API call was made outside the
119 * glBegin()/glEnd() pair, with return value.
121 * \param ctx GL context.
122 * \param retval value to return value in case the assertion fails.
124 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
126 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
127 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 * Macro to assert that the API call was made outside the
134 * glBegin()/glEnd() pair.
136 * \param ctx GL context.
138 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
140 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
141 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 * Macro to assert that the API call was made outside the
148 * glBegin()/glEnd() pair and flush the vertices.
150 * \param ctx GL context.
152 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
155 SAVE_FLUSH_VERTICES(ctx); \
159 * Macro to assert that the API call was made outside the
160 * glBegin()/glEnd() pair and flush the vertices, with return value.
162 * \param ctx GL context.
163 * \param retval value to return value in case the assertion fails.
165 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
167 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
168 SAVE_FLUSH_VERTICES(ctx); \
174 * Display list opcodes.
176 * The fact that these identifiers are assigned consecutive
177 * integer values starting at 0 is very important, see InstSize array usage)
181 OPCODE_INVALID
= -1, /* Force signed enum */
187 OPCODE_BLEND_EQUATION
,
188 OPCODE_BLEND_EQUATION_SEPARATE
,
189 OPCODE_BLEND_FUNC_SEPARATE
,
191 OPCODE_BLEND_EQUATION_I
,
192 OPCODE_BLEND_EQUATION_SEPARATE_I
,
194 OPCODE_BLEND_FUNC_SEPARATE_I
,
197 OPCODE_CALL_LIST_OFFSET
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COPY_TEX_IMAGE1D
,
214 OPCODE_COPY_TEX_IMAGE2D
,
215 OPCODE_COPY_TEX_SUB_IMAGE1D
,
216 OPCODE_COPY_TEX_SUB_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE3D
,
223 OPCODE_DISABLE_INDEXED
,
227 OPCODE_ENABLE_INDEXED
,
241 OPCODE_LOAD_IDENTITY
,
254 OPCODE_PIXEL_TRANSFER
,
257 OPCODE_POINT_PARAMETERS
,
259 OPCODE_POLYGON_STIPPLE
,
260 OPCODE_POLYGON_OFFSET
,
264 OPCODE_PRIORITIZE_TEXTURE
,
273 OPCODE_SELECT_TEXTURE_SGIS
,
274 OPCODE_SELECT_TEXTURE_COORD_SET
,
285 OPCODE_TEX_SUB_IMAGE1D
,
286 OPCODE_TEX_SUB_IMAGE2D
,
287 OPCODE_TEX_SUB_IMAGE3D
,
291 /* GL_ARB_multitexture */
292 OPCODE_ACTIVE_TEXTURE
,
293 /* GL_ARB_texture_compression */
294 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
300 /* GL_ARB_multisample */
301 OPCODE_SAMPLE_COVERAGE
,
302 /* GL_ARB_window_pos */
303 OPCODE_WINDOW_POS_ARB
,
304 /* GL_NV_fragment_program */
305 OPCODE_BIND_PROGRAM_NV
,
306 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
307 /* GL_EXT_stencil_two_side */
308 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
309 /* GL_EXT_depth_bounds_test */
310 OPCODE_DEPTH_BOUNDS_EXT
,
311 /* GL_ARB_vertex/fragment_program */
312 OPCODE_PROGRAM_STRING_ARB
,
313 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
314 /* GL_ARB_occlusion_query */
315 OPCODE_BEGIN_QUERY_ARB
,
316 OPCODE_END_QUERY_ARB
,
317 /* GL_ARB_draw_buffers */
318 OPCODE_DRAW_BUFFERS_ARB
,
319 /* GL_ATI_fragment_shader */
320 OPCODE_TEX_BUMP_PARAMETER_ATI
,
321 /* GL_ATI_fragment_shader */
322 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
323 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
325 OPCODE_STENCIL_FUNC_SEPARATE
,
326 OPCODE_STENCIL_OP_SEPARATE
,
327 OPCODE_STENCIL_MASK_SEPARATE
,
329 /* GL_ARB_shader_objects */
347 OPCODE_UNIFORM_MATRIX22
,
348 OPCODE_UNIFORM_MATRIX33
,
349 OPCODE_UNIFORM_MATRIX44
,
350 OPCODE_UNIFORM_MATRIX23
,
351 OPCODE_UNIFORM_MATRIX32
,
352 OPCODE_UNIFORM_MATRIX24
,
353 OPCODE_UNIFORM_MATRIX42
,
354 OPCODE_UNIFORM_MATRIX34
,
355 OPCODE_UNIFORM_MATRIX43
,
367 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
368 OPCODE_USE_PROGRAM_STAGES
,
369 OPCODE_PROGRAM_UNIFORM_1F
,
370 OPCODE_PROGRAM_UNIFORM_2F
,
371 OPCODE_PROGRAM_UNIFORM_3F
,
372 OPCODE_PROGRAM_UNIFORM_4F
,
373 OPCODE_PROGRAM_UNIFORM_1FV
,
374 OPCODE_PROGRAM_UNIFORM_2FV
,
375 OPCODE_PROGRAM_UNIFORM_3FV
,
376 OPCODE_PROGRAM_UNIFORM_4FV
,
377 OPCODE_PROGRAM_UNIFORM_1I
,
378 OPCODE_PROGRAM_UNIFORM_2I
,
379 OPCODE_PROGRAM_UNIFORM_3I
,
380 OPCODE_PROGRAM_UNIFORM_4I
,
381 OPCODE_PROGRAM_UNIFORM_1IV
,
382 OPCODE_PROGRAM_UNIFORM_2IV
,
383 OPCODE_PROGRAM_UNIFORM_3IV
,
384 OPCODE_PROGRAM_UNIFORM_4IV
,
385 OPCODE_PROGRAM_UNIFORM_1UI
,
386 OPCODE_PROGRAM_UNIFORM_2UI
,
387 OPCODE_PROGRAM_UNIFORM_3UI
,
388 OPCODE_PROGRAM_UNIFORM_4UI
,
389 OPCODE_PROGRAM_UNIFORM_1UIV
,
390 OPCODE_PROGRAM_UNIFORM_2UIV
,
391 OPCODE_PROGRAM_UNIFORM_3UIV
,
392 OPCODE_PROGRAM_UNIFORM_4UIV
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
403 /* GL_ARB_color_buffer_float */
406 /* GL_EXT_framebuffer_blit */
407 OPCODE_BLIT_FRAMEBUFFER
,
409 /* Vertex attributes -- fallback for when optimized display
410 * list build isn't active.
429 /* GL_EXT_provoking_vertex */
430 OPCODE_PROVOKING_VERTEX
,
432 /* GL_EXT_transform_feedback */
433 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
434 OPCODE_END_TRANSFORM_FEEDBACK
,
435 OPCODE_BIND_TRANSFORM_FEEDBACK
,
436 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
437 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
438 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
440 /* GL_EXT_texture_integer */
442 OPCODE_CLEARCOLOR_UI
,
443 OPCODE_TEXPARAMETER_I
,
444 OPCODE_TEXPARAMETER_UI
,
446 /* GL_EXT_separate_shader_objects */
447 OPCODE_ACTIVE_PROGRAM_EXT
,
448 OPCODE_USE_SHADER_PROGRAM_EXT
,
450 /* GL_ARB_instanced_arrays */
451 OPCODE_VERTEX_ATTRIB_DIVISOR
,
453 /* GL_NV_texture_barrier */
454 OPCODE_TEXTURE_BARRIER_NV
,
456 /* GL_ARB_sampler_object */
458 OPCODE_SAMPLER_PARAMETERIV
,
459 OPCODE_SAMPLER_PARAMETERFV
,
460 OPCODE_SAMPLER_PARAMETERIIV
,
461 OPCODE_SAMPLER_PARAMETERUIV
,
463 /* GL_ARB_geometry_shader4 */
464 OPCODE_PROGRAM_PARAMETERI
,
465 OPCODE_FRAMEBUFFER_TEXTURE
,
466 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
471 /* GL_NV_conditional_render */
472 OPCODE_BEGIN_CONDITIONAL_RENDER
,
473 OPCODE_END_CONDITIONAL_RENDER
,
475 /* ARB_timer_query */
476 OPCODE_QUERY_COUNTER
,
478 /* ARB_transform_feedback3 */
479 OPCODE_BEGIN_QUERY_INDEXED
,
480 OPCODE_END_QUERY_INDEXED
,
481 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
483 /* ARB_transform_feedback_instanced */
484 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
485 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
487 /* ARB_uniform_buffer_object */
488 OPCODE_UNIFORM_BLOCK_BINDING
,
490 /* The following three are meta instructions */
491 OPCODE_ERROR
, /* raise compiled-in error */
502 * Display list instructions are stored as sequences of "nodes". Nodes
503 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
504 * are linked together with a pointer.
506 * Each instruction in the display list is stored as a sequence of
507 * contiguous nodes in memory.
508 * Each node is the union of a variety of data types.
510 * Note, all of these members should be 4 bytes in size or less for the
511 * sake of compact display lists. We store 8-byte pointers in a pair of
512 * these nodes using the save/get_pointer() functions below.
530 typedef union gl_dlist_node Node
;
533 /** How many 4-byte dwords to store a pointer */
534 #define POINTER_DWORDS (sizeof(void *) / 4)
536 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
537 * space for display lists. The following types and functions are
538 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
543 GLuint dwords
[POINTER_DWORDS
];
548 * Save a 4 or 8-byte pointer at dest (and dest+1).
551 save_pointer(union gl_dlist_node
*dest
, void *src
)
556 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
557 STATIC_ASSERT(sizeof(union gl_dlist_node
) == 4);
561 for (i
= 0; i
< POINTER_DWORDS
; i
++)
562 dest
[i
].ui
= p
.dwords
[i
];
567 * Retrieve a 4 or 8-byte pointer from node (node+1).
570 get_pointer(const union gl_dlist_node
*node
)
575 for (i
= 0; i
< POINTER_DWORDS
; i
++)
576 p
.dwords
[i
] = node
[i
].ui
;
583 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
584 * environment. In 64-bit env, sizeof(Node)==8 anyway.
594 * How many nodes to allocate at a time. Note that bulk vertex data
595 * from glBegin/glVertex/glEnd primitives will typically wind up in
596 * a VBO, and not directly in the display list itself.
598 #define BLOCK_SIZE 256
603 * Number of nodes of storage needed for each instruction.
604 * Sizes for dynamically allocated opcodes are stored in the context struct.
606 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
609 void mesa_print_display_list(GLuint list
);
613 * Allocate a gl_display_list object with an initial block of storage.
614 * \param count how many display list nodes/tokes to allocate
616 static struct gl_display_list
*
617 make_list(GLuint name
, GLuint count
)
619 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
621 dlist
->Head
= malloc(sizeof(Node
) * count
);
622 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
628 * Lookup function to just encapsulate casting.
630 struct gl_display_list
*
631 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
633 return (struct gl_display_list
*)
634 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
638 /** Is the given opcode an extension code? */
639 static inline GLboolean
640 is_ext_opcode(OpCode opcode
)
642 return (opcode
>= OPCODE_EXT_0
);
646 /** Destroy an extended opcode instruction */
648 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
650 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
652 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
653 step
= ctx
->ListExt
->Opcode
[i
].Size
;
658 /** Execute an extended opcode instruction */
660 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
662 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
664 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
665 step
= ctx
->ListExt
->Opcode
[i
].Size
;
670 /** Print an extended opcode instruction */
672 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
674 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
676 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
677 step
= ctx
->ListExt
->Opcode
[i
].Size
;
683 * Delete the named display list, but don't remove from hash table.
684 * \param dlist - display list pointer
687 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
692 n
= block
= dlist
->Head
;
694 done
= block
? GL_FALSE
: GL_TRUE
;
696 const OpCode opcode
= n
[0].opcode
;
698 /* check for extension opcodes first */
699 if (is_ext_opcode(opcode
)) {
700 n
+= ext_opcode_destroy(ctx
, n
);
704 /* for some commands, we need to free malloc'd memory */
706 free(get_pointer(&n
[6]));
707 n
+= InstSize
[n
[0].opcode
];
710 free(get_pointer(&n
[10]));
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 if (type
== GL_BITMAP
)
964 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
966 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
967 format
, type
, pixels
, unpack
);
968 if (pixels
&& !image
) {
969 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
973 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
974 depth
, format
, type
, INT_MAX
, pixels
)) {
975 const GLubyte
*map
, *src
;
979 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
980 GL_MAP_READ_BIT
, unpack
->BufferObj
,
983 /* unable to map src buffer! */
984 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
988 src
= ADD_POINTERS(map
, pixels
);
989 if (type
== GL_BITMAP
)
990 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
992 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
993 format
, type
, src
, unpack
);
995 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
998 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1004 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1009 /** Return copy of memory */
1011 memdup(const void *src
, GLsizei bytes
)
1013 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1015 memcpy(b
, src
, bytes
);
1021 * Allocate space for a display list instruction (opcode + payload space).
1022 * \param opcode the instruction opcode (OPCODE_* value)
1023 * \param bytes instruction payload size (not counting opcode)
1024 * \return pointer to allocated memory (the opcode space)
1027 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
1029 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1030 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1033 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
1034 if (InstSize
[opcode
] == 0) {
1035 /* save instruction size now */
1036 InstSize
[opcode
] = numNodes
;
1039 /* make sure instruction size agrees */
1040 ASSERT(numNodes
== InstSize
[opcode
]);
1044 if (ctx
->ListState
.CurrentPos
+ numNodes
+ contNodes
> BLOCK_SIZE
) {
1045 /* This block is full. Allocate a new block and chain to it */
1047 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1048 n
[0].opcode
= OPCODE_CONTINUE
;
1049 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1051 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1054 save_pointer(&n
[1], newblock
);
1055 ctx
->ListState
.CurrentBlock
= newblock
;
1056 ctx
->ListState
.CurrentPos
= 0;
1059 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1060 ctx
->ListState
.CurrentPos
+= numNodes
;
1062 n
[0].opcode
= opcode
;
1070 * Allocate space for a display list instruction. Used by callers outside
1071 * this file for things like VBO vertex data.
1073 * \param opcode the instruction opcode (OPCODE_* value)
1074 * \param bytes instruction size in bytes, not counting opcode.
1075 * \return pointer to the usable data area (not including the internal
1079 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1081 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
1083 return n
+ 1; /* return pointer to payload area, after opcode */
1090 * This function allows modules and drivers to get their own opcodes
1091 * for extending display list functionality.
1092 * \param ctx the rendering context
1093 * \param size number of bytes for storing the new display list command
1094 * \param execute function to execute the new display list command
1095 * \param destroy function to destroy the new display list command
1096 * \param print function to print the new display list command
1097 * \return the new opcode number or -1 if error
1100 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1102 void (*execute
) (struct gl_context
*, void *),
1103 void (*destroy
) (struct gl_context
*, void *),
1104 void (*print
) (struct gl_context
*, void *))
1106 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1107 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1108 ctx
->ListExt
->Opcode
[i
].Size
=
1109 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1110 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1111 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1112 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1113 return i
+ OPCODE_EXT_0
;
1120 * Allocate space for a display list instruction. The space is basically
1121 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1122 * function parameter, node[2] is the second parameter, etc.
1124 * \param opcode one of OPCODE_x
1125 * \param nparams number of function parameters
1126 * \return pointer to start of instruction space
1128 static inline Node
*
1129 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1131 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1136 * Called by EndList to try to reduce memory used for the list.
1139 trim_list(struct gl_context
*ctx
)
1141 /* If the list we're ending only has one allocated block of nodes/tokens
1142 * and its size isn't a full block size, realloc the block to use less
1143 * memory. This is important for apps that create many small display
1144 * lists and apps that use glXUseXFont (many lists each containing one
1146 * Note: we currently only trim display lists that allocated one block
1147 * of tokens. That hits the short list case which is what we're mainly
1148 * concerned with. Trimming longer lists would involve traversing the
1149 * linked list of blocks.
1151 struct gl_dlist_state
*list
= &ctx
->ListState
;
1153 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1154 (list
->CurrentPos
< BLOCK_SIZE
)) {
1155 /* There's only one block and it's not full, so realloc */
1156 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1157 list
->CurrentList
->Head
=
1158 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1159 if (!list
->CurrentBlock
) {
1160 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1168 * Display List compilation functions
1170 static void GLAPIENTRY
1171 save_Accum(GLenum op
, GLfloat value
)
1173 GET_CURRENT_CONTEXT(ctx
);
1175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1176 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1181 if (ctx
->ExecuteFlag
) {
1182 CALL_Accum(ctx
->Exec
, (op
, value
));
1187 static void GLAPIENTRY
1188 save_AlphaFunc(GLenum func
, GLclampf ref
)
1190 GET_CURRENT_CONTEXT(ctx
);
1192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1193 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1196 n
[2].f
= (GLfloat
) ref
;
1198 if (ctx
->ExecuteFlag
) {
1199 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1204 static void GLAPIENTRY
1205 save_BindTexture(GLenum target
, GLuint texture
)
1207 GET_CURRENT_CONTEXT(ctx
);
1209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1210 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1215 if (ctx
->ExecuteFlag
) {
1216 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1221 static void GLAPIENTRY
1222 save_Bitmap(GLsizei width
, GLsizei height
,
1223 GLfloat xorig
, GLfloat yorig
,
1224 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1226 GET_CURRENT_CONTEXT(ctx
);
1228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1229 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1231 n
[1].i
= (GLint
) width
;
1232 n
[2].i
= (GLint
) height
;
1238 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1239 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1241 if (ctx
->ExecuteFlag
) {
1242 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1243 xorig
, yorig
, xmove
, ymove
, pixels
));
1248 static void GLAPIENTRY
1249 save_BlendEquation(GLenum mode
)
1251 GET_CURRENT_CONTEXT(ctx
);
1253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1254 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1258 if (ctx
->ExecuteFlag
) {
1259 CALL_BlendEquation(ctx
->Exec
, (mode
));
1264 static void GLAPIENTRY
1265 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1267 GET_CURRENT_CONTEXT(ctx
);
1269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1270 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1275 if (ctx
->ExecuteFlag
) {
1276 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1281 static void GLAPIENTRY
1282 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1283 GLenum sfactorA
, GLenum dfactorA
)
1285 GET_CURRENT_CONTEXT(ctx
);
1287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1288 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1290 n
[1].e
= sfactorRGB
;
1291 n
[2].e
= dfactorRGB
;
1295 if (ctx
->ExecuteFlag
) {
1296 CALL_BlendFuncSeparate(ctx
->Exec
,
1297 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1302 static void GLAPIENTRY
1303 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1305 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1309 static void GLAPIENTRY
1310 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1312 GET_CURRENT_CONTEXT(ctx
);
1314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1315 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1322 if (ctx
->ExecuteFlag
) {
1323 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1327 /* GL_ARB_draw_buffers_blend */
1328 static void GLAPIENTRY
1329 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1330 GLenum sfactorA
, GLenum dfactorA
)
1332 GET_CURRENT_CONTEXT(ctx
);
1334 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1335 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1338 n
[2].e
= sfactorRGB
;
1339 n
[3].e
= dfactorRGB
;
1343 if (ctx
->ExecuteFlag
) {
1344 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1345 sfactorA
, dfactorA
));
1349 /* GL_ARB_draw_buffers_blend */
1350 static void GLAPIENTRY
1351 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1353 GET_CURRENT_CONTEXT(ctx
);
1355 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1356 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1362 if (ctx
->ExecuteFlag
) {
1363 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1367 /* GL_ARB_draw_buffers_blend */
1368 static void GLAPIENTRY
1369 save_BlendEquationi(GLuint buf
, GLenum mode
)
1371 GET_CURRENT_CONTEXT(ctx
);
1373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1374 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1379 if (ctx
->ExecuteFlag
) {
1380 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1384 /* GL_ARB_draw_buffers_blend */
1385 static void GLAPIENTRY
1386 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1388 GET_CURRENT_CONTEXT(ctx
);
1390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1391 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1397 if (ctx
->ExecuteFlag
) {
1398 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1403 /* GL_ARB_draw_instanced. */
1404 static void GLAPIENTRY
1405 save_DrawArraysInstancedARB(GLenum mode
,
1410 GET_CURRENT_CONTEXT(ctx
);
1411 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1412 "glDrawArraysInstanced() during display list compile");
1415 static void GLAPIENTRY
1416 save_DrawElementsInstancedARB(GLenum mode
,
1419 const GLvoid
*indices
,
1422 GET_CURRENT_CONTEXT(ctx
);
1423 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1424 "glDrawElementsInstanced() during display list compile");
1427 static void GLAPIENTRY
1428 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1431 const GLvoid
*indices
,
1435 GET_CURRENT_CONTEXT(ctx
);
1436 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1437 "glDrawElementsInstancedBaseVertex() during display list compile");
1440 /* GL_ARB_base_instance. */
1441 static void GLAPIENTRY
1442 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1446 GLuint baseinstance
)
1448 GET_CURRENT_CONTEXT(ctx
);
1449 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1450 "glDrawArraysInstancedBaseInstance() during display list compile");
1453 static void APIENTRY
1454 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1457 const void *indices
,
1459 GLuint baseinstance
)
1461 GET_CURRENT_CONTEXT(ctx
);
1462 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1463 "glDrawElementsInstancedBaseInstance() during display list compile");
1466 static void APIENTRY
1467 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1470 const void *indices
,
1473 GLuint baseinstance
)
1475 GET_CURRENT_CONTEXT(ctx
);
1476 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1477 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1482 * While building a display list we cache some OpenGL state.
1483 * Under some circumstances we need to invalidate that state (immediately
1484 * when we start compiling a list, or after glCallList(s)).
1487 invalidate_saved_current_state(struct gl_context
*ctx
)
1491 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1492 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1494 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1495 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1497 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1499 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1503 static void GLAPIENTRY
1504 save_CallList(GLuint list
)
1506 GET_CURRENT_CONTEXT(ctx
);
1508 SAVE_FLUSH_VERTICES(ctx
);
1510 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1515 /* After this, we don't know what state we're in. Invalidate all
1516 * cached information previously gathered:
1518 invalidate_saved_current_state( ctx
);
1520 if (ctx
->ExecuteFlag
) {
1521 _mesa_CallList(list
);
1526 static void GLAPIENTRY
1527 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1529 GET_CURRENT_CONTEXT(ctx
);
1531 GLboolean typeErrorFlag
;
1533 SAVE_FLUSH_VERTICES(ctx
);
1537 case GL_UNSIGNED_BYTE
:
1539 case GL_UNSIGNED_SHORT
:
1541 case GL_UNSIGNED_INT
:
1546 typeErrorFlag
= GL_FALSE
;
1549 typeErrorFlag
= GL_TRUE
;
1552 for (i
= 0; i
< num
; i
++) {
1553 GLint list
= translate_id(i
, type
, lists
);
1554 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1557 n
[2].b
= typeErrorFlag
;
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 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1572 static void GLAPIENTRY
1573 save_Clear(GLbitfield mask
)
1575 GET_CURRENT_CONTEXT(ctx
);
1577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1578 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1582 if (ctx
->ExecuteFlag
) {
1583 CALL_Clear(ctx
->Exec
, (mask
));
1588 static void GLAPIENTRY
1589 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1591 GET_CURRENT_CONTEXT(ctx
);
1593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1594 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1597 n
[2].i
= drawbuffer
;
1599 if (buffer
== GL_COLOR
) {
1610 if (ctx
->ExecuteFlag
) {
1611 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1616 static void GLAPIENTRY
1617 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1619 GET_CURRENT_CONTEXT(ctx
);
1621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1622 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1625 n
[2].i
= drawbuffer
;
1627 if (buffer
== GL_COLOR
) {
1638 if (ctx
->ExecuteFlag
) {
1639 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1644 static void GLAPIENTRY
1645 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1647 GET_CURRENT_CONTEXT(ctx
);
1649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1650 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1653 n
[2].i
= drawbuffer
;
1655 if (buffer
== GL_COLOR
) {
1666 if (ctx
->ExecuteFlag
) {
1667 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1672 static void GLAPIENTRY
1673 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1674 GLfloat depth
, GLint stencil
)
1676 GET_CURRENT_CONTEXT(ctx
);
1678 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1679 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1682 n
[2].i
= drawbuffer
;
1686 if (ctx
->ExecuteFlag
) {
1687 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1692 static void GLAPIENTRY
1693 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1695 GET_CURRENT_CONTEXT(ctx
);
1697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1698 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1705 if (ctx
->ExecuteFlag
) {
1706 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1711 static void GLAPIENTRY
1712 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1714 GET_CURRENT_CONTEXT(ctx
);
1716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1717 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1724 if (ctx
->ExecuteFlag
) {
1725 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1730 static void GLAPIENTRY
1731 save_ClearDepth(GLclampd depth
)
1733 GET_CURRENT_CONTEXT(ctx
);
1735 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1736 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1738 n
[1].f
= (GLfloat
) depth
;
1740 if (ctx
->ExecuteFlag
) {
1741 CALL_ClearDepth(ctx
->Exec
, (depth
));
1746 static void GLAPIENTRY
1747 save_ClearIndex(GLfloat c
)
1749 GET_CURRENT_CONTEXT(ctx
);
1751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1752 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1756 if (ctx
->ExecuteFlag
) {
1757 CALL_ClearIndex(ctx
->Exec
, (c
));
1762 static void GLAPIENTRY
1763 save_ClearStencil(GLint s
)
1765 GET_CURRENT_CONTEXT(ctx
);
1767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1768 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1772 if (ctx
->ExecuteFlag
) {
1773 CALL_ClearStencil(ctx
->Exec
, (s
));
1778 static void GLAPIENTRY
1779 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1781 GET_CURRENT_CONTEXT(ctx
);
1783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1784 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1787 n
[2].f
= (GLfloat
) equ
[0];
1788 n
[3].f
= (GLfloat
) equ
[1];
1789 n
[4].f
= (GLfloat
) equ
[2];
1790 n
[5].f
= (GLfloat
) equ
[3];
1792 if (ctx
->ExecuteFlag
) {
1793 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1799 static void GLAPIENTRY
1800 save_ColorMask(GLboolean red
, GLboolean green
,
1801 GLboolean blue
, GLboolean alpha
)
1803 GET_CURRENT_CONTEXT(ctx
);
1805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1806 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1813 if (ctx
->ExecuteFlag
) {
1814 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1819 static void GLAPIENTRY
1820 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1821 GLboolean blue
, GLboolean alpha
)
1823 GET_CURRENT_CONTEXT(ctx
);
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1826 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1834 if (ctx
->ExecuteFlag
) {
1835 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1840 static void GLAPIENTRY
1841 save_ColorMaterial(GLenum face
, GLenum mode
)
1843 GET_CURRENT_CONTEXT(ctx
);
1845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1847 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1852 if (ctx
->ExecuteFlag
) {
1853 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1858 static void GLAPIENTRY
1859 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1861 GET_CURRENT_CONTEXT(ctx
);
1863 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1864 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1868 n
[3].i
= (GLint
) width
;
1869 n
[4].i
= (GLint
) height
;
1872 if (ctx
->ExecuteFlag
) {
1873 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1879 static void GLAPIENTRY
1880 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1881 GLint x
, GLint y
, GLsizei width
, GLint border
)
1883 GET_CURRENT_CONTEXT(ctx
);
1885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1886 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1890 n
[3].e
= internalformat
;
1896 if (ctx
->ExecuteFlag
) {
1897 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1898 x
, y
, width
, border
));
1903 static void GLAPIENTRY
1904 save_CopyTexImage2D(GLenum target
, GLint level
,
1905 GLenum internalformat
,
1906 GLint x
, GLint y
, GLsizei width
,
1907 GLsizei height
, GLint border
)
1909 GET_CURRENT_CONTEXT(ctx
);
1911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1912 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1916 n
[3].e
= internalformat
;
1923 if (ctx
->ExecuteFlag
) {
1924 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1925 x
, y
, width
, height
, border
));
1931 static void GLAPIENTRY
1932 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1933 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1935 GET_CURRENT_CONTEXT(ctx
);
1937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1938 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1947 if (ctx
->ExecuteFlag
) {
1948 CALL_CopyTexSubImage1D(ctx
->Exec
,
1949 (target
, level
, xoffset
, x
, y
, width
));
1954 static void GLAPIENTRY
1955 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1956 GLint xoffset
, GLint yoffset
,
1957 GLint x
, GLint y
, GLsizei width
, GLint height
)
1959 GET_CURRENT_CONTEXT(ctx
);
1961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1962 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1973 if (ctx
->ExecuteFlag
) {
1974 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1975 x
, y
, width
, height
));
1980 static void GLAPIENTRY
1981 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1982 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1983 GLint x
, GLint y
, GLsizei width
, GLint height
)
1985 GET_CURRENT_CONTEXT(ctx
);
1987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1988 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2000 if (ctx
->ExecuteFlag
) {
2001 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2002 xoffset
, yoffset
, zoffset
,
2003 x
, y
, width
, height
));
2008 static void GLAPIENTRY
2009 save_CullFace(GLenum mode
)
2011 GET_CURRENT_CONTEXT(ctx
);
2013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2014 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2018 if (ctx
->ExecuteFlag
) {
2019 CALL_CullFace(ctx
->Exec
, (mode
));
2024 static void GLAPIENTRY
2025 save_DepthFunc(GLenum func
)
2027 GET_CURRENT_CONTEXT(ctx
);
2029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2030 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2034 if (ctx
->ExecuteFlag
) {
2035 CALL_DepthFunc(ctx
->Exec
, (func
));
2040 static void GLAPIENTRY
2041 save_DepthMask(GLboolean mask
)
2043 GET_CURRENT_CONTEXT(ctx
);
2045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2046 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2050 if (ctx
->ExecuteFlag
) {
2051 CALL_DepthMask(ctx
->Exec
, (mask
));
2056 static void GLAPIENTRY
2057 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2059 GET_CURRENT_CONTEXT(ctx
);
2061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2062 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2064 n
[1].f
= (GLfloat
) nearval
;
2065 n
[2].f
= (GLfloat
) farval
;
2067 if (ctx
->ExecuteFlag
) {
2068 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2073 static void GLAPIENTRY
2074 save_Disable(GLenum cap
)
2076 GET_CURRENT_CONTEXT(ctx
);
2078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2079 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2083 if (ctx
->ExecuteFlag
) {
2084 CALL_Disable(ctx
->Exec
, (cap
));
2089 static void GLAPIENTRY
2090 save_DisableIndexed(GLuint index
, GLenum cap
)
2092 GET_CURRENT_CONTEXT(ctx
);
2094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2095 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2100 if (ctx
->ExecuteFlag
) {
2101 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2106 static void GLAPIENTRY
2107 save_DrawBuffer(GLenum mode
)
2109 GET_CURRENT_CONTEXT(ctx
);
2111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2112 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2116 if (ctx
->ExecuteFlag
) {
2117 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2122 static void GLAPIENTRY
2123 save_DrawPixels(GLsizei width
, GLsizei height
,
2124 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2126 GET_CURRENT_CONTEXT(ctx
);
2129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2131 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2138 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2139 pixels
, &ctx
->Unpack
));
2141 if (ctx
->ExecuteFlag
) {
2142 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2148 static void GLAPIENTRY
2149 save_Enable(GLenum cap
)
2151 GET_CURRENT_CONTEXT(ctx
);
2153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2154 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2158 if (ctx
->ExecuteFlag
) {
2159 CALL_Enable(ctx
->Exec
, (cap
));
2165 static void GLAPIENTRY
2166 save_EnableIndexed(GLuint index
, GLenum cap
)
2168 GET_CURRENT_CONTEXT(ctx
);
2170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2171 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2176 if (ctx
->ExecuteFlag
) {
2177 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2183 static void GLAPIENTRY
2184 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2186 GET_CURRENT_CONTEXT(ctx
);
2188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2189 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2195 if (ctx
->ExecuteFlag
) {
2196 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2201 static void GLAPIENTRY
2202 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2204 GET_CURRENT_CONTEXT(ctx
);
2206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2207 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2215 if (ctx
->ExecuteFlag
) {
2216 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2223 static void GLAPIENTRY
2224 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2226 GET_CURRENT_CONTEXT(ctx
);
2228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2229 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2237 if (ctx
->ExecuteFlag
) {
2238 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2243 static void GLAPIENTRY
2244 save_Fogf(GLenum pname
, GLfloat param
)
2248 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2249 save_Fogfv(pname
, parray
);
2253 static void GLAPIENTRY
2254 save_Fogiv(GLenum pname
, const GLint
*params
)
2259 case GL_FOG_DENSITY
:
2263 p
[0] = (GLfloat
) *params
;
2269 p
[0] = INT_TO_FLOAT(params
[0]);
2270 p
[1] = INT_TO_FLOAT(params
[1]);
2271 p
[2] = INT_TO_FLOAT(params
[2]);
2272 p
[3] = INT_TO_FLOAT(params
[3]);
2275 /* Error will be caught later in gl_Fogfv */
2276 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2278 save_Fogfv(pname
, p
);
2282 static void GLAPIENTRY
2283 save_Fogi(GLenum pname
, GLint param
)
2287 parray
[1] = parray
[2] = parray
[3] = 0;
2288 save_Fogiv(pname
, parray
);
2292 static void GLAPIENTRY
2293 save_FrontFace(GLenum mode
)
2295 GET_CURRENT_CONTEXT(ctx
);
2297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2298 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2302 if (ctx
->ExecuteFlag
) {
2303 CALL_FrontFace(ctx
->Exec
, (mode
));
2308 static void GLAPIENTRY
2309 save_Frustum(GLdouble left
, GLdouble right
,
2310 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2312 GET_CURRENT_CONTEXT(ctx
);
2314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2315 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2317 n
[1].f
= (GLfloat
) left
;
2318 n
[2].f
= (GLfloat
) right
;
2319 n
[3].f
= (GLfloat
) bottom
;
2320 n
[4].f
= (GLfloat
) top
;
2321 n
[5].f
= (GLfloat
) nearval
;
2322 n
[6].f
= (GLfloat
) farval
;
2324 if (ctx
->ExecuteFlag
) {
2325 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2330 static void GLAPIENTRY
2331 save_Hint(GLenum target
, GLenum mode
)
2333 GET_CURRENT_CONTEXT(ctx
);
2335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2336 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2341 if (ctx
->ExecuteFlag
) {
2342 CALL_Hint(ctx
->Exec
, (target
, mode
));
2347 static void GLAPIENTRY
2348 save_IndexMask(GLuint mask
)
2350 GET_CURRENT_CONTEXT(ctx
);
2352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2353 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2357 if (ctx
->ExecuteFlag
) {
2358 CALL_IndexMask(ctx
->Exec
, (mask
));
2363 static void GLAPIENTRY
2364 save_InitNames(void)
2366 GET_CURRENT_CONTEXT(ctx
);
2367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2368 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2369 if (ctx
->ExecuteFlag
) {
2370 CALL_InitNames(ctx
->Exec
, ());
2375 static void GLAPIENTRY
2376 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2378 GET_CURRENT_CONTEXT(ctx
);
2380 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2381 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2399 case GL_SPOT_DIRECTION
:
2402 case GL_SPOT_EXPONENT
:
2405 case GL_SPOT_CUTOFF
:
2408 case GL_CONSTANT_ATTENUATION
:
2411 case GL_LINEAR_ATTENUATION
:
2414 case GL_QUADRATIC_ATTENUATION
:
2420 for (i
= 0; i
< nParams
; i
++) {
2421 n
[3 + i
].f
= params
[i
];
2424 if (ctx
->ExecuteFlag
) {
2425 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2430 static void GLAPIENTRY
2431 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2435 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2436 save_Lightfv(light
, pname
, parray
);
2440 static void GLAPIENTRY
2441 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2448 fparam
[0] = INT_TO_FLOAT(params
[0]);
2449 fparam
[1] = INT_TO_FLOAT(params
[1]);
2450 fparam
[2] = INT_TO_FLOAT(params
[2]);
2451 fparam
[3] = INT_TO_FLOAT(params
[3]);
2454 fparam
[0] = (GLfloat
) params
[0];
2455 fparam
[1] = (GLfloat
) params
[1];
2456 fparam
[2] = (GLfloat
) params
[2];
2457 fparam
[3] = (GLfloat
) params
[3];
2459 case GL_SPOT_DIRECTION
:
2460 fparam
[0] = (GLfloat
) params
[0];
2461 fparam
[1] = (GLfloat
) params
[1];
2462 fparam
[2] = (GLfloat
) params
[2];
2464 case GL_SPOT_EXPONENT
:
2465 case GL_SPOT_CUTOFF
:
2466 case GL_CONSTANT_ATTENUATION
:
2467 case GL_LINEAR_ATTENUATION
:
2468 case GL_QUADRATIC_ATTENUATION
:
2469 fparam
[0] = (GLfloat
) params
[0];
2472 /* error will be caught later in gl_Lightfv */
2475 save_Lightfv(light
, pname
, fparam
);
2479 static void GLAPIENTRY
2480 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2484 parray
[1] = parray
[2] = parray
[3] = 0;
2485 save_Lightiv(light
, pname
, parray
);
2489 static void GLAPIENTRY
2490 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2492 GET_CURRENT_CONTEXT(ctx
);
2494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2495 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2503 if (ctx
->ExecuteFlag
) {
2504 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2509 static void GLAPIENTRY
2510 save_LightModelf(GLenum pname
, GLfloat param
)
2514 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2515 save_LightModelfv(pname
, parray
);
2519 static void GLAPIENTRY
2520 save_LightModeliv(GLenum pname
, const GLint
*params
)
2524 case GL_LIGHT_MODEL_AMBIENT
:
2525 fparam
[0] = INT_TO_FLOAT(params
[0]);
2526 fparam
[1] = INT_TO_FLOAT(params
[1]);
2527 fparam
[2] = INT_TO_FLOAT(params
[2]);
2528 fparam
[3] = INT_TO_FLOAT(params
[3]);
2530 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2531 case GL_LIGHT_MODEL_TWO_SIDE
:
2532 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2533 fparam
[0] = (GLfloat
) params
[0];
2539 /* Error will be caught later in gl_LightModelfv */
2540 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2542 save_LightModelfv(pname
, fparam
);
2546 static void GLAPIENTRY
2547 save_LightModeli(GLenum pname
, GLint param
)
2551 parray
[1] = parray
[2] = parray
[3] = 0;
2552 save_LightModeliv(pname
, parray
);
2556 static void GLAPIENTRY
2557 save_LineStipple(GLint factor
, GLushort pattern
)
2559 GET_CURRENT_CONTEXT(ctx
);
2561 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2562 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2567 if (ctx
->ExecuteFlag
) {
2568 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2573 static void GLAPIENTRY
2574 save_LineWidth(GLfloat width
)
2576 GET_CURRENT_CONTEXT(ctx
);
2578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2579 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2583 if (ctx
->ExecuteFlag
) {
2584 CALL_LineWidth(ctx
->Exec
, (width
));
2589 static void GLAPIENTRY
2590 save_ListBase(GLuint base
)
2592 GET_CURRENT_CONTEXT(ctx
);
2594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2595 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2599 if (ctx
->ExecuteFlag
) {
2600 CALL_ListBase(ctx
->Exec
, (base
));
2605 static void GLAPIENTRY
2606 save_LoadIdentity(void)
2608 GET_CURRENT_CONTEXT(ctx
);
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2610 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2611 if (ctx
->ExecuteFlag
) {
2612 CALL_LoadIdentity(ctx
->Exec
, ());
2617 static void GLAPIENTRY
2618 save_LoadMatrixf(const GLfloat
* m
)
2620 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2626 for (i
= 0; i
< 16; i
++) {
2630 if (ctx
->ExecuteFlag
) {
2631 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2636 static void GLAPIENTRY
2637 save_LoadMatrixd(const GLdouble
* m
)
2641 for (i
= 0; i
< 16; i
++) {
2642 f
[i
] = (GLfloat
) m
[i
];
2644 save_LoadMatrixf(f
);
2648 static void GLAPIENTRY
2649 save_LoadName(GLuint name
)
2651 GET_CURRENT_CONTEXT(ctx
);
2653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2654 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2658 if (ctx
->ExecuteFlag
) {
2659 CALL_LoadName(ctx
->Exec
, (name
));
2664 static void GLAPIENTRY
2665 save_LogicOp(GLenum opcode
)
2667 GET_CURRENT_CONTEXT(ctx
);
2669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2670 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2674 if (ctx
->ExecuteFlag
) {
2675 CALL_LogicOp(ctx
->Exec
, (opcode
));
2680 static void GLAPIENTRY
2681 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2682 GLint order
, const GLdouble
* points
)
2684 GET_CURRENT_CONTEXT(ctx
);
2686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2687 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2689 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2691 n
[2].f
= (GLfloat
) u1
;
2692 n
[3].f
= (GLfloat
) u2
;
2693 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2695 save_pointer(&n
[6], pnts
);
2697 if (ctx
->ExecuteFlag
) {
2698 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2702 static void GLAPIENTRY
2703 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2704 GLint order
, const GLfloat
* points
)
2706 GET_CURRENT_CONTEXT(ctx
);
2708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2709 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2711 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2715 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2717 save_pointer(&n
[6], pnts
);
2719 if (ctx
->ExecuteFlag
) {
2720 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2725 static void GLAPIENTRY
2726 save_Map2d(GLenum target
,
2727 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2728 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2729 const GLdouble
* points
)
2731 GET_CURRENT_CONTEXT(ctx
);
2733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2734 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2736 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2737 vstride
, vorder
, points
);
2739 n
[2].f
= (GLfloat
) u1
;
2740 n
[3].f
= (GLfloat
) u2
;
2741 n
[4].f
= (GLfloat
) v1
;
2742 n
[5].f
= (GLfloat
) v2
;
2743 /* XXX verify these strides are correct */
2744 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2745 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2748 save_pointer(&n
[10], pnts
);
2750 if (ctx
->ExecuteFlag
) {
2751 CALL_Map2d(ctx
->Exec
, (target
,
2752 u1
, u2
, ustride
, uorder
,
2753 v1
, v2
, vstride
, vorder
, points
));
2758 static void GLAPIENTRY
2759 save_Map2f(GLenum target
,
2760 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2761 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2762 const GLfloat
* points
)
2764 GET_CURRENT_CONTEXT(ctx
);
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2767 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2769 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2770 vstride
, vorder
, points
);
2776 /* XXX verify these strides are correct */
2777 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2778 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2781 save_pointer(&n
[10], pnts
);
2783 if (ctx
->ExecuteFlag
) {
2784 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2785 v1
, v2
, vstride
, vorder
, points
));
2790 static void GLAPIENTRY
2791 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2793 GET_CURRENT_CONTEXT(ctx
);
2795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2796 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2802 if (ctx
->ExecuteFlag
) {
2803 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2808 static void GLAPIENTRY
2809 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2811 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2815 static void GLAPIENTRY
2816 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2817 GLint vn
, GLfloat v1
, GLfloat v2
)
2819 GET_CURRENT_CONTEXT(ctx
);
2821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2822 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2831 if (ctx
->ExecuteFlag
) {
2832 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2838 static void GLAPIENTRY
2839 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2840 GLint vn
, GLdouble v1
, GLdouble v2
)
2842 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2843 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2847 static void GLAPIENTRY
2848 save_MatrixMode(GLenum mode
)
2850 GET_CURRENT_CONTEXT(ctx
);
2852 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2853 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2857 if (ctx
->ExecuteFlag
) {
2858 CALL_MatrixMode(ctx
->Exec
, (mode
));
2863 static void GLAPIENTRY
2864 save_MultMatrixf(const GLfloat
* m
)
2866 GET_CURRENT_CONTEXT(ctx
);
2868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2869 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2872 for (i
= 0; i
< 16; i
++) {
2876 if (ctx
->ExecuteFlag
) {
2877 CALL_MultMatrixf(ctx
->Exec
, (m
));
2882 static void GLAPIENTRY
2883 save_MultMatrixd(const GLdouble
* m
)
2887 for (i
= 0; i
< 16; i
++) {
2888 f
[i
] = (GLfloat
) m
[i
];
2890 save_MultMatrixf(f
);
2894 static void GLAPIENTRY
2895 save_NewList(GLuint name
, GLenum mode
)
2897 GET_CURRENT_CONTEXT(ctx
);
2898 /* It's an error to call this function while building a display list */
2899 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2906 static void GLAPIENTRY
2907 save_Ortho(GLdouble left
, GLdouble right
,
2908 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2910 GET_CURRENT_CONTEXT(ctx
);
2912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2913 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2915 n
[1].f
= (GLfloat
) left
;
2916 n
[2].f
= (GLfloat
) right
;
2917 n
[3].f
= (GLfloat
) bottom
;
2918 n
[4].f
= (GLfloat
) top
;
2919 n
[5].f
= (GLfloat
) nearval
;
2920 n
[6].f
= (GLfloat
) farval
;
2922 if (ctx
->ExecuteFlag
) {
2923 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2928 static void GLAPIENTRY
2929 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2931 GET_CURRENT_CONTEXT(ctx
);
2933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2934 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2938 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2940 if (ctx
->ExecuteFlag
) {
2941 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2946 static void GLAPIENTRY
2947 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2949 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2951 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2952 for (i
= 0; i
< mapsize
; i
++) {
2953 fvalues
[i
] = (GLfloat
) values
[i
];
2957 for (i
= 0; i
< mapsize
; i
++) {
2958 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2961 save_PixelMapfv(map
, mapsize
, fvalues
);
2965 static void GLAPIENTRY
2966 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2968 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2970 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2971 for (i
= 0; i
< mapsize
; i
++) {
2972 fvalues
[i
] = (GLfloat
) values
[i
];
2976 for (i
= 0; i
< mapsize
; i
++) {
2977 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2980 save_PixelMapfv(map
, mapsize
, fvalues
);
2984 static void GLAPIENTRY
2985 save_PixelTransferf(GLenum pname
, GLfloat param
)
2987 GET_CURRENT_CONTEXT(ctx
);
2989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2990 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2995 if (ctx
->ExecuteFlag
) {
2996 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3001 static void GLAPIENTRY
3002 save_PixelTransferi(GLenum pname
, GLint param
)
3004 save_PixelTransferf(pname
, (GLfloat
) param
);
3008 static void GLAPIENTRY
3009 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3011 GET_CURRENT_CONTEXT(ctx
);
3013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3014 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3019 if (ctx
->ExecuteFlag
) {
3020 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3025 static void GLAPIENTRY
3026 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3028 GET_CURRENT_CONTEXT(ctx
);
3030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3031 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3038 if (ctx
->ExecuteFlag
) {
3039 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3044 static void GLAPIENTRY
3045 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3049 parray
[1] = parray
[2] = 0.0F
;
3050 save_PointParameterfvEXT(pname
, parray
);
3053 static void GLAPIENTRY
3054 save_PointParameteriNV(GLenum pname
, GLint param
)
3057 parray
[0] = (GLfloat
) param
;
3058 parray
[1] = parray
[2] = 0.0F
;
3059 save_PointParameterfvEXT(pname
, parray
);
3062 static void GLAPIENTRY
3063 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3066 parray
[0] = (GLfloat
) param
[0];
3067 parray
[1] = parray
[2] = 0.0F
;
3068 save_PointParameterfvEXT(pname
, parray
);
3072 static void GLAPIENTRY
3073 save_PointSize(GLfloat size
)
3075 GET_CURRENT_CONTEXT(ctx
);
3077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3078 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3082 if (ctx
->ExecuteFlag
) {
3083 CALL_PointSize(ctx
->Exec
, (size
));
3088 static void GLAPIENTRY
3089 save_PolygonMode(GLenum face
, GLenum mode
)
3091 GET_CURRENT_CONTEXT(ctx
);
3093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3094 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3099 if (ctx
->ExecuteFlag
) {
3100 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3105 static void GLAPIENTRY
3106 save_PolygonStipple(const GLubyte
* pattern
)
3108 GET_CURRENT_CONTEXT(ctx
);
3111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3113 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3116 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3117 pattern
, &ctx
->Unpack
));
3119 if (ctx
->ExecuteFlag
) {
3120 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3125 static void GLAPIENTRY
3126 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3128 GET_CURRENT_CONTEXT(ctx
);
3130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3131 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3136 if (ctx
->ExecuteFlag
) {
3137 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3142 static void GLAPIENTRY
3143 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3145 GET_CURRENT_CONTEXT(ctx
);
3146 /* XXX mult by DepthMaxF here??? */
3147 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3151 static void GLAPIENTRY
3152 save_PopAttrib(void)
3154 GET_CURRENT_CONTEXT(ctx
);
3155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3156 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3157 if (ctx
->ExecuteFlag
) {
3158 CALL_PopAttrib(ctx
->Exec
, ());
3163 static void GLAPIENTRY
3164 save_PopMatrix(void)
3166 GET_CURRENT_CONTEXT(ctx
);
3167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3168 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3169 if (ctx
->ExecuteFlag
) {
3170 CALL_PopMatrix(ctx
->Exec
, ());
3175 static void GLAPIENTRY
3178 GET_CURRENT_CONTEXT(ctx
);
3179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3180 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3181 if (ctx
->ExecuteFlag
) {
3182 CALL_PopName(ctx
->Exec
, ());
3187 static void GLAPIENTRY
3188 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3189 const GLclampf
* priorities
)
3191 GET_CURRENT_CONTEXT(ctx
);
3193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3195 for (i
= 0; i
< num
; i
++) {
3197 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3199 n
[1].ui
= textures
[i
];
3200 n
[2].f
= priorities
[i
];
3203 if (ctx
->ExecuteFlag
) {
3204 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3209 static void GLAPIENTRY
3210 save_PushAttrib(GLbitfield mask
)
3212 GET_CURRENT_CONTEXT(ctx
);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3215 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3219 if (ctx
->ExecuteFlag
) {
3220 CALL_PushAttrib(ctx
->Exec
, (mask
));
3225 static void GLAPIENTRY
3226 save_PushMatrix(void)
3228 GET_CURRENT_CONTEXT(ctx
);
3229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3230 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3231 if (ctx
->ExecuteFlag
) {
3232 CALL_PushMatrix(ctx
->Exec
, ());
3237 static void GLAPIENTRY
3238 save_PushName(GLuint name
)
3240 GET_CURRENT_CONTEXT(ctx
);
3242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3243 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3247 if (ctx
->ExecuteFlag
) {
3248 CALL_PushName(ctx
->Exec
, (name
));
3253 static void GLAPIENTRY
3254 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3256 GET_CURRENT_CONTEXT(ctx
);
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3266 if (ctx
->ExecuteFlag
) {
3267 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3271 static void GLAPIENTRY
3272 save_RasterPos2d(GLdouble x
, GLdouble y
)
3274 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3277 static void GLAPIENTRY
3278 save_RasterPos2f(GLfloat x
, GLfloat y
)
3280 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3283 static void GLAPIENTRY
3284 save_RasterPos2i(GLint x
, GLint y
)
3286 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3289 static void GLAPIENTRY
3290 save_RasterPos2s(GLshort x
, GLshort y
)
3292 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3295 static void GLAPIENTRY
3296 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3298 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3301 static void GLAPIENTRY
3302 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3304 save_RasterPos4f(x
, y
, z
, 1.0F
);
3307 static void GLAPIENTRY
3308 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3310 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3313 static void GLAPIENTRY
3314 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3316 save_RasterPos4f(x
, y
, z
, 1.0F
);
3319 static void GLAPIENTRY
3320 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3322 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3325 static void GLAPIENTRY
3326 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3328 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3331 static void GLAPIENTRY
3332 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3334 save_RasterPos4f(x
, y
, z
, w
);
3337 static void GLAPIENTRY
3338 save_RasterPos2dv(const GLdouble
* v
)
3340 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3343 static void GLAPIENTRY
3344 save_RasterPos2fv(const GLfloat
* v
)
3346 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3349 static void GLAPIENTRY
3350 save_RasterPos2iv(const GLint
* v
)
3352 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3355 static void GLAPIENTRY
3356 save_RasterPos2sv(const GLshort
* v
)
3358 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3361 static void GLAPIENTRY
3362 save_RasterPos3dv(const GLdouble
* v
)
3364 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3367 static void GLAPIENTRY
3368 save_RasterPos3fv(const GLfloat
* v
)
3370 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3373 static void GLAPIENTRY
3374 save_RasterPos3iv(const GLint
* v
)
3376 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3379 static void GLAPIENTRY
3380 save_RasterPos3sv(const GLshort
* v
)
3382 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3385 static void GLAPIENTRY
3386 save_RasterPos4dv(const GLdouble
* v
)
3388 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3389 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3392 static void GLAPIENTRY
3393 save_RasterPos4fv(const GLfloat
* v
)
3395 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3398 static void GLAPIENTRY
3399 save_RasterPos4iv(const GLint
* v
)
3401 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3402 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3405 static void GLAPIENTRY
3406 save_RasterPos4sv(const GLshort
* v
)
3408 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3412 static void GLAPIENTRY
3413 save_PassThrough(GLfloat token
)
3415 GET_CURRENT_CONTEXT(ctx
);
3417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3418 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3422 if (ctx
->ExecuteFlag
) {
3423 CALL_PassThrough(ctx
->Exec
, (token
));
3428 static void GLAPIENTRY
3429 save_ReadBuffer(GLenum mode
)
3431 GET_CURRENT_CONTEXT(ctx
);
3433 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3434 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3438 if (ctx
->ExecuteFlag
) {
3439 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3444 static void GLAPIENTRY
3445 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3447 GET_CURRENT_CONTEXT(ctx
);
3449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3450 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3457 if (ctx
->ExecuteFlag
) {
3458 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3463 static void GLAPIENTRY
3464 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3466 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3470 static void GLAPIENTRY
3471 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3473 GET_CURRENT_CONTEXT(ctx
);
3475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3476 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3482 if (ctx
->ExecuteFlag
) {
3483 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3488 static void GLAPIENTRY
3489 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3491 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3495 static void GLAPIENTRY
3496 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3498 GET_CURRENT_CONTEXT(ctx
);
3500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3501 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3508 if (ctx
->ExecuteFlag
) {
3509 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3514 static void GLAPIENTRY
3515 save_ShadeModel(GLenum mode
)
3517 GET_CURRENT_CONTEXT(ctx
);
3519 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3521 if (ctx
->ExecuteFlag
) {
3522 CALL_ShadeModel(ctx
->Exec
, (mode
));
3525 /* Don't compile this call if it's a no-op.
3526 * By avoiding this state change we have a better chance of
3527 * coalescing subsequent drawing commands into one batch.
3529 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3532 SAVE_FLUSH_VERTICES(ctx
);
3534 ctx
->ListState
.Current
.ShadeModel
= mode
;
3536 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3543 static void GLAPIENTRY
3544 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3546 GET_CURRENT_CONTEXT(ctx
);
3548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3549 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3555 if (ctx
->ExecuteFlag
) {
3556 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3561 static void GLAPIENTRY
3562 save_StencilMask(GLuint mask
)
3564 GET_CURRENT_CONTEXT(ctx
);
3566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3567 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3571 if (ctx
->ExecuteFlag
) {
3572 CALL_StencilMask(ctx
->Exec
, (mask
));
3577 static void GLAPIENTRY
3578 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3580 GET_CURRENT_CONTEXT(ctx
);
3582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3583 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3589 if (ctx
->ExecuteFlag
) {
3590 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3595 static void GLAPIENTRY
3596 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3598 GET_CURRENT_CONTEXT(ctx
);
3600 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3601 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3608 if (ctx
->ExecuteFlag
) {
3609 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3614 static void GLAPIENTRY
3615 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3618 GET_CURRENT_CONTEXT(ctx
);
3620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3622 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3630 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3637 if (ctx
->ExecuteFlag
) {
3638 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3639 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3644 static void GLAPIENTRY
3645 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3647 GET_CURRENT_CONTEXT(ctx
);
3649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3650 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3655 if (ctx
->ExecuteFlag
) {
3656 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3661 static void GLAPIENTRY
3662 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3664 GET_CURRENT_CONTEXT(ctx
);
3666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3667 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3674 if (ctx
->ExecuteFlag
) {
3675 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3680 static void GLAPIENTRY
3681 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3683 GET_CURRENT_CONTEXT(ctx
);
3685 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3686 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3690 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3698 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3701 if (ctx
->ExecuteFlag
) {
3702 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3707 static void GLAPIENTRY
3708 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3711 parray
[0] = (GLfloat
) param
;
3712 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3713 save_TexEnvfv(target
, pname
, parray
);
3717 static void GLAPIENTRY
3718 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3721 p
[0] = (GLfloat
) param
;
3722 p
[1] = p
[2] = p
[3] = 0.0F
;
3723 save_TexEnvfv(target
, pname
, p
);
3727 static void GLAPIENTRY
3728 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3731 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3732 p
[0] = INT_TO_FLOAT(param
[0]);
3733 p
[1] = INT_TO_FLOAT(param
[1]);
3734 p
[2] = INT_TO_FLOAT(param
[2]);
3735 p
[3] = INT_TO_FLOAT(param
[3]);
3738 p
[0] = (GLfloat
) param
[0];
3739 p
[1] = p
[2] = p
[3] = 0.0F
;
3741 save_TexEnvfv(target
, pname
, p
);
3745 static void GLAPIENTRY
3746 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3748 GET_CURRENT_CONTEXT(ctx
);
3750 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3751 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3760 if (ctx
->ExecuteFlag
) {
3761 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3766 static void GLAPIENTRY
3767 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3770 p
[0] = (GLfloat
) params
[0];
3771 p
[1] = (GLfloat
) params
[1];
3772 p
[2] = (GLfloat
) params
[2];
3773 p
[3] = (GLfloat
) params
[3];
3774 save_TexGenfv(coord
, pname
, p
);
3778 static void GLAPIENTRY
3779 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3782 parray
[0] = (GLfloat
) param
;
3783 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3784 save_TexGenfv(coord
, pname
, parray
);
3788 static void GLAPIENTRY
3789 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3792 p
[0] = (GLfloat
) params
[0];
3793 p
[1] = (GLfloat
) params
[1];
3794 p
[2] = (GLfloat
) params
[2];
3795 p
[3] = (GLfloat
) params
[3];
3796 save_TexGenfv(coord
, pname
, p
);
3800 static void GLAPIENTRY
3801 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3805 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3806 save_TexGenfv(coord
, pname
, parray
);
3810 static void GLAPIENTRY
3811 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3815 parray
[1] = parray
[2] = parray
[3] = 0;
3816 save_TexGeniv(coord
, pname
, parray
);
3820 static void GLAPIENTRY
3821 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3823 GET_CURRENT_CONTEXT(ctx
);
3825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3826 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3835 if (ctx
->ExecuteFlag
) {
3836 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3841 static void GLAPIENTRY
3842 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3846 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3847 save_TexParameterfv(target
, pname
, parray
);
3851 static void GLAPIENTRY
3852 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3855 fparam
[0] = (GLfloat
) param
;
3856 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3857 save_TexParameterfv(target
, pname
, fparam
);
3861 static void GLAPIENTRY
3862 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3865 fparam
[0] = (GLfloat
) params
[0];
3866 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3867 save_TexParameterfv(target
, pname
, fparam
);
3871 static void GLAPIENTRY
3872 save_TexImage1D(GLenum target
,
3873 GLint level
, GLint components
,
3874 GLsizei width
, GLint border
,
3875 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3877 GET_CURRENT_CONTEXT(ctx
);
3878 if (target
== GL_PROXY_TEXTURE_1D
) {
3879 /* don't compile, execute immediately */
3880 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3881 border
, format
, type
, pixels
));
3885 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3886 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3890 n
[3].i
= components
;
3891 n
[4].i
= (GLint
) width
;
3896 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3897 pixels
, &ctx
->Unpack
));
3899 if (ctx
->ExecuteFlag
) {
3900 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3901 border
, format
, type
, pixels
));
3907 static void GLAPIENTRY
3908 save_TexImage2D(GLenum target
,
3909 GLint level
, GLint components
,
3910 GLsizei width
, GLsizei height
, GLint border
,
3911 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3913 GET_CURRENT_CONTEXT(ctx
);
3914 if (target
== GL_PROXY_TEXTURE_2D
) {
3915 /* don't compile, execute immediately */
3916 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3917 height
, border
, format
, type
, pixels
));
3921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3922 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3926 n
[3].i
= components
;
3927 n
[4].i
= (GLint
) width
;
3928 n
[5].i
= (GLint
) height
;
3933 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3934 pixels
, &ctx
->Unpack
));
3936 if (ctx
->ExecuteFlag
) {
3937 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3938 height
, border
, format
, type
, pixels
));
3944 static void GLAPIENTRY
3945 save_TexImage3D(GLenum target
,
3946 GLint level
, GLint internalFormat
,
3947 GLsizei width
, GLsizei height
, GLsizei depth
,
3949 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3951 GET_CURRENT_CONTEXT(ctx
);
3952 if (target
== GL_PROXY_TEXTURE_3D
) {
3953 /* don't compile, execute immediately */
3954 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3955 height
, depth
, border
, format
, type
,
3960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3961 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3965 n
[3].i
= (GLint
) internalFormat
;
3966 n
[4].i
= (GLint
) width
;
3967 n
[5].i
= (GLint
) height
;
3968 n
[6].i
= (GLint
) depth
;
3972 save_pointer(&n
[10],
3973 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3974 pixels
, &ctx
->Unpack
));
3976 if (ctx
->ExecuteFlag
) {
3977 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3978 height
, depth
, border
, format
, type
,
3985 static void GLAPIENTRY
3986 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3987 GLsizei width
, GLenum format
, GLenum type
,
3988 const GLvoid
* pixels
)
3990 GET_CURRENT_CONTEXT(ctx
);
3993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3995 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4000 n
[4].i
= (GLint
) width
;
4004 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4005 pixels
, &ctx
->Unpack
));
4007 if (ctx
->ExecuteFlag
) {
4008 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4009 format
, type
, pixels
));
4014 static void GLAPIENTRY
4015 save_TexSubImage2D(GLenum target
, GLint level
,
4016 GLint xoffset
, GLint yoffset
,
4017 GLsizei width
, GLsizei height
,
4018 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4020 GET_CURRENT_CONTEXT(ctx
);
4023 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4025 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4031 n
[5].i
= (GLint
) width
;
4032 n
[6].i
= (GLint
) height
;
4036 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4037 pixels
, &ctx
->Unpack
));
4039 if (ctx
->ExecuteFlag
) {
4040 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4041 width
, height
, format
, type
, pixels
));
4046 static void GLAPIENTRY
4047 save_TexSubImage3D(GLenum target
, GLint level
,
4048 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4049 GLsizei width
, GLsizei height
, GLsizei depth
,
4050 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4052 GET_CURRENT_CONTEXT(ctx
);
4055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4057 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4064 n
[6].i
= (GLint
) width
;
4065 n
[7].i
= (GLint
) height
;
4066 n
[8].i
= (GLint
) depth
;
4069 save_pointer(&n
[11],
4070 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4071 pixels
, &ctx
->Unpack
));
4073 if (ctx
->ExecuteFlag
) {
4074 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4075 xoffset
, yoffset
, zoffset
,
4076 width
, height
, depth
, format
, type
,
4082 static void GLAPIENTRY
4083 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4085 GET_CURRENT_CONTEXT(ctx
);
4087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4088 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4094 if (ctx
->ExecuteFlag
) {
4095 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4100 static void GLAPIENTRY
4101 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4103 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4108 static void GLAPIENTRY
4109 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4111 GET_CURRENT_CONTEXT(ctx
);
4113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4114 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4118 n
[3].i
= (GLint
) width
;
4119 n
[4].i
= (GLint
) height
;
4121 if (ctx
->ExecuteFlag
) {
4122 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4127 static void GLAPIENTRY
4128 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4130 GET_CURRENT_CONTEXT(ctx
);
4132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4133 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4140 if (ctx
->ExecuteFlag
) {
4141 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4145 static void GLAPIENTRY
4146 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4148 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4151 static void GLAPIENTRY
4152 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4154 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4157 static void GLAPIENTRY
4158 save_WindowPos2iMESA(GLint x
, GLint y
)
4160 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4163 static void GLAPIENTRY
4164 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4166 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4169 static void GLAPIENTRY
4170 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4172 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4175 static void GLAPIENTRY
4176 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4178 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4181 static void GLAPIENTRY
4182 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4184 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4187 static void GLAPIENTRY
4188 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4190 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4193 static void GLAPIENTRY
4194 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4196 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4199 static void GLAPIENTRY
4200 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4202 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4205 static void GLAPIENTRY
4206 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4208 save_WindowPos4fMESA(x
, y
, z
, w
);
4211 static void GLAPIENTRY
4212 save_WindowPos2dvMESA(const GLdouble
* v
)
4214 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4217 static void GLAPIENTRY
4218 save_WindowPos2fvMESA(const GLfloat
* v
)
4220 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4223 static void GLAPIENTRY
4224 save_WindowPos2ivMESA(const GLint
* v
)
4226 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4229 static void GLAPIENTRY
4230 save_WindowPos2svMESA(const GLshort
* v
)
4232 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4235 static void GLAPIENTRY
4236 save_WindowPos3dvMESA(const GLdouble
* v
)
4238 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4241 static void GLAPIENTRY
4242 save_WindowPos3fvMESA(const GLfloat
* v
)
4244 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4247 static void GLAPIENTRY
4248 save_WindowPos3ivMESA(const GLint
* v
)
4250 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4253 static void GLAPIENTRY
4254 save_WindowPos3svMESA(const GLshort
* v
)
4256 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4259 static void GLAPIENTRY
4260 save_WindowPos4dvMESA(const GLdouble
* v
)
4262 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4263 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4266 static void GLAPIENTRY
4267 save_WindowPos4fvMESA(const GLfloat
* v
)
4269 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4272 static void GLAPIENTRY
4273 save_WindowPos4ivMESA(const GLint
* v
)
4275 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4276 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4279 static void GLAPIENTRY
4280 save_WindowPos4svMESA(const GLshort
* v
)
4282 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4287 /* GL_ARB_multitexture */
4288 static void GLAPIENTRY
4289 save_ActiveTextureARB(GLenum target
)
4291 GET_CURRENT_CONTEXT(ctx
);
4293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4294 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4298 if (ctx
->ExecuteFlag
) {
4299 CALL_ActiveTexture(ctx
->Exec
, (target
));
4304 /* GL_ARB_transpose_matrix */
4306 static void GLAPIENTRY
4307 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4310 _math_transposefd(tm
, m
);
4311 save_LoadMatrixf(tm
);
4315 static void GLAPIENTRY
4316 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4319 _math_transposef(tm
, m
);
4320 save_LoadMatrixf(tm
);
4324 static void GLAPIENTRY
4325 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4328 _math_transposefd(tm
, m
);
4329 save_MultMatrixf(tm
);
4333 static void GLAPIENTRY
4334 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4337 _math_transposef(tm
, m
);
4338 save_MultMatrixf(tm
);
4341 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4343 GET_CURRENT_CONTEXT(ctx
);
4349 image
= malloc(size
);
4351 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4354 memcpy(image
, data
, size
);
4360 /* GL_ARB_texture_compression */
4361 static void GLAPIENTRY
4362 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4363 GLenum internalFormat
, GLsizei width
,
4364 GLint border
, GLsizei imageSize
,
4365 const GLvoid
* data
)
4367 GET_CURRENT_CONTEXT(ctx
);
4368 if (target
== GL_PROXY_TEXTURE_1D
) {
4369 /* don't compile, execute immediately */
4370 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4371 width
, border
, imageSize
,
4376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4378 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4379 6 + POINTER_DWORDS
);
4383 n
[3].e
= internalFormat
;
4384 n
[4].i
= (GLint
) width
;
4388 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4390 if (ctx
->ExecuteFlag
) {
4391 CALL_CompressedTexImage1D(ctx
->Exec
,
4392 (target
, level
, internalFormat
, width
,
4393 border
, imageSize
, data
));
4399 static void GLAPIENTRY
4400 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4401 GLenum internalFormat
, GLsizei width
,
4402 GLsizei height
, GLint border
, GLsizei imageSize
,
4403 const GLvoid
* data
)
4405 GET_CURRENT_CONTEXT(ctx
);
4406 if (target
== GL_PROXY_TEXTURE_2D
) {
4407 /* don't compile, execute immediately */
4408 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4409 width
, height
, border
,
4414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4416 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4417 7 + POINTER_DWORDS
);
4421 n
[3].e
= internalFormat
;
4422 n
[4].i
= (GLint
) width
;
4423 n
[5].i
= (GLint
) height
;
4427 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4429 if (ctx
->ExecuteFlag
) {
4430 CALL_CompressedTexImage2D(ctx
->Exec
,
4431 (target
, level
, internalFormat
, width
,
4432 height
, border
, imageSize
, data
));
4438 static void GLAPIENTRY
4439 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4440 GLenum internalFormat
, GLsizei width
,
4441 GLsizei height
, GLsizei depth
, GLint border
,
4442 GLsizei imageSize
, const GLvoid
* data
)
4444 GET_CURRENT_CONTEXT(ctx
);
4445 if (target
== GL_PROXY_TEXTURE_3D
) {
4446 /* don't compile, execute immediately */
4447 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4448 width
, height
, depth
, border
,
4453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4455 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4456 8 + POINTER_DWORDS
);
4460 n
[3].e
= internalFormat
;
4461 n
[4].i
= (GLint
) width
;
4462 n
[5].i
= (GLint
) height
;
4463 n
[6].i
= (GLint
) depth
;
4467 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4469 if (ctx
->ExecuteFlag
) {
4470 CALL_CompressedTexImage3D(ctx
->Exec
,
4471 (target
, level
, internalFormat
, width
,
4472 height
, depth
, border
, imageSize
,
4479 static void GLAPIENTRY
4480 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4481 GLsizei width
, GLenum format
,
4482 GLsizei imageSize
, const GLvoid
* data
)
4485 GET_CURRENT_CONTEXT(ctx
);
4486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4488 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4489 6 + POINTER_DWORDS
);
4494 n
[4].i
= (GLint
) width
;
4498 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4500 if (ctx
->ExecuteFlag
) {
4501 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4502 width
, format
, imageSize
,
4508 static void GLAPIENTRY
4509 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4510 GLint yoffset
, GLsizei width
, GLsizei height
,
4511 GLenum format
, GLsizei imageSize
,
4512 const GLvoid
* data
)
4515 GET_CURRENT_CONTEXT(ctx
);
4516 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4518 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4519 8 + POINTER_DWORDS
);
4525 n
[5].i
= (GLint
) width
;
4526 n
[6].i
= (GLint
) height
;
4530 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4532 if (ctx
->ExecuteFlag
) {
4533 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4534 (target
, level
, xoffset
, yoffset
, width
,
4535 height
, format
, imageSize
, data
));
4540 static void GLAPIENTRY
4541 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4542 GLint yoffset
, GLint zoffset
, GLsizei width
,
4543 GLsizei height
, GLsizei depth
, GLenum format
,
4544 GLsizei imageSize
, const GLvoid
* data
)
4547 GET_CURRENT_CONTEXT(ctx
);
4548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4550 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4551 10 + POINTER_DWORDS
);
4558 n
[6].i
= (GLint
) width
;
4559 n
[7].i
= (GLint
) height
;
4560 n
[8].i
= (GLint
) depth
;
4562 n
[10].i
= imageSize
;
4563 save_pointer(&n
[11],
4564 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4566 if (ctx
->ExecuteFlag
) {
4567 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4568 (target
, level
, xoffset
, yoffset
,
4569 zoffset
, width
, height
, depth
, format
,
4575 /* GL_ARB_multisample */
4576 static void GLAPIENTRY
4577 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4579 GET_CURRENT_CONTEXT(ctx
);
4581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4582 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4587 if (ctx
->ExecuteFlag
) {
4588 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4594 * GL_NV_fragment_program
4596 static void GLAPIENTRY
4597 save_BindProgramNV(GLenum target
, GLuint id
)
4599 GET_CURRENT_CONTEXT(ctx
);
4601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4602 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4607 if (ctx
->ExecuteFlag
) {
4608 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4612 static void GLAPIENTRY
4613 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4614 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4616 GET_CURRENT_CONTEXT(ctx
);
4618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4619 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4628 if (ctx
->ExecuteFlag
) {
4629 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4634 static void GLAPIENTRY
4635 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4636 const GLfloat
*params
)
4638 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4639 params
[2], params
[3]);
4643 static void GLAPIENTRY
4644 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4645 const GLfloat
* params
)
4647 GET_CURRENT_CONTEXT(ctx
);
4649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4653 const GLfloat
* p
= params
;
4655 for (i
= 0 ; i
< count
; i
++) {
4656 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4669 if (ctx
->ExecuteFlag
) {
4670 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4675 static void GLAPIENTRY
4676 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4677 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4679 save_ProgramEnvParameter4fARB(target
, index
,
4681 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4685 static void GLAPIENTRY
4686 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4687 const GLdouble
*params
)
4689 save_ProgramEnvParameter4fARB(target
, index
,
4690 (GLfloat
) params
[0],
4691 (GLfloat
) params
[1],
4692 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4696 static void GLAPIENTRY
4697 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4698 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4700 GET_CURRENT_CONTEXT(ctx
);
4702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4703 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4712 if (ctx
->ExecuteFlag
) {
4713 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4718 static void GLAPIENTRY
4719 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4720 const GLfloat
*params
)
4722 GET_CURRENT_CONTEXT(ctx
);
4724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4725 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4734 if (ctx
->ExecuteFlag
) {
4735 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4740 static void GLAPIENTRY
4741 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4742 const GLfloat
*params
)
4744 GET_CURRENT_CONTEXT(ctx
);
4746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4750 const GLfloat
* p
= params
;
4752 for (i
= 0 ; i
< count
; i
++) {
4753 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4766 if (ctx
->ExecuteFlag
) {
4767 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4772 static void GLAPIENTRY
4773 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4774 GLdouble x
, GLdouble y
,
4775 GLdouble z
, GLdouble w
)
4777 GET_CURRENT_CONTEXT(ctx
);
4779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4780 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4784 n
[3].f
= (GLfloat
) x
;
4785 n
[4].f
= (GLfloat
) y
;
4786 n
[5].f
= (GLfloat
) z
;
4787 n
[6].f
= (GLfloat
) w
;
4789 if (ctx
->ExecuteFlag
) {
4790 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4795 static void GLAPIENTRY
4796 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4797 const GLdouble
*params
)
4799 GET_CURRENT_CONTEXT(ctx
);
4801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4802 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4806 n
[3].f
= (GLfloat
) params
[0];
4807 n
[4].f
= (GLfloat
) params
[1];
4808 n
[5].f
= (GLfloat
) params
[2];
4809 n
[6].f
= (GLfloat
) params
[3];
4811 if (ctx
->ExecuteFlag
) {
4812 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4817 /* GL_EXT_stencil_two_side */
4818 static void GLAPIENTRY
4819 save_ActiveStencilFaceEXT(GLenum face
)
4821 GET_CURRENT_CONTEXT(ctx
);
4823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4824 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4828 if (ctx
->ExecuteFlag
) {
4829 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4834 /* GL_EXT_depth_bounds_test */
4835 static void GLAPIENTRY
4836 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4838 GET_CURRENT_CONTEXT(ctx
);
4840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4841 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4843 n
[1].f
= (GLfloat
) zmin
;
4844 n
[2].f
= (GLfloat
) zmax
;
4846 if (ctx
->ExecuteFlag
) {
4847 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4853 static void GLAPIENTRY
4854 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4855 const GLvoid
* string
)
4857 GET_CURRENT_CONTEXT(ctx
);
4860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4862 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4864 GLubyte
*programCopy
= malloc(len
);
4866 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4869 memcpy(programCopy
, string
, len
);
4873 save_pointer(&n
[4], programCopy
);
4875 if (ctx
->ExecuteFlag
) {
4876 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4881 static void GLAPIENTRY
4882 save_BeginQueryARB(GLenum target
, GLuint id
)
4884 GET_CURRENT_CONTEXT(ctx
);
4886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4887 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4892 if (ctx
->ExecuteFlag
) {
4893 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4897 static void GLAPIENTRY
4898 save_EndQueryARB(GLenum target
)
4900 GET_CURRENT_CONTEXT(ctx
);
4902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4903 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4907 if (ctx
->ExecuteFlag
) {
4908 CALL_EndQuery(ctx
->Exec
, (target
));
4912 static void GLAPIENTRY
4913 save_QueryCounter(GLuint id
, GLenum target
)
4915 GET_CURRENT_CONTEXT(ctx
);
4917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4918 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4923 if (ctx
->ExecuteFlag
) {
4924 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4928 static void GLAPIENTRY
4929 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4931 GET_CURRENT_CONTEXT(ctx
);
4933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4934 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4940 if (ctx
->ExecuteFlag
) {
4941 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4945 static void GLAPIENTRY
4946 save_EndQueryIndexed(GLenum target
, GLuint index
)
4948 GET_CURRENT_CONTEXT(ctx
);
4950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4951 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4956 if (ctx
->ExecuteFlag
) {
4957 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4962 static void GLAPIENTRY
4963 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4965 GET_CURRENT_CONTEXT(ctx
);
4967 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4968 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4972 if (count
> MAX_DRAW_BUFFERS
)
4973 count
= MAX_DRAW_BUFFERS
;
4974 for (i
= 0; i
< count
; i
++) {
4975 n
[2 + i
].e
= buffers
[i
];
4978 if (ctx
->ExecuteFlag
) {
4979 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4983 static void GLAPIENTRY
4984 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4986 GET_CURRENT_CONTEXT(ctx
);
4989 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4997 if (ctx
->ExecuteFlag
) {
4998 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5002 static void GLAPIENTRY
5003 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5006 p
[0] = INT_TO_FLOAT(param
[0]);
5007 p
[1] = INT_TO_FLOAT(param
[1]);
5008 p
[2] = INT_TO_FLOAT(param
[2]);
5009 p
[3] = INT_TO_FLOAT(param
[3]);
5010 save_TexBumpParameterfvATI(pname
, p
);
5013 static void GLAPIENTRY
5014 save_BindFragmentShaderATI(GLuint id
)
5016 GET_CURRENT_CONTEXT(ctx
);
5019 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5023 if (ctx
->ExecuteFlag
) {
5024 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5028 static void GLAPIENTRY
5029 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5031 GET_CURRENT_CONTEXT(ctx
);
5034 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5042 if (ctx
->ExecuteFlag
) {
5043 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5047 static void GLAPIENTRY
5048 save_Attr1fNV(GLenum attr
, GLfloat x
)
5050 GET_CURRENT_CONTEXT(ctx
);
5052 SAVE_FLUSH_VERTICES(ctx
);
5053 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5059 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5060 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5061 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5063 if (ctx
->ExecuteFlag
) {
5064 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5068 static void GLAPIENTRY
5069 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5071 GET_CURRENT_CONTEXT(ctx
);
5073 SAVE_FLUSH_VERTICES(ctx
);
5074 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5081 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5082 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5083 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5085 if (ctx
->ExecuteFlag
) {
5086 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5090 static void GLAPIENTRY
5091 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5093 GET_CURRENT_CONTEXT(ctx
);
5095 SAVE_FLUSH_VERTICES(ctx
);
5096 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5104 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5105 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5106 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5108 if (ctx
->ExecuteFlag
) {
5109 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5113 static void GLAPIENTRY
5114 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5116 GET_CURRENT_CONTEXT(ctx
);
5118 SAVE_FLUSH_VERTICES(ctx
);
5119 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5128 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5129 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5130 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5132 if (ctx
->ExecuteFlag
) {
5133 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5138 static void GLAPIENTRY
5139 save_Attr1fARB(GLenum attr
, GLfloat x
)
5141 GET_CURRENT_CONTEXT(ctx
);
5143 SAVE_FLUSH_VERTICES(ctx
);
5144 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5150 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5151 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5152 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5154 if (ctx
->ExecuteFlag
) {
5155 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5159 static void GLAPIENTRY
5160 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5162 GET_CURRENT_CONTEXT(ctx
);
5164 SAVE_FLUSH_VERTICES(ctx
);
5165 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5172 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5173 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5174 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5176 if (ctx
->ExecuteFlag
) {
5177 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5181 static void GLAPIENTRY
5182 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5184 GET_CURRENT_CONTEXT(ctx
);
5186 SAVE_FLUSH_VERTICES(ctx
);
5187 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5195 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5196 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5197 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5199 if (ctx
->ExecuteFlag
) {
5200 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5204 static void GLAPIENTRY
5205 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5207 GET_CURRENT_CONTEXT(ctx
);
5209 SAVE_FLUSH_VERTICES(ctx
);
5210 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5219 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5220 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5221 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5223 if (ctx
->ExecuteFlag
) {
5224 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5229 static void GLAPIENTRY
5230 save_EvalCoord1f(GLfloat x
)
5232 GET_CURRENT_CONTEXT(ctx
);
5234 SAVE_FLUSH_VERTICES(ctx
);
5235 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5239 if (ctx
->ExecuteFlag
) {
5240 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5244 static void GLAPIENTRY
5245 save_EvalCoord1fv(const GLfloat
* v
)
5247 save_EvalCoord1f(v
[0]);
5250 static void GLAPIENTRY
5251 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5253 GET_CURRENT_CONTEXT(ctx
);
5255 SAVE_FLUSH_VERTICES(ctx
);
5256 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5261 if (ctx
->ExecuteFlag
) {
5262 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5266 static void GLAPIENTRY
5267 save_EvalCoord2fv(const GLfloat
* v
)
5269 save_EvalCoord2f(v
[0], v
[1]);
5273 static void GLAPIENTRY
5274 save_EvalPoint1(GLint x
)
5276 GET_CURRENT_CONTEXT(ctx
);
5278 SAVE_FLUSH_VERTICES(ctx
);
5279 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5283 if (ctx
->ExecuteFlag
) {
5284 CALL_EvalPoint1(ctx
->Exec
, (x
));
5288 static void GLAPIENTRY
5289 save_EvalPoint2(GLint x
, GLint y
)
5291 GET_CURRENT_CONTEXT(ctx
);
5293 SAVE_FLUSH_VERTICES(ctx
);
5294 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5299 if (ctx
->ExecuteFlag
) {
5300 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5304 static void GLAPIENTRY
5305 save_Indexf(GLfloat x
)
5307 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5310 static void GLAPIENTRY
5311 save_Indexfv(const GLfloat
* v
)
5313 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5316 static void GLAPIENTRY
5317 save_EdgeFlag(GLboolean x
)
5319 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5324 * Compare 'count' elements of vectors 'a' and 'b'.
5325 * \return GL_TRUE if equal, GL_FALSE if different.
5327 static inline GLboolean
5328 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5330 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5335 * This glMaterial function is used for glMaterial calls that are outside
5336 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5338 static void GLAPIENTRY
5339 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5341 GET_CURRENT_CONTEXT(ctx
);
5349 case GL_FRONT_AND_BACK
:
5352 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5361 case GL_AMBIENT_AND_DIFFUSE
:
5367 case GL_COLOR_INDEXES
:
5371 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5375 if (ctx
->ExecuteFlag
) {
5376 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5379 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5381 /* Try to eliminate redundant statechanges. Because it is legal to
5382 * call glMaterial even inside begin/end calls, don't need to worry
5383 * about ctx->Driver.CurrentSavePrimitive here.
5385 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5386 if (bitmask
& (1 << i
)) {
5387 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5388 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5389 /* no change in material value */
5390 bitmask
&= ~(1 << i
);
5393 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5394 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5399 /* If this call has no effect, return early */
5403 SAVE_FLUSH_VERTICES(ctx
);
5405 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5409 for (i
= 0; i
< args
; i
++)
5410 n
[3 + i
].f
= param
[i
];
5414 static void GLAPIENTRY
5415 save_Begin(GLenum mode
)
5417 GET_CURRENT_CONTEXT(ctx
);
5419 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5420 /* compile this error into the display list */
5421 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5423 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5424 /* compile this error into the display list */
5425 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5430 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5432 /* Give the driver an opportunity to hook in an optimized
5433 * display list compiler.
5435 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5438 SAVE_FLUSH_VERTICES(ctx
);
5439 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5444 if (ctx
->ExecuteFlag
) {
5445 CALL_Begin(ctx
->Exec
, (mode
));
5450 static void GLAPIENTRY
5453 GET_CURRENT_CONTEXT(ctx
);
5454 SAVE_FLUSH_VERTICES(ctx
);
5455 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5456 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5457 if (ctx
->ExecuteFlag
) {
5458 CALL_End(ctx
->Exec
, ());
5462 static void GLAPIENTRY
5463 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5465 GET_CURRENT_CONTEXT(ctx
);
5467 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5468 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5475 if (ctx
->ExecuteFlag
) {
5476 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5481 static void GLAPIENTRY
5482 save_Vertex2f(GLfloat x
, GLfloat y
)
5484 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5487 static void GLAPIENTRY
5488 save_Vertex2fv(const GLfloat
* v
)
5490 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5493 static void GLAPIENTRY
5494 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5496 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5499 static void GLAPIENTRY
5500 save_Vertex3fv(const GLfloat
* v
)
5502 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5505 static void GLAPIENTRY
5506 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5508 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5511 static void GLAPIENTRY
5512 save_Vertex4fv(const GLfloat
* v
)
5514 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5517 static void GLAPIENTRY
5518 save_TexCoord1f(GLfloat x
)
5520 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5523 static void GLAPIENTRY
5524 save_TexCoord1fv(const GLfloat
* v
)
5526 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5529 static void GLAPIENTRY
5530 save_TexCoord2f(GLfloat x
, GLfloat y
)
5532 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5535 static void GLAPIENTRY
5536 save_TexCoord2fv(const GLfloat
* v
)
5538 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5541 static void GLAPIENTRY
5542 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5544 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5547 static void GLAPIENTRY
5548 save_TexCoord3fv(const GLfloat
* v
)
5550 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5553 static void GLAPIENTRY
5554 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5556 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5559 static void GLAPIENTRY
5560 save_TexCoord4fv(const GLfloat
* v
)
5562 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5565 static void GLAPIENTRY
5566 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5568 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5571 static void GLAPIENTRY
5572 save_Normal3fv(const GLfloat
* v
)
5574 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5577 static void GLAPIENTRY
5578 save_FogCoordfEXT(GLfloat x
)
5580 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5583 static void GLAPIENTRY
5584 save_FogCoordfvEXT(const GLfloat
* v
)
5586 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5589 static void GLAPIENTRY
5590 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5592 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5595 static void GLAPIENTRY
5596 save_Color3fv(const GLfloat
* v
)
5598 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5601 static void GLAPIENTRY
5602 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5604 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5607 static void GLAPIENTRY
5608 save_Color4fv(const GLfloat
* v
)
5610 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5613 static void GLAPIENTRY
5614 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5616 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5619 static void GLAPIENTRY
5620 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5622 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5626 /* Just call the respective ATTR for texcoord
5628 static void GLAPIENTRY
5629 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5631 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5632 save_Attr1fNV(attr
, x
);
5635 static void GLAPIENTRY
5636 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5638 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5639 save_Attr1fNV(attr
, v
[0]);
5642 static void GLAPIENTRY
5643 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5645 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5646 save_Attr2fNV(attr
, x
, y
);
5649 static void GLAPIENTRY
5650 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5652 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5653 save_Attr2fNV(attr
, v
[0], v
[1]);
5656 static void GLAPIENTRY
5657 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5659 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5660 save_Attr3fNV(attr
, x
, y
, z
);
5663 static void GLAPIENTRY
5664 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5666 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5667 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5670 static void GLAPIENTRY
5671 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5672 GLfloat z
, GLfloat w
)
5674 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5675 save_Attr4fNV(attr
, x
, y
, z
, w
);
5678 static void GLAPIENTRY
5679 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5681 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5682 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5687 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5693 GET_CURRENT_CONTEXT(ctx
);
5694 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5699 static void GLAPIENTRY
5700 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5702 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5703 save_Attr1fARB(index
, x
);
5708 static void GLAPIENTRY
5709 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5711 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5712 save_Attr1fARB(index
, v
[0]);
5717 static void GLAPIENTRY
5718 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5720 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5721 save_Attr2fARB(index
, x
, y
);
5726 static void GLAPIENTRY
5727 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5729 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5730 save_Attr2fARB(index
, v
[0], v
[1]);
5735 static void GLAPIENTRY
5736 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5738 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5739 save_Attr3fARB(index
, x
, y
, z
);
5744 static void GLAPIENTRY
5745 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5747 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5748 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5753 static void GLAPIENTRY
5754 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5757 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5758 save_Attr4fARB(index
, x
, y
, z
, w
);
5763 static void GLAPIENTRY
5764 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5766 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5767 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5772 static void GLAPIENTRY
5773 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5774 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5775 GLbitfield mask
, GLenum filter
)
5777 GET_CURRENT_CONTEXT(ctx
);
5779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5780 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5793 if (ctx
->ExecuteFlag
) {
5794 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5795 dstX0
, dstY0
, dstX1
, dstY1
,
5801 /** GL_EXT_provoking_vertex */
5802 static void GLAPIENTRY
5803 save_ProvokingVertexEXT(GLenum mode
)
5805 GET_CURRENT_CONTEXT(ctx
);
5807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5808 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5812 if (ctx
->ExecuteFlag
) {
5813 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5814 _mesa_ProvokingVertex(mode
);
5819 /** GL_EXT_transform_feedback */
5820 static void GLAPIENTRY
5821 save_BeginTransformFeedback(GLenum mode
)
5823 GET_CURRENT_CONTEXT(ctx
);
5825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5826 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5830 if (ctx
->ExecuteFlag
) {
5831 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5836 /** GL_EXT_transform_feedback */
5837 static void GLAPIENTRY
5838 save_EndTransformFeedback(void)
5840 GET_CURRENT_CONTEXT(ctx
);
5841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5842 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5843 if (ctx
->ExecuteFlag
) {
5844 CALL_EndTransformFeedback(ctx
->Exec
, ());
5848 static void GLAPIENTRY
5849 save_BindTransformFeedback(GLenum target
, GLuint name
)
5851 GET_CURRENT_CONTEXT(ctx
);
5853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5854 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5859 if (ctx
->ExecuteFlag
) {
5860 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5864 static void GLAPIENTRY
5865 save_PauseTransformFeedback(void)
5867 GET_CURRENT_CONTEXT(ctx
);
5868 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5869 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5870 if (ctx
->ExecuteFlag
) {
5871 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5875 static void GLAPIENTRY
5876 save_ResumeTransformFeedback(void)
5878 GET_CURRENT_CONTEXT(ctx
);
5879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5880 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5881 if (ctx
->ExecuteFlag
) {
5882 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5886 static void GLAPIENTRY
5887 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5889 GET_CURRENT_CONTEXT(ctx
);
5891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5892 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5897 if (ctx
->ExecuteFlag
) {
5898 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5902 static void GLAPIENTRY
5903 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5905 GET_CURRENT_CONTEXT(ctx
);
5907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5908 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5914 if (ctx
->ExecuteFlag
) {
5915 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5919 static void GLAPIENTRY
5920 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5923 GET_CURRENT_CONTEXT(ctx
);
5925 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5926 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5930 n
[3].si
= primcount
;
5932 if (ctx
->ExecuteFlag
) {
5933 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5937 static void GLAPIENTRY
5938 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5939 GLuint stream
, GLsizei primcount
)
5941 GET_CURRENT_CONTEXT(ctx
);
5943 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5944 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5949 n
[4].si
= primcount
;
5951 if (ctx
->ExecuteFlag
) {
5952 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5957 /* aka UseProgram() */
5958 static void GLAPIENTRY
5959 save_UseProgramObjectARB(GLhandleARB program
)
5961 GET_CURRENT_CONTEXT(ctx
);
5963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5964 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5968 if (ctx
->ExecuteFlag
) {
5969 CALL_UseProgram(ctx
->Exec
, (program
));
5974 static void GLAPIENTRY
5975 save_Uniform1fARB(GLint location
, GLfloat x
)
5977 GET_CURRENT_CONTEXT(ctx
);
5979 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5980 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5985 if (ctx
->ExecuteFlag
) {
5986 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5991 static void GLAPIENTRY
5992 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5994 GET_CURRENT_CONTEXT(ctx
);
5996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5997 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6003 if (ctx
->ExecuteFlag
) {
6004 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6009 static void GLAPIENTRY
6010 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6012 GET_CURRENT_CONTEXT(ctx
);
6014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6015 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6022 if (ctx
->ExecuteFlag
) {
6023 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6028 static void GLAPIENTRY
6029 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6031 GET_CURRENT_CONTEXT(ctx
);
6033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6034 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6042 if (ctx
->ExecuteFlag
) {
6043 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6048 static void GLAPIENTRY
6049 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6051 GET_CURRENT_CONTEXT(ctx
);
6053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6054 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6058 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6060 if (ctx
->ExecuteFlag
) {
6061 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6065 static void GLAPIENTRY
6066 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6068 GET_CURRENT_CONTEXT(ctx
);
6070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6071 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6075 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6077 if (ctx
->ExecuteFlag
) {
6078 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6082 static void GLAPIENTRY
6083 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6085 GET_CURRENT_CONTEXT(ctx
);
6087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6088 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6092 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6094 if (ctx
->ExecuteFlag
) {
6095 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6099 static void GLAPIENTRY
6100 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6102 GET_CURRENT_CONTEXT(ctx
);
6104 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6105 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6109 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6111 if (ctx
->ExecuteFlag
) {
6112 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6117 static void GLAPIENTRY
6118 save_Uniform1iARB(GLint location
, GLint x
)
6120 GET_CURRENT_CONTEXT(ctx
);
6122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6123 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6128 if (ctx
->ExecuteFlag
) {
6129 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6133 static void GLAPIENTRY
6134 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6136 GET_CURRENT_CONTEXT(ctx
);
6138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6139 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6145 if (ctx
->ExecuteFlag
) {
6146 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6150 static void GLAPIENTRY
6151 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6153 GET_CURRENT_CONTEXT(ctx
);
6155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6156 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6163 if (ctx
->ExecuteFlag
) {
6164 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6168 static void GLAPIENTRY
6169 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6171 GET_CURRENT_CONTEXT(ctx
);
6173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6174 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6182 if (ctx
->ExecuteFlag
) {
6183 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6189 static void GLAPIENTRY
6190 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6192 GET_CURRENT_CONTEXT(ctx
);
6194 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6195 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6199 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6201 if (ctx
->ExecuteFlag
) {
6202 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6206 static void GLAPIENTRY
6207 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6209 GET_CURRENT_CONTEXT(ctx
);
6211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6212 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6216 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6218 if (ctx
->ExecuteFlag
) {
6219 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6223 static void GLAPIENTRY
6224 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6226 GET_CURRENT_CONTEXT(ctx
);
6228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6229 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6233 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6235 if (ctx
->ExecuteFlag
) {
6236 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6240 static void GLAPIENTRY
6241 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6243 GET_CURRENT_CONTEXT(ctx
);
6245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6246 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6250 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6252 if (ctx
->ExecuteFlag
) {
6253 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6259 static void GLAPIENTRY
6260 save_Uniform1ui(GLint location
, GLuint x
)
6262 GET_CURRENT_CONTEXT(ctx
);
6264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6265 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6270 if (ctx
->ExecuteFlag
) {
6271 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6275 static void GLAPIENTRY
6276 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6278 GET_CURRENT_CONTEXT(ctx
);
6280 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6281 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6287 if (ctx
->ExecuteFlag
) {
6288 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6292 static void GLAPIENTRY
6293 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6295 GET_CURRENT_CONTEXT(ctx
);
6297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6298 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6305 if (ctx
->ExecuteFlag
) {
6306 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6310 static void GLAPIENTRY
6311 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6313 GET_CURRENT_CONTEXT(ctx
);
6315 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6316 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6324 if (ctx
->ExecuteFlag
) {
6325 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6331 static void GLAPIENTRY
6332 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6334 GET_CURRENT_CONTEXT(ctx
);
6336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6337 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6341 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6343 if (ctx
->ExecuteFlag
) {
6344 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6348 static void GLAPIENTRY
6349 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6351 GET_CURRENT_CONTEXT(ctx
);
6353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6354 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6358 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6360 if (ctx
->ExecuteFlag
) {
6361 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6365 static void GLAPIENTRY
6366 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6368 GET_CURRENT_CONTEXT(ctx
);
6370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6371 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6375 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6377 if (ctx
->ExecuteFlag
) {
6378 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6382 static void GLAPIENTRY
6383 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6385 GET_CURRENT_CONTEXT(ctx
);
6387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6388 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6392 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6394 if (ctx
->ExecuteFlag
) {
6395 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6401 static void GLAPIENTRY
6402 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6405 GET_CURRENT_CONTEXT(ctx
);
6407 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6408 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6413 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6415 if (ctx
->ExecuteFlag
) {
6416 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6420 static void GLAPIENTRY
6421 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6424 GET_CURRENT_CONTEXT(ctx
);
6426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6427 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6432 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6434 if (ctx
->ExecuteFlag
) {
6435 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6439 static void GLAPIENTRY
6440 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6443 GET_CURRENT_CONTEXT(ctx
);
6445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6446 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6451 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6453 if (ctx
->ExecuteFlag
) {
6454 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6459 static void GLAPIENTRY
6460 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6463 GET_CURRENT_CONTEXT(ctx
);
6465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6466 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6471 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6473 if (ctx
->ExecuteFlag
) {
6474 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6478 static void GLAPIENTRY
6479 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6482 GET_CURRENT_CONTEXT(ctx
);
6484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6485 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6490 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6492 if (ctx
->ExecuteFlag
) {
6493 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6498 static void GLAPIENTRY
6499 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6502 GET_CURRENT_CONTEXT(ctx
);
6504 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6505 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6510 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6512 if (ctx
->ExecuteFlag
) {
6513 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6517 static void GLAPIENTRY
6518 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6521 GET_CURRENT_CONTEXT(ctx
);
6523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6524 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6529 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6531 if (ctx
->ExecuteFlag
) {
6532 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6537 static void GLAPIENTRY
6538 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6541 GET_CURRENT_CONTEXT(ctx
);
6543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6544 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6549 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6551 if (ctx
->ExecuteFlag
) {
6552 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6556 static void GLAPIENTRY
6557 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6560 GET_CURRENT_CONTEXT(ctx
);
6562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6563 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6568 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6570 if (ctx
->ExecuteFlag
) {
6571 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6575 static void GLAPIENTRY
6576 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6578 GET_CURRENT_CONTEXT(ctx
);
6580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6581 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6587 if (ctx
->ExecuteFlag
) {
6588 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6592 static void GLAPIENTRY
6593 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6595 GET_CURRENT_CONTEXT(ctx
);
6597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6598 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6604 if (ctx
->ExecuteFlag
) {
6605 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6609 static void GLAPIENTRY
6610 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6612 GET_CURRENT_CONTEXT(ctx
);
6614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6615 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6622 if (ctx
->ExecuteFlag
) {
6623 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6627 static void GLAPIENTRY
6628 save_ProgramUniform3f(GLuint program
, GLint location
,
6629 GLfloat x
, GLfloat y
, GLfloat z
)
6631 GET_CURRENT_CONTEXT(ctx
);
6633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6634 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6642 if (ctx
->ExecuteFlag
) {
6643 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6647 static void GLAPIENTRY
6648 save_ProgramUniform4f(GLuint program
, GLint location
,
6649 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6651 GET_CURRENT_CONTEXT(ctx
);
6653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6654 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6663 if (ctx
->ExecuteFlag
) {
6664 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6668 static void GLAPIENTRY
6669 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6672 GET_CURRENT_CONTEXT(ctx
);
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6675 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6680 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6682 if (ctx
->ExecuteFlag
) {
6683 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6687 static void GLAPIENTRY
6688 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6691 GET_CURRENT_CONTEXT(ctx
);
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6694 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6699 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6701 if (ctx
->ExecuteFlag
) {
6702 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6706 static void GLAPIENTRY
6707 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6710 GET_CURRENT_CONTEXT(ctx
);
6712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6713 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6718 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6720 if (ctx
->ExecuteFlag
) {
6721 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6725 static void GLAPIENTRY
6726 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6729 GET_CURRENT_CONTEXT(ctx
);
6731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6732 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6737 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6739 if (ctx
->ExecuteFlag
) {
6740 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6744 static void GLAPIENTRY
6745 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6747 GET_CURRENT_CONTEXT(ctx
);
6749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6750 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6756 if (ctx
->ExecuteFlag
) {
6757 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6761 static void GLAPIENTRY
6762 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6764 GET_CURRENT_CONTEXT(ctx
);
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6767 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6774 if (ctx
->ExecuteFlag
) {
6775 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6779 static void GLAPIENTRY
6780 save_ProgramUniform3i(GLuint program
, GLint location
,
6781 GLint x
, GLint y
, GLint z
)
6783 GET_CURRENT_CONTEXT(ctx
);
6785 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6786 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6794 if (ctx
->ExecuteFlag
) {
6795 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6799 static void GLAPIENTRY
6800 save_ProgramUniform4i(GLuint program
, GLint location
,
6801 GLint x
, GLint y
, GLint z
, GLint w
)
6803 GET_CURRENT_CONTEXT(ctx
);
6805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6806 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6815 if (ctx
->ExecuteFlag
) {
6816 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6820 static void GLAPIENTRY
6821 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6824 GET_CURRENT_CONTEXT(ctx
);
6826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6827 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6832 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6834 if (ctx
->ExecuteFlag
) {
6835 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6839 static void GLAPIENTRY
6840 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6843 GET_CURRENT_CONTEXT(ctx
);
6845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6846 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6851 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6853 if (ctx
->ExecuteFlag
) {
6854 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6858 static void GLAPIENTRY
6859 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6862 GET_CURRENT_CONTEXT(ctx
);
6864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6865 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6870 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6872 if (ctx
->ExecuteFlag
) {
6873 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6877 static void GLAPIENTRY
6878 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6881 GET_CURRENT_CONTEXT(ctx
);
6883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6884 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6889 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6891 if (ctx
->ExecuteFlag
) {
6892 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6896 static void GLAPIENTRY
6897 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6899 GET_CURRENT_CONTEXT(ctx
);
6901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6902 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6908 if (ctx
->ExecuteFlag
) {
6909 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6913 static void GLAPIENTRY
6914 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6916 GET_CURRENT_CONTEXT(ctx
);
6918 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6919 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6926 if (ctx
->ExecuteFlag
) {
6927 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6931 static void GLAPIENTRY
6932 save_ProgramUniform3ui(GLuint program
, GLint location
,
6933 GLuint x
, GLuint y
, GLuint z
)
6935 GET_CURRENT_CONTEXT(ctx
);
6937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6938 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6946 if (ctx
->ExecuteFlag
) {
6947 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6951 static void GLAPIENTRY
6952 save_ProgramUniform4ui(GLuint program
, GLint location
,
6953 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6955 GET_CURRENT_CONTEXT(ctx
);
6957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6958 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
6967 if (ctx
->ExecuteFlag
) {
6968 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6972 static void GLAPIENTRY
6973 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
6976 GET_CURRENT_CONTEXT(ctx
);
6978 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6979 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
6984 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
6986 if (ctx
->ExecuteFlag
) {
6987 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
6991 static void GLAPIENTRY
6992 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
6995 GET_CURRENT_CONTEXT(ctx
);
6997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6998 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7003 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7005 if (ctx
->ExecuteFlag
) {
7006 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7010 static void GLAPIENTRY
7011 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7014 GET_CURRENT_CONTEXT(ctx
);
7016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7017 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7022 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7024 if (ctx
->ExecuteFlag
) {
7025 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7029 static void GLAPIENTRY
7030 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7033 GET_CURRENT_CONTEXT(ctx
);
7035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7036 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7041 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7043 if (ctx
->ExecuteFlag
) {
7044 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7048 static void GLAPIENTRY
7049 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7050 GLboolean transpose
, const GLfloat
*v
)
7052 GET_CURRENT_CONTEXT(ctx
);
7054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7055 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7056 4 + POINTER_DWORDS
);
7062 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7064 if (ctx
->ExecuteFlag
) {
7065 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7066 (program
, location
, count
, transpose
, v
));
7070 static void GLAPIENTRY
7071 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7072 GLboolean transpose
, const GLfloat
*v
)
7074 GET_CURRENT_CONTEXT(ctx
);
7076 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7077 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7078 4 + POINTER_DWORDS
);
7084 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7086 if (ctx
->ExecuteFlag
) {
7087 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7088 (program
, location
, count
, transpose
, v
));
7092 static void GLAPIENTRY
7093 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7094 GLboolean transpose
, const GLfloat
*v
)
7096 GET_CURRENT_CONTEXT(ctx
);
7098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7099 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7100 4 + POINTER_DWORDS
);
7106 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7108 if (ctx
->ExecuteFlag
) {
7109 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7110 (program
, location
, count
, transpose
, v
));
7114 static void GLAPIENTRY
7115 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7116 GLboolean transpose
, const GLfloat
*v
)
7118 GET_CURRENT_CONTEXT(ctx
);
7120 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7121 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7122 4 + POINTER_DWORDS
);
7128 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7130 if (ctx
->ExecuteFlag
) {
7131 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7132 (program
, location
, count
, transpose
, v
));
7136 static void GLAPIENTRY
7137 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7138 GLboolean transpose
, const GLfloat
*v
)
7140 GET_CURRENT_CONTEXT(ctx
);
7142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7143 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7144 4 + POINTER_DWORDS
);
7150 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7152 if (ctx
->ExecuteFlag
) {
7153 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7154 (program
, location
, count
, transpose
, v
));
7158 static void GLAPIENTRY
7159 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7160 GLboolean transpose
, const GLfloat
*v
)
7162 GET_CURRENT_CONTEXT(ctx
);
7164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7165 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7166 4 + POINTER_DWORDS
);
7172 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7174 if (ctx
->ExecuteFlag
) {
7175 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7176 (program
, location
, count
, transpose
, v
));
7180 static void GLAPIENTRY
7181 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7182 GLboolean transpose
, const GLfloat
*v
)
7184 GET_CURRENT_CONTEXT(ctx
);
7186 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7187 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7188 4 + POINTER_DWORDS
);
7194 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7196 if (ctx
->ExecuteFlag
) {
7197 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7198 (program
, location
, count
, transpose
, v
));
7202 static void GLAPIENTRY
7203 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7204 GLboolean transpose
, const GLfloat
*v
)
7206 GET_CURRENT_CONTEXT(ctx
);
7208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7209 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7210 4 + POINTER_DWORDS
);
7216 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7218 if (ctx
->ExecuteFlag
) {
7219 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7220 (program
, location
, count
, transpose
, v
));
7224 static void GLAPIENTRY
7225 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7226 GLboolean transpose
, const GLfloat
*v
)
7228 GET_CURRENT_CONTEXT(ctx
);
7230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7231 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7232 4 + POINTER_DWORDS
);
7238 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7240 if (ctx
->ExecuteFlag
) {
7241 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7242 (program
, location
, count
, transpose
, v
));
7246 static void GLAPIENTRY
7247 save_ClampColorARB(GLenum target
, GLenum clamp
)
7249 GET_CURRENT_CONTEXT(ctx
);
7251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7252 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7257 if (ctx
->ExecuteFlag
) {
7258 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7262 static void GLAPIENTRY
7263 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
7265 GET_CURRENT_CONTEXT(ctx
);
7267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7268 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
7273 if (ctx
->ExecuteFlag
) {
7274 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
7278 static void GLAPIENTRY
7279 save_ActiveProgramEXT(GLuint program
)
7281 GET_CURRENT_CONTEXT(ctx
);
7283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7284 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
7288 if (ctx
->ExecuteFlag
) {
7289 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
7293 /** GL_EXT_texture_integer */
7294 static void GLAPIENTRY
7295 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7297 GET_CURRENT_CONTEXT(ctx
);
7299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7300 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7307 if (ctx
->ExecuteFlag
) {
7308 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7312 /** GL_EXT_texture_integer */
7313 static void GLAPIENTRY
7314 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7316 GET_CURRENT_CONTEXT(ctx
);
7318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7319 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7326 if (ctx
->ExecuteFlag
) {
7327 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7331 /** GL_EXT_texture_integer */
7332 static void GLAPIENTRY
7333 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7335 GET_CURRENT_CONTEXT(ctx
);
7337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7338 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7347 if (ctx
->ExecuteFlag
) {
7348 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7352 /** GL_EXT_texture_integer */
7353 static void GLAPIENTRY
7354 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7356 GET_CURRENT_CONTEXT(ctx
);
7358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7359 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7363 n
[3].ui
= params
[0];
7364 n
[4].ui
= params
[1];
7365 n
[5].ui
= params
[2];
7366 n
[6].ui
= params
[3];
7368 if (ctx
->ExecuteFlag
) {
7369 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7373 /* GL_ARB_instanced_arrays */
7374 static void GLAPIENTRY
7375 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7377 GET_CURRENT_CONTEXT(ctx
);
7379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7380 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7385 if (ctx
->ExecuteFlag
) {
7386 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7391 /* GL_NV_texture_barrier */
7392 static void GLAPIENTRY
7393 save_TextureBarrierNV(void)
7395 GET_CURRENT_CONTEXT(ctx
);
7396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7397 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7398 if (ctx
->ExecuteFlag
) {
7399 CALL_TextureBarrierNV(ctx
->Exec
, ());
7404 /* GL_ARB_sampler_objects */
7405 static void GLAPIENTRY
7406 save_BindSampler(GLuint unit
, GLuint sampler
)
7409 GET_CURRENT_CONTEXT(ctx
);
7410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7411 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7416 if (ctx
->ExecuteFlag
) {
7417 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7421 static void GLAPIENTRY
7422 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7425 GET_CURRENT_CONTEXT(ctx
);
7426 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7427 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7432 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7438 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7441 if (ctx
->ExecuteFlag
) {
7442 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7446 static void GLAPIENTRY
7447 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7451 parray
[1] = parray
[2] = parray
[3] = 0;
7452 save_SamplerParameteriv(sampler
, pname
, parray
);
7455 static void GLAPIENTRY
7456 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7459 GET_CURRENT_CONTEXT(ctx
);
7460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7461 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7466 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7472 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7475 if (ctx
->ExecuteFlag
) {
7476 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7480 static void GLAPIENTRY
7481 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7485 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7486 save_SamplerParameterfv(sampler
, pname
, parray
);
7489 static void GLAPIENTRY
7490 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7493 GET_CURRENT_CONTEXT(ctx
);
7494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7495 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7500 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7506 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7509 if (ctx
->ExecuteFlag
) {
7510 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7514 static void GLAPIENTRY
7515 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7518 GET_CURRENT_CONTEXT(ctx
);
7519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7520 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7524 n
[3].ui
= params
[0];
7525 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7526 n
[4].ui
= params
[1];
7527 n
[5].ui
= params
[2];
7528 n
[6].ui
= params
[3];
7531 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7534 if (ctx
->ExecuteFlag
) {
7535 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7539 /* GL_ARB_geometry_shader4 */
7540 static void GLAPIENTRY
7541 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7544 GET_CURRENT_CONTEXT(ctx
);
7545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7546 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7552 if (ctx
->ExecuteFlag
) {
7553 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7557 static void GLAPIENTRY
7558 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7559 GLuint texture
, GLint level
)
7562 GET_CURRENT_CONTEXT(ctx
);
7563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7564 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7567 n
[2].e
= attachment
;
7571 if (ctx
->ExecuteFlag
) {
7572 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7576 static void GLAPIENTRY
7577 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7578 GLuint texture
, GLint level
, GLenum face
)
7581 GET_CURRENT_CONTEXT(ctx
);
7582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7583 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7586 n
[2].e
= attachment
;
7591 if (ctx
->ExecuteFlag
) {
7592 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7599 static void GLAPIENTRY
7600 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7603 GET_CURRENT_CONTEXT(ctx
);
7604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7605 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7607 union uint64_pair p
;
7610 n
[2].ui
= p
.uint32
[0];
7611 n
[3].ui
= p
.uint32
[1];
7612 save_pointer(&n
[4], sync
);
7614 if (ctx
->ExecuteFlag
) {
7615 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7620 /** GL_NV_conditional_render */
7621 static void GLAPIENTRY
7622 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7624 GET_CURRENT_CONTEXT(ctx
);
7626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7627 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7632 if (ctx
->ExecuteFlag
) {
7633 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7637 static void GLAPIENTRY
7638 save_EndConditionalRender(void)
7640 GET_CURRENT_CONTEXT(ctx
);
7641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7642 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7643 if (ctx
->ExecuteFlag
) {
7644 CALL_EndConditionalRender(ctx
->Exec
, ());
7648 static void GLAPIENTRY
7649 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7651 GET_CURRENT_CONTEXT(ctx
);
7653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7654 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7660 if (ctx
->ExecuteFlag
) {
7661 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7667 * Save an error-generating command into display list.
7669 * KW: Will appear in the list before the vertex buffer containing the
7670 * command that provoked the error. I don't see this as a problem.
7673 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7676 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7679 save_pointer(&n
[2], (void *) s
);
7680 /* note: the data/string here doesn't have to be freed in
7681 * _mesa_delete_list() since the string is never dynamically
7689 * Compile an error into current display list.
7692 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7694 if (ctx
->CompileFlag
)
7695 save_error(ctx
, error
, s
);
7696 if (ctx
->ExecuteFlag
)
7697 _mesa_error(ctx
, error
, "%s", s
);
7702 * Test if ID names a display list.
7705 islist(struct gl_context
*ctx
, GLuint list
)
7707 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7717 /**********************************************************************/
7718 /* Display list execution */
7719 /**********************************************************************/
7723 * Execute a display list. Note that the ListBase offset must have already
7724 * been added before calling this function. I.e. the list argument is
7725 * the absolute list number, not relative to ListBase.
7726 * \param list - display list number
7729 execute_list(struct gl_context
*ctx
, GLuint list
)
7731 struct gl_display_list
*dlist
;
7735 if (list
== 0 || !islist(ctx
, list
))
7738 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7739 /* raise an error? */
7743 dlist
= _mesa_lookup_list(ctx
, list
);
7747 ctx
->ListState
.CallDepth
++;
7749 if (ctx
->Driver
.BeginCallList
)
7750 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7756 const OpCode opcode
= n
[0].opcode
;
7758 if (is_ext_opcode(opcode
)) {
7759 n
+= ext_opcode_execute(ctx
, n
);
7764 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7767 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7769 case OPCODE_ALPHA_FUNC
:
7770 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7772 case OPCODE_BIND_TEXTURE
:
7773 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7777 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7778 ctx
->Unpack
= ctx
->DefaultPacking
;
7779 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7780 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7781 get_pointer(&n
[7])));
7782 ctx
->Unpack
= save
; /* restore */
7785 case OPCODE_BLEND_COLOR
:
7786 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7788 case OPCODE_BLEND_EQUATION
:
7789 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7791 case OPCODE_BLEND_EQUATION_SEPARATE
:
7792 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7794 case OPCODE_BLEND_FUNC_SEPARATE
:
7795 CALL_BlendFuncSeparate(ctx
->Exec
,
7796 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7799 case OPCODE_BLEND_FUNC_I
:
7800 /* GL_ARB_draw_buffers_blend */
7801 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7803 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7804 /* GL_ARB_draw_buffers_blend */
7805 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7808 case OPCODE_BLEND_EQUATION_I
:
7809 /* GL_ARB_draw_buffers_blend */
7810 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7812 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7813 /* GL_ARB_draw_buffers_blend */
7814 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7815 (n
[1].ui
, n
[2].e
, n
[3].e
));
7818 case OPCODE_CALL_LIST
:
7819 /* Generated by glCallList(), don't add ListBase */
7820 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7821 execute_list(ctx
, n
[1].ui
);
7824 case OPCODE_CALL_LIST_OFFSET
:
7825 /* Generated by glCallLists() so we must add ListBase */
7827 /* user specified a bad data type at compile time */
7828 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7830 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7831 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7832 execute_list(ctx
, list
);
7836 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7838 case OPCODE_CLEAR_BUFFER_IV
:
7845 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7848 case OPCODE_CLEAR_BUFFER_UIV
:
7855 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7858 case OPCODE_CLEAR_BUFFER_FV
:
7865 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7868 case OPCODE_CLEAR_BUFFER_FI
:
7869 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7871 case OPCODE_CLEAR_COLOR
:
7872 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7874 case OPCODE_CLEAR_ACCUM
:
7875 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7877 case OPCODE_CLEAR_DEPTH
:
7878 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7880 case OPCODE_CLEAR_INDEX
:
7881 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7883 case OPCODE_CLEAR_STENCIL
:
7884 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7886 case OPCODE_CLIP_PLANE
:
7893 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7896 case OPCODE_COLOR_MASK
:
7897 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7899 case OPCODE_COLOR_MASK_INDEXED
:
7900 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7903 case OPCODE_COLOR_MATERIAL
:
7904 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7906 case OPCODE_COPY_PIXELS
:
7907 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7908 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7911 case OPCODE_COPY_TEX_IMAGE1D
:
7912 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7913 n
[5].i
, n
[6].i
, n
[7].i
));
7915 case OPCODE_COPY_TEX_IMAGE2D
:
7916 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7917 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7919 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7920 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7921 n
[4].i
, n
[5].i
, n
[6].i
));
7923 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7924 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7925 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7928 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7929 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7930 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7933 case OPCODE_CULL_FACE
:
7934 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7936 case OPCODE_DEPTH_FUNC
:
7937 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7939 case OPCODE_DEPTH_MASK
:
7940 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7942 case OPCODE_DEPTH_RANGE
:
7943 CALL_DepthRange(ctx
->Exec
,
7944 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7946 case OPCODE_DISABLE
:
7947 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7949 case OPCODE_DISABLE_INDEXED
:
7950 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7952 case OPCODE_DRAW_BUFFER
:
7953 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7955 case OPCODE_DRAW_PIXELS
:
7957 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7958 ctx
->Unpack
= ctx
->DefaultPacking
;
7959 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7960 get_pointer(&n
[5])));
7961 ctx
->Unpack
= save
; /* restore */
7965 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7967 case OPCODE_ENABLE_INDEXED
:
7968 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7970 case OPCODE_EVALMESH1
:
7971 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7973 case OPCODE_EVALMESH2
:
7974 CALL_EvalMesh2(ctx
->Exec
,
7975 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7984 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7987 case OPCODE_FRONT_FACE
:
7988 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7990 case OPCODE_FRUSTUM
:
7991 CALL_Frustum(ctx
->Exec
,
7992 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7995 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7997 case OPCODE_INDEX_MASK
:
7998 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
8000 case OPCODE_INIT_NAMES
:
8001 CALL_InitNames(ctx
->Exec
, ());
8010 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8013 case OPCODE_LIGHT_MODEL
:
8020 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8023 case OPCODE_LINE_STIPPLE
:
8024 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8026 case OPCODE_LINE_WIDTH
:
8027 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8029 case OPCODE_LIST_BASE
:
8030 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8032 case OPCODE_LOAD_IDENTITY
:
8033 CALL_LoadIdentity(ctx
->Exec
, ());
8035 case OPCODE_LOAD_MATRIX
:
8036 if (sizeof(Node
) == sizeof(GLfloat
)) {
8037 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8042 for (i
= 0; i
< 16; i
++) {
8045 CALL_LoadMatrixf(ctx
->Exec
, (m
));
8048 case OPCODE_LOAD_NAME
:
8049 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8051 case OPCODE_LOGIC_OP
:
8052 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8056 GLenum target
= n
[1].e
;
8057 GLint ustride
= _mesa_evaluator_components(target
);
8058 GLint uorder
= n
[5].i
;
8059 GLfloat u1
= n
[2].f
;
8060 GLfloat u2
= n
[3].f
;
8061 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8062 (GLfloat
*) get_pointer(&n
[6])));
8067 GLenum target
= n
[1].e
;
8068 GLfloat u1
= n
[2].f
;
8069 GLfloat u2
= n
[3].f
;
8070 GLfloat v1
= n
[4].f
;
8071 GLfloat v2
= n
[5].f
;
8072 GLint ustride
= n
[6].i
;
8073 GLint vstride
= n
[7].i
;
8074 GLint uorder
= n
[8].i
;
8075 GLint vorder
= n
[9].i
;
8076 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8077 v1
, v2
, vstride
, vorder
,
8078 (GLfloat
*) get_pointer(&n
[10])));
8081 case OPCODE_MAPGRID1
:
8082 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8084 case OPCODE_MAPGRID2
:
8085 CALL_MapGrid2f(ctx
->Exec
,
8086 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8088 case OPCODE_MATRIX_MODE
:
8089 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8091 case OPCODE_MULT_MATRIX
:
8092 if (sizeof(Node
) == sizeof(GLfloat
)) {
8093 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8098 for (i
= 0; i
< 16; i
++) {
8101 CALL_MultMatrixf(ctx
->Exec
, (m
));
8105 CALL_Ortho(ctx
->Exec
,
8106 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8108 case OPCODE_PASSTHROUGH
:
8109 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8111 case OPCODE_PIXEL_MAP
:
8112 CALL_PixelMapfv(ctx
->Exec
,
8113 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8115 case OPCODE_PIXEL_TRANSFER
:
8116 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8118 case OPCODE_PIXEL_ZOOM
:
8119 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8121 case OPCODE_POINT_SIZE
:
8122 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8124 case OPCODE_POINT_PARAMETERS
:
8130 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8133 case OPCODE_POLYGON_MODE
:
8134 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8136 case OPCODE_POLYGON_STIPPLE
:
8138 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8139 ctx
->Unpack
= ctx
->DefaultPacking
;
8140 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8141 ctx
->Unpack
= save
; /* restore */
8144 case OPCODE_POLYGON_OFFSET
:
8145 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8147 case OPCODE_POP_ATTRIB
:
8148 CALL_PopAttrib(ctx
->Exec
, ());
8150 case OPCODE_POP_MATRIX
:
8151 CALL_PopMatrix(ctx
->Exec
, ());
8153 case OPCODE_POP_NAME
:
8154 CALL_PopName(ctx
->Exec
, ());
8156 case OPCODE_PRIORITIZE_TEXTURE
:
8157 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8159 case OPCODE_PUSH_ATTRIB
:
8160 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8162 case OPCODE_PUSH_MATRIX
:
8163 CALL_PushMatrix(ctx
->Exec
, ());
8165 case OPCODE_PUSH_NAME
:
8166 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8168 case OPCODE_RASTER_POS
:
8169 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8171 case OPCODE_READ_BUFFER
:
8172 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8175 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8178 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8180 case OPCODE_SCISSOR
:
8181 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8183 case OPCODE_SHADE_MODEL
:
8184 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8186 case OPCODE_PROVOKING_VERTEX
:
8187 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8189 case OPCODE_STENCIL_FUNC
:
8190 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8192 case OPCODE_STENCIL_MASK
:
8193 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8195 case OPCODE_STENCIL_OP
:
8196 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8198 case OPCODE_STENCIL_FUNC_SEPARATE
:
8199 CALL_StencilFuncSeparate(ctx
->Exec
,
8200 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8202 case OPCODE_STENCIL_MASK_SEPARATE
:
8203 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8205 case OPCODE_STENCIL_OP_SEPARATE
:
8206 CALL_StencilOpSeparate(ctx
->Exec
,
8207 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8216 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8226 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8229 case OPCODE_TEXPARAMETER
:
8236 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8239 case OPCODE_TEX_IMAGE1D
:
8241 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8242 ctx
->Unpack
= ctx
->DefaultPacking
;
8243 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8245 n
[3].i
, /* components */
8247 n
[5].e
, /* border */
8248 n
[6].e
, /* format */
8250 get_pointer(&n
[8])));
8251 ctx
->Unpack
= save
; /* restore */
8254 case OPCODE_TEX_IMAGE2D
:
8256 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8257 ctx
->Unpack
= ctx
->DefaultPacking
;
8258 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8260 n
[3].i
, /* components */
8262 n
[5].i
, /* height */
8263 n
[6].e
, /* border */
8264 n
[7].e
, /* format */
8266 get_pointer(&n
[9])));
8267 ctx
->Unpack
= save
; /* restore */
8270 case OPCODE_TEX_IMAGE3D
:
8272 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8273 ctx
->Unpack
= ctx
->DefaultPacking
;
8274 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8276 n
[3].i
, /* components */
8278 n
[5].i
, /* height */
8280 n
[7].e
, /* border */
8281 n
[8].e
, /* format */
8283 get_pointer(&n
[10])));
8284 ctx
->Unpack
= save
; /* restore */
8287 case OPCODE_TEX_SUB_IMAGE1D
:
8289 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8290 ctx
->Unpack
= ctx
->DefaultPacking
;
8291 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8293 n
[6].e
, get_pointer(&n
[7])));
8294 ctx
->Unpack
= save
; /* restore */
8297 case OPCODE_TEX_SUB_IMAGE2D
:
8299 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8300 ctx
->Unpack
= ctx
->DefaultPacking
;
8301 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8303 n
[6].i
, n
[7].e
, n
[8].e
,
8304 get_pointer(&n
[9])));
8305 ctx
->Unpack
= save
; /* restore */
8308 case OPCODE_TEX_SUB_IMAGE3D
:
8310 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8311 ctx
->Unpack
= ctx
->DefaultPacking
;
8312 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8313 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8314 n
[8].i
, n
[9].e
, n
[10].e
,
8315 get_pointer(&n
[11])));
8316 ctx
->Unpack
= save
; /* restore */
8319 case OPCODE_TRANSLATE
:
8320 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8322 case OPCODE_VIEWPORT
:
8323 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8324 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8326 case OPCODE_WINDOW_POS
:
8327 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8329 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8330 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8332 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8333 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8334 n
[4].i
, n
[5].i
, n
[6].i
,
8335 get_pointer(&n
[7])));
8337 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8338 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8339 n
[4].i
, n
[5].i
, n
[6].i
,
8340 n
[7].i
, get_pointer(&n
[8])));
8342 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8343 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8344 n
[4].i
, n
[5].i
, n
[6].i
,
8346 get_pointer(&n
[9])));
8348 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8349 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8350 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8352 get_pointer(&n
[7])));
8354 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8355 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8356 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8357 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8358 get_pointer(&n
[9])));
8360 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8361 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8362 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8363 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8365 get_pointer(&n
[11])));
8367 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8368 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8370 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8371 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8373 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8374 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8376 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8377 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8378 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8381 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8382 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8384 case OPCODE_DEPTH_BOUNDS_EXT
:
8385 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8387 case OPCODE_PROGRAM_STRING_ARB
:
8388 CALL_ProgramStringARB(ctx
->Exec
,
8389 (n
[1].e
, n
[2].e
, n
[3].i
,
8390 get_pointer(&n
[4])));
8392 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8393 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8397 case OPCODE_BEGIN_QUERY_ARB
:
8398 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8400 case OPCODE_END_QUERY_ARB
:
8401 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8403 case OPCODE_QUERY_COUNTER
:
8404 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8406 case OPCODE_BEGIN_QUERY_INDEXED
:
8407 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8409 case OPCODE_END_QUERY_INDEXED
:
8410 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8412 case OPCODE_DRAW_BUFFERS_ARB
:
8414 GLenum buffers
[MAX_DRAW_BUFFERS
];
8415 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8416 for (i
= 0; i
< count
; i
++)
8417 buffers
[i
] = n
[2 + i
].e
;
8418 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8421 case OPCODE_BLIT_FRAMEBUFFER
:
8422 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8423 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8426 case OPCODE_USE_PROGRAM
:
8427 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8429 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8430 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8432 case OPCODE_ACTIVE_PROGRAM_EXT
:
8433 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8435 case OPCODE_UNIFORM_1F
:
8436 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8438 case OPCODE_UNIFORM_2F
:
8439 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8441 case OPCODE_UNIFORM_3F
:
8442 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8444 case OPCODE_UNIFORM_4F
:
8445 CALL_Uniform4f(ctx
->Exec
,
8446 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8448 case OPCODE_UNIFORM_1FV
:
8449 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8451 case OPCODE_UNIFORM_2FV
:
8452 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8454 case OPCODE_UNIFORM_3FV
:
8455 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8457 case OPCODE_UNIFORM_4FV
:
8458 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8460 case OPCODE_UNIFORM_1I
:
8461 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8463 case OPCODE_UNIFORM_2I
:
8464 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8466 case OPCODE_UNIFORM_3I
:
8467 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8469 case OPCODE_UNIFORM_4I
:
8470 CALL_Uniform4i(ctx
->Exec
,
8471 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8473 case OPCODE_UNIFORM_1IV
:
8474 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8476 case OPCODE_UNIFORM_2IV
:
8477 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8479 case OPCODE_UNIFORM_3IV
:
8480 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8482 case OPCODE_UNIFORM_4IV
:
8483 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8485 case OPCODE_UNIFORM_1UI
:
8486 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8488 case OPCODE_UNIFORM_2UI
:
8489 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8491 case OPCODE_UNIFORM_3UI
:
8492 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8494 case OPCODE_UNIFORM_4UI
:
8495 /*CALL_Uniform4uiARB(ctx->Exec,
8496 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8499 case OPCODE_UNIFORM_1UIV
:
8500 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8501 get_pointer(&n[3])));*/
8503 case OPCODE_UNIFORM_2UIV
:
8504 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8505 get_pointer(&n[3])));*/
8507 case OPCODE_UNIFORM_3UIV
:
8508 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8509 get_pointer(&n[3])));*/
8511 case OPCODE_UNIFORM_4UIV
:
8512 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8513 get_pointer(&n[3])));*/
8515 case OPCODE_UNIFORM_MATRIX22
:
8516 CALL_UniformMatrix2fv(ctx
->Exec
,
8517 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8519 case OPCODE_UNIFORM_MATRIX33
:
8520 CALL_UniformMatrix3fv(ctx
->Exec
,
8521 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8523 case OPCODE_UNIFORM_MATRIX44
:
8524 CALL_UniformMatrix4fv(ctx
->Exec
,
8525 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8527 case OPCODE_UNIFORM_MATRIX23
:
8528 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8529 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8531 case OPCODE_UNIFORM_MATRIX32
:
8532 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8533 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8535 case OPCODE_UNIFORM_MATRIX24
:
8536 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8537 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8539 case OPCODE_UNIFORM_MATRIX42
:
8540 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8541 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8543 case OPCODE_UNIFORM_MATRIX34
:
8544 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8545 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8547 case OPCODE_UNIFORM_MATRIX43
:
8548 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8549 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8552 case OPCODE_USE_PROGRAM_STAGES
:
8553 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8555 case OPCODE_PROGRAM_UNIFORM_1F
:
8556 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8558 case OPCODE_PROGRAM_UNIFORM_2F
:
8559 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8561 case OPCODE_PROGRAM_UNIFORM_3F
:
8562 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8563 n
[3].f
, n
[4].f
, n
[5].f
));
8565 case OPCODE_PROGRAM_UNIFORM_4F
:
8566 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8567 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8569 case OPCODE_PROGRAM_UNIFORM_1FV
:
8570 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8571 get_pointer(&n
[4])));
8573 case OPCODE_PROGRAM_UNIFORM_2FV
:
8574 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8575 get_pointer(&n
[4])));
8577 case OPCODE_PROGRAM_UNIFORM_3FV
:
8578 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8579 get_pointer(&n
[4])));
8581 case OPCODE_PROGRAM_UNIFORM_4FV
:
8582 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8583 get_pointer(&n
[4])));
8585 case OPCODE_PROGRAM_UNIFORM_1I
:
8586 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8588 case OPCODE_PROGRAM_UNIFORM_2I
:
8589 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8591 case OPCODE_PROGRAM_UNIFORM_3I
:
8592 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8593 n
[3].i
, n
[4].i
, n
[5].i
));
8595 case OPCODE_PROGRAM_UNIFORM_4I
:
8596 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8597 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8599 case OPCODE_PROGRAM_UNIFORM_1IV
:
8600 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8601 get_pointer(&n
[4])));
8603 case OPCODE_PROGRAM_UNIFORM_2IV
:
8604 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8605 get_pointer(&n
[4])));
8607 case OPCODE_PROGRAM_UNIFORM_3IV
:
8608 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8609 get_pointer(&n
[4])));
8611 case OPCODE_PROGRAM_UNIFORM_4IV
:
8612 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8613 get_pointer(&n
[4])));
8615 case OPCODE_PROGRAM_UNIFORM_1UI
:
8616 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8618 case OPCODE_PROGRAM_UNIFORM_2UI
:
8619 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8622 case OPCODE_PROGRAM_UNIFORM_3UI
:
8623 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8624 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8626 case OPCODE_PROGRAM_UNIFORM_4UI
:
8627 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8629 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8631 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8632 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8633 get_pointer(&n
[4])));
8635 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8636 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8637 get_pointer(&n
[4])));
8639 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8640 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8641 get_pointer(&n
[4])));
8643 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8644 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8645 get_pointer(&n
[4])));
8647 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8648 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8649 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8650 get_pointer(&n
[5])));
8652 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8653 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8654 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8655 get_pointer(&n
[5])));
8657 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8658 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8659 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8660 get_pointer(&n
[5])));
8662 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8663 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8664 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8665 get_pointer(&n
[5])));
8667 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8668 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8669 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8670 get_pointer(&n
[5])));
8672 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8673 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8674 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8675 get_pointer(&n
[5])));
8677 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8678 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8679 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8680 get_pointer(&n
[5])));
8682 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8683 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8684 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8685 get_pointer(&n
[5])));
8687 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8688 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8689 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8690 get_pointer(&n
[5])));
8693 case OPCODE_CLAMP_COLOR
:
8694 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8697 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8700 GLuint i
, pname
= n
[1].ui
;
8702 for (i
= 0; i
< 4; i
++)
8703 values
[i
] = n
[1 + i
].f
;
8704 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8707 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8708 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8710 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8713 GLuint i
, dst
= n
[1].ui
;
8715 for (i
= 0; i
< 4; i
++)
8716 values
[i
] = n
[1 + i
].f
;
8717 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8720 case OPCODE_ATTR_1F_NV
:
8721 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8723 case OPCODE_ATTR_2F_NV
:
8724 /* Really shouldn't have to do this - the Node structure
8725 * is convenient, but it would be better to store the data
8726 * packed appropriately so that it can be sent directly
8727 * on. With x86_64 becoming common, this will start to
8730 if (sizeof(Node
) == sizeof(GLfloat
))
8731 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8733 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8735 case OPCODE_ATTR_3F_NV
:
8736 if (sizeof(Node
) == sizeof(GLfloat
))
8737 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8739 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8742 case OPCODE_ATTR_4F_NV
:
8743 if (sizeof(Node
) == sizeof(GLfloat
))
8744 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8746 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8749 case OPCODE_ATTR_1F_ARB
:
8750 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8752 case OPCODE_ATTR_2F_ARB
:
8753 /* Really shouldn't have to do this - the Node structure
8754 * is convenient, but it would be better to store the data
8755 * packed appropriately so that it can be sent directly
8756 * on. With x86_64 becoming common, this will start to
8759 if (sizeof(Node
) == sizeof(GLfloat
))
8760 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8762 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8764 case OPCODE_ATTR_3F_ARB
:
8765 if (sizeof(Node
) == sizeof(GLfloat
))
8766 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8768 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8771 case OPCODE_ATTR_4F_ARB
:
8772 if (sizeof(Node
) == sizeof(GLfloat
))
8773 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8775 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8778 case OPCODE_MATERIAL
:
8779 if (sizeof(Node
) == sizeof(GLfloat
))
8780 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8787 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8791 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8794 CALL_End(ctx
->Exec
, ());
8797 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8799 case OPCODE_EVAL_C1
:
8800 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8802 case OPCODE_EVAL_C2
:
8803 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8805 case OPCODE_EVAL_P1
:
8806 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8808 case OPCODE_EVAL_P2
:
8809 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8812 /* GL_EXT_texture_integer */
8813 case OPCODE_CLEARCOLOR_I
:
8814 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8816 case OPCODE_CLEARCOLOR_UI
:
8817 CALL_ClearColorIuiEXT(ctx
->Exec
,
8818 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8820 case OPCODE_TEXPARAMETER_I
:
8827 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8830 case OPCODE_TEXPARAMETER_UI
:
8833 params
[0] = n
[3].ui
;
8834 params
[1] = n
[4].ui
;
8835 params
[2] = n
[5].ui
;
8836 params
[3] = n
[6].ui
;
8837 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8841 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8842 /* GL_ARB_instanced_arrays */
8843 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8846 case OPCODE_TEXTURE_BARRIER_NV
:
8847 CALL_TextureBarrierNV(ctx
->Exec
, ());
8850 /* GL_EXT/ARB_transform_feedback */
8851 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8852 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8854 case OPCODE_END_TRANSFORM_FEEDBACK
:
8855 CALL_EndTransformFeedback(ctx
->Exec
, ());
8857 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8858 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8860 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8861 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8863 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8864 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8866 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8867 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8869 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8870 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8871 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8873 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8874 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8875 (n
[1].e
, n
[2].ui
, n
[3].si
));
8877 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8878 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8879 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8883 case OPCODE_BIND_SAMPLER
:
8884 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8886 case OPCODE_SAMPLER_PARAMETERIV
:
8893 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8896 case OPCODE_SAMPLER_PARAMETERFV
:
8903 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8906 case OPCODE_SAMPLER_PARAMETERIIV
:
8913 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8916 case OPCODE_SAMPLER_PARAMETERUIV
:
8919 params
[0] = n
[3].ui
;
8920 params
[1] = n
[4].ui
;
8921 params
[2] = n
[5].ui
;
8922 params
[3] = n
[6].ui
;
8923 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8927 /* GL_ARB_geometry_shader4 */
8928 case OPCODE_PROGRAM_PARAMETERI
:
8929 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8931 case OPCODE_FRAMEBUFFER_TEXTURE
:
8932 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8935 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8936 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8937 n
[3].ui
, n
[4].i
, n
[5].e
));
8941 case OPCODE_WAIT_SYNC
:
8943 union uint64_pair p
;
8944 p
.uint32
[0] = n
[2].ui
;
8945 p
.uint32
[1] = n
[3].ui
;
8946 CALL_WaitSync(ctx
->Exec
,
8947 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8951 /* GL_NV_conditional_render */
8952 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8953 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8955 case OPCODE_END_CONDITIONAL_RENDER
:
8956 CALL_EndConditionalRender(ctx
->Exec
, ());
8959 case OPCODE_UNIFORM_BLOCK_BINDING
:
8960 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8963 case OPCODE_CONTINUE
:
8964 n
= (Node
*) get_pointer(&n
[1]);
8966 case OPCODE_END_OF_LIST
:
8972 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8974 _mesa_problem(ctx
, "%s", msg
);
8979 /* increment n to point to next compiled command */
8980 if (opcode
!= OPCODE_CONTINUE
) {
8981 n
+= InstSize
[opcode
];
8986 if (ctx
->Driver
.EndCallList
)
8987 ctx
->Driver
.EndCallList(ctx
);
8989 ctx
->ListState
.CallDepth
--;
8994 /**********************************************************************/
8996 /**********************************************************************/
8999 * Test if a display list number is valid.
9001 GLboolean GLAPIENTRY
9002 _mesa_IsList(GLuint list
)
9004 GET_CURRENT_CONTEXT(ctx
);
9005 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9006 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
9007 return islist(ctx
, list
);
9012 * Delete a sequence of consecutive display lists.
9015 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9017 GET_CURRENT_CONTEXT(ctx
);
9019 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9020 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9023 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9026 for (i
= list
; i
< list
+ range
; i
++) {
9027 destroy_list(ctx
, i
);
9033 * Return a display list number, n, such that lists n through n+range-1
9037 _mesa_GenLists(GLsizei range
)
9039 GET_CURRENT_CONTEXT(ctx
);
9041 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9042 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9045 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9053 * Make this an atomic operation
9055 mtx_lock(&ctx
->Shared
->Mutex
);
9057 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9059 /* reserve the list IDs by with empty/dummy lists */
9061 for (i
= 0; i
< range
; i
++) {
9062 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
9063 make_list(base
+ i
, 1));
9067 mtx_unlock(&ctx
->Shared
->Mutex
);
9074 * Begin a new display list.
9077 _mesa_NewList(GLuint name
, GLenum mode
)
9079 GET_CURRENT_CONTEXT(ctx
);
9081 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9082 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9084 if (MESA_VERBOSE
& VERBOSE_API
)
9085 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9086 _mesa_lookup_enum_by_nr(mode
));
9089 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9093 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9094 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9098 if (ctx
->ListState
.CurrentList
) {
9099 /* already compiling a display list */
9100 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9104 ctx
->CompileFlag
= GL_TRUE
;
9105 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9107 /* Reset accumulated list state */
9108 invalidate_saved_current_state( ctx
);
9110 /* Allocate new display list */
9111 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9112 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9113 ctx
->ListState
.CurrentPos
= 0;
9115 ctx
->Driver
.NewList(ctx
, name
, mode
);
9117 ctx
->CurrentDispatch
= ctx
->Save
;
9118 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9123 * End definition of current display list.
9128 GET_CURRENT_CONTEXT(ctx
);
9129 SAVE_FLUSH_VERTICES(ctx
);
9130 FLUSH_VERTICES(ctx
, 0);
9132 if (MESA_VERBOSE
& VERBOSE_API
)
9133 _mesa_debug(ctx
, "glEndList\n");
9135 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9136 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9137 "glEndList() called inside glBegin/End");
9140 /* Check that a list is under construction */
9141 if (!ctx
->ListState
.CurrentList
) {
9142 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9146 /* Call before emitting END_OF_LIST, in case the driver wants to
9147 * emit opcodes itself.
9149 ctx
->Driver
.EndList(ctx
);
9151 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9155 /* Destroy old list, if any */
9156 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9158 /* Install the new list */
9159 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9160 ctx
->ListState
.CurrentList
->Name
,
9161 ctx
->ListState
.CurrentList
);
9164 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9165 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9167 ctx
->ListState
.CurrentList
= NULL
;
9168 ctx
->ListState
.CurrentBlock
= NULL
;
9169 ctx
->ListState
.CurrentPos
= 0;
9170 ctx
->ExecuteFlag
= GL_TRUE
;
9171 ctx
->CompileFlag
= GL_FALSE
;
9173 ctx
->CurrentDispatch
= ctx
->Exec
;
9174 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9179 _mesa_CallList(GLuint list
)
9181 GLboolean save_compile_flag
;
9182 GET_CURRENT_CONTEXT(ctx
);
9183 FLUSH_CURRENT(ctx
, 0);
9185 if (MESA_VERBOSE
& VERBOSE_API
)
9186 _mesa_debug(ctx
, "glCallList %d\n", list
);
9189 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9194 mesa_print_display_list( list
);
9196 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9197 * execute the display list, and restore the CompileFlag.
9199 save_compile_flag
= ctx
->CompileFlag
;
9200 if (save_compile_flag
) {
9201 ctx
->CompileFlag
= GL_FALSE
;
9204 execute_list(ctx
, list
);
9205 ctx
->CompileFlag
= save_compile_flag
;
9207 /* also restore API function pointers to point to "save" versions */
9208 if (save_compile_flag
) {
9209 ctx
->CurrentDispatch
= ctx
->Save
;
9210 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9216 * Execute glCallLists: call multiple display lists.
9219 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9221 GET_CURRENT_CONTEXT(ctx
);
9223 GLboolean save_compile_flag
;
9225 if (MESA_VERBOSE
& VERBOSE_API
)
9226 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9230 case GL_UNSIGNED_BYTE
:
9232 case GL_UNSIGNED_SHORT
:
9234 case GL_UNSIGNED_INT
:
9242 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9246 /* Save the CompileFlag status, turn it off, execute display list,
9247 * and restore the CompileFlag.
9249 save_compile_flag
= ctx
->CompileFlag
;
9250 ctx
->CompileFlag
= GL_FALSE
;
9252 for (i
= 0; i
< n
; i
++) {
9253 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9254 execute_list(ctx
, list
);
9257 ctx
->CompileFlag
= save_compile_flag
;
9259 /* also restore API function pointers to point to "save" versions */
9260 if (save_compile_flag
) {
9261 ctx
->CurrentDispatch
= ctx
->Save
;
9262 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9268 * Set the offset added to list numbers in glCallLists.
9271 _mesa_ListBase(GLuint base
)
9273 GET_CURRENT_CONTEXT(ctx
);
9274 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9275 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9276 ctx
->List
.ListBase
= base
;
9280 * Setup the given dispatch table to point to Mesa's display list
9281 * building functions.
9283 * This does not include any of the tnl functions - they are
9284 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9288 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9290 struct _glapi_table
*table
= ctx
->Save
;
9291 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9293 /* Initially populate the dispatch table with the contents of the
9294 * normal-execution dispatch table. This lets us skip populating functions
9295 * that should be called directly instead of compiled into display lists.
9297 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9299 _mesa_loopback_init_api_table(ctx
, table
);
9302 vbo_initialize_save_dispatch(ctx
, table
);
9305 SET_Accum(table
, save_Accum
);
9306 SET_AlphaFunc(table
, save_AlphaFunc
);
9307 SET_Bitmap(table
, save_Bitmap
);
9308 SET_BlendFunc(table
, save_BlendFunc
);
9309 SET_CallList(table
, save_CallList
);
9310 SET_CallLists(table
, save_CallLists
);
9311 SET_Clear(table
, save_Clear
);
9312 SET_ClearAccum(table
, save_ClearAccum
);
9313 SET_ClearColor(table
, save_ClearColor
);
9314 SET_ClearDepth(table
, save_ClearDepth
);
9315 SET_ClearIndex(table
, save_ClearIndex
);
9316 SET_ClearStencil(table
, save_ClearStencil
);
9317 SET_ClipPlane(table
, save_ClipPlane
);
9318 SET_ColorMask(table
, save_ColorMask
);
9319 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9320 SET_ColorMaterial(table
, save_ColorMaterial
);
9321 SET_CopyPixels(table
, save_CopyPixels
);
9322 SET_CullFace(table
, save_CullFace
);
9323 SET_DepthFunc(table
, save_DepthFunc
);
9324 SET_DepthMask(table
, save_DepthMask
);
9325 SET_DepthRange(table
, save_DepthRange
);
9326 SET_Disable(table
, save_Disable
);
9327 SET_Disablei(table
, save_DisableIndexed
);
9328 SET_DrawBuffer(table
, save_DrawBuffer
);
9329 SET_DrawPixels(table
, save_DrawPixels
);
9330 SET_Enable(table
, save_Enable
);
9331 SET_Enablei(table
, save_EnableIndexed
);
9332 SET_EvalMesh1(table
, save_EvalMesh1
);
9333 SET_EvalMesh2(table
, save_EvalMesh2
);
9334 SET_Fogf(table
, save_Fogf
);
9335 SET_Fogfv(table
, save_Fogfv
);
9336 SET_Fogi(table
, save_Fogi
);
9337 SET_Fogiv(table
, save_Fogiv
);
9338 SET_FrontFace(table
, save_FrontFace
);
9339 SET_Frustum(table
, save_Frustum
);
9340 SET_Hint(table
, save_Hint
);
9341 SET_IndexMask(table
, save_IndexMask
);
9342 SET_InitNames(table
, save_InitNames
);
9343 SET_LightModelf(table
, save_LightModelf
);
9344 SET_LightModelfv(table
, save_LightModelfv
);
9345 SET_LightModeli(table
, save_LightModeli
);
9346 SET_LightModeliv(table
, save_LightModeliv
);
9347 SET_Lightf(table
, save_Lightf
);
9348 SET_Lightfv(table
, save_Lightfv
);
9349 SET_Lighti(table
, save_Lighti
);
9350 SET_Lightiv(table
, save_Lightiv
);
9351 SET_LineStipple(table
, save_LineStipple
);
9352 SET_LineWidth(table
, save_LineWidth
);
9353 SET_ListBase(table
, save_ListBase
);
9354 SET_LoadIdentity(table
, save_LoadIdentity
);
9355 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9356 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9357 SET_LoadName(table
, save_LoadName
);
9358 SET_LogicOp(table
, save_LogicOp
);
9359 SET_Map1d(table
, save_Map1d
);
9360 SET_Map1f(table
, save_Map1f
);
9361 SET_Map2d(table
, save_Map2d
);
9362 SET_Map2f(table
, save_Map2f
);
9363 SET_MapGrid1d(table
, save_MapGrid1d
);
9364 SET_MapGrid1f(table
, save_MapGrid1f
);
9365 SET_MapGrid2d(table
, save_MapGrid2d
);
9366 SET_MapGrid2f(table
, save_MapGrid2f
);
9367 SET_MatrixMode(table
, save_MatrixMode
);
9368 SET_MultMatrixd(table
, save_MultMatrixd
);
9369 SET_MultMatrixf(table
, save_MultMatrixf
);
9370 SET_NewList(table
, save_NewList
);
9371 SET_Ortho(table
, save_Ortho
);
9372 SET_PassThrough(table
, save_PassThrough
);
9373 SET_PixelMapfv(table
, save_PixelMapfv
);
9374 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9375 SET_PixelMapusv(table
, save_PixelMapusv
);
9376 SET_PixelTransferf(table
, save_PixelTransferf
);
9377 SET_PixelTransferi(table
, save_PixelTransferi
);
9378 SET_PixelZoom(table
, save_PixelZoom
);
9379 SET_PointSize(table
, save_PointSize
);
9380 SET_PolygonMode(table
, save_PolygonMode
);
9381 SET_PolygonOffset(table
, save_PolygonOffset
);
9382 SET_PolygonStipple(table
, save_PolygonStipple
);
9383 SET_PopAttrib(table
, save_PopAttrib
);
9384 SET_PopMatrix(table
, save_PopMatrix
);
9385 SET_PopName(table
, save_PopName
);
9386 SET_PushAttrib(table
, save_PushAttrib
);
9387 SET_PushMatrix(table
, save_PushMatrix
);
9388 SET_PushName(table
, save_PushName
);
9389 SET_RasterPos2d(table
, save_RasterPos2d
);
9390 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9391 SET_RasterPos2f(table
, save_RasterPos2f
);
9392 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9393 SET_RasterPos2i(table
, save_RasterPos2i
);
9394 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9395 SET_RasterPos2s(table
, save_RasterPos2s
);
9396 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9397 SET_RasterPos3d(table
, save_RasterPos3d
);
9398 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9399 SET_RasterPos3f(table
, save_RasterPos3f
);
9400 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9401 SET_RasterPos3i(table
, save_RasterPos3i
);
9402 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9403 SET_RasterPos3s(table
, save_RasterPos3s
);
9404 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9405 SET_RasterPos4d(table
, save_RasterPos4d
);
9406 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9407 SET_RasterPos4f(table
, save_RasterPos4f
);
9408 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9409 SET_RasterPos4i(table
, save_RasterPos4i
);
9410 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9411 SET_RasterPos4s(table
, save_RasterPos4s
);
9412 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9413 SET_ReadBuffer(table
, save_ReadBuffer
);
9414 SET_Rectf(table
, save_Rectf
);
9415 SET_Rotated(table
, save_Rotated
);
9416 SET_Rotatef(table
, save_Rotatef
);
9417 SET_Scaled(table
, save_Scaled
);
9418 SET_Scalef(table
, save_Scalef
);
9419 SET_Scissor(table
, save_Scissor
);
9420 SET_ShadeModel(table
, save_ShadeModel
);
9421 SET_StencilFunc(table
, save_StencilFunc
);
9422 SET_StencilMask(table
, save_StencilMask
);
9423 SET_StencilOp(table
, save_StencilOp
);
9424 SET_TexEnvf(table
, save_TexEnvf
);
9425 SET_TexEnvfv(table
, save_TexEnvfv
);
9426 SET_TexEnvi(table
, save_TexEnvi
);
9427 SET_TexEnviv(table
, save_TexEnviv
);
9428 SET_TexGend(table
, save_TexGend
);
9429 SET_TexGendv(table
, save_TexGendv
);
9430 SET_TexGenf(table
, save_TexGenf
);
9431 SET_TexGenfv(table
, save_TexGenfv
);
9432 SET_TexGeni(table
, save_TexGeni
);
9433 SET_TexGeniv(table
, save_TexGeniv
);
9434 SET_TexImage1D(table
, save_TexImage1D
);
9435 SET_TexImage2D(table
, save_TexImage2D
);
9436 SET_TexParameterf(table
, save_TexParameterf
);
9437 SET_TexParameterfv(table
, save_TexParameterfv
);
9438 SET_TexParameteri(table
, save_TexParameteri
);
9439 SET_TexParameteriv(table
, save_TexParameteriv
);
9440 SET_Translated(table
, save_Translated
);
9441 SET_Translatef(table
, save_Translatef
);
9442 SET_Viewport(table
, save_Viewport
);
9445 SET_BindTexture(table
, save_BindTexture
);
9446 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9447 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9448 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9449 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9450 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9451 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9452 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9455 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9456 SET_TexImage3D(table
, save_TexImage3D
);
9457 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9460 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9461 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9462 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9464 /* ATI_separate_stencil */
9465 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9467 /* GL_ARB_imaging */
9468 /* Not all are supported */
9469 SET_BlendColor(table
, save_BlendColor
);
9470 SET_BlendEquation(table
, save_BlendEquation
);
9472 /* 2. GL_EXT_blend_color */
9474 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9477 /* 3. GL_EXT_polygon_offset */
9478 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9480 /* 6. GL_EXT_texture3d */
9482 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9483 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9484 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9487 /* 37. GL_EXT_blend_minmax */
9489 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9492 /* 54. GL_EXT_point_parameters */
9493 SET_PointParameterf(table
, save_PointParameterfEXT
);
9494 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9496 /* 173. GL_EXT_blend_func_separate */
9497 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9499 /* 197. GL_MESA_window_pos */
9500 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9501 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9502 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9503 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9504 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9505 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9506 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9507 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9508 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9509 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9510 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9511 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9512 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9513 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9514 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9515 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9516 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9517 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9518 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9519 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9520 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9521 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9522 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9523 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9525 /* 233. GL_NV_vertex_program */
9526 /* The following commands DO NOT go into display lists:
9527 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9528 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9530 SET_BindProgramARB(table
, save_BindProgramNV
);
9532 /* 244. GL_ATI_envmap_bumpmap */
9533 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9534 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9536 /* 245. GL_ATI_fragment_shader */
9537 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9538 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9540 /* 262. GL_NV_point_sprite */
9541 SET_PointParameteri(table
, save_PointParameteriNV
);
9542 SET_PointParameteriv(table
, save_PointParameterivNV
);
9544 /* 268. GL_EXT_stencil_two_side */
9545 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9547 /* ???. GL_EXT_depth_bounds_test */
9548 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9550 /* ARB 1. GL_ARB_multitexture */
9551 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9553 /* ARB 3. GL_ARB_transpose_matrix */
9554 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9555 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9556 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9557 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9559 /* ARB 5. GL_ARB_multisample */
9560 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9562 /* ARB 12. GL_ARB_texture_compression */
9563 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9564 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9565 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9566 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9567 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9568 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9570 /* ARB 14. GL_ARB_point_parameters */
9571 /* aliased with EXT_point_parameters functions */
9573 /* ARB 25. GL_ARB_window_pos */
9574 /* aliased with MESA_window_pos functions */
9576 /* ARB 26. GL_ARB_vertex_program */
9577 /* ARB 27. GL_ARB_fragment_program */
9578 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9579 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9580 SET_BindProgramARB(table
, save_BindProgramNV
);
9581 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9582 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9583 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9584 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9585 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9586 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9587 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9588 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9590 SET_BeginQuery(table
, save_BeginQueryARB
);
9591 SET_EndQuery(table
, save_EndQueryARB
);
9592 SET_QueryCounter(table
, save_QueryCounter
);
9594 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9596 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9598 SET_UseProgram(table
, save_UseProgramObjectARB
);
9599 SET_Uniform1f(table
, save_Uniform1fARB
);
9600 SET_Uniform2f(table
, save_Uniform2fARB
);
9601 SET_Uniform3f(table
, save_Uniform3fARB
);
9602 SET_Uniform4f(table
, save_Uniform4fARB
);
9603 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9604 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9605 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9606 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9607 SET_Uniform1i(table
, save_Uniform1iARB
);
9608 SET_Uniform2i(table
, save_Uniform2iARB
);
9609 SET_Uniform3i(table
, save_Uniform3iARB
);
9610 SET_Uniform4i(table
, save_Uniform4iARB
);
9611 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9612 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9613 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9614 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9615 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9616 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9617 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9618 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9619 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9620 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9621 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9622 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9623 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9625 /* 299. GL_EXT_blend_equation_separate */
9626 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9628 /* GL_EXT_gpu_program_parameters */
9629 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9630 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9632 /* 364. GL_EXT_provoking_vertex */
9633 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9635 /* GL_EXT_texture_integer */
9636 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9637 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9638 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9639 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9641 /* 377. GL_EXT_separate_shader_objects */
9642 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9643 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9645 /* GL_ARB_color_buffer_float */
9646 SET_ClampColor(table
, save_ClampColorARB
);
9649 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9650 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9651 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9652 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9654 SET_Uniform1ui(table
, save_Uniform1ui
);
9655 SET_Uniform2ui(table
, save_Uniform2ui
);
9656 SET_Uniform3ui(table
, save_Uniform3ui
);
9657 SET_Uniform4ui(table
, save_Uniform4ui
);
9658 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9659 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9660 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9661 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9663 (void) save_Uniform1ui
;
9664 (void) save_Uniform2ui
;
9665 (void) save_Uniform3ui
;
9666 (void) save_Uniform4ui
;
9667 (void) save_Uniform1uiv
;
9668 (void) save_Uniform2uiv
;
9669 (void) save_Uniform3uiv
;
9670 (void) save_Uniform4uiv
;
9674 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9675 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9676 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9677 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9678 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9679 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9680 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9681 SET_DrawTransformFeedbackInstanced(table
,
9682 save_DrawTransformFeedbackInstanced
);
9683 SET_DrawTransformFeedbackStreamInstanced(table
,
9684 save_DrawTransformFeedbackStreamInstanced
);
9685 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9686 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9688 /* GL_ARB_instanced_arrays */
9689 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9691 /* GL_NV_texture_barrier */
9692 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9694 SET_BindSampler(table
, save_BindSampler
);
9695 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9696 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9697 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9698 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9699 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9700 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9702 /* GL_ARB_draw_buffer_blend */
9703 SET_BlendFunciARB(table
, save_BlendFunci
);
9704 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9705 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9706 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9708 /* GL_ARB_geometry_shader4 */
9709 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9710 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9711 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9713 /* GL_NV_conditional_render */
9714 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9715 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9718 SET_WaitSync(table
, save_WaitSync
);
9720 /* GL_ARB_uniform_buffer_object */
9721 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9723 /* GL_ARB_draw_instanced */
9724 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9725 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9727 /* GL_ARB_draw_elements_base_vertex */
9728 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9730 /* GL_ARB_base_instance */
9731 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9732 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9733 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9735 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9736 SET_UseProgramStages(table
, save_UseProgramStages
);
9737 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9738 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9739 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9740 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9741 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9742 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9743 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9744 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9745 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9746 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9747 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9748 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9749 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9750 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9751 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9752 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9753 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9754 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9755 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9756 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9757 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9758 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9759 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9760 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9761 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9762 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9763 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9764 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9765 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9766 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9767 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9768 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9769 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9775 enum_string(GLenum k
)
9777 return _mesa_lookup_enum_by_nr(k
);
9782 * Print the commands in a display list. For debugging only.
9783 * TODO: many commands aren't handled yet.
9785 static void GLAPIENTRY
9786 print_list(struct gl_context
*ctx
, GLuint list
)
9788 struct gl_display_list
*dlist
;
9792 if (!islist(ctx
, list
)) {
9793 printf("%u is not a display list ID\n", list
);
9797 dlist
= _mesa_lookup_list(ctx
, list
);
9803 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9805 done
= n
? GL_FALSE
: GL_TRUE
;
9807 const OpCode opcode
= n
[0].opcode
;
9809 if (is_ext_opcode(opcode
)) {
9810 n
+= ext_opcode_print(ctx
, n
);
9815 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9818 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9819 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9820 get_pointer(&n
[7]));
9822 case OPCODE_CALL_LIST
:
9823 printf("CallList %d\n", (int) n
[1].ui
);
9825 case OPCODE_CALL_LIST_OFFSET
:
9826 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9827 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9829 case OPCODE_DISABLE
:
9830 printf("Disable %s\n", enum_string(n
[1].e
));
9833 printf("Enable %s\n", enum_string(n
[1].e
));
9835 case OPCODE_FRUSTUM
:
9836 printf("Frustum %g %g %g %g %g %g\n",
9837 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9839 case OPCODE_LINE_STIPPLE
:
9840 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9842 case OPCODE_LOAD_IDENTITY
:
9843 printf("LoadIdentity\n");
9845 case OPCODE_LOAD_MATRIX
:
9846 printf("LoadMatrix\n");
9847 printf(" %8f %8f %8f %8f\n",
9848 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9849 printf(" %8f %8f %8f %8f\n",
9850 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9851 printf(" %8f %8f %8f %8f\n",
9852 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9853 printf(" %8f %8f %8f %8f\n",
9854 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9856 case OPCODE_MULT_MATRIX
:
9857 printf("MultMatrix (or Rotate)\n");
9858 printf(" %8f %8f %8f %8f\n",
9859 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9860 printf(" %8f %8f %8f %8f\n",
9861 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9862 printf(" %8f %8f %8f %8f\n",
9863 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9864 printf(" %8f %8f %8f %8f\n",
9865 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9868 printf("Ortho %g %g %g %g %g %g\n",
9869 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9871 case OPCODE_POP_ATTRIB
:
9872 printf("PopAttrib\n");
9874 case OPCODE_POP_MATRIX
:
9875 printf("PopMatrix\n");
9877 case OPCODE_POP_NAME
:
9878 printf("PopName\n");
9880 case OPCODE_PUSH_ATTRIB
:
9881 printf("PushAttrib %x\n", n
[1].bf
);
9883 case OPCODE_PUSH_MATRIX
:
9884 printf("PushMatrix\n");
9886 case OPCODE_PUSH_NAME
:
9887 printf("PushName %d\n", (int) n
[1].ui
);
9889 case OPCODE_RASTER_POS
:
9890 printf("RasterPos %g %g %g %g\n",
9891 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9894 printf("Rotate %g %g %g %g\n",
9895 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9898 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9900 case OPCODE_TRANSLATE
:
9901 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9903 case OPCODE_BIND_TEXTURE
:
9904 printf("BindTexture %s %d\n",
9905 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9907 case OPCODE_SHADE_MODEL
:
9908 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9911 printf("Map1 %s %.3f %.3f %d %d\n",
9912 _mesa_lookup_enum_by_nr(n
[1].ui
),
9913 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9916 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9917 _mesa_lookup_enum_by_nr(n
[1].ui
),
9918 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9919 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9921 case OPCODE_MAPGRID1
:
9922 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9924 case OPCODE_MAPGRID2
:
9925 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9926 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9928 case OPCODE_EVALMESH1
:
9929 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9931 case OPCODE_EVALMESH2
:
9932 printf("EvalMesh2 %d %d %d %d\n",
9933 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9936 case OPCODE_ATTR_1F_NV
:
9937 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9939 case OPCODE_ATTR_2F_NV
:
9940 printf("ATTR_2F_NV attr %d: %f %f\n",
9941 n
[1].i
, n
[2].f
, n
[3].f
);
9943 case OPCODE_ATTR_3F_NV
:
9944 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9945 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9947 case OPCODE_ATTR_4F_NV
:
9948 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9949 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9951 case OPCODE_ATTR_1F_ARB
:
9952 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9954 case OPCODE_ATTR_2F_ARB
:
9955 printf("ATTR_2F_ARB attr %d: %f %f\n",
9956 n
[1].i
, n
[2].f
, n
[3].f
);
9958 case OPCODE_ATTR_3F_ARB
:
9959 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9960 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9962 case OPCODE_ATTR_4F_ARB
:
9963 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9964 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9967 case OPCODE_MATERIAL
:
9968 printf("MATERIAL %x %x: %f %f %f %f\n",
9969 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9972 printf("BEGIN %x\n", n
[1].i
);
9978 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9981 case OPCODE_EVAL_C1
:
9982 printf("EVAL_C1 %f\n", n
[1].f
);
9984 case OPCODE_EVAL_C2
:
9985 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9987 case OPCODE_EVAL_P1
:
9988 printf("EVAL_P1 %d\n", n
[1].i
);
9990 case OPCODE_EVAL_P2
:
9991 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9994 case OPCODE_PROVOKING_VERTEX
:
9995 printf("ProvokingVertex %s\n",
9996 _mesa_lookup_enum_by_nr(n
[1].ui
));
10000 * meta opcodes/commands
10003 printf("Error: %s %s\n", enum_string(n
[1].e
),
10004 (const char *) get_pointer(&n
[2]));
10006 case OPCODE_CONTINUE
:
10007 printf("DISPLAY-LIST-CONTINUE\n");
10008 n
= (Node
*) get_pointer(&n
[1]);
10010 case OPCODE_END_OF_LIST
:
10011 printf("END-LIST %u\n", list
);
10015 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10017 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10018 opcode
, (void *) n
);
10022 printf("command %d, %u operands\n", opcode
,
10026 /* increment n to point to next compiled command */
10027 if (opcode
!= OPCODE_CONTINUE
) {
10028 n
+= InstSize
[opcode
];
10037 * Clients may call this function to help debug display list problems.
10038 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10039 * changed, or break in the future without notice.
10042 mesa_print_display_list(GLuint list
)
10044 GET_CURRENT_CONTEXT(ctx
);
10045 print_list(ctx
, list
);
10049 /**********************************************************************/
10050 /***** Initialization *****/
10051 /**********************************************************************/
10054 save_vtxfmt_init(GLvertexformat
* vfmt
)
10056 vfmt
->ArrayElement
= _ae_ArrayElement
;
10058 vfmt
->Begin
= save_Begin
;
10060 vfmt
->CallList
= save_CallList
;
10061 vfmt
->CallLists
= save_CallLists
;
10063 vfmt
->Color3f
= save_Color3f
;
10064 vfmt
->Color3fv
= save_Color3fv
;
10065 vfmt
->Color4f
= save_Color4f
;
10066 vfmt
->Color4fv
= save_Color4fv
;
10067 vfmt
->EdgeFlag
= save_EdgeFlag
;
10068 vfmt
->End
= save_End
;
10070 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10071 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10072 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10073 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10074 vfmt
->EvalPoint1
= save_EvalPoint1
;
10075 vfmt
->EvalPoint2
= save_EvalPoint2
;
10077 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10078 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10079 vfmt
->Indexf
= save_Indexf
;
10080 vfmt
->Indexfv
= save_Indexfv
;
10081 vfmt
->Materialfv
= save_Materialfv
;
10082 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10083 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10084 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10085 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10086 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10087 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10088 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10089 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10090 vfmt
->Normal3f
= save_Normal3f
;
10091 vfmt
->Normal3fv
= save_Normal3fv
;
10092 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10093 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10094 vfmt
->TexCoord1f
= save_TexCoord1f
;
10095 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10096 vfmt
->TexCoord2f
= save_TexCoord2f
;
10097 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10098 vfmt
->TexCoord3f
= save_TexCoord3f
;
10099 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10100 vfmt
->TexCoord4f
= save_TexCoord4f
;
10101 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10102 vfmt
->Vertex2f
= save_Vertex2f
;
10103 vfmt
->Vertex2fv
= save_Vertex2fv
;
10104 vfmt
->Vertex3f
= save_Vertex3f
;
10105 vfmt
->Vertex3fv
= save_Vertex3fv
;
10106 vfmt
->Vertex4f
= save_Vertex4f
;
10107 vfmt
->Vertex4fv
= save_Vertex4fv
;
10108 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10109 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10110 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10111 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10112 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10113 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10114 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10115 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10120 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10121 const GLvertexformat
*vfmt
)
10123 SET_CallList(disp
, vfmt
->CallList
);
10124 SET_CallLists(disp
, vfmt
->CallLists
);
10129 * Initialize display list state for given context.
10132 _mesa_init_display_list(struct gl_context
*ctx
)
10134 static GLboolean tableInitialized
= GL_FALSE
;
10136 /* zero-out the instruction size table, just once */
10137 if (!tableInitialized
) {
10138 memset(InstSize
, 0, sizeof(InstSize
));
10139 tableInitialized
= GL_TRUE
;
10142 /* extension info */
10143 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10146 ctx
->ListState
.CallDepth
= 0;
10147 ctx
->ExecuteFlag
= GL_TRUE
;
10148 ctx
->CompileFlag
= GL_FALSE
;
10149 ctx
->ListState
.CurrentBlock
= NULL
;
10150 ctx
->ListState
.CurrentPos
= 0;
10152 /* Display List group */
10153 ctx
->List
.ListBase
= 0;
10155 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10160 _mesa_free_display_list_data(struct gl_context
*ctx
)
10162 free(ctx
->ListExt
);
10163 ctx
->ListExt
= NULL
;