2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
35 #include "api_arrayelt.h"
37 #include "api_loopback.h"
38 #include "api_validate.h"
39 #include "atifragshader.h"
41 #include "bufferobj.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
62 #include "texstorage.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
68 #include "math/m_matrix.h"
70 #include "main/dispatch.h"
77 * Other parts of Mesa (such as the VBO module) can plug into the display
78 * list system. This structure describes new display list instructions.
80 struct gl_list_instruction
83 void (*Execute
)( struct gl_context
*ctx
, void *data
);
84 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
85 void (*Print
)( struct gl_context
*ctx
, void *data
, FILE *f
);
89 #define MAX_DLIST_EXT_OPCODES 16
92 * Used by device drivers to hook new commands into display lists.
94 struct gl_list_extensions
96 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
105 * \param ctx GL context.
107 * Checks if dd_function_table::SaveNeedFlush is marked to flush
108 * stored (save) vertices, and calls
109 * dd_function_table::SaveFlushVertices if so.
111 #define SAVE_FLUSH_VERTICES(ctx) \
113 if (ctx->Driver.SaveNeedFlush) \
114 ctx->Driver.SaveFlushVertices(ctx); \
119 * Macro to assert that the API call was made outside the
120 * glBegin()/glEnd() pair, with return value.
122 * \param ctx GL context.
123 * \param retval value to return value in case the assertion fails.
125 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
127 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
128 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
134 * Macro to assert that the API call was made outside the
135 * glBegin()/glEnd() pair.
137 * \param ctx GL context.
139 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
141 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
142 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
148 * Macro to assert that the API call was made outside the
149 * glBegin()/glEnd() pair and flush the vertices.
151 * \param ctx GL context.
153 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
155 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
156 SAVE_FLUSH_VERTICES(ctx); \
160 * Macro to assert that the API call was made outside the
161 * glBegin()/glEnd() pair and flush the vertices, with return value.
163 * \param ctx GL context.
164 * \param retval value to return value in case the assertion fails.
166 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
168 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
169 SAVE_FLUSH_VERTICES(ctx); \
175 * Display list opcodes.
177 * The fact that these identifiers are assigned consecutive
178 * integer values starting at 0 is very important, see InstSize array usage)
182 OPCODE_INVALID
= -1, /* Force signed enum */
188 OPCODE_BLEND_EQUATION
,
189 OPCODE_BLEND_EQUATION_SEPARATE
,
190 OPCODE_BLEND_FUNC_SEPARATE
,
192 OPCODE_BLEND_EQUATION_I
,
193 OPCODE_BLEND_EQUATION_SEPARATE_I
,
195 OPCODE_BLEND_FUNC_SEPARATE_I
,
198 OPCODE_CALL_LIST_OFFSET
,
204 OPCODE_CLEAR_STENCIL
,
205 OPCODE_CLEAR_BUFFER_IV
,
206 OPCODE_CLEAR_BUFFER_UIV
,
207 OPCODE_CLEAR_BUFFER_FV
,
208 OPCODE_CLEAR_BUFFER_FI
,
211 OPCODE_COLOR_MASK_INDEXED
,
212 OPCODE_COLOR_MATERIAL
,
214 OPCODE_COPY_TEX_IMAGE1D
,
215 OPCODE_COPY_TEX_IMAGE2D
,
216 OPCODE_COPY_TEX_SUB_IMAGE1D
,
217 OPCODE_COPY_TEX_SUB_IMAGE2D
,
218 OPCODE_COPY_TEX_SUB_IMAGE3D
,
224 OPCODE_DISABLE_INDEXED
,
228 OPCODE_ENABLE_INDEXED
,
242 OPCODE_LOAD_IDENTITY
,
255 OPCODE_PIXEL_TRANSFER
,
258 OPCODE_POINT_PARAMETERS
,
260 OPCODE_POLYGON_STIPPLE
,
261 OPCODE_POLYGON_OFFSET
,
265 OPCODE_PRIORITIZE_TEXTURE
,
274 OPCODE_SELECT_TEXTURE_SGIS
,
275 OPCODE_SELECT_TEXTURE_COORD_SET
,
286 OPCODE_TEX_SUB_IMAGE1D
,
287 OPCODE_TEX_SUB_IMAGE2D
,
288 OPCODE_TEX_SUB_IMAGE3D
,
292 /* GL_ARB_multitexture */
293 OPCODE_ACTIVE_TEXTURE
,
294 /* GL_ARB_texture_compression */
295 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
297 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
300 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
301 /* GL_ARB_multisample */
302 OPCODE_SAMPLE_COVERAGE
,
303 /* GL_ARB_window_pos */
304 OPCODE_WINDOW_POS_ARB
,
305 /* GL_NV_fragment_program */
306 OPCODE_BIND_PROGRAM_NV
,
307 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
308 /* GL_EXT_stencil_two_side */
309 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
310 /* GL_EXT_depth_bounds_test */
311 OPCODE_DEPTH_BOUNDS_EXT
,
312 /* GL_ARB_vertex/fragment_program */
313 OPCODE_PROGRAM_STRING_ARB
,
314 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
315 /* GL_ARB_occlusion_query */
316 OPCODE_BEGIN_QUERY_ARB
,
317 OPCODE_END_QUERY_ARB
,
318 /* GL_ARB_draw_buffers */
319 OPCODE_DRAW_BUFFERS_ARB
,
320 /* GL_ATI_fragment_shader */
321 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
322 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
324 OPCODE_STENCIL_FUNC_SEPARATE
,
325 OPCODE_STENCIL_OP_SEPARATE
,
326 OPCODE_STENCIL_MASK_SEPARATE
,
328 /* GL_ARB_shader_objects */
346 OPCODE_UNIFORM_MATRIX22
,
347 OPCODE_UNIFORM_MATRIX33
,
348 OPCODE_UNIFORM_MATRIX44
,
349 OPCODE_UNIFORM_MATRIX23
,
350 OPCODE_UNIFORM_MATRIX32
,
351 OPCODE_UNIFORM_MATRIX24
,
352 OPCODE_UNIFORM_MATRIX42
,
353 OPCODE_UNIFORM_MATRIX34
,
354 OPCODE_UNIFORM_MATRIX43
,
366 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
367 OPCODE_USE_PROGRAM_STAGES
,
368 OPCODE_PROGRAM_UNIFORM_1F
,
369 OPCODE_PROGRAM_UNIFORM_2F
,
370 OPCODE_PROGRAM_UNIFORM_3F
,
371 OPCODE_PROGRAM_UNIFORM_4F
,
372 OPCODE_PROGRAM_UNIFORM_1FV
,
373 OPCODE_PROGRAM_UNIFORM_2FV
,
374 OPCODE_PROGRAM_UNIFORM_3FV
,
375 OPCODE_PROGRAM_UNIFORM_4FV
,
376 OPCODE_PROGRAM_UNIFORM_1I
,
377 OPCODE_PROGRAM_UNIFORM_2I
,
378 OPCODE_PROGRAM_UNIFORM_3I
,
379 OPCODE_PROGRAM_UNIFORM_4I
,
380 OPCODE_PROGRAM_UNIFORM_1IV
,
381 OPCODE_PROGRAM_UNIFORM_2IV
,
382 OPCODE_PROGRAM_UNIFORM_3IV
,
383 OPCODE_PROGRAM_UNIFORM_4IV
,
384 OPCODE_PROGRAM_UNIFORM_1UI
,
385 OPCODE_PROGRAM_UNIFORM_2UI
,
386 OPCODE_PROGRAM_UNIFORM_3UI
,
387 OPCODE_PROGRAM_UNIFORM_4UI
,
388 OPCODE_PROGRAM_UNIFORM_1UIV
,
389 OPCODE_PROGRAM_UNIFORM_2UIV
,
390 OPCODE_PROGRAM_UNIFORM_3UIV
,
391 OPCODE_PROGRAM_UNIFORM_4UIV
,
392 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
402 /* GL_ARB_clip_control */
405 /* GL_ARB_color_buffer_float */
408 /* GL_EXT_framebuffer_blit */
409 OPCODE_BLIT_FRAMEBUFFER
,
411 /* Vertex attributes -- fallback for when optimized display
412 * list build isn't active.
431 /* GL_EXT_provoking_vertex */
432 OPCODE_PROVOKING_VERTEX
,
434 /* GL_EXT_transform_feedback */
435 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
436 OPCODE_END_TRANSFORM_FEEDBACK
,
437 OPCODE_BIND_TRANSFORM_FEEDBACK
,
438 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
439 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
440 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
442 /* GL_EXT_texture_integer */
444 OPCODE_CLEARCOLOR_UI
,
445 OPCODE_TEXPARAMETER_I
,
446 OPCODE_TEXPARAMETER_UI
,
448 /* GL_ARB_instanced_arrays */
449 OPCODE_VERTEX_ATTRIB_DIVISOR
,
451 /* GL_NV_texture_barrier */
452 OPCODE_TEXTURE_BARRIER_NV
,
454 /* GL_ARB_sampler_object */
456 OPCODE_SAMPLER_PARAMETERIV
,
457 OPCODE_SAMPLER_PARAMETERFV
,
458 OPCODE_SAMPLER_PARAMETERIIV
,
459 OPCODE_SAMPLER_PARAMETERUIV
,
461 /* GL_ARB_geometry_shader4 */
462 OPCODE_PROGRAM_PARAMETERI
,
463 OPCODE_FRAMEBUFFER_TEXTURE
,
464 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
469 /* GL_NV_conditional_render */
470 OPCODE_BEGIN_CONDITIONAL_RENDER
,
471 OPCODE_END_CONDITIONAL_RENDER
,
473 /* ARB_timer_query */
474 OPCODE_QUERY_COUNTER
,
476 /* ARB_transform_feedback3 */
477 OPCODE_BEGIN_QUERY_INDEXED
,
478 OPCODE_END_QUERY_INDEXED
,
479 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
481 /* ARB_transform_feedback_instanced */
482 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
483 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
485 /* ARB_uniform_buffer_object */
486 OPCODE_UNIFORM_BLOCK_BINDING
,
488 /* EXT_polygon_offset_clamp */
489 OPCODE_POLYGON_OFFSET_CLAMP
,
491 /* The following three are meta instructions */
492 OPCODE_ERROR
, /* raise compiled-in error */
494 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
504 * Display list instructions are stored as sequences of "nodes". Nodes
505 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
506 * are linked together with a pointer.
508 * Each instruction in the display list is stored as a sequence of
509 * contiguous nodes in memory.
510 * Each node is the union of a variety of data types.
512 * Note, all of these members should be 4 bytes in size or less for the
513 * sake of compact display lists. We store 8-byte pointers in a pair of
514 * these nodes using the save/get_pointer() functions below.
532 typedef union gl_dlist_node Node
;
535 /** How many 4-byte dwords to store a pointer */
536 #define POINTER_DWORDS (sizeof(void *) / 4)
538 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
539 * space for display lists. The following types and functions are
540 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
545 GLuint dwords
[POINTER_DWORDS
];
550 * Save a 4 or 8-byte pointer at dest (and dest+1).
553 save_pointer(Node
*dest
, void *src
)
558 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
559 STATIC_ASSERT(sizeof(Node
) == 4);
563 for (i
= 0; i
< POINTER_DWORDS
; i
++)
564 dest
[i
].ui
= p
.dwords
[i
];
569 * Retrieve a 4 or 8-byte pointer from node (node+1).
572 get_pointer(const Node
*node
)
577 for (i
= 0; i
< POINTER_DWORDS
; i
++)
578 p
.dwords
[i
] = node
[i
].ui
;
585 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
596 * How many nodes to allocate at a time. Note that bulk vertex data
597 * from glBegin/glVertex/glEnd primitives will typically wind up in
598 * a VBO, and not directly in the display list itself.
600 #define BLOCK_SIZE 256
605 * Number of nodes of storage needed for each instruction.
606 * Sizes for dynamically allocated opcodes are stored in the context struct.
608 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
611 void mesa_print_display_list(GLuint list
);
615 * Allocate a gl_display_list object with an initial block of storage.
616 * \param count how many display list nodes/tokes to allocate
618 static struct gl_display_list
*
619 make_list(GLuint name
, GLuint count
)
621 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
623 dlist
->Head
= malloc(sizeof(Node
) * count
);
624 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
630 * Lookup function to just encapsulate casting.
632 struct gl_display_list
*
633 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
635 return (struct gl_display_list
*)
636 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
640 /** Is the given opcode an extension code? */
641 static inline GLboolean
642 is_ext_opcode(OpCode opcode
)
644 return (opcode
>= OPCODE_EXT_0
);
648 /** Destroy an extended opcode instruction */
650 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
652 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
654 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
655 step
= ctx
->ListExt
->Opcode
[i
].Size
;
660 /** Execute an extended opcode instruction */
662 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
664 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
666 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
667 step
= ctx
->ListExt
->Opcode
[i
].Size
;
672 /** Print an extended opcode instruction */
674 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
676 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
678 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
679 step
= ctx
->ListExt
->Opcode
[i
].Size
;
685 * Delete the named display list, but don't remove from hash table.
686 * \param dlist - display list pointer
689 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
694 n
= block
= dlist
->Head
;
696 done
= block
? GL_FALSE
: GL_TRUE
;
698 const OpCode opcode
= n
[0].opcode
;
700 /* check for extension opcodes first */
701 if (is_ext_opcode(opcode
)) {
702 n
+= ext_opcode_destroy(ctx
, n
);
706 /* for some commands, we need to free malloc'd memory */
708 free(get_pointer(&n
[6]));
709 n
+= InstSize
[n
[0].opcode
];
712 free(get_pointer(&n
[10]));
713 n
+= InstSize
[n
[0].opcode
];
715 case OPCODE_DRAW_PIXELS
:
716 free(get_pointer(&n
[5]));
717 n
+= InstSize
[n
[0].opcode
];
720 free(get_pointer(&n
[7]));
721 n
+= InstSize
[n
[0].opcode
];
723 case OPCODE_POLYGON_STIPPLE
:
724 free(get_pointer(&n
[1]));
725 n
+= InstSize
[n
[0].opcode
];
727 case OPCODE_TEX_IMAGE1D
:
728 free(get_pointer(&n
[8]));
729 n
+= InstSize
[n
[0].opcode
];
731 case OPCODE_TEX_IMAGE2D
:
732 free(get_pointer(&n
[9]));
733 n
+= InstSize
[n
[0].opcode
];
735 case OPCODE_TEX_IMAGE3D
:
736 free(get_pointer(&n
[10]));
737 n
+= InstSize
[n
[0].opcode
];
739 case OPCODE_TEX_SUB_IMAGE1D
:
740 free(get_pointer(&n
[7]));
741 n
+= InstSize
[n
[0].opcode
];
743 case OPCODE_TEX_SUB_IMAGE2D
:
744 free(get_pointer(&n
[9]));
745 n
+= InstSize
[n
[0].opcode
];
747 case OPCODE_TEX_SUB_IMAGE3D
:
748 free(get_pointer(&n
[11]));
749 n
+= InstSize
[n
[0].opcode
];
751 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
752 free(get_pointer(&n
[7]));
753 n
+= InstSize
[n
[0].opcode
];
755 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
756 free(get_pointer(&n
[8]));
757 n
+= InstSize
[n
[0].opcode
];
759 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
760 free(get_pointer(&n
[9]));
761 n
+= InstSize
[n
[0].opcode
];
763 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
764 free(get_pointer(&n
[7]));
765 n
+= InstSize
[n
[0].opcode
];
767 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
768 free(get_pointer(&n
[9]));
769 n
+= InstSize
[n
[0].opcode
];
771 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
772 free(get_pointer(&n
[11]));
773 n
+= InstSize
[n
[0].opcode
];
775 case OPCODE_PROGRAM_STRING_ARB
:
776 free(get_pointer(&n
[4])); /* program string */
777 n
+= InstSize
[n
[0].opcode
];
779 case OPCODE_UNIFORM_1FV
:
780 case OPCODE_UNIFORM_2FV
:
781 case OPCODE_UNIFORM_3FV
:
782 case OPCODE_UNIFORM_4FV
:
783 case OPCODE_UNIFORM_1IV
:
784 case OPCODE_UNIFORM_2IV
:
785 case OPCODE_UNIFORM_3IV
:
786 case OPCODE_UNIFORM_4IV
:
787 case OPCODE_UNIFORM_1UIV
:
788 case OPCODE_UNIFORM_2UIV
:
789 case OPCODE_UNIFORM_3UIV
:
790 case OPCODE_UNIFORM_4UIV
:
791 free(get_pointer(&n
[3]));
792 n
+= InstSize
[n
[0].opcode
];
794 case OPCODE_UNIFORM_MATRIX22
:
795 case OPCODE_UNIFORM_MATRIX33
:
796 case OPCODE_UNIFORM_MATRIX44
:
797 case OPCODE_UNIFORM_MATRIX24
:
798 case OPCODE_UNIFORM_MATRIX42
:
799 case OPCODE_UNIFORM_MATRIX23
:
800 case OPCODE_UNIFORM_MATRIX32
:
801 case OPCODE_UNIFORM_MATRIX34
:
802 case OPCODE_UNIFORM_MATRIX43
:
803 free(get_pointer(&n
[4]));
804 n
+= InstSize
[n
[0].opcode
];
806 case OPCODE_PROGRAM_UNIFORM_1FV
:
807 case OPCODE_PROGRAM_UNIFORM_2FV
:
808 case OPCODE_PROGRAM_UNIFORM_3FV
:
809 case OPCODE_PROGRAM_UNIFORM_4FV
:
810 case OPCODE_PROGRAM_UNIFORM_1IV
:
811 case OPCODE_PROGRAM_UNIFORM_2IV
:
812 case OPCODE_PROGRAM_UNIFORM_3IV
:
813 case OPCODE_PROGRAM_UNIFORM_4IV
:
814 case OPCODE_PROGRAM_UNIFORM_1UIV
:
815 case OPCODE_PROGRAM_UNIFORM_2UIV
:
816 case OPCODE_PROGRAM_UNIFORM_3UIV
:
817 case OPCODE_PROGRAM_UNIFORM_4UIV
:
818 free(get_pointer(&n
[4]));
819 n
+= InstSize
[n
[0].opcode
];
821 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
824 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
825 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
826 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
827 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
828 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
829 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
830 free(get_pointer(&n
[5]));
831 n
+= InstSize
[n
[0].opcode
];
833 case OPCODE_PIXEL_MAP
:
834 free(get_pointer(&n
[3]));
835 n
+= InstSize
[n
[0].opcode
];
838 case OPCODE_CONTINUE
:
839 n
= (Node
*) get_pointer(&n
[1]);
843 case OPCODE_END_OF_LIST
:
848 /* Most frequent case */
849 n
+= InstSize
[n
[0].opcode
];
861 * Destroy a display list and remove from hash table.
862 * \param list - display list number
865 destroy_list(struct gl_context
*ctx
, GLuint list
)
867 struct gl_display_list
*dlist
;
872 dlist
= _mesa_lookup_list(ctx
, list
);
876 _mesa_delete_list(ctx
, dlist
);
877 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
882 * Translate the nth element of list from <type> to GLint.
885 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
897 bptr
= (GLbyte
*) list
;
898 return (GLint
) bptr
[n
];
899 case GL_UNSIGNED_BYTE
:
900 ubptr
= (GLubyte
*) list
;
901 return (GLint
) ubptr
[n
];
903 sptr
= (GLshort
*) list
;
904 return (GLint
) sptr
[n
];
905 case GL_UNSIGNED_SHORT
:
906 usptr
= (GLushort
*) list
;
907 return (GLint
) usptr
[n
];
909 iptr
= (GLint
*) list
;
911 case GL_UNSIGNED_INT
:
912 uiptr
= (GLuint
*) list
;
913 return (GLint
) uiptr
[n
];
915 fptr
= (GLfloat
*) list
;
916 return (GLint
) floorf(fptr
[n
]);
918 ubptr
= ((GLubyte
*) list
) + 2 * n
;
919 return (GLint
) ubptr
[0] * 256
922 ubptr
= ((GLubyte
*) list
) + 3 * n
;
923 return (GLint
) ubptr
[0] * 65536
924 + (GLint
) ubptr
[1] * 256
927 ubptr
= ((GLubyte
*) list
) + 4 * n
;
928 return (GLint
) ubptr
[0] * 16777216
929 + (GLint
) ubptr
[1] * 65536
930 + (GLint
) ubptr
[2] * 256
939 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
940 * If width < 0 or height < 0 or format or type are invalid we'll just
941 * return NULL. We will not generate an error since OpenGL command
942 * arguments aren't error-checked until the command is actually executed
943 * (not when they're compiled).
944 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
947 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
948 GLsizei width
, GLsizei height
, GLsizei depth
,
949 GLenum format
, GLenum type
, const GLvoid
* pixels
,
950 const struct gl_pixelstore_attrib
*unpack
)
952 if (width
<= 0 || height
<= 0) {
956 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
957 /* bad format and/or type */
961 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
965 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
966 format
, type
, pixels
, unpack
);
967 if (pixels
&& !image
) {
968 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
972 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
973 depth
, format
, type
, INT_MAX
, pixels
)) {
974 const GLubyte
*map
, *src
;
978 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
979 GL_MAP_READ_BIT
, unpack
->BufferObj
,
982 /* unable to map src buffer! */
983 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
987 src
= ADD_POINTERS(map
, pixels
);
988 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
989 format
, type
, src
, unpack
);
991 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
994 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1000 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1005 /** Return copy of memory */
1007 memdup(const void *src
, GLsizei bytes
)
1009 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1011 memcpy(b
, src
, bytes
);
1017 * Allocate space for a display list instruction (opcode + payload space).
1018 * \param opcode the instruction opcode (OPCODE_* value)
1019 * \param bytes instruction payload size (not counting opcode)
1020 * \param align8 does the payload need to be 8-byte aligned?
1021 * This is only relevant in 64-bit environments.
1022 * \return pointer to allocated memory (the payload will be at pointer+1)
1025 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1027 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1028 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1032 if (opcode
< OPCODE_EXT_0
) {
1033 if (InstSize
[opcode
] == 0) {
1034 /* save instruction size now */
1035 InstSize
[opcode
] = numNodes
;
1038 /* make sure instruction size agrees */
1039 assert(numNodes
== InstSize
[opcode
]);
1043 if (sizeof(void *) > sizeof(Node
) && align8
1044 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1045 /* The opcode would get placed at node[0] and the payload would start
1046 * at node[1]. But the payload needs to be at an even offset (8-byte
1055 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1057 /* This block is full. Allocate a new block and chain to it */
1059 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1060 n
[0].opcode
= OPCODE_CONTINUE
;
1061 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1063 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1067 /* a fresh block should be 8-byte aligned on 64-bit systems */
1068 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1070 save_pointer(&n
[1], newblock
);
1071 ctx
->ListState
.CurrentBlock
= newblock
;
1072 ctx
->ListState
.CurrentPos
= 0;
1074 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1075 * we have to insert a NOP so that the payload of the real opcode lands
1076 * on an even location:
1077 * node[0] = OPCODE_NOP
1078 * node[1] = OPCODE_x;
1079 * node[2] = start of payload
1081 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1084 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1086 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1087 n
[0].opcode
= OPCODE_NOP
;
1089 /* The "real" opcode will now be at an odd location and the payload
1090 * will be at an even location.
1093 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1095 n
[0].opcode
= opcode
;
1103 * Allocate space for a display list instruction. Used by callers outside
1104 * this file for things like VBO vertex data.
1106 * \param opcode the instruction opcode (OPCODE_* value)
1107 * \param bytes instruction size in bytes, not counting opcode.
1108 * \return pointer to the usable data area (not including the internal
1112 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1114 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1116 return n
+ 1; /* return pointer to payload area, after opcode */
1123 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1124 * aligned in 64-bit environments, 4-byte aligned otherwise.
1127 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1129 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1131 return n
+ 1; /* return pointer to payload area, after opcode */
1138 * This function allows modules and drivers to get their own opcodes
1139 * for extending display list functionality.
1140 * \param ctx the rendering context
1141 * \param size number of bytes for storing the new display list command
1142 * \param execute function to execute the new display list command
1143 * \param destroy function to destroy the new display list command
1144 * \param print function to print the new display list command
1145 * \return the new opcode number or -1 if error
1148 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1150 void (*execute
) (struct gl_context
*, void *),
1151 void (*destroy
) (struct gl_context
*, void *),
1152 void (*print
) (struct gl_context
*, void *, FILE *))
1154 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1155 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1156 ctx
->ListExt
->Opcode
[i
].Size
=
1157 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1158 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1159 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1160 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1161 return i
+ OPCODE_EXT_0
;
1168 * Allocate space for a display list instruction. The space is basically
1169 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1170 * function parameter, node[2] is the second parameter, etc.
1172 * \param opcode one of OPCODE_x
1173 * \param nparams number of function parameters
1174 * \return pointer to start of instruction space
1176 static inline Node
*
1177 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1179 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1184 * Called by EndList to try to reduce memory used for the list.
1187 trim_list(struct gl_context
*ctx
)
1189 /* If the list we're ending only has one allocated block of nodes/tokens
1190 * and its size isn't a full block size, realloc the block to use less
1191 * memory. This is important for apps that create many small display
1192 * lists and apps that use glXUseXFont (many lists each containing one
1194 * Note: we currently only trim display lists that allocated one block
1195 * of tokens. That hits the short list case which is what we're mainly
1196 * concerned with. Trimming longer lists would involve traversing the
1197 * linked list of blocks.
1199 struct gl_dlist_state
*list
= &ctx
->ListState
;
1201 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1202 (list
->CurrentPos
< BLOCK_SIZE
)) {
1203 /* There's only one block and it's not full, so realloc */
1204 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1205 list
->CurrentList
->Head
=
1206 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1207 if (!list
->CurrentBlock
) {
1208 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1216 * Display List compilation functions
1218 static void GLAPIENTRY
1219 save_Accum(GLenum op
, GLfloat value
)
1221 GET_CURRENT_CONTEXT(ctx
);
1223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1224 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1229 if (ctx
->ExecuteFlag
) {
1230 CALL_Accum(ctx
->Exec
, (op
, value
));
1235 static void GLAPIENTRY
1236 save_AlphaFunc(GLenum func
, GLclampf ref
)
1238 GET_CURRENT_CONTEXT(ctx
);
1240 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1241 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1244 n
[2].f
= (GLfloat
) ref
;
1246 if (ctx
->ExecuteFlag
) {
1247 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1252 static void GLAPIENTRY
1253 save_BindTexture(GLenum target
, GLuint texture
)
1255 GET_CURRENT_CONTEXT(ctx
);
1257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1258 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1263 if (ctx
->ExecuteFlag
) {
1264 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1269 static void GLAPIENTRY
1270 save_Bitmap(GLsizei width
, GLsizei height
,
1271 GLfloat xorig
, GLfloat yorig
,
1272 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1274 GET_CURRENT_CONTEXT(ctx
);
1276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1277 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1279 n
[1].i
= (GLint
) width
;
1280 n
[2].i
= (GLint
) height
;
1286 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1287 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1289 if (ctx
->ExecuteFlag
) {
1290 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1291 xorig
, yorig
, xmove
, ymove
, pixels
));
1296 static void GLAPIENTRY
1297 save_BlendEquation(GLenum mode
)
1299 GET_CURRENT_CONTEXT(ctx
);
1301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1302 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1306 if (ctx
->ExecuteFlag
) {
1307 CALL_BlendEquation(ctx
->Exec
, (mode
));
1312 static void GLAPIENTRY
1313 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1315 GET_CURRENT_CONTEXT(ctx
);
1317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1318 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1323 if (ctx
->ExecuteFlag
) {
1324 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1329 static void GLAPIENTRY
1330 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1331 GLenum sfactorA
, GLenum dfactorA
)
1333 GET_CURRENT_CONTEXT(ctx
);
1335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1336 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1338 n
[1].e
= sfactorRGB
;
1339 n
[2].e
= dfactorRGB
;
1343 if (ctx
->ExecuteFlag
) {
1344 CALL_BlendFuncSeparate(ctx
->Exec
,
1345 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1350 static void GLAPIENTRY
1351 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1353 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1357 static void GLAPIENTRY
1358 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1360 GET_CURRENT_CONTEXT(ctx
);
1362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1363 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1370 if (ctx
->ExecuteFlag
) {
1371 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1375 /* GL_ARB_draw_buffers_blend */
1376 static void GLAPIENTRY
1377 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1378 GLenum sfactorA
, GLenum dfactorA
)
1380 GET_CURRENT_CONTEXT(ctx
);
1382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1383 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1386 n
[2].e
= sfactorRGB
;
1387 n
[3].e
= dfactorRGB
;
1391 if (ctx
->ExecuteFlag
) {
1392 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1393 sfactorA
, dfactorA
));
1397 /* GL_ARB_draw_buffers_blend */
1398 static void GLAPIENTRY
1399 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1401 GET_CURRENT_CONTEXT(ctx
);
1403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1404 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1410 if (ctx
->ExecuteFlag
) {
1411 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1415 /* GL_ARB_draw_buffers_blend */
1416 static void GLAPIENTRY
1417 save_BlendEquationi(GLuint buf
, GLenum mode
)
1419 GET_CURRENT_CONTEXT(ctx
);
1421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1422 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1427 if (ctx
->ExecuteFlag
) {
1428 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1432 /* GL_ARB_draw_buffers_blend */
1433 static void GLAPIENTRY
1434 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1436 GET_CURRENT_CONTEXT(ctx
);
1438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1439 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1445 if (ctx
->ExecuteFlag
) {
1446 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1451 /* GL_ARB_draw_instanced. */
1452 static void GLAPIENTRY
1453 save_DrawArraysInstancedARB(GLenum mode
,
1458 GET_CURRENT_CONTEXT(ctx
);
1459 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1460 "glDrawArraysInstanced() during display list compile");
1463 static void GLAPIENTRY
1464 save_DrawElementsInstancedARB(GLenum mode
,
1467 const GLvoid
*indices
,
1470 GET_CURRENT_CONTEXT(ctx
);
1471 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1472 "glDrawElementsInstanced() during display list compile");
1475 static void GLAPIENTRY
1476 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1479 const GLvoid
*indices
,
1483 GET_CURRENT_CONTEXT(ctx
);
1484 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1485 "glDrawElementsInstancedBaseVertex() during display list compile");
1488 /* GL_ARB_base_instance. */
1489 static void GLAPIENTRY
1490 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1494 GLuint baseinstance
)
1496 GET_CURRENT_CONTEXT(ctx
);
1497 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1498 "glDrawArraysInstancedBaseInstance() during display list compile");
1501 static void APIENTRY
1502 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1505 const void *indices
,
1507 GLuint baseinstance
)
1509 GET_CURRENT_CONTEXT(ctx
);
1510 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1511 "glDrawElementsInstancedBaseInstance() during display list compile");
1514 static void APIENTRY
1515 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1518 const void *indices
,
1521 GLuint baseinstance
)
1523 GET_CURRENT_CONTEXT(ctx
);
1524 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1525 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1530 * While building a display list we cache some OpenGL state.
1531 * Under some circumstances we need to invalidate that state (immediately
1532 * when we start compiling a list, or after glCallList(s)).
1535 invalidate_saved_current_state(struct gl_context
*ctx
)
1539 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1540 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1542 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1543 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1545 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1547 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1551 static void GLAPIENTRY
1552 save_CallList(GLuint list
)
1554 GET_CURRENT_CONTEXT(ctx
);
1556 SAVE_FLUSH_VERTICES(ctx
);
1558 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1563 /* After this, we don't know what state we're in. Invalidate all
1564 * cached information previously gathered:
1566 invalidate_saved_current_state( ctx
);
1568 if (ctx
->ExecuteFlag
) {
1569 _mesa_CallList(list
);
1574 static void GLAPIENTRY
1575 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1577 GET_CURRENT_CONTEXT(ctx
);
1579 GLboolean typeErrorFlag
;
1581 SAVE_FLUSH_VERTICES(ctx
);
1585 case GL_UNSIGNED_BYTE
:
1587 case GL_UNSIGNED_SHORT
:
1589 case GL_UNSIGNED_INT
:
1594 typeErrorFlag
= GL_FALSE
;
1597 typeErrorFlag
= GL_TRUE
;
1600 for (i
= 0; i
< num
; i
++) {
1601 GLint list
= translate_id(i
, type
, lists
);
1602 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1605 n
[2].b
= typeErrorFlag
;
1609 /* After this, we don't know what state we're in. Invalidate all
1610 * cached information previously gathered:
1612 invalidate_saved_current_state( ctx
);
1614 if (ctx
->ExecuteFlag
) {
1615 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1620 static void GLAPIENTRY
1621 save_Clear(GLbitfield mask
)
1623 GET_CURRENT_CONTEXT(ctx
);
1625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1626 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1630 if (ctx
->ExecuteFlag
) {
1631 CALL_Clear(ctx
->Exec
, (mask
));
1636 static void GLAPIENTRY
1637 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1639 GET_CURRENT_CONTEXT(ctx
);
1641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1642 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1645 n
[2].i
= drawbuffer
;
1647 if (buffer
== GL_COLOR
) {
1658 if (ctx
->ExecuteFlag
) {
1659 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1664 static void GLAPIENTRY
1665 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1667 GET_CURRENT_CONTEXT(ctx
);
1669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1670 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1673 n
[2].i
= drawbuffer
;
1675 if (buffer
== GL_COLOR
) {
1686 if (ctx
->ExecuteFlag
) {
1687 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1692 static void GLAPIENTRY
1693 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1695 GET_CURRENT_CONTEXT(ctx
);
1697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1698 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1701 n
[2].i
= drawbuffer
;
1703 if (buffer
== GL_COLOR
) {
1714 if (ctx
->ExecuteFlag
) {
1715 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1720 static void GLAPIENTRY
1721 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1722 GLfloat depth
, GLint stencil
)
1724 GET_CURRENT_CONTEXT(ctx
);
1726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1727 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1730 n
[2].i
= drawbuffer
;
1734 if (ctx
->ExecuteFlag
) {
1735 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1740 static void GLAPIENTRY
1741 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1743 GET_CURRENT_CONTEXT(ctx
);
1745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1746 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1753 if (ctx
->ExecuteFlag
) {
1754 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1759 static void GLAPIENTRY
1760 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1762 GET_CURRENT_CONTEXT(ctx
);
1764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1765 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1772 if (ctx
->ExecuteFlag
) {
1773 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1778 static void GLAPIENTRY
1779 save_ClearDepth(GLclampd depth
)
1781 GET_CURRENT_CONTEXT(ctx
);
1783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1784 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1786 n
[1].f
= (GLfloat
) depth
;
1788 if (ctx
->ExecuteFlag
) {
1789 CALL_ClearDepth(ctx
->Exec
, (depth
));
1794 static void GLAPIENTRY
1795 save_ClearIndex(GLfloat c
)
1797 GET_CURRENT_CONTEXT(ctx
);
1799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1800 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1804 if (ctx
->ExecuteFlag
) {
1805 CALL_ClearIndex(ctx
->Exec
, (c
));
1810 static void GLAPIENTRY
1811 save_ClearStencil(GLint s
)
1813 GET_CURRENT_CONTEXT(ctx
);
1815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1816 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1820 if (ctx
->ExecuteFlag
) {
1821 CALL_ClearStencil(ctx
->Exec
, (s
));
1826 static void GLAPIENTRY
1827 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1829 GET_CURRENT_CONTEXT(ctx
);
1831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1832 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1835 n
[2].f
= (GLfloat
) equ
[0];
1836 n
[3].f
= (GLfloat
) equ
[1];
1837 n
[4].f
= (GLfloat
) equ
[2];
1838 n
[5].f
= (GLfloat
) equ
[3];
1840 if (ctx
->ExecuteFlag
) {
1841 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1847 static void GLAPIENTRY
1848 save_ColorMask(GLboolean red
, GLboolean green
,
1849 GLboolean blue
, GLboolean alpha
)
1851 GET_CURRENT_CONTEXT(ctx
);
1853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1854 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1861 if (ctx
->ExecuteFlag
) {
1862 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1867 static void GLAPIENTRY
1868 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1869 GLboolean blue
, GLboolean alpha
)
1871 GET_CURRENT_CONTEXT(ctx
);
1873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1874 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1882 if (ctx
->ExecuteFlag
) {
1883 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1888 static void GLAPIENTRY
1889 save_ColorMaterial(GLenum face
, GLenum mode
)
1891 GET_CURRENT_CONTEXT(ctx
);
1893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1895 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1900 if (ctx
->ExecuteFlag
) {
1901 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1906 static void GLAPIENTRY
1907 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1909 GET_CURRENT_CONTEXT(ctx
);
1911 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1912 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1916 n
[3].i
= (GLint
) width
;
1917 n
[4].i
= (GLint
) height
;
1920 if (ctx
->ExecuteFlag
) {
1921 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1927 static void GLAPIENTRY
1928 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1929 GLint x
, GLint y
, GLsizei width
, GLint border
)
1931 GET_CURRENT_CONTEXT(ctx
);
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1934 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1938 n
[3].e
= internalformat
;
1944 if (ctx
->ExecuteFlag
) {
1945 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1946 x
, y
, width
, border
));
1951 static void GLAPIENTRY
1952 save_CopyTexImage2D(GLenum target
, GLint level
,
1953 GLenum internalformat
,
1954 GLint x
, GLint y
, GLsizei width
,
1955 GLsizei height
, GLint border
)
1957 GET_CURRENT_CONTEXT(ctx
);
1959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1960 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1964 n
[3].e
= internalformat
;
1971 if (ctx
->ExecuteFlag
) {
1972 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1973 x
, y
, width
, height
, border
));
1979 static void GLAPIENTRY
1980 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1981 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1983 GET_CURRENT_CONTEXT(ctx
);
1985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1986 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1995 if (ctx
->ExecuteFlag
) {
1996 CALL_CopyTexSubImage1D(ctx
->Exec
,
1997 (target
, level
, xoffset
, x
, y
, width
));
2002 static void GLAPIENTRY
2003 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2004 GLint xoffset
, GLint yoffset
,
2005 GLint x
, GLint y
, GLsizei width
, GLint height
)
2007 GET_CURRENT_CONTEXT(ctx
);
2009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2010 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2021 if (ctx
->ExecuteFlag
) {
2022 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2023 x
, y
, width
, height
));
2028 static void GLAPIENTRY
2029 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2030 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2031 GLint x
, GLint y
, GLsizei width
, GLint height
)
2033 GET_CURRENT_CONTEXT(ctx
);
2035 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2036 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2048 if (ctx
->ExecuteFlag
) {
2049 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2050 xoffset
, yoffset
, zoffset
,
2051 x
, y
, width
, height
));
2056 static void GLAPIENTRY
2057 save_CullFace(GLenum mode
)
2059 GET_CURRENT_CONTEXT(ctx
);
2061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2062 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2066 if (ctx
->ExecuteFlag
) {
2067 CALL_CullFace(ctx
->Exec
, (mode
));
2072 static void GLAPIENTRY
2073 save_DepthFunc(GLenum func
)
2075 GET_CURRENT_CONTEXT(ctx
);
2077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2078 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2082 if (ctx
->ExecuteFlag
) {
2083 CALL_DepthFunc(ctx
->Exec
, (func
));
2088 static void GLAPIENTRY
2089 save_DepthMask(GLboolean mask
)
2091 GET_CURRENT_CONTEXT(ctx
);
2093 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2094 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2098 if (ctx
->ExecuteFlag
) {
2099 CALL_DepthMask(ctx
->Exec
, (mask
));
2104 static void GLAPIENTRY
2105 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2107 GET_CURRENT_CONTEXT(ctx
);
2109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2110 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2112 n
[1].f
= (GLfloat
) nearval
;
2113 n
[2].f
= (GLfloat
) farval
;
2115 if (ctx
->ExecuteFlag
) {
2116 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2121 static void GLAPIENTRY
2122 save_Disable(GLenum cap
)
2124 GET_CURRENT_CONTEXT(ctx
);
2126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2127 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2131 if (ctx
->ExecuteFlag
) {
2132 CALL_Disable(ctx
->Exec
, (cap
));
2137 static void GLAPIENTRY
2138 save_DisableIndexed(GLuint index
, GLenum cap
)
2140 GET_CURRENT_CONTEXT(ctx
);
2142 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2143 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2148 if (ctx
->ExecuteFlag
) {
2149 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2154 static void GLAPIENTRY
2155 save_DrawBuffer(GLenum mode
)
2157 GET_CURRENT_CONTEXT(ctx
);
2159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2160 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2164 if (ctx
->ExecuteFlag
) {
2165 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2170 static void GLAPIENTRY
2171 save_DrawPixels(GLsizei width
, GLsizei height
,
2172 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2174 GET_CURRENT_CONTEXT(ctx
);
2177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2179 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2186 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2187 pixels
, &ctx
->Unpack
));
2189 if (ctx
->ExecuteFlag
) {
2190 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2196 static void GLAPIENTRY
2197 save_Enable(GLenum cap
)
2199 GET_CURRENT_CONTEXT(ctx
);
2201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2202 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2206 if (ctx
->ExecuteFlag
) {
2207 CALL_Enable(ctx
->Exec
, (cap
));
2213 static void GLAPIENTRY
2214 save_EnableIndexed(GLuint index
, GLenum cap
)
2216 GET_CURRENT_CONTEXT(ctx
);
2218 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2219 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2224 if (ctx
->ExecuteFlag
) {
2225 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2231 static void GLAPIENTRY
2232 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2234 GET_CURRENT_CONTEXT(ctx
);
2236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2237 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2243 if (ctx
->ExecuteFlag
) {
2244 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2249 static void GLAPIENTRY
2250 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2252 GET_CURRENT_CONTEXT(ctx
);
2254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2255 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2263 if (ctx
->ExecuteFlag
) {
2264 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2271 static void GLAPIENTRY
2272 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2274 GET_CURRENT_CONTEXT(ctx
);
2276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2277 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2285 if (ctx
->ExecuteFlag
) {
2286 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2291 static void GLAPIENTRY
2292 save_Fogf(GLenum pname
, GLfloat param
)
2296 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2297 save_Fogfv(pname
, parray
);
2301 static void GLAPIENTRY
2302 save_Fogiv(GLenum pname
, const GLint
*params
)
2307 case GL_FOG_DENSITY
:
2311 p
[0] = (GLfloat
) *params
;
2317 p
[0] = INT_TO_FLOAT(params
[0]);
2318 p
[1] = INT_TO_FLOAT(params
[1]);
2319 p
[2] = INT_TO_FLOAT(params
[2]);
2320 p
[3] = INT_TO_FLOAT(params
[3]);
2323 /* Error will be caught later in gl_Fogfv */
2324 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2326 save_Fogfv(pname
, p
);
2330 static void GLAPIENTRY
2331 save_Fogi(GLenum pname
, GLint param
)
2335 parray
[1] = parray
[2] = parray
[3] = 0;
2336 save_Fogiv(pname
, parray
);
2340 static void GLAPIENTRY
2341 save_FrontFace(GLenum mode
)
2343 GET_CURRENT_CONTEXT(ctx
);
2345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2346 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2350 if (ctx
->ExecuteFlag
) {
2351 CALL_FrontFace(ctx
->Exec
, (mode
));
2356 static void GLAPIENTRY
2357 save_Frustum(GLdouble left
, GLdouble right
,
2358 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2360 GET_CURRENT_CONTEXT(ctx
);
2362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2363 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2365 n
[1].f
= (GLfloat
) left
;
2366 n
[2].f
= (GLfloat
) right
;
2367 n
[3].f
= (GLfloat
) bottom
;
2368 n
[4].f
= (GLfloat
) top
;
2369 n
[5].f
= (GLfloat
) nearval
;
2370 n
[6].f
= (GLfloat
) farval
;
2372 if (ctx
->ExecuteFlag
) {
2373 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2378 static void GLAPIENTRY
2379 save_Hint(GLenum target
, GLenum mode
)
2381 GET_CURRENT_CONTEXT(ctx
);
2383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2384 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2389 if (ctx
->ExecuteFlag
) {
2390 CALL_Hint(ctx
->Exec
, (target
, mode
));
2395 static void GLAPIENTRY
2396 save_IndexMask(GLuint mask
)
2398 GET_CURRENT_CONTEXT(ctx
);
2400 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2401 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2405 if (ctx
->ExecuteFlag
) {
2406 CALL_IndexMask(ctx
->Exec
, (mask
));
2411 static void GLAPIENTRY
2412 save_InitNames(void)
2414 GET_CURRENT_CONTEXT(ctx
);
2415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2416 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2417 if (ctx
->ExecuteFlag
) {
2418 CALL_InitNames(ctx
->Exec
, ());
2423 static void GLAPIENTRY
2424 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2426 GET_CURRENT_CONTEXT(ctx
);
2428 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2429 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2447 case GL_SPOT_DIRECTION
:
2450 case GL_SPOT_EXPONENT
:
2453 case GL_SPOT_CUTOFF
:
2456 case GL_CONSTANT_ATTENUATION
:
2459 case GL_LINEAR_ATTENUATION
:
2462 case GL_QUADRATIC_ATTENUATION
:
2468 for (i
= 0; i
< nParams
; i
++) {
2469 n
[3 + i
].f
= params
[i
];
2472 if (ctx
->ExecuteFlag
) {
2473 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2478 static void GLAPIENTRY
2479 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2483 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2484 save_Lightfv(light
, pname
, parray
);
2488 static void GLAPIENTRY
2489 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2496 fparam
[0] = INT_TO_FLOAT(params
[0]);
2497 fparam
[1] = INT_TO_FLOAT(params
[1]);
2498 fparam
[2] = INT_TO_FLOAT(params
[2]);
2499 fparam
[3] = INT_TO_FLOAT(params
[3]);
2502 fparam
[0] = (GLfloat
) params
[0];
2503 fparam
[1] = (GLfloat
) params
[1];
2504 fparam
[2] = (GLfloat
) params
[2];
2505 fparam
[3] = (GLfloat
) params
[3];
2507 case GL_SPOT_DIRECTION
:
2508 fparam
[0] = (GLfloat
) params
[0];
2509 fparam
[1] = (GLfloat
) params
[1];
2510 fparam
[2] = (GLfloat
) params
[2];
2512 case GL_SPOT_EXPONENT
:
2513 case GL_SPOT_CUTOFF
:
2514 case GL_CONSTANT_ATTENUATION
:
2515 case GL_LINEAR_ATTENUATION
:
2516 case GL_QUADRATIC_ATTENUATION
:
2517 fparam
[0] = (GLfloat
) params
[0];
2520 /* error will be caught later in gl_Lightfv */
2523 save_Lightfv(light
, pname
, fparam
);
2527 static void GLAPIENTRY
2528 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2532 parray
[1] = parray
[2] = parray
[3] = 0;
2533 save_Lightiv(light
, pname
, parray
);
2537 static void GLAPIENTRY
2538 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2540 GET_CURRENT_CONTEXT(ctx
);
2542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2543 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2551 if (ctx
->ExecuteFlag
) {
2552 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2557 static void GLAPIENTRY
2558 save_LightModelf(GLenum pname
, GLfloat param
)
2562 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2563 save_LightModelfv(pname
, parray
);
2567 static void GLAPIENTRY
2568 save_LightModeliv(GLenum pname
, const GLint
*params
)
2572 case GL_LIGHT_MODEL_AMBIENT
:
2573 fparam
[0] = INT_TO_FLOAT(params
[0]);
2574 fparam
[1] = INT_TO_FLOAT(params
[1]);
2575 fparam
[2] = INT_TO_FLOAT(params
[2]);
2576 fparam
[3] = INT_TO_FLOAT(params
[3]);
2578 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2579 case GL_LIGHT_MODEL_TWO_SIDE
:
2580 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2581 fparam
[0] = (GLfloat
) params
[0];
2587 /* Error will be caught later in gl_LightModelfv */
2588 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2590 save_LightModelfv(pname
, fparam
);
2594 static void GLAPIENTRY
2595 save_LightModeli(GLenum pname
, GLint param
)
2599 parray
[1] = parray
[2] = parray
[3] = 0;
2600 save_LightModeliv(pname
, parray
);
2604 static void GLAPIENTRY
2605 save_LineStipple(GLint factor
, GLushort pattern
)
2607 GET_CURRENT_CONTEXT(ctx
);
2609 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2610 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2615 if (ctx
->ExecuteFlag
) {
2616 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2621 static void GLAPIENTRY
2622 save_LineWidth(GLfloat width
)
2624 GET_CURRENT_CONTEXT(ctx
);
2626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2627 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2631 if (ctx
->ExecuteFlag
) {
2632 CALL_LineWidth(ctx
->Exec
, (width
));
2637 static void GLAPIENTRY
2638 save_ListBase(GLuint base
)
2640 GET_CURRENT_CONTEXT(ctx
);
2642 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2643 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2647 if (ctx
->ExecuteFlag
) {
2648 CALL_ListBase(ctx
->Exec
, (base
));
2653 static void GLAPIENTRY
2654 save_LoadIdentity(void)
2656 GET_CURRENT_CONTEXT(ctx
);
2657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2658 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2659 if (ctx
->ExecuteFlag
) {
2660 CALL_LoadIdentity(ctx
->Exec
, ());
2665 static void GLAPIENTRY
2666 save_LoadMatrixf(const GLfloat
* m
)
2668 GET_CURRENT_CONTEXT(ctx
);
2670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2671 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2674 for (i
= 0; i
< 16; i
++) {
2678 if (ctx
->ExecuteFlag
) {
2679 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2684 static void GLAPIENTRY
2685 save_LoadMatrixd(const GLdouble
* m
)
2689 for (i
= 0; i
< 16; i
++) {
2690 f
[i
] = (GLfloat
) m
[i
];
2692 save_LoadMatrixf(f
);
2696 static void GLAPIENTRY
2697 save_LoadName(GLuint name
)
2699 GET_CURRENT_CONTEXT(ctx
);
2701 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2702 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2706 if (ctx
->ExecuteFlag
) {
2707 CALL_LoadName(ctx
->Exec
, (name
));
2712 static void GLAPIENTRY
2713 save_LogicOp(GLenum opcode
)
2715 GET_CURRENT_CONTEXT(ctx
);
2717 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2718 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2722 if (ctx
->ExecuteFlag
) {
2723 CALL_LogicOp(ctx
->Exec
, (opcode
));
2728 static void GLAPIENTRY
2729 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2730 GLint order
, const GLdouble
* points
)
2732 GET_CURRENT_CONTEXT(ctx
);
2734 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2735 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2737 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2739 n
[2].f
= (GLfloat
) u1
;
2740 n
[3].f
= (GLfloat
) u2
;
2741 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2743 save_pointer(&n
[6], pnts
);
2745 if (ctx
->ExecuteFlag
) {
2746 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2750 static void GLAPIENTRY
2751 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2752 GLint order
, const GLfloat
* points
)
2754 GET_CURRENT_CONTEXT(ctx
);
2756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2757 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2759 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2763 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2765 save_pointer(&n
[6], pnts
);
2767 if (ctx
->ExecuteFlag
) {
2768 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2773 static void GLAPIENTRY
2774 save_Map2d(GLenum target
,
2775 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2776 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2777 const GLdouble
* points
)
2779 GET_CURRENT_CONTEXT(ctx
);
2781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2782 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2784 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2785 vstride
, vorder
, points
);
2787 n
[2].f
= (GLfloat
) u1
;
2788 n
[3].f
= (GLfloat
) u2
;
2789 n
[4].f
= (GLfloat
) v1
;
2790 n
[5].f
= (GLfloat
) v2
;
2791 /* XXX verify these strides are correct */
2792 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2793 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2796 save_pointer(&n
[10], pnts
);
2798 if (ctx
->ExecuteFlag
) {
2799 CALL_Map2d(ctx
->Exec
, (target
,
2800 u1
, u2
, ustride
, uorder
,
2801 v1
, v2
, vstride
, vorder
, points
));
2806 static void GLAPIENTRY
2807 save_Map2f(GLenum target
,
2808 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2809 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2810 const GLfloat
* points
)
2812 GET_CURRENT_CONTEXT(ctx
);
2814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2815 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2817 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2818 vstride
, vorder
, points
);
2824 /* XXX verify these strides are correct */
2825 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2826 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2829 save_pointer(&n
[10], pnts
);
2831 if (ctx
->ExecuteFlag
) {
2832 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2833 v1
, v2
, vstride
, vorder
, points
));
2838 static void GLAPIENTRY
2839 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2841 GET_CURRENT_CONTEXT(ctx
);
2843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2844 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2850 if (ctx
->ExecuteFlag
) {
2851 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2856 static void GLAPIENTRY
2857 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2859 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2863 static void GLAPIENTRY
2864 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2865 GLint vn
, GLfloat v1
, GLfloat v2
)
2867 GET_CURRENT_CONTEXT(ctx
);
2869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2870 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2879 if (ctx
->ExecuteFlag
) {
2880 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2886 static void GLAPIENTRY
2887 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2888 GLint vn
, GLdouble v1
, GLdouble v2
)
2890 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2891 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2895 static void GLAPIENTRY
2896 save_MatrixMode(GLenum mode
)
2898 GET_CURRENT_CONTEXT(ctx
);
2900 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2901 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2905 if (ctx
->ExecuteFlag
) {
2906 CALL_MatrixMode(ctx
->Exec
, (mode
));
2911 static void GLAPIENTRY
2912 save_MultMatrixf(const GLfloat
* m
)
2914 GET_CURRENT_CONTEXT(ctx
);
2916 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2917 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2920 for (i
= 0; i
< 16; i
++) {
2924 if (ctx
->ExecuteFlag
) {
2925 CALL_MultMatrixf(ctx
->Exec
, (m
));
2930 static void GLAPIENTRY
2931 save_MultMatrixd(const GLdouble
* m
)
2935 for (i
= 0; i
< 16; i
++) {
2936 f
[i
] = (GLfloat
) m
[i
];
2938 save_MultMatrixf(f
);
2942 static void GLAPIENTRY
2943 save_NewList(GLuint name
, GLenum mode
)
2945 GET_CURRENT_CONTEXT(ctx
);
2946 /* It's an error to call this function while building a display list */
2947 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2954 static void GLAPIENTRY
2955 save_Ortho(GLdouble left
, GLdouble right
,
2956 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2958 GET_CURRENT_CONTEXT(ctx
);
2960 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2961 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2963 n
[1].f
= (GLfloat
) left
;
2964 n
[2].f
= (GLfloat
) right
;
2965 n
[3].f
= (GLfloat
) bottom
;
2966 n
[4].f
= (GLfloat
) top
;
2967 n
[5].f
= (GLfloat
) nearval
;
2968 n
[6].f
= (GLfloat
) farval
;
2970 if (ctx
->ExecuteFlag
) {
2971 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2976 static void GLAPIENTRY
2977 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2979 GET_CURRENT_CONTEXT(ctx
);
2981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2982 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2986 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2988 if (ctx
->ExecuteFlag
) {
2989 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2994 static void GLAPIENTRY
2995 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2997 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2999 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3000 for (i
= 0; i
< mapsize
; i
++) {
3001 fvalues
[i
] = (GLfloat
) values
[i
];
3005 for (i
= 0; i
< mapsize
; i
++) {
3006 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3009 save_PixelMapfv(map
, mapsize
, fvalues
);
3013 static void GLAPIENTRY
3014 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3016 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3018 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3019 for (i
= 0; i
< mapsize
; i
++) {
3020 fvalues
[i
] = (GLfloat
) values
[i
];
3024 for (i
= 0; i
< mapsize
; i
++) {
3025 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3028 save_PixelMapfv(map
, mapsize
, fvalues
);
3032 static void GLAPIENTRY
3033 save_PixelTransferf(GLenum pname
, GLfloat param
)
3035 GET_CURRENT_CONTEXT(ctx
);
3037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3038 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3043 if (ctx
->ExecuteFlag
) {
3044 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3049 static void GLAPIENTRY
3050 save_PixelTransferi(GLenum pname
, GLint param
)
3052 save_PixelTransferf(pname
, (GLfloat
) param
);
3056 static void GLAPIENTRY
3057 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3059 GET_CURRENT_CONTEXT(ctx
);
3061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3062 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3067 if (ctx
->ExecuteFlag
) {
3068 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3073 static void GLAPIENTRY
3074 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3076 GET_CURRENT_CONTEXT(ctx
);
3078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3079 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3086 if (ctx
->ExecuteFlag
) {
3087 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3092 static void GLAPIENTRY
3093 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3097 parray
[1] = parray
[2] = 0.0F
;
3098 save_PointParameterfvEXT(pname
, parray
);
3101 static void GLAPIENTRY
3102 save_PointParameteriNV(GLenum pname
, GLint param
)
3105 parray
[0] = (GLfloat
) param
;
3106 parray
[1] = parray
[2] = 0.0F
;
3107 save_PointParameterfvEXT(pname
, parray
);
3110 static void GLAPIENTRY
3111 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3114 parray
[0] = (GLfloat
) param
[0];
3115 parray
[1] = parray
[2] = 0.0F
;
3116 save_PointParameterfvEXT(pname
, parray
);
3120 static void GLAPIENTRY
3121 save_PointSize(GLfloat size
)
3123 GET_CURRENT_CONTEXT(ctx
);
3125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3126 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3130 if (ctx
->ExecuteFlag
) {
3131 CALL_PointSize(ctx
->Exec
, (size
));
3136 static void GLAPIENTRY
3137 save_PolygonMode(GLenum face
, GLenum mode
)
3139 GET_CURRENT_CONTEXT(ctx
);
3141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3142 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3147 if (ctx
->ExecuteFlag
) {
3148 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3153 static void GLAPIENTRY
3154 save_PolygonStipple(const GLubyte
* pattern
)
3156 GET_CURRENT_CONTEXT(ctx
);
3159 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3161 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3164 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3165 pattern
, &ctx
->Unpack
));
3167 if (ctx
->ExecuteFlag
) {
3168 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3173 static void GLAPIENTRY
3174 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3176 GET_CURRENT_CONTEXT(ctx
);
3178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3179 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3184 if (ctx
->ExecuteFlag
) {
3185 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3190 static void GLAPIENTRY
3191 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3193 GET_CURRENT_CONTEXT(ctx
);
3194 /* XXX mult by DepthMaxF here??? */
3195 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3198 static void GLAPIENTRY
3199 save_PolygonOffsetClampEXT(GLfloat factor
, GLfloat units
, GLfloat clamp
)
3201 GET_CURRENT_CONTEXT(ctx
);
3203 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3204 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET_CLAMP
, 3);
3210 if (ctx
->ExecuteFlag
) {
3211 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (factor
, units
, clamp
));
3215 static void GLAPIENTRY
3216 save_PopAttrib(void)
3218 GET_CURRENT_CONTEXT(ctx
);
3219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3220 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3221 if (ctx
->ExecuteFlag
) {
3222 CALL_PopAttrib(ctx
->Exec
, ());
3227 static void GLAPIENTRY
3228 save_PopMatrix(void)
3230 GET_CURRENT_CONTEXT(ctx
);
3231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3232 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3233 if (ctx
->ExecuteFlag
) {
3234 CALL_PopMatrix(ctx
->Exec
, ());
3239 static void GLAPIENTRY
3242 GET_CURRENT_CONTEXT(ctx
);
3243 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3244 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3245 if (ctx
->ExecuteFlag
) {
3246 CALL_PopName(ctx
->Exec
, ());
3251 static void GLAPIENTRY
3252 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3253 const GLclampf
* priorities
)
3255 GET_CURRENT_CONTEXT(ctx
);
3257 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 for (i
= 0; i
< num
; i
++) {
3261 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3263 n
[1].ui
= textures
[i
];
3264 n
[2].f
= priorities
[i
];
3267 if (ctx
->ExecuteFlag
) {
3268 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3273 static void GLAPIENTRY
3274 save_PushAttrib(GLbitfield mask
)
3276 GET_CURRENT_CONTEXT(ctx
);
3278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3279 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3283 if (ctx
->ExecuteFlag
) {
3284 CALL_PushAttrib(ctx
->Exec
, (mask
));
3289 static void GLAPIENTRY
3290 save_PushMatrix(void)
3292 GET_CURRENT_CONTEXT(ctx
);
3293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3294 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3295 if (ctx
->ExecuteFlag
) {
3296 CALL_PushMatrix(ctx
->Exec
, ());
3301 static void GLAPIENTRY
3302 save_PushName(GLuint name
)
3304 GET_CURRENT_CONTEXT(ctx
);
3306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3307 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3311 if (ctx
->ExecuteFlag
) {
3312 CALL_PushName(ctx
->Exec
, (name
));
3317 static void GLAPIENTRY
3318 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3320 GET_CURRENT_CONTEXT(ctx
);
3322 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3323 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3330 if (ctx
->ExecuteFlag
) {
3331 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3335 static void GLAPIENTRY
3336 save_RasterPos2d(GLdouble x
, GLdouble y
)
3338 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3341 static void GLAPIENTRY
3342 save_RasterPos2f(GLfloat x
, GLfloat y
)
3344 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3347 static void GLAPIENTRY
3348 save_RasterPos2i(GLint x
, GLint y
)
3350 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3353 static void GLAPIENTRY
3354 save_RasterPos2s(GLshort x
, GLshort y
)
3356 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3359 static void GLAPIENTRY
3360 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3362 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3365 static void GLAPIENTRY
3366 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3368 save_RasterPos4f(x
, y
, z
, 1.0F
);
3371 static void GLAPIENTRY
3372 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3374 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3377 static void GLAPIENTRY
3378 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3380 save_RasterPos4f(x
, y
, z
, 1.0F
);
3383 static void GLAPIENTRY
3384 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3386 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3389 static void GLAPIENTRY
3390 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3392 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3395 static void GLAPIENTRY
3396 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3398 save_RasterPos4f(x
, y
, z
, w
);
3401 static void GLAPIENTRY
3402 save_RasterPos2dv(const GLdouble
* v
)
3404 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3407 static void GLAPIENTRY
3408 save_RasterPos2fv(const GLfloat
* v
)
3410 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3413 static void GLAPIENTRY
3414 save_RasterPos2iv(const GLint
* v
)
3416 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3419 static void GLAPIENTRY
3420 save_RasterPos2sv(const GLshort
* v
)
3422 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3425 static void GLAPIENTRY
3426 save_RasterPos3dv(const GLdouble
* v
)
3428 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3431 static void GLAPIENTRY
3432 save_RasterPos3fv(const GLfloat
* v
)
3434 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3437 static void GLAPIENTRY
3438 save_RasterPos3iv(const GLint
* v
)
3440 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3443 static void GLAPIENTRY
3444 save_RasterPos3sv(const GLshort
* v
)
3446 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3449 static void GLAPIENTRY
3450 save_RasterPos4dv(const GLdouble
* v
)
3452 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3453 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3456 static void GLAPIENTRY
3457 save_RasterPos4fv(const GLfloat
* v
)
3459 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3462 static void GLAPIENTRY
3463 save_RasterPos4iv(const GLint
* v
)
3465 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3466 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3469 static void GLAPIENTRY
3470 save_RasterPos4sv(const GLshort
* v
)
3472 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3476 static void GLAPIENTRY
3477 save_PassThrough(GLfloat token
)
3479 GET_CURRENT_CONTEXT(ctx
);
3481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3482 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3486 if (ctx
->ExecuteFlag
) {
3487 CALL_PassThrough(ctx
->Exec
, (token
));
3492 static void GLAPIENTRY
3493 save_ReadBuffer(GLenum mode
)
3495 GET_CURRENT_CONTEXT(ctx
);
3497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3498 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3502 if (ctx
->ExecuteFlag
) {
3503 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3508 static void GLAPIENTRY
3509 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3511 GET_CURRENT_CONTEXT(ctx
);
3513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3514 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3521 if (ctx
->ExecuteFlag
) {
3522 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3527 static void GLAPIENTRY
3528 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3530 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3534 static void GLAPIENTRY
3535 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3537 GET_CURRENT_CONTEXT(ctx
);
3539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3540 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3546 if (ctx
->ExecuteFlag
) {
3547 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3552 static void GLAPIENTRY
3553 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3555 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3559 static void GLAPIENTRY
3560 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3562 GET_CURRENT_CONTEXT(ctx
);
3564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3565 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3572 if (ctx
->ExecuteFlag
) {
3573 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3578 static void GLAPIENTRY
3579 save_ShadeModel(GLenum mode
)
3581 GET_CURRENT_CONTEXT(ctx
);
3583 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3585 if (ctx
->ExecuteFlag
) {
3586 CALL_ShadeModel(ctx
->Exec
, (mode
));
3589 /* Don't compile this call if it's a no-op.
3590 * By avoiding this state change we have a better chance of
3591 * coalescing subsequent drawing commands into one batch.
3593 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3596 SAVE_FLUSH_VERTICES(ctx
);
3598 ctx
->ListState
.Current
.ShadeModel
= mode
;
3600 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3607 static void GLAPIENTRY
3608 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3610 GET_CURRENT_CONTEXT(ctx
);
3612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3613 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3619 if (ctx
->ExecuteFlag
) {
3620 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3625 static void GLAPIENTRY
3626 save_StencilMask(GLuint mask
)
3628 GET_CURRENT_CONTEXT(ctx
);
3630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3631 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3635 if (ctx
->ExecuteFlag
) {
3636 CALL_StencilMask(ctx
->Exec
, (mask
));
3641 static void GLAPIENTRY
3642 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3644 GET_CURRENT_CONTEXT(ctx
);
3646 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3647 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3653 if (ctx
->ExecuteFlag
) {
3654 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3659 static void GLAPIENTRY
3660 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3662 GET_CURRENT_CONTEXT(ctx
);
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3665 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3672 if (ctx
->ExecuteFlag
) {
3673 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3678 static void GLAPIENTRY
3679 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3682 GET_CURRENT_CONTEXT(ctx
);
3684 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3686 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3694 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3701 if (ctx
->ExecuteFlag
) {
3702 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3703 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3708 static void GLAPIENTRY
3709 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3711 GET_CURRENT_CONTEXT(ctx
);
3713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3714 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3719 if (ctx
->ExecuteFlag
) {
3720 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3725 static void GLAPIENTRY
3726 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3728 GET_CURRENT_CONTEXT(ctx
);
3730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3731 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3738 if (ctx
->ExecuteFlag
) {
3739 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3744 static void GLAPIENTRY
3745 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3747 GET_CURRENT_CONTEXT(ctx
);
3749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3750 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3754 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3762 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3765 if (ctx
->ExecuteFlag
) {
3766 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3771 static void GLAPIENTRY
3772 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3775 parray
[0] = (GLfloat
) param
;
3776 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3777 save_TexEnvfv(target
, pname
, parray
);
3781 static void GLAPIENTRY
3782 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3785 p
[0] = (GLfloat
) param
;
3786 p
[1] = p
[2] = p
[3] = 0.0F
;
3787 save_TexEnvfv(target
, pname
, p
);
3791 static void GLAPIENTRY
3792 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3795 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3796 p
[0] = INT_TO_FLOAT(param
[0]);
3797 p
[1] = INT_TO_FLOAT(param
[1]);
3798 p
[2] = INT_TO_FLOAT(param
[2]);
3799 p
[3] = INT_TO_FLOAT(param
[3]);
3802 p
[0] = (GLfloat
) param
[0];
3803 p
[1] = p
[2] = p
[3] = 0.0F
;
3805 save_TexEnvfv(target
, pname
, p
);
3809 static void GLAPIENTRY
3810 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3812 GET_CURRENT_CONTEXT(ctx
);
3814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3815 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3824 if (ctx
->ExecuteFlag
) {
3825 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3830 static void GLAPIENTRY
3831 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3834 p
[0] = (GLfloat
) params
[0];
3835 p
[1] = (GLfloat
) params
[1];
3836 p
[2] = (GLfloat
) params
[2];
3837 p
[3] = (GLfloat
) params
[3];
3838 save_TexGenfv(coord
, pname
, p
);
3842 static void GLAPIENTRY
3843 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3846 parray
[0] = (GLfloat
) param
;
3847 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3848 save_TexGenfv(coord
, pname
, parray
);
3852 static void GLAPIENTRY
3853 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3856 p
[0] = (GLfloat
) params
[0];
3857 p
[1] = (GLfloat
) params
[1];
3858 p
[2] = (GLfloat
) params
[2];
3859 p
[3] = (GLfloat
) params
[3];
3860 save_TexGenfv(coord
, pname
, p
);
3864 static void GLAPIENTRY
3865 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3869 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3870 save_TexGenfv(coord
, pname
, parray
);
3874 static void GLAPIENTRY
3875 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3879 parray
[1] = parray
[2] = parray
[3] = 0;
3880 save_TexGeniv(coord
, pname
, parray
);
3884 static void GLAPIENTRY
3885 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3887 GET_CURRENT_CONTEXT(ctx
);
3889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3890 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3899 if (ctx
->ExecuteFlag
) {
3900 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3905 static void GLAPIENTRY
3906 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3910 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3911 save_TexParameterfv(target
, pname
, parray
);
3915 static void GLAPIENTRY
3916 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3919 fparam
[0] = (GLfloat
) param
;
3920 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3921 save_TexParameterfv(target
, pname
, fparam
);
3925 static void GLAPIENTRY
3926 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3929 fparam
[0] = (GLfloat
) params
[0];
3930 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3931 save_TexParameterfv(target
, pname
, fparam
);
3935 static void GLAPIENTRY
3936 save_TexImage1D(GLenum target
,
3937 GLint level
, GLint components
,
3938 GLsizei width
, GLint border
,
3939 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3941 GET_CURRENT_CONTEXT(ctx
);
3942 if (target
== GL_PROXY_TEXTURE_1D
) {
3943 /* don't compile, execute immediately */
3944 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3945 border
, format
, type
, pixels
));
3949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3950 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3954 n
[3].i
= components
;
3955 n
[4].i
= (GLint
) width
;
3960 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3961 pixels
, &ctx
->Unpack
));
3963 if (ctx
->ExecuteFlag
) {
3964 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3965 border
, format
, type
, pixels
));
3971 static void GLAPIENTRY
3972 save_TexImage2D(GLenum target
,
3973 GLint level
, GLint components
,
3974 GLsizei width
, GLsizei height
, GLint border
,
3975 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3977 GET_CURRENT_CONTEXT(ctx
);
3978 if (target
== GL_PROXY_TEXTURE_2D
) {
3979 /* don't compile, execute immediately */
3980 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3981 height
, border
, format
, type
, pixels
));
3985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3986 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3990 n
[3].i
= components
;
3991 n
[4].i
= (GLint
) width
;
3992 n
[5].i
= (GLint
) height
;
3997 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3998 pixels
, &ctx
->Unpack
));
4000 if (ctx
->ExecuteFlag
) {
4001 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4002 height
, border
, format
, type
, pixels
));
4008 static void GLAPIENTRY
4009 save_TexImage3D(GLenum target
,
4010 GLint level
, GLint internalFormat
,
4011 GLsizei width
, GLsizei height
, GLsizei depth
,
4013 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4015 GET_CURRENT_CONTEXT(ctx
);
4016 if (target
== GL_PROXY_TEXTURE_3D
) {
4017 /* don't compile, execute immediately */
4018 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4019 height
, depth
, border
, format
, type
,
4024 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4025 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4029 n
[3].i
= (GLint
) internalFormat
;
4030 n
[4].i
= (GLint
) width
;
4031 n
[5].i
= (GLint
) height
;
4032 n
[6].i
= (GLint
) depth
;
4036 save_pointer(&n
[10],
4037 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4038 pixels
, &ctx
->Unpack
));
4040 if (ctx
->ExecuteFlag
) {
4041 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4042 height
, depth
, border
, format
, type
,
4049 static void GLAPIENTRY
4050 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4051 GLsizei width
, GLenum format
, GLenum type
,
4052 const GLvoid
* pixels
)
4054 GET_CURRENT_CONTEXT(ctx
);
4057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4059 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4064 n
[4].i
= (GLint
) width
;
4068 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4069 pixels
, &ctx
->Unpack
));
4071 if (ctx
->ExecuteFlag
) {
4072 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4073 format
, type
, pixels
));
4078 static void GLAPIENTRY
4079 save_TexSubImage2D(GLenum target
, GLint level
,
4080 GLint xoffset
, GLint yoffset
,
4081 GLsizei width
, GLsizei height
,
4082 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4084 GET_CURRENT_CONTEXT(ctx
);
4087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4089 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4095 n
[5].i
= (GLint
) width
;
4096 n
[6].i
= (GLint
) height
;
4100 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4101 pixels
, &ctx
->Unpack
));
4103 if (ctx
->ExecuteFlag
) {
4104 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4105 width
, height
, format
, type
, pixels
));
4110 static void GLAPIENTRY
4111 save_TexSubImage3D(GLenum target
, GLint level
,
4112 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4113 GLsizei width
, GLsizei height
, GLsizei depth
,
4114 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4116 GET_CURRENT_CONTEXT(ctx
);
4119 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4121 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4128 n
[6].i
= (GLint
) width
;
4129 n
[7].i
= (GLint
) height
;
4130 n
[8].i
= (GLint
) depth
;
4133 save_pointer(&n
[11],
4134 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4135 pixels
, &ctx
->Unpack
));
4137 if (ctx
->ExecuteFlag
) {
4138 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4139 xoffset
, yoffset
, zoffset
,
4140 width
, height
, depth
, format
, type
,
4146 static void GLAPIENTRY
4147 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4149 GET_CURRENT_CONTEXT(ctx
);
4151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4152 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4158 if (ctx
->ExecuteFlag
) {
4159 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4164 static void GLAPIENTRY
4165 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4167 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4172 static void GLAPIENTRY
4173 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4175 GET_CURRENT_CONTEXT(ctx
);
4177 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4178 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4182 n
[3].i
= (GLint
) width
;
4183 n
[4].i
= (GLint
) height
;
4185 if (ctx
->ExecuteFlag
) {
4186 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4191 static void GLAPIENTRY
4192 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4194 GET_CURRENT_CONTEXT(ctx
);
4196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4197 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4204 if (ctx
->ExecuteFlag
) {
4205 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4209 static void GLAPIENTRY
4210 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4212 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4215 static void GLAPIENTRY
4216 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4218 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4221 static void GLAPIENTRY
4222 save_WindowPos2iMESA(GLint x
, GLint y
)
4224 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4227 static void GLAPIENTRY
4228 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4230 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4233 static void GLAPIENTRY
4234 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4236 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4239 static void GLAPIENTRY
4240 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4242 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4245 static void GLAPIENTRY
4246 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4248 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4251 static void GLAPIENTRY
4252 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4254 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4257 static void GLAPIENTRY
4258 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4260 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4263 static void GLAPIENTRY
4264 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4266 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4269 static void GLAPIENTRY
4270 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4272 save_WindowPos4fMESA(x
, y
, z
, w
);
4275 static void GLAPIENTRY
4276 save_WindowPos2dvMESA(const GLdouble
* v
)
4278 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4281 static void GLAPIENTRY
4282 save_WindowPos2fvMESA(const GLfloat
* v
)
4284 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4287 static void GLAPIENTRY
4288 save_WindowPos2ivMESA(const GLint
* v
)
4290 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4293 static void GLAPIENTRY
4294 save_WindowPos2svMESA(const GLshort
* v
)
4296 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4299 static void GLAPIENTRY
4300 save_WindowPos3dvMESA(const GLdouble
* v
)
4302 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4305 static void GLAPIENTRY
4306 save_WindowPos3fvMESA(const GLfloat
* v
)
4308 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4311 static void GLAPIENTRY
4312 save_WindowPos3ivMESA(const GLint
* v
)
4314 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4317 static void GLAPIENTRY
4318 save_WindowPos3svMESA(const GLshort
* v
)
4320 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4323 static void GLAPIENTRY
4324 save_WindowPos4dvMESA(const GLdouble
* v
)
4326 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4327 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4330 static void GLAPIENTRY
4331 save_WindowPos4fvMESA(const GLfloat
* v
)
4333 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4336 static void GLAPIENTRY
4337 save_WindowPos4ivMESA(const GLint
* v
)
4339 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4340 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4343 static void GLAPIENTRY
4344 save_WindowPos4svMESA(const GLshort
* v
)
4346 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4351 /* GL_ARB_multitexture */
4352 static void GLAPIENTRY
4353 save_ActiveTextureARB(GLenum target
)
4355 GET_CURRENT_CONTEXT(ctx
);
4357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4358 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4362 if (ctx
->ExecuteFlag
) {
4363 CALL_ActiveTexture(ctx
->Exec
, (target
));
4368 /* GL_ARB_transpose_matrix */
4370 static void GLAPIENTRY
4371 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4374 _math_transposefd(tm
, m
);
4375 save_LoadMatrixf(tm
);
4379 static void GLAPIENTRY
4380 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4383 _math_transposef(tm
, m
);
4384 save_LoadMatrixf(tm
);
4388 static void GLAPIENTRY
4389 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4392 _math_transposefd(tm
, m
);
4393 save_MultMatrixf(tm
);
4397 static void GLAPIENTRY
4398 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4401 _math_transposef(tm
, m
);
4402 save_MultMatrixf(tm
);
4405 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4407 GET_CURRENT_CONTEXT(ctx
);
4413 image
= malloc(size
);
4415 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4418 memcpy(image
, data
, size
);
4424 /* GL_ARB_texture_compression */
4425 static void GLAPIENTRY
4426 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4427 GLenum internalFormat
, GLsizei width
,
4428 GLint border
, GLsizei imageSize
,
4429 const GLvoid
* data
)
4431 GET_CURRENT_CONTEXT(ctx
);
4432 if (target
== GL_PROXY_TEXTURE_1D
) {
4433 /* don't compile, execute immediately */
4434 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4435 width
, border
, imageSize
,
4440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4442 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4443 6 + POINTER_DWORDS
);
4447 n
[3].e
= internalFormat
;
4448 n
[4].i
= (GLint
) width
;
4452 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4454 if (ctx
->ExecuteFlag
) {
4455 CALL_CompressedTexImage1D(ctx
->Exec
,
4456 (target
, level
, internalFormat
, width
,
4457 border
, imageSize
, data
));
4463 static void GLAPIENTRY
4464 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4465 GLenum internalFormat
, GLsizei width
,
4466 GLsizei height
, GLint border
, GLsizei imageSize
,
4467 const GLvoid
* data
)
4469 GET_CURRENT_CONTEXT(ctx
);
4470 if (target
== GL_PROXY_TEXTURE_2D
) {
4471 /* don't compile, execute immediately */
4472 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4473 width
, height
, border
,
4478 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4480 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4481 7 + POINTER_DWORDS
);
4485 n
[3].e
= internalFormat
;
4486 n
[4].i
= (GLint
) width
;
4487 n
[5].i
= (GLint
) height
;
4491 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4493 if (ctx
->ExecuteFlag
) {
4494 CALL_CompressedTexImage2D(ctx
->Exec
,
4495 (target
, level
, internalFormat
, width
,
4496 height
, border
, imageSize
, data
));
4502 static void GLAPIENTRY
4503 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4504 GLenum internalFormat
, GLsizei width
,
4505 GLsizei height
, GLsizei depth
, GLint border
,
4506 GLsizei imageSize
, const GLvoid
* data
)
4508 GET_CURRENT_CONTEXT(ctx
);
4509 if (target
== GL_PROXY_TEXTURE_3D
) {
4510 /* don't compile, execute immediately */
4511 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4512 width
, height
, depth
, border
,
4517 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4519 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4520 8 + POINTER_DWORDS
);
4524 n
[3].e
= internalFormat
;
4525 n
[4].i
= (GLint
) width
;
4526 n
[5].i
= (GLint
) height
;
4527 n
[6].i
= (GLint
) depth
;
4531 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4533 if (ctx
->ExecuteFlag
) {
4534 CALL_CompressedTexImage3D(ctx
->Exec
,
4535 (target
, level
, internalFormat
, width
,
4536 height
, depth
, border
, imageSize
,
4543 static void GLAPIENTRY
4544 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4545 GLsizei width
, GLenum format
,
4546 GLsizei imageSize
, const GLvoid
* data
)
4549 GET_CURRENT_CONTEXT(ctx
);
4550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4552 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4553 6 + POINTER_DWORDS
);
4558 n
[4].i
= (GLint
) width
;
4562 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4564 if (ctx
->ExecuteFlag
) {
4565 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4566 width
, format
, imageSize
,
4572 static void GLAPIENTRY
4573 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4574 GLint yoffset
, GLsizei width
, GLsizei height
,
4575 GLenum format
, GLsizei imageSize
,
4576 const GLvoid
* data
)
4579 GET_CURRENT_CONTEXT(ctx
);
4580 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4582 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4583 8 + POINTER_DWORDS
);
4589 n
[5].i
= (GLint
) width
;
4590 n
[6].i
= (GLint
) height
;
4594 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4596 if (ctx
->ExecuteFlag
) {
4597 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4598 (target
, level
, xoffset
, yoffset
, width
,
4599 height
, format
, imageSize
, data
));
4604 static void GLAPIENTRY
4605 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4606 GLint yoffset
, GLint zoffset
, GLsizei width
,
4607 GLsizei height
, GLsizei depth
, GLenum format
,
4608 GLsizei imageSize
, const GLvoid
* data
)
4611 GET_CURRENT_CONTEXT(ctx
);
4612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4614 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4615 10 + POINTER_DWORDS
);
4622 n
[6].i
= (GLint
) width
;
4623 n
[7].i
= (GLint
) height
;
4624 n
[8].i
= (GLint
) depth
;
4626 n
[10].i
= imageSize
;
4627 save_pointer(&n
[11],
4628 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4630 if (ctx
->ExecuteFlag
) {
4631 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4632 (target
, level
, xoffset
, yoffset
,
4633 zoffset
, width
, height
, depth
, format
,
4639 /* GL_ARB_multisample */
4640 static void GLAPIENTRY
4641 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4643 GET_CURRENT_CONTEXT(ctx
);
4645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4646 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4651 if (ctx
->ExecuteFlag
) {
4652 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4658 * GL_NV_fragment_program
4660 static void GLAPIENTRY
4661 save_BindProgramNV(GLenum target
, GLuint id
)
4663 GET_CURRENT_CONTEXT(ctx
);
4665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4666 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4671 if (ctx
->ExecuteFlag
) {
4672 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4676 static void GLAPIENTRY
4677 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4678 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4680 GET_CURRENT_CONTEXT(ctx
);
4682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4683 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4692 if (ctx
->ExecuteFlag
) {
4693 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4698 static void GLAPIENTRY
4699 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4700 const GLfloat
*params
)
4702 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4703 params
[2], params
[3]);
4707 static void GLAPIENTRY
4708 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4709 const GLfloat
* params
)
4711 GET_CURRENT_CONTEXT(ctx
);
4713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4717 const GLfloat
* p
= params
;
4719 for (i
= 0 ; i
< count
; i
++) {
4720 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4733 if (ctx
->ExecuteFlag
) {
4734 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4739 static void GLAPIENTRY
4740 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4741 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4743 save_ProgramEnvParameter4fARB(target
, index
,
4745 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4749 static void GLAPIENTRY
4750 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4751 const GLdouble
*params
)
4753 save_ProgramEnvParameter4fARB(target
, index
,
4754 (GLfloat
) params
[0],
4755 (GLfloat
) params
[1],
4756 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4760 static void GLAPIENTRY
4761 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4762 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4764 GET_CURRENT_CONTEXT(ctx
);
4766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4767 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4776 if (ctx
->ExecuteFlag
) {
4777 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4782 static void GLAPIENTRY
4783 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4784 const GLfloat
*params
)
4786 GET_CURRENT_CONTEXT(ctx
);
4788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4789 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4798 if (ctx
->ExecuteFlag
) {
4799 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4804 static void GLAPIENTRY
4805 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4806 const GLfloat
*params
)
4808 GET_CURRENT_CONTEXT(ctx
);
4810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4814 const GLfloat
* p
= params
;
4816 for (i
= 0 ; i
< count
; i
++) {
4817 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4830 if (ctx
->ExecuteFlag
) {
4831 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4836 static void GLAPIENTRY
4837 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4838 GLdouble x
, GLdouble y
,
4839 GLdouble z
, GLdouble w
)
4841 GET_CURRENT_CONTEXT(ctx
);
4843 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4844 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4848 n
[3].f
= (GLfloat
) x
;
4849 n
[4].f
= (GLfloat
) y
;
4850 n
[5].f
= (GLfloat
) z
;
4851 n
[6].f
= (GLfloat
) w
;
4853 if (ctx
->ExecuteFlag
) {
4854 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4859 static void GLAPIENTRY
4860 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4861 const GLdouble
*params
)
4863 GET_CURRENT_CONTEXT(ctx
);
4865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4866 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4870 n
[3].f
= (GLfloat
) params
[0];
4871 n
[4].f
= (GLfloat
) params
[1];
4872 n
[5].f
= (GLfloat
) params
[2];
4873 n
[6].f
= (GLfloat
) params
[3];
4875 if (ctx
->ExecuteFlag
) {
4876 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4881 /* GL_EXT_stencil_two_side */
4882 static void GLAPIENTRY
4883 save_ActiveStencilFaceEXT(GLenum face
)
4885 GET_CURRENT_CONTEXT(ctx
);
4887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4888 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4892 if (ctx
->ExecuteFlag
) {
4893 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4898 /* GL_EXT_depth_bounds_test */
4899 static void GLAPIENTRY
4900 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4902 GET_CURRENT_CONTEXT(ctx
);
4904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4905 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4907 n
[1].f
= (GLfloat
) zmin
;
4908 n
[2].f
= (GLfloat
) zmax
;
4910 if (ctx
->ExecuteFlag
) {
4911 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4917 static void GLAPIENTRY
4918 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4919 const GLvoid
* string
)
4921 GET_CURRENT_CONTEXT(ctx
);
4924 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4926 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4928 GLubyte
*programCopy
= malloc(len
);
4930 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4933 memcpy(programCopy
, string
, len
);
4937 save_pointer(&n
[4], programCopy
);
4939 if (ctx
->ExecuteFlag
) {
4940 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4945 static void GLAPIENTRY
4946 save_BeginQueryARB(GLenum target
, GLuint id
)
4948 GET_CURRENT_CONTEXT(ctx
);
4950 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4951 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4956 if (ctx
->ExecuteFlag
) {
4957 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4961 static void GLAPIENTRY
4962 save_EndQueryARB(GLenum target
)
4964 GET_CURRENT_CONTEXT(ctx
);
4966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4967 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4971 if (ctx
->ExecuteFlag
) {
4972 CALL_EndQuery(ctx
->Exec
, (target
));
4976 static void GLAPIENTRY
4977 save_QueryCounter(GLuint id
, GLenum target
)
4979 GET_CURRENT_CONTEXT(ctx
);
4981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4982 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4987 if (ctx
->ExecuteFlag
) {
4988 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4992 static void GLAPIENTRY
4993 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4995 GET_CURRENT_CONTEXT(ctx
);
4997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4998 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5004 if (ctx
->ExecuteFlag
) {
5005 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5009 static void GLAPIENTRY
5010 save_EndQueryIndexed(GLenum target
, GLuint index
)
5012 GET_CURRENT_CONTEXT(ctx
);
5014 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5015 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5020 if (ctx
->ExecuteFlag
) {
5021 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5026 static void GLAPIENTRY
5027 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5029 GET_CURRENT_CONTEXT(ctx
);
5031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5032 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5036 if (count
> MAX_DRAW_BUFFERS
)
5037 count
= MAX_DRAW_BUFFERS
;
5038 for (i
= 0; i
< count
; i
++) {
5039 n
[2 + i
].e
= buffers
[i
];
5042 if (ctx
->ExecuteFlag
) {
5043 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5047 static void GLAPIENTRY
5048 save_BindFragmentShaderATI(GLuint id
)
5050 GET_CURRENT_CONTEXT(ctx
);
5053 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5057 if (ctx
->ExecuteFlag
) {
5058 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5062 static void GLAPIENTRY
5063 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5065 GET_CURRENT_CONTEXT(ctx
);
5068 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5076 if (ctx
->ExecuteFlag
) {
5077 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5081 static void GLAPIENTRY
5082 save_Attr1fNV(GLenum attr
, GLfloat x
)
5084 GET_CURRENT_CONTEXT(ctx
);
5086 SAVE_FLUSH_VERTICES(ctx
);
5087 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5093 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5094 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5095 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5097 if (ctx
->ExecuteFlag
) {
5098 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5102 static void GLAPIENTRY
5103 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5105 GET_CURRENT_CONTEXT(ctx
);
5107 SAVE_FLUSH_VERTICES(ctx
);
5108 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5115 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5116 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5117 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5119 if (ctx
->ExecuteFlag
) {
5120 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5124 static void GLAPIENTRY
5125 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5127 GET_CURRENT_CONTEXT(ctx
);
5129 SAVE_FLUSH_VERTICES(ctx
);
5130 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5138 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5139 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5140 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5142 if (ctx
->ExecuteFlag
) {
5143 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5147 static void GLAPIENTRY
5148 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5150 GET_CURRENT_CONTEXT(ctx
);
5152 SAVE_FLUSH_VERTICES(ctx
);
5153 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5162 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5163 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5164 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5166 if (ctx
->ExecuteFlag
) {
5167 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5172 static void GLAPIENTRY
5173 save_Attr1fARB(GLenum attr
, GLfloat x
)
5175 GET_CURRENT_CONTEXT(ctx
);
5177 SAVE_FLUSH_VERTICES(ctx
);
5178 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5184 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5185 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5186 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5188 if (ctx
->ExecuteFlag
) {
5189 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5193 static void GLAPIENTRY
5194 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5196 GET_CURRENT_CONTEXT(ctx
);
5198 SAVE_FLUSH_VERTICES(ctx
);
5199 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5206 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5207 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5208 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5210 if (ctx
->ExecuteFlag
) {
5211 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5215 static void GLAPIENTRY
5216 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5218 GET_CURRENT_CONTEXT(ctx
);
5220 SAVE_FLUSH_VERTICES(ctx
);
5221 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5229 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5230 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5231 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5233 if (ctx
->ExecuteFlag
) {
5234 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5238 static void GLAPIENTRY
5239 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5241 GET_CURRENT_CONTEXT(ctx
);
5243 SAVE_FLUSH_VERTICES(ctx
);
5244 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5253 assert(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5254 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5255 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5257 if (ctx
->ExecuteFlag
) {
5258 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5263 static void GLAPIENTRY
5264 save_EvalCoord1f(GLfloat x
)
5266 GET_CURRENT_CONTEXT(ctx
);
5268 SAVE_FLUSH_VERTICES(ctx
);
5269 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5273 if (ctx
->ExecuteFlag
) {
5274 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5278 static void GLAPIENTRY
5279 save_EvalCoord1fv(const GLfloat
* v
)
5281 save_EvalCoord1f(v
[0]);
5284 static void GLAPIENTRY
5285 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5287 GET_CURRENT_CONTEXT(ctx
);
5289 SAVE_FLUSH_VERTICES(ctx
);
5290 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5295 if (ctx
->ExecuteFlag
) {
5296 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5300 static void GLAPIENTRY
5301 save_EvalCoord2fv(const GLfloat
* v
)
5303 save_EvalCoord2f(v
[0], v
[1]);
5307 static void GLAPIENTRY
5308 save_EvalPoint1(GLint x
)
5310 GET_CURRENT_CONTEXT(ctx
);
5312 SAVE_FLUSH_VERTICES(ctx
);
5313 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5317 if (ctx
->ExecuteFlag
) {
5318 CALL_EvalPoint1(ctx
->Exec
, (x
));
5322 static void GLAPIENTRY
5323 save_EvalPoint2(GLint x
, GLint y
)
5325 GET_CURRENT_CONTEXT(ctx
);
5327 SAVE_FLUSH_VERTICES(ctx
);
5328 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5333 if (ctx
->ExecuteFlag
) {
5334 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5338 static void GLAPIENTRY
5339 save_Indexf(GLfloat x
)
5341 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5344 static void GLAPIENTRY
5345 save_Indexfv(const GLfloat
* v
)
5347 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5350 static void GLAPIENTRY
5351 save_EdgeFlag(GLboolean x
)
5353 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5358 * Compare 'count' elements of vectors 'a' and 'b'.
5359 * \return GL_TRUE if equal, GL_FALSE if different.
5361 static inline GLboolean
5362 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5364 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5369 * This glMaterial function is used for glMaterial calls that are outside
5370 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5372 static void GLAPIENTRY
5373 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5375 GET_CURRENT_CONTEXT(ctx
);
5383 case GL_FRONT_AND_BACK
:
5386 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5395 case GL_AMBIENT_AND_DIFFUSE
:
5401 case GL_COLOR_INDEXES
:
5405 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5409 if (ctx
->ExecuteFlag
) {
5410 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5413 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5415 /* Try to eliminate redundant statechanges. Because it is legal to
5416 * call glMaterial even inside begin/end calls, don't need to worry
5417 * about ctx->Driver.CurrentSavePrimitive here.
5419 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5420 if (bitmask
& (1 << i
)) {
5421 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5422 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5423 /* no change in material value */
5424 bitmask
&= ~(1 << i
);
5427 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5428 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5433 /* If this call has no effect, return early */
5437 SAVE_FLUSH_VERTICES(ctx
);
5439 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5443 for (i
= 0; i
< args
; i
++)
5444 n
[3 + i
].f
= param
[i
];
5448 static void GLAPIENTRY
5449 save_Begin(GLenum mode
)
5451 GET_CURRENT_CONTEXT(ctx
);
5453 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5454 /* compile this error into the display list */
5455 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5457 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5458 /* compile this error into the display list */
5459 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5464 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5466 /* Give the driver an opportunity to hook in an optimized
5467 * display list compiler.
5469 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5472 SAVE_FLUSH_VERTICES(ctx
);
5473 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5478 if (ctx
->ExecuteFlag
) {
5479 CALL_Begin(ctx
->Exec
, (mode
));
5484 static void GLAPIENTRY
5487 GET_CURRENT_CONTEXT(ctx
);
5488 SAVE_FLUSH_VERTICES(ctx
);
5489 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5490 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5491 if (ctx
->ExecuteFlag
) {
5492 CALL_End(ctx
->Exec
, ());
5496 static void GLAPIENTRY
5497 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5499 GET_CURRENT_CONTEXT(ctx
);
5501 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5502 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5509 if (ctx
->ExecuteFlag
) {
5510 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5515 static void GLAPIENTRY
5516 save_Vertex2f(GLfloat x
, GLfloat y
)
5518 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5521 static void GLAPIENTRY
5522 save_Vertex2fv(const GLfloat
* v
)
5524 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5527 static void GLAPIENTRY
5528 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5530 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5533 static void GLAPIENTRY
5534 save_Vertex3fv(const GLfloat
* v
)
5536 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5539 static void GLAPIENTRY
5540 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5542 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5545 static void GLAPIENTRY
5546 save_Vertex4fv(const GLfloat
* v
)
5548 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5551 static void GLAPIENTRY
5552 save_TexCoord1f(GLfloat x
)
5554 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5557 static void GLAPIENTRY
5558 save_TexCoord1fv(const GLfloat
* v
)
5560 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5563 static void GLAPIENTRY
5564 save_TexCoord2f(GLfloat x
, GLfloat y
)
5566 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5569 static void GLAPIENTRY
5570 save_TexCoord2fv(const GLfloat
* v
)
5572 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5575 static void GLAPIENTRY
5576 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5578 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5581 static void GLAPIENTRY
5582 save_TexCoord3fv(const GLfloat
* v
)
5584 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5587 static void GLAPIENTRY
5588 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5590 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5593 static void GLAPIENTRY
5594 save_TexCoord4fv(const GLfloat
* v
)
5596 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5599 static void GLAPIENTRY
5600 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5602 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5605 static void GLAPIENTRY
5606 save_Normal3fv(const GLfloat
* v
)
5608 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5611 static void GLAPIENTRY
5612 save_FogCoordfEXT(GLfloat x
)
5614 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5617 static void GLAPIENTRY
5618 save_FogCoordfvEXT(const GLfloat
* v
)
5620 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5623 static void GLAPIENTRY
5624 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5626 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5629 static void GLAPIENTRY
5630 save_Color3fv(const GLfloat
* v
)
5632 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5635 static void GLAPIENTRY
5636 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5638 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5641 static void GLAPIENTRY
5642 save_Color4fv(const GLfloat
* v
)
5644 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5647 static void GLAPIENTRY
5648 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5650 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5653 static void GLAPIENTRY
5654 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5656 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5660 /* Just call the respective ATTR for texcoord
5662 static void GLAPIENTRY
5663 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5665 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5666 save_Attr1fNV(attr
, x
);
5669 static void GLAPIENTRY
5670 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5672 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5673 save_Attr1fNV(attr
, v
[0]);
5676 static void GLAPIENTRY
5677 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5679 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5680 save_Attr2fNV(attr
, x
, y
);
5683 static void GLAPIENTRY
5684 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5686 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5687 save_Attr2fNV(attr
, v
[0], v
[1]);
5690 static void GLAPIENTRY
5691 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5693 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5694 save_Attr3fNV(attr
, x
, y
, z
);
5697 static void GLAPIENTRY
5698 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5700 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5701 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5704 static void GLAPIENTRY
5705 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5706 GLfloat z
, GLfloat w
)
5708 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5709 save_Attr4fNV(attr
, x
, y
, z
, w
);
5712 static void GLAPIENTRY
5713 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5715 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5716 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5721 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5727 GET_CURRENT_CONTEXT(ctx
);
5728 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5733 static void GLAPIENTRY
5734 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5736 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5737 save_Attr1fARB(index
, x
);
5742 static void GLAPIENTRY
5743 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5745 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5746 save_Attr1fARB(index
, v
[0]);
5751 static void GLAPIENTRY
5752 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5754 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5755 save_Attr2fARB(index
, x
, y
);
5760 static void GLAPIENTRY
5761 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5763 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5764 save_Attr2fARB(index
, v
[0], v
[1]);
5769 static void GLAPIENTRY
5770 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5772 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5773 save_Attr3fARB(index
, x
, y
, z
);
5778 static void GLAPIENTRY
5779 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5781 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5782 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5787 static void GLAPIENTRY
5788 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5791 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5792 save_Attr4fARB(index
, x
, y
, z
, w
);
5797 static void GLAPIENTRY
5798 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5800 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5801 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5806 static void GLAPIENTRY
5807 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5808 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5809 GLbitfield mask
, GLenum filter
)
5811 GET_CURRENT_CONTEXT(ctx
);
5813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5814 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5827 if (ctx
->ExecuteFlag
) {
5828 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5829 dstX0
, dstY0
, dstX1
, dstY1
,
5835 /** GL_EXT_provoking_vertex */
5836 static void GLAPIENTRY
5837 save_ProvokingVertexEXT(GLenum mode
)
5839 GET_CURRENT_CONTEXT(ctx
);
5841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5842 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5846 if (ctx
->ExecuteFlag
) {
5847 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5848 _mesa_ProvokingVertex(mode
);
5853 /** GL_EXT_transform_feedback */
5854 static void GLAPIENTRY
5855 save_BeginTransformFeedback(GLenum mode
)
5857 GET_CURRENT_CONTEXT(ctx
);
5859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5860 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5864 if (ctx
->ExecuteFlag
) {
5865 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5870 /** GL_EXT_transform_feedback */
5871 static void GLAPIENTRY
5872 save_EndTransformFeedback(void)
5874 GET_CURRENT_CONTEXT(ctx
);
5875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5876 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5877 if (ctx
->ExecuteFlag
) {
5878 CALL_EndTransformFeedback(ctx
->Exec
, ());
5882 static void GLAPIENTRY
5883 save_BindTransformFeedback(GLenum target
, GLuint name
)
5885 GET_CURRENT_CONTEXT(ctx
);
5887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5888 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5893 if (ctx
->ExecuteFlag
) {
5894 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5898 static void GLAPIENTRY
5899 save_PauseTransformFeedback(void)
5901 GET_CURRENT_CONTEXT(ctx
);
5902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5903 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5904 if (ctx
->ExecuteFlag
) {
5905 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5909 static void GLAPIENTRY
5910 save_ResumeTransformFeedback(void)
5912 GET_CURRENT_CONTEXT(ctx
);
5913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5914 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5915 if (ctx
->ExecuteFlag
) {
5916 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5920 static void GLAPIENTRY
5921 save_DrawTransformFeedback(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
, 2);
5931 if (ctx
->ExecuteFlag
) {
5932 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5936 static void GLAPIENTRY
5937 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5939 GET_CURRENT_CONTEXT(ctx
);
5941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5942 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5948 if (ctx
->ExecuteFlag
) {
5949 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5953 static void GLAPIENTRY
5954 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5957 GET_CURRENT_CONTEXT(ctx
);
5959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5960 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5964 n
[3].si
= primcount
;
5966 if (ctx
->ExecuteFlag
) {
5967 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5971 static void GLAPIENTRY
5972 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5973 GLuint stream
, GLsizei primcount
)
5975 GET_CURRENT_CONTEXT(ctx
);
5977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5978 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5983 n
[4].si
= primcount
;
5985 if (ctx
->ExecuteFlag
) {
5986 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5991 /* aka UseProgram() */
5992 static void GLAPIENTRY
5993 save_UseProgramObjectARB(GLhandleARB program
)
5995 GET_CURRENT_CONTEXT(ctx
);
5997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5998 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6002 if (ctx
->ExecuteFlag
) {
6003 CALL_UseProgram(ctx
->Exec
, (program
));
6008 static void GLAPIENTRY
6009 save_Uniform1fARB(GLint location
, GLfloat x
)
6011 GET_CURRENT_CONTEXT(ctx
);
6013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6014 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6019 if (ctx
->ExecuteFlag
) {
6020 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6025 static void GLAPIENTRY
6026 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6028 GET_CURRENT_CONTEXT(ctx
);
6030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6031 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6037 if (ctx
->ExecuteFlag
) {
6038 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6043 static void GLAPIENTRY
6044 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6046 GET_CURRENT_CONTEXT(ctx
);
6048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6049 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6056 if (ctx
->ExecuteFlag
) {
6057 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6062 static void GLAPIENTRY
6063 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6065 GET_CURRENT_CONTEXT(ctx
);
6067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6068 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6076 if (ctx
->ExecuteFlag
) {
6077 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6082 static void GLAPIENTRY
6083 save_Uniform1fvARB(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_1FV
, 2 + POINTER_DWORDS
);
6092 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6094 if (ctx
->ExecuteFlag
) {
6095 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6099 static void GLAPIENTRY
6100 save_Uniform2fvARB(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_2FV
, 2 + POINTER_DWORDS
);
6109 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6111 if (ctx
->ExecuteFlag
) {
6112 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6116 static void GLAPIENTRY
6117 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6119 GET_CURRENT_CONTEXT(ctx
);
6121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6122 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6126 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6128 if (ctx
->ExecuteFlag
) {
6129 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6133 static void GLAPIENTRY
6134 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6136 GET_CURRENT_CONTEXT(ctx
);
6138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6139 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6143 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6145 if (ctx
->ExecuteFlag
) {
6146 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6151 static void GLAPIENTRY
6152 save_Uniform1iARB(GLint location
, GLint x
)
6154 GET_CURRENT_CONTEXT(ctx
);
6156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6157 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6162 if (ctx
->ExecuteFlag
) {
6163 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6167 static void GLAPIENTRY
6168 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6170 GET_CURRENT_CONTEXT(ctx
);
6172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6173 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6179 if (ctx
->ExecuteFlag
) {
6180 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6184 static void GLAPIENTRY
6185 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6187 GET_CURRENT_CONTEXT(ctx
);
6189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6190 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6197 if (ctx
->ExecuteFlag
) {
6198 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6202 static void GLAPIENTRY
6203 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6205 GET_CURRENT_CONTEXT(ctx
);
6207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6208 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6216 if (ctx
->ExecuteFlag
) {
6217 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6223 static void GLAPIENTRY
6224 save_Uniform1ivARB(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_1IV
, 2 + POINTER_DWORDS
);
6233 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6235 if (ctx
->ExecuteFlag
) {
6236 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6240 static void GLAPIENTRY
6241 save_Uniform2ivARB(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_2IV
, 2 + POINTER_DWORDS
);
6250 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6252 if (ctx
->ExecuteFlag
) {
6253 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6257 static void GLAPIENTRY
6258 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6260 GET_CURRENT_CONTEXT(ctx
);
6262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6263 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6267 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6269 if (ctx
->ExecuteFlag
) {
6270 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6274 static void GLAPIENTRY
6275 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6277 GET_CURRENT_CONTEXT(ctx
);
6279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6280 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6284 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6286 if (ctx
->ExecuteFlag
) {
6287 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6293 static void GLAPIENTRY
6294 save_Uniform1ui(GLint location
, GLuint x
)
6296 GET_CURRENT_CONTEXT(ctx
);
6298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6299 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6304 if (ctx
->ExecuteFlag
) {
6305 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6309 static void GLAPIENTRY
6310 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6312 GET_CURRENT_CONTEXT(ctx
);
6314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6315 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6321 if (ctx
->ExecuteFlag
) {
6322 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6326 static void GLAPIENTRY
6327 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6329 GET_CURRENT_CONTEXT(ctx
);
6331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6332 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6339 if (ctx
->ExecuteFlag
) {
6340 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6344 static void GLAPIENTRY
6345 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6347 GET_CURRENT_CONTEXT(ctx
);
6349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6350 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6358 if (ctx
->ExecuteFlag
) {
6359 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6365 static void GLAPIENTRY
6366 save_Uniform1uiv(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_1UIV
, 2 + POINTER_DWORDS
);
6375 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6377 if (ctx
->ExecuteFlag
) {
6378 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6382 static void GLAPIENTRY
6383 save_Uniform2uiv(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_2UIV
, 2 + POINTER_DWORDS
);
6392 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6394 if (ctx
->ExecuteFlag
) {
6395 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6399 static void GLAPIENTRY
6400 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6402 GET_CURRENT_CONTEXT(ctx
);
6404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6405 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6409 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6411 if (ctx
->ExecuteFlag
) {
6412 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6416 static void GLAPIENTRY
6417 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6419 GET_CURRENT_CONTEXT(ctx
);
6421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6422 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6426 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6428 if (ctx
->ExecuteFlag
) {
6429 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6435 static void GLAPIENTRY
6436 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6439 GET_CURRENT_CONTEXT(ctx
);
6441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6442 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6447 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6454 static void GLAPIENTRY
6455 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6458 GET_CURRENT_CONTEXT(ctx
);
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6461 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6466 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6468 if (ctx
->ExecuteFlag
) {
6469 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6473 static void GLAPIENTRY
6474 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6477 GET_CURRENT_CONTEXT(ctx
);
6479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6480 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6485 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6487 if (ctx
->ExecuteFlag
) {
6488 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6493 static void GLAPIENTRY
6494 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6497 GET_CURRENT_CONTEXT(ctx
);
6499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6500 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6505 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6507 if (ctx
->ExecuteFlag
) {
6508 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6512 static void GLAPIENTRY
6513 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6516 GET_CURRENT_CONTEXT(ctx
);
6518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6519 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6524 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6526 if (ctx
->ExecuteFlag
) {
6527 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6532 static void GLAPIENTRY
6533 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6536 GET_CURRENT_CONTEXT(ctx
);
6538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6539 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6544 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6546 if (ctx
->ExecuteFlag
) {
6547 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6551 static void GLAPIENTRY
6552 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6555 GET_CURRENT_CONTEXT(ctx
);
6557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6558 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6563 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6565 if (ctx
->ExecuteFlag
) {
6566 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6571 static void GLAPIENTRY
6572 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6575 GET_CURRENT_CONTEXT(ctx
);
6577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6578 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6583 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6585 if (ctx
->ExecuteFlag
) {
6586 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6590 static void GLAPIENTRY
6591 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6594 GET_CURRENT_CONTEXT(ctx
);
6596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6597 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6602 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6604 if (ctx
->ExecuteFlag
) {
6605 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6609 static void GLAPIENTRY
6610 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6612 GET_CURRENT_CONTEXT(ctx
);
6614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6615 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6621 if (ctx
->ExecuteFlag
) {
6622 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6626 static void GLAPIENTRY
6627 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6629 GET_CURRENT_CONTEXT(ctx
);
6631 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6632 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6638 if (ctx
->ExecuteFlag
) {
6639 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6643 static void GLAPIENTRY
6644 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6646 GET_CURRENT_CONTEXT(ctx
);
6648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6649 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6656 if (ctx
->ExecuteFlag
) {
6657 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6661 static void GLAPIENTRY
6662 save_ProgramUniform3f(GLuint program
, GLint location
,
6663 GLfloat x
, GLfloat y
, GLfloat z
)
6665 GET_CURRENT_CONTEXT(ctx
);
6667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6668 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6676 if (ctx
->ExecuteFlag
) {
6677 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6681 static void GLAPIENTRY
6682 save_ProgramUniform4f(GLuint program
, GLint location
,
6683 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6685 GET_CURRENT_CONTEXT(ctx
);
6687 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6688 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6697 if (ctx
->ExecuteFlag
) {
6698 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6702 static void GLAPIENTRY
6703 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6706 GET_CURRENT_CONTEXT(ctx
);
6708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6709 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6714 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6716 if (ctx
->ExecuteFlag
) {
6717 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6721 static void GLAPIENTRY
6722 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6725 GET_CURRENT_CONTEXT(ctx
);
6727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6728 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6733 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6735 if (ctx
->ExecuteFlag
) {
6736 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6740 static void GLAPIENTRY
6741 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6744 GET_CURRENT_CONTEXT(ctx
);
6746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6747 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6752 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6754 if (ctx
->ExecuteFlag
) {
6755 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6759 static void GLAPIENTRY
6760 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6763 GET_CURRENT_CONTEXT(ctx
);
6765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6766 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6771 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6773 if (ctx
->ExecuteFlag
) {
6774 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6778 static void GLAPIENTRY
6779 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6781 GET_CURRENT_CONTEXT(ctx
);
6783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6784 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6790 if (ctx
->ExecuteFlag
) {
6791 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6795 static void GLAPIENTRY
6796 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6798 GET_CURRENT_CONTEXT(ctx
);
6800 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6801 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6808 if (ctx
->ExecuteFlag
) {
6809 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6813 static void GLAPIENTRY
6814 save_ProgramUniform3i(GLuint program
, GLint location
,
6815 GLint x
, GLint y
, GLint z
)
6817 GET_CURRENT_CONTEXT(ctx
);
6819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6820 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6828 if (ctx
->ExecuteFlag
) {
6829 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6833 static void GLAPIENTRY
6834 save_ProgramUniform4i(GLuint program
, GLint location
,
6835 GLint x
, GLint y
, GLint z
, GLint w
)
6837 GET_CURRENT_CONTEXT(ctx
);
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6840 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6849 if (ctx
->ExecuteFlag
) {
6850 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6854 static void GLAPIENTRY
6855 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6858 GET_CURRENT_CONTEXT(ctx
);
6860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6861 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6866 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6868 if (ctx
->ExecuteFlag
) {
6869 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6873 static void GLAPIENTRY
6874 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6877 GET_CURRENT_CONTEXT(ctx
);
6879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6880 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6885 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6887 if (ctx
->ExecuteFlag
) {
6888 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6892 static void GLAPIENTRY
6893 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6896 GET_CURRENT_CONTEXT(ctx
);
6898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6899 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6904 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6906 if (ctx
->ExecuteFlag
) {
6907 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6911 static void GLAPIENTRY
6912 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6915 GET_CURRENT_CONTEXT(ctx
);
6917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6918 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6923 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6925 if (ctx
->ExecuteFlag
) {
6926 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6930 static void GLAPIENTRY
6931 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6933 GET_CURRENT_CONTEXT(ctx
);
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6936 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6942 if (ctx
->ExecuteFlag
) {
6943 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6947 static void GLAPIENTRY
6948 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6950 GET_CURRENT_CONTEXT(ctx
);
6952 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6953 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6960 if (ctx
->ExecuteFlag
) {
6961 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6965 static void GLAPIENTRY
6966 save_ProgramUniform3ui(GLuint program
, GLint location
,
6967 GLuint x
, GLuint y
, GLuint z
)
6969 GET_CURRENT_CONTEXT(ctx
);
6971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6972 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6980 if (ctx
->ExecuteFlag
) {
6981 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6985 static void GLAPIENTRY
6986 save_ProgramUniform4ui(GLuint program
, GLint location
,
6987 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6989 GET_CURRENT_CONTEXT(ctx
);
6991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6992 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
7001 if (ctx
->ExecuteFlag
) {
7002 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
7006 static void GLAPIENTRY
7007 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
7010 GET_CURRENT_CONTEXT(ctx
);
7012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7013 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
7018 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7020 if (ctx
->ExecuteFlag
) {
7021 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7025 static void GLAPIENTRY
7026 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7029 GET_CURRENT_CONTEXT(ctx
);
7031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7032 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7037 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7039 if (ctx
->ExecuteFlag
) {
7040 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7044 static void GLAPIENTRY
7045 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7048 GET_CURRENT_CONTEXT(ctx
);
7050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7051 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7056 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7058 if (ctx
->ExecuteFlag
) {
7059 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7063 static void GLAPIENTRY
7064 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7067 GET_CURRENT_CONTEXT(ctx
);
7069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7070 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7075 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7077 if (ctx
->ExecuteFlag
) {
7078 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7082 static void GLAPIENTRY
7083 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7084 GLboolean transpose
, const GLfloat
*v
)
7086 GET_CURRENT_CONTEXT(ctx
);
7088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7089 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7090 4 + POINTER_DWORDS
);
7096 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7098 if (ctx
->ExecuteFlag
) {
7099 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7100 (program
, location
, count
, transpose
, v
));
7104 static void GLAPIENTRY
7105 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7106 GLboolean transpose
, const GLfloat
*v
)
7108 GET_CURRENT_CONTEXT(ctx
);
7110 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7111 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7112 4 + POINTER_DWORDS
);
7118 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7120 if (ctx
->ExecuteFlag
) {
7121 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7122 (program
, location
, count
, transpose
, v
));
7126 static void GLAPIENTRY
7127 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7128 GLboolean transpose
, const GLfloat
*v
)
7130 GET_CURRENT_CONTEXT(ctx
);
7132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7133 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7134 4 + POINTER_DWORDS
);
7140 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7142 if (ctx
->ExecuteFlag
) {
7143 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7144 (program
, location
, count
, transpose
, v
));
7148 static void GLAPIENTRY
7149 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7150 GLboolean transpose
, const GLfloat
*v
)
7152 GET_CURRENT_CONTEXT(ctx
);
7154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7155 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7156 4 + POINTER_DWORDS
);
7162 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7164 if (ctx
->ExecuteFlag
) {
7165 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7166 (program
, location
, count
, transpose
, v
));
7170 static void GLAPIENTRY
7171 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7172 GLboolean transpose
, const GLfloat
*v
)
7174 GET_CURRENT_CONTEXT(ctx
);
7176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7177 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7178 4 + POINTER_DWORDS
);
7184 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7186 if (ctx
->ExecuteFlag
) {
7187 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7188 (program
, location
, count
, transpose
, v
));
7192 static void GLAPIENTRY
7193 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7194 GLboolean transpose
, const GLfloat
*v
)
7196 GET_CURRENT_CONTEXT(ctx
);
7198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7199 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7200 4 + POINTER_DWORDS
);
7206 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7208 if (ctx
->ExecuteFlag
) {
7209 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7210 (program
, location
, count
, transpose
, v
));
7214 static void GLAPIENTRY
7215 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7216 GLboolean transpose
, const GLfloat
*v
)
7218 GET_CURRENT_CONTEXT(ctx
);
7220 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7221 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7222 4 + POINTER_DWORDS
);
7228 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7230 if (ctx
->ExecuteFlag
) {
7231 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7232 (program
, location
, count
, transpose
, v
));
7236 static void GLAPIENTRY
7237 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7238 GLboolean transpose
, const GLfloat
*v
)
7240 GET_CURRENT_CONTEXT(ctx
);
7242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7243 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7244 4 + POINTER_DWORDS
);
7250 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7252 if (ctx
->ExecuteFlag
) {
7253 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7254 (program
, location
, count
, transpose
, v
));
7258 static void GLAPIENTRY
7259 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7260 GLboolean transpose
, const GLfloat
*v
)
7262 GET_CURRENT_CONTEXT(ctx
);
7264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7265 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7266 4 + POINTER_DWORDS
);
7272 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7274 if (ctx
->ExecuteFlag
) {
7275 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7276 (program
, location
, count
, transpose
, v
));
7280 static void GLAPIENTRY
7281 save_ClipControl(GLenum origin
, GLenum depth
)
7283 GET_CURRENT_CONTEXT(ctx
);
7285 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7286 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7291 if (ctx
->ExecuteFlag
) {
7292 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7296 static void GLAPIENTRY
7297 save_ClampColorARB(GLenum target
, GLenum clamp
)
7299 GET_CURRENT_CONTEXT(ctx
);
7301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7302 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7307 if (ctx
->ExecuteFlag
) {
7308 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7312 /** GL_EXT_texture_integer */
7313 static void GLAPIENTRY
7314 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7316 GET_CURRENT_CONTEXT(ctx
);
7318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7319 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7326 if (ctx
->ExecuteFlag
) {
7327 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7331 /** GL_EXT_texture_integer */
7332 static void GLAPIENTRY
7333 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7335 GET_CURRENT_CONTEXT(ctx
);
7337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7338 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7345 if (ctx
->ExecuteFlag
) {
7346 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7350 /** GL_EXT_texture_integer */
7351 static void GLAPIENTRY
7352 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7354 GET_CURRENT_CONTEXT(ctx
);
7356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7357 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7366 if (ctx
->ExecuteFlag
) {
7367 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7371 /** GL_EXT_texture_integer */
7372 static void GLAPIENTRY
7373 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7375 GET_CURRENT_CONTEXT(ctx
);
7377 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7378 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7382 n
[3].ui
= params
[0];
7383 n
[4].ui
= params
[1];
7384 n
[5].ui
= params
[2];
7385 n
[6].ui
= params
[3];
7387 if (ctx
->ExecuteFlag
) {
7388 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7392 /* GL_ARB_instanced_arrays */
7393 static void GLAPIENTRY
7394 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7396 GET_CURRENT_CONTEXT(ctx
);
7398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7399 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7404 if (ctx
->ExecuteFlag
) {
7405 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7410 /* GL_NV_texture_barrier */
7411 static void GLAPIENTRY
7412 save_TextureBarrierNV(void)
7414 GET_CURRENT_CONTEXT(ctx
);
7415 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7416 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7417 if (ctx
->ExecuteFlag
) {
7418 CALL_TextureBarrierNV(ctx
->Exec
, ());
7423 /* GL_ARB_sampler_objects */
7424 static void GLAPIENTRY
7425 save_BindSampler(GLuint unit
, GLuint sampler
)
7428 GET_CURRENT_CONTEXT(ctx
);
7429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7430 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7435 if (ctx
->ExecuteFlag
) {
7436 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7440 static void GLAPIENTRY
7441 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7444 GET_CURRENT_CONTEXT(ctx
);
7445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7446 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7451 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7457 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7460 if (ctx
->ExecuteFlag
) {
7461 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7465 static void GLAPIENTRY
7466 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7470 parray
[1] = parray
[2] = parray
[3] = 0;
7471 save_SamplerParameteriv(sampler
, pname
, parray
);
7474 static void GLAPIENTRY
7475 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7478 GET_CURRENT_CONTEXT(ctx
);
7479 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7480 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7485 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7491 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7494 if (ctx
->ExecuteFlag
) {
7495 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7499 static void GLAPIENTRY
7500 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7504 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7505 save_SamplerParameterfv(sampler
, pname
, parray
);
7508 static void GLAPIENTRY
7509 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7512 GET_CURRENT_CONTEXT(ctx
);
7513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7514 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7519 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7525 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7528 if (ctx
->ExecuteFlag
) {
7529 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7533 static void GLAPIENTRY
7534 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7537 GET_CURRENT_CONTEXT(ctx
);
7538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7539 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7543 n
[3].ui
= params
[0];
7544 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7545 n
[4].ui
= params
[1];
7546 n
[5].ui
= params
[2];
7547 n
[6].ui
= params
[3];
7550 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7553 if (ctx
->ExecuteFlag
) {
7554 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7558 /* GL_ARB_geometry_shader4 */
7559 static void GLAPIENTRY
7560 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7563 GET_CURRENT_CONTEXT(ctx
);
7564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7565 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7571 if (ctx
->ExecuteFlag
) {
7572 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7576 static void GLAPIENTRY
7577 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7578 GLuint texture
, GLint level
)
7581 GET_CURRENT_CONTEXT(ctx
);
7582 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7583 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7586 n
[2].e
= attachment
;
7590 if (ctx
->ExecuteFlag
) {
7591 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7596 static void GLAPIENTRY
7597 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7600 GET_CURRENT_CONTEXT(ctx
);
7601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7602 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7604 union uint64_pair p
;
7607 n
[2].ui
= p
.uint32
[0];
7608 n
[3].ui
= p
.uint32
[1];
7609 save_pointer(&n
[4], sync
);
7611 if (ctx
->ExecuteFlag
) {
7612 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7617 /** GL_NV_conditional_render */
7618 static void GLAPIENTRY
7619 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7621 GET_CURRENT_CONTEXT(ctx
);
7623 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7624 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7629 if (ctx
->ExecuteFlag
) {
7630 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7634 static void GLAPIENTRY
7635 save_EndConditionalRender(void)
7637 GET_CURRENT_CONTEXT(ctx
);
7638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7639 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7640 if (ctx
->ExecuteFlag
) {
7641 CALL_EndConditionalRender(ctx
->Exec
, ());
7645 static void GLAPIENTRY
7646 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7648 GET_CURRENT_CONTEXT(ctx
);
7650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7651 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7657 if (ctx
->ExecuteFlag
) {
7658 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7664 * Save an error-generating command into display list.
7666 * KW: Will appear in the list before the vertex buffer containing the
7667 * command that provoked the error. I don't see this as a problem.
7670 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7673 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7676 save_pointer(&n
[2], (void *) s
);
7677 /* note: the data/string here doesn't have to be freed in
7678 * _mesa_delete_list() since the string is never dynamically
7686 * Compile an error into current display list.
7689 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7691 if (ctx
->CompileFlag
)
7692 save_error(ctx
, error
, s
);
7693 if (ctx
->ExecuteFlag
)
7694 _mesa_error(ctx
, error
, "%s", s
);
7699 * Test if ID names a display list.
7702 islist(struct gl_context
*ctx
, GLuint list
)
7704 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7714 /**********************************************************************/
7715 /* Display list execution */
7716 /**********************************************************************/
7720 * Execute a display list. Note that the ListBase offset must have already
7721 * been added before calling this function. I.e. the list argument is
7722 * the absolute list number, not relative to ListBase.
7723 * \param list - display list number
7726 execute_list(struct gl_context
*ctx
, GLuint list
)
7728 struct gl_display_list
*dlist
;
7732 if (list
== 0 || !islist(ctx
, list
))
7735 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7736 /* raise an error? */
7740 dlist
= _mesa_lookup_list(ctx
, list
);
7744 ctx
->ListState
.CallDepth
++;
7746 if (ctx
->Driver
.BeginCallList
)
7747 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7753 const OpCode opcode
= n
[0].opcode
;
7755 if (is_ext_opcode(opcode
)) {
7756 n
+= ext_opcode_execute(ctx
, n
);
7761 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7764 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7766 case OPCODE_ALPHA_FUNC
:
7767 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7769 case OPCODE_BIND_TEXTURE
:
7770 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7774 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7775 ctx
->Unpack
= ctx
->DefaultPacking
;
7776 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7777 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7778 get_pointer(&n
[7])));
7779 ctx
->Unpack
= save
; /* restore */
7782 case OPCODE_BLEND_COLOR
:
7783 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7785 case OPCODE_BLEND_EQUATION
:
7786 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7788 case OPCODE_BLEND_EQUATION_SEPARATE
:
7789 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7791 case OPCODE_BLEND_FUNC_SEPARATE
:
7792 CALL_BlendFuncSeparate(ctx
->Exec
,
7793 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7796 case OPCODE_BLEND_FUNC_I
:
7797 /* GL_ARB_draw_buffers_blend */
7798 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7800 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7801 /* GL_ARB_draw_buffers_blend */
7802 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7805 case OPCODE_BLEND_EQUATION_I
:
7806 /* GL_ARB_draw_buffers_blend */
7807 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7809 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7810 /* GL_ARB_draw_buffers_blend */
7811 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7812 (n
[1].ui
, n
[2].e
, n
[3].e
));
7815 case OPCODE_CALL_LIST
:
7816 /* Generated by glCallList(), don't add ListBase */
7817 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7818 execute_list(ctx
, n
[1].ui
);
7821 case OPCODE_CALL_LIST_OFFSET
:
7822 /* Generated by glCallLists() so we must add ListBase */
7824 /* user specified a bad data type at compile time */
7825 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7827 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7828 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7829 execute_list(ctx
, list
);
7833 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7835 case OPCODE_CLEAR_BUFFER_IV
:
7842 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7845 case OPCODE_CLEAR_BUFFER_UIV
:
7852 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7855 case OPCODE_CLEAR_BUFFER_FV
:
7862 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7865 case OPCODE_CLEAR_BUFFER_FI
:
7866 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7868 case OPCODE_CLEAR_COLOR
:
7869 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7871 case OPCODE_CLEAR_ACCUM
:
7872 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7874 case OPCODE_CLEAR_DEPTH
:
7875 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7877 case OPCODE_CLEAR_INDEX
:
7878 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7880 case OPCODE_CLEAR_STENCIL
:
7881 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7883 case OPCODE_CLIP_PLANE
:
7890 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7893 case OPCODE_COLOR_MASK
:
7894 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7896 case OPCODE_COLOR_MASK_INDEXED
:
7897 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7900 case OPCODE_COLOR_MATERIAL
:
7901 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7903 case OPCODE_COPY_PIXELS
:
7904 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7905 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7908 case OPCODE_COPY_TEX_IMAGE1D
:
7909 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7910 n
[5].i
, n
[6].i
, n
[7].i
));
7912 case OPCODE_COPY_TEX_IMAGE2D
:
7913 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7914 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7916 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7917 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7918 n
[4].i
, n
[5].i
, n
[6].i
));
7920 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7921 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7922 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7925 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7926 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7927 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7930 case OPCODE_CULL_FACE
:
7931 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7933 case OPCODE_DEPTH_FUNC
:
7934 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7936 case OPCODE_DEPTH_MASK
:
7937 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7939 case OPCODE_DEPTH_RANGE
:
7940 CALL_DepthRange(ctx
->Exec
,
7941 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7943 case OPCODE_DISABLE
:
7944 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7946 case OPCODE_DISABLE_INDEXED
:
7947 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7949 case OPCODE_DRAW_BUFFER
:
7950 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7952 case OPCODE_DRAW_PIXELS
:
7954 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7955 ctx
->Unpack
= ctx
->DefaultPacking
;
7956 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7957 get_pointer(&n
[5])));
7958 ctx
->Unpack
= save
; /* restore */
7962 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7964 case OPCODE_ENABLE_INDEXED
:
7965 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7967 case OPCODE_EVALMESH1
:
7968 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7970 case OPCODE_EVALMESH2
:
7971 CALL_EvalMesh2(ctx
->Exec
,
7972 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7981 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7984 case OPCODE_FRONT_FACE
:
7985 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7987 case OPCODE_FRUSTUM
:
7988 CALL_Frustum(ctx
->Exec
,
7989 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7992 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7994 case OPCODE_INDEX_MASK
:
7995 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7997 case OPCODE_INIT_NAMES
:
7998 CALL_InitNames(ctx
->Exec
, ());
8007 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8010 case OPCODE_LIGHT_MODEL
:
8017 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8020 case OPCODE_LINE_STIPPLE
:
8021 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8023 case OPCODE_LINE_WIDTH
:
8024 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8026 case OPCODE_LIST_BASE
:
8027 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8029 case OPCODE_LOAD_IDENTITY
:
8030 CALL_LoadIdentity(ctx
->Exec
, ());
8032 case OPCODE_LOAD_MATRIX
:
8033 STATIC_ASSERT(sizeof(Node
) == sizeof(GLfloat
));
8034 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8036 case OPCODE_LOAD_NAME
:
8037 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8039 case OPCODE_LOGIC_OP
:
8040 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8044 GLenum target
= n
[1].e
;
8045 GLint ustride
= _mesa_evaluator_components(target
);
8046 GLint uorder
= n
[5].i
;
8047 GLfloat u1
= n
[2].f
;
8048 GLfloat u2
= n
[3].f
;
8049 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8050 (GLfloat
*) get_pointer(&n
[6])));
8055 GLenum target
= n
[1].e
;
8056 GLfloat u1
= n
[2].f
;
8057 GLfloat u2
= n
[3].f
;
8058 GLfloat v1
= n
[4].f
;
8059 GLfloat v2
= n
[5].f
;
8060 GLint ustride
= n
[6].i
;
8061 GLint vstride
= n
[7].i
;
8062 GLint uorder
= n
[8].i
;
8063 GLint vorder
= n
[9].i
;
8064 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8065 v1
, v2
, vstride
, vorder
,
8066 (GLfloat
*) get_pointer(&n
[10])));
8069 case OPCODE_MAPGRID1
:
8070 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8072 case OPCODE_MAPGRID2
:
8073 CALL_MapGrid2f(ctx
->Exec
,
8074 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8076 case OPCODE_MATRIX_MODE
:
8077 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8079 case OPCODE_MULT_MATRIX
:
8080 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8083 CALL_Ortho(ctx
->Exec
,
8084 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8086 case OPCODE_PASSTHROUGH
:
8087 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8089 case OPCODE_PIXEL_MAP
:
8090 CALL_PixelMapfv(ctx
->Exec
,
8091 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8093 case OPCODE_PIXEL_TRANSFER
:
8094 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8096 case OPCODE_PIXEL_ZOOM
:
8097 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8099 case OPCODE_POINT_SIZE
:
8100 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8102 case OPCODE_POINT_PARAMETERS
:
8108 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8111 case OPCODE_POLYGON_MODE
:
8112 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8114 case OPCODE_POLYGON_STIPPLE
:
8116 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8117 ctx
->Unpack
= ctx
->DefaultPacking
;
8118 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8119 ctx
->Unpack
= save
; /* restore */
8122 case OPCODE_POLYGON_OFFSET
:
8123 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8125 case OPCODE_POLYGON_OFFSET_CLAMP
:
8126 CALL_PolygonOffsetClampEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8128 case OPCODE_POP_ATTRIB
:
8129 CALL_PopAttrib(ctx
->Exec
, ());
8131 case OPCODE_POP_MATRIX
:
8132 CALL_PopMatrix(ctx
->Exec
, ());
8134 case OPCODE_POP_NAME
:
8135 CALL_PopName(ctx
->Exec
, ());
8137 case OPCODE_PRIORITIZE_TEXTURE
:
8138 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8140 case OPCODE_PUSH_ATTRIB
:
8141 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8143 case OPCODE_PUSH_MATRIX
:
8144 CALL_PushMatrix(ctx
->Exec
, ());
8146 case OPCODE_PUSH_NAME
:
8147 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8149 case OPCODE_RASTER_POS
:
8150 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8152 case OPCODE_READ_BUFFER
:
8153 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8156 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8159 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8161 case OPCODE_SCISSOR
:
8162 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8164 case OPCODE_SHADE_MODEL
:
8165 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8167 case OPCODE_PROVOKING_VERTEX
:
8168 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8170 case OPCODE_STENCIL_FUNC
:
8171 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8173 case OPCODE_STENCIL_MASK
:
8174 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8176 case OPCODE_STENCIL_OP
:
8177 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8179 case OPCODE_STENCIL_FUNC_SEPARATE
:
8180 CALL_StencilFuncSeparate(ctx
->Exec
,
8181 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8183 case OPCODE_STENCIL_MASK_SEPARATE
:
8184 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8186 case OPCODE_STENCIL_OP_SEPARATE
:
8187 CALL_StencilOpSeparate(ctx
->Exec
,
8188 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8197 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8207 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8210 case OPCODE_TEXPARAMETER
:
8217 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8220 case OPCODE_TEX_IMAGE1D
:
8222 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8223 ctx
->Unpack
= ctx
->DefaultPacking
;
8224 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8226 n
[3].i
, /* components */
8228 n
[5].e
, /* border */
8229 n
[6].e
, /* format */
8231 get_pointer(&n
[8])));
8232 ctx
->Unpack
= save
; /* restore */
8235 case OPCODE_TEX_IMAGE2D
:
8237 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8238 ctx
->Unpack
= ctx
->DefaultPacking
;
8239 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8241 n
[3].i
, /* components */
8243 n
[5].i
, /* height */
8244 n
[6].e
, /* border */
8245 n
[7].e
, /* format */
8247 get_pointer(&n
[9])));
8248 ctx
->Unpack
= save
; /* restore */
8251 case OPCODE_TEX_IMAGE3D
:
8253 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8254 ctx
->Unpack
= ctx
->DefaultPacking
;
8255 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8257 n
[3].i
, /* components */
8259 n
[5].i
, /* height */
8261 n
[7].e
, /* border */
8262 n
[8].e
, /* format */
8264 get_pointer(&n
[10])));
8265 ctx
->Unpack
= save
; /* restore */
8268 case OPCODE_TEX_SUB_IMAGE1D
:
8270 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8271 ctx
->Unpack
= ctx
->DefaultPacking
;
8272 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8274 n
[6].e
, get_pointer(&n
[7])));
8275 ctx
->Unpack
= save
; /* restore */
8278 case OPCODE_TEX_SUB_IMAGE2D
:
8280 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8281 ctx
->Unpack
= ctx
->DefaultPacking
;
8282 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8284 n
[6].i
, n
[7].e
, n
[8].e
,
8285 get_pointer(&n
[9])));
8286 ctx
->Unpack
= save
; /* restore */
8289 case OPCODE_TEX_SUB_IMAGE3D
:
8291 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8292 ctx
->Unpack
= ctx
->DefaultPacking
;
8293 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8294 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8295 n
[8].i
, n
[9].e
, n
[10].e
,
8296 get_pointer(&n
[11])));
8297 ctx
->Unpack
= save
; /* restore */
8300 case OPCODE_TRANSLATE
:
8301 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8303 case OPCODE_VIEWPORT
:
8304 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8305 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8307 case OPCODE_WINDOW_POS
:
8308 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8310 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8311 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8313 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8314 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8315 n
[4].i
, n
[5].i
, n
[6].i
,
8316 get_pointer(&n
[7])));
8318 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8319 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8320 n
[4].i
, n
[5].i
, n
[6].i
,
8321 n
[7].i
, get_pointer(&n
[8])));
8323 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8324 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8325 n
[4].i
, n
[5].i
, n
[6].i
,
8327 get_pointer(&n
[9])));
8329 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8330 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8331 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8333 get_pointer(&n
[7])));
8335 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8336 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8337 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8338 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8339 get_pointer(&n
[9])));
8341 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8342 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8343 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8344 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8346 get_pointer(&n
[11])));
8348 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8349 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8351 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8352 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8354 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8355 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8357 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8358 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8359 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8362 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8363 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8365 case OPCODE_DEPTH_BOUNDS_EXT
:
8366 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8368 case OPCODE_PROGRAM_STRING_ARB
:
8369 CALL_ProgramStringARB(ctx
->Exec
,
8370 (n
[1].e
, n
[2].e
, n
[3].i
,
8371 get_pointer(&n
[4])));
8373 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8374 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8378 case OPCODE_BEGIN_QUERY_ARB
:
8379 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8381 case OPCODE_END_QUERY_ARB
:
8382 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8384 case OPCODE_QUERY_COUNTER
:
8385 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8387 case OPCODE_BEGIN_QUERY_INDEXED
:
8388 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8390 case OPCODE_END_QUERY_INDEXED
:
8391 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8393 case OPCODE_DRAW_BUFFERS_ARB
:
8395 GLenum buffers
[MAX_DRAW_BUFFERS
];
8396 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8397 for (i
= 0; i
< count
; i
++)
8398 buffers
[i
] = n
[2 + i
].e
;
8399 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8402 case OPCODE_BLIT_FRAMEBUFFER
:
8403 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8404 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8407 case OPCODE_USE_PROGRAM
:
8408 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8410 case OPCODE_UNIFORM_1F
:
8411 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8413 case OPCODE_UNIFORM_2F
:
8414 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8416 case OPCODE_UNIFORM_3F
:
8417 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8419 case OPCODE_UNIFORM_4F
:
8420 CALL_Uniform4f(ctx
->Exec
,
8421 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8423 case OPCODE_UNIFORM_1FV
:
8424 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8426 case OPCODE_UNIFORM_2FV
:
8427 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8429 case OPCODE_UNIFORM_3FV
:
8430 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8432 case OPCODE_UNIFORM_4FV
:
8433 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8435 case OPCODE_UNIFORM_1I
:
8436 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8438 case OPCODE_UNIFORM_2I
:
8439 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8441 case OPCODE_UNIFORM_3I
:
8442 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8444 case OPCODE_UNIFORM_4I
:
8445 CALL_Uniform4i(ctx
->Exec
,
8446 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8448 case OPCODE_UNIFORM_1IV
:
8449 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8451 case OPCODE_UNIFORM_2IV
:
8452 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8454 case OPCODE_UNIFORM_3IV
:
8455 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8457 case OPCODE_UNIFORM_4IV
:
8458 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8460 case OPCODE_UNIFORM_1UI
:
8461 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8463 case OPCODE_UNIFORM_2UI
:
8464 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8466 case OPCODE_UNIFORM_3UI
:
8467 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8469 case OPCODE_UNIFORM_4UI
:
8470 /*CALL_Uniform4uiARB(ctx->Exec,
8471 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8474 case OPCODE_UNIFORM_1UIV
:
8475 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8476 get_pointer(&n[3])));*/
8478 case OPCODE_UNIFORM_2UIV
:
8479 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8480 get_pointer(&n[3])));*/
8482 case OPCODE_UNIFORM_3UIV
:
8483 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8484 get_pointer(&n[3])));*/
8486 case OPCODE_UNIFORM_4UIV
:
8487 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8488 get_pointer(&n[3])));*/
8490 case OPCODE_UNIFORM_MATRIX22
:
8491 CALL_UniformMatrix2fv(ctx
->Exec
,
8492 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8494 case OPCODE_UNIFORM_MATRIX33
:
8495 CALL_UniformMatrix3fv(ctx
->Exec
,
8496 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8498 case OPCODE_UNIFORM_MATRIX44
:
8499 CALL_UniformMatrix4fv(ctx
->Exec
,
8500 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8502 case OPCODE_UNIFORM_MATRIX23
:
8503 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8504 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8506 case OPCODE_UNIFORM_MATRIX32
:
8507 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8508 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8510 case OPCODE_UNIFORM_MATRIX24
:
8511 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8512 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8514 case OPCODE_UNIFORM_MATRIX42
:
8515 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8516 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8518 case OPCODE_UNIFORM_MATRIX34
:
8519 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8520 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8522 case OPCODE_UNIFORM_MATRIX43
:
8523 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8524 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8527 case OPCODE_USE_PROGRAM_STAGES
:
8528 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8530 case OPCODE_PROGRAM_UNIFORM_1F
:
8531 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8533 case OPCODE_PROGRAM_UNIFORM_2F
:
8534 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8536 case OPCODE_PROGRAM_UNIFORM_3F
:
8537 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8538 n
[3].f
, n
[4].f
, n
[5].f
));
8540 case OPCODE_PROGRAM_UNIFORM_4F
:
8541 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8542 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8544 case OPCODE_PROGRAM_UNIFORM_1FV
:
8545 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8546 get_pointer(&n
[4])));
8548 case OPCODE_PROGRAM_UNIFORM_2FV
:
8549 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8550 get_pointer(&n
[4])));
8552 case OPCODE_PROGRAM_UNIFORM_3FV
:
8553 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8554 get_pointer(&n
[4])));
8556 case OPCODE_PROGRAM_UNIFORM_4FV
:
8557 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8558 get_pointer(&n
[4])));
8560 case OPCODE_PROGRAM_UNIFORM_1I
:
8561 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8563 case OPCODE_PROGRAM_UNIFORM_2I
:
8564 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8566 case OPCODE_PROGRAM_UNIFORM_3I
:
8567 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8568 n
[3].i
, n
[4].i
, n
[5].i
));
8570 case OPCODE_PROGRAM_UNIFORM_4I
:
8571 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8572 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8574 case OPCODE_PROGRAM_UNIFORM_1IV
:
8575 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8576 get_pointer(&n
[4])));
8578 case OPCODE_PROGRAM_UNIFORM_2IV
:
8579 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8580 get_pointer(&n
[4])));
8582 case OPCODE_PROGRAM_UNIFORM_3IV
:
8583 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8584 get_pointer(&n
[4])));
8586 case OPCODE_PROGRAM_UNIFORM_4IV
:
8587 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8588 get_pointer(&n
[4])));
8590 case OPCODE_PROGRAM_UNIFORM_1UI
:
8591 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8593 case OPCODE_PROGRAM_UNIFORM_2UI
:
8594 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8597 case OPCODE_PROGRAM_UNIFORM_3UI
:
8598 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8599 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8601 case OPCODE_PROGRAM_UNIFORM_4UI
:
8602 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8604 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8606 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8607 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8608 get_pointer(&n
[4])));
8610 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8611 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8612 get_pointer(&n
[4])));
8614 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8615 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8616 get_pointer(&n
[4])));
8618 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8619 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8620 get_pointer(&n
[4])));
8622 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8623 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8624 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8625 get_pointer(&n
[5])));
8627 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8628 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8629 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8630 get_pointer(&n
[5])));
8632 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8633 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8634 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8635 get_pointer(&n
[5])));
8637 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8638 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8639 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8640 get_pointer(&n
[5])));
8642 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8643 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8644 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8645 get_pointer(&n
[5])));
8647 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8648 CALL_ProgramUniformMatrix3x4fv(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_MATRIX42F
:
8653 CALL_ProgramUniformMatrix4x2fv(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_MATRIX43F
:
8658 CALL_ProgramUniformMatrix4x3fv(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_MATRIX44F
:
8663 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8664 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8665 get_pointer(&n
[5])));
8668 case OPCODE_CLIP_CONTROL
:
8669 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8672 case OPCODE_CLAMP_COLOR
:
8673 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8676 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8677 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8679 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8680 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (n
[1].ui
, &n
[2].f
));
8682 case OPCODE_ATTR_1F_NV
:
8683 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8685 case OPCODE_ATTR_2F_NV
:
8686 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8688 case OPCODE_ATTR_3F_NV
:
8689 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8691 case OPCODE_ATTR_4F_NV
:
8692 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8694 case OPCODE_ATTR_1F_ARB
:
8695 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8697 case OPCODE_ATTR_2F_ARB
:
8698 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8700 case OPCODE_ATTR_3F_ARB
:
8701 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8703 case OPCODE_ATTR_4F_ARB
:
8704 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8706 case OPCODE_MATERIAL
:
8707 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8710 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8713 CALL_End(ctx
->Exec
, ());
8716 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8718 case OPCODE_EVAL_C1
:
8719 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8721 case OPCODE_EVAL_C2
:
8722 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8724 case OPCODE_EVAL_P1
:
8725 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8727 case OPCODE_EVAL_P2
:
8728 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8731 /* GL_EXT_texture_integer */
8732 case OPCODE_CLEARCOLOR_I
:
8733 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8735 case OPCODE_CLEARCOLOR_UI
:
8736 CALL_ClearColorIuiEXT(ctx
->Exec
,
8737 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8739 case OPCODE_TEXPARAMETER_I
:
8746 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8749 case OPCODE_TEXPARAMETER_UI
:
8752 params
[0] = n
[3].ui
;
8753 params
[1] = n
[4].ui
;
8754 params
[2] = n
[5].ui
;
8755 params
[3] = n
[6].ui
;
8756 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8760 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8761 /* GL_ARB_instanced_arrays */
8762 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8765 case OPCODE_TEXTURE_BARRIER_NV
:
8766 CALL_TextureBarrierNV(ctx
->Exec
, ());
8769 /* GL_EXT/ARB_transform_feedback */
8770 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8771 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8773 case OPCODE_END_TRANSFORM_FEEDBACK
:
8774 CALL_EndTransformFeedback(ctx
->Exec
, ());
8776 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8777 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8779 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8780 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8782 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8783 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8785 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8786 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8788 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8789 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8790 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8792 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8793 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8794 (n
[1].e
, n
[2].ui
, n
[3].si
));
8796 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8797 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8798 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8802 case OPCODE_BIND_SAMPLER
:
8803 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8805 case OPCODE_SAMPLER_PARAMETERIV
:
8812 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8815 case OPCODE_SAMPLER_PARAMETERFV
:
8822 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8825 case OPCODE_SAMPLER_PARAMETERIIV
:
8832 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8835 case OPCODE_SAMPLER_PARAMETERUIV
:
8838 params
[0] = n
[3].ui
;
8839 params
[1] = n
[4].ui
;
8840 params
[2] = n
[5].ui
;
8841 params
[3] = n
[6].ui
;
8842 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8846 /* GL_ARB_geometry_shader4 */
8847 case OPCODE_PROGRAM_PARAMETERI
:
8848 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8850 case OPCODE_FRAMEBUFFER_TEXTURE
:
8851 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8855 case OPCODE_WAIT_SYNC
:
8857 union uint64_pair p
;
8858 p
.uint32
[0] = n
[2].ui
;
8859 p
.uint32
[1] = n
[3].ui
;
8860 CALL_WaitSync(ctx
->Exec
,
8861 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8865 /* GL_NV_conditional_render */
8866 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8867 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8869 case OPCODE_END_CONDITIONAL_RENDER
:
8870 CALL_EndConditionalRender(ctx
->Exec
, ());
8873 case OPCODE_UNIFORM_BLOCK_BINDING
:
8874 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8877 case OPCODE_CONTINUE
:
8878 n
= (Node
*) get_pointer(&n
[1]);
8883 case OPCODE_END_OF_LIST
:
8889 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8891 _mesa_problem(ctx
, "%s", msg
);
8896 /* increment n to point to next compiled command */
8897 if (opcode
!= OPCODE_CONTINUE
) {
8898 n
+= InstSize
[opcode
];
8903 if (ctx
->Driver
.EndCallList
)
8904 ctx
->Driver
.EndCallList(ctx
);
8906 ctx
->ListState
.CallDepth
--;
8911 /**********************************************************************/
8913 /**********************************************************************/
8916 * Test if a display list number is valid.
8918 GLboolean GLAPIENTRY
8919 _mesa_IsList(GLuint list
)
8921 GET_CURRENT_CONTEXT(ctx
);
8922 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8923 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8924 return islist(ctx
, list
);
8929 * Delete a sequence of consecutive display lists.
8932 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8934 GET_CURRENT_CONTEXT(ctx
);
8936 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8937 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8940 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8943 for (i
= list
; i
< list
+ range
; i
++) {
8944 destroy_list(ctx
, i
);
8950 * Return a display list number, n, such that lists n through n+range-1
8954 _mesa_GenLists(GLsizei range
)
8956 GET_CURRENT_CONTEXT(ctx
);
8958 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8959 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8962 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8970 * Make this an atomic operation
8972 mtx_lock(&ctx
->Shared
->Mutex
);
8974 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8976 /* reserve the list IDs by with empty/dummy lists */
8978 for (i
= 0; i
< range
; i
++) {
8979 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8980 make_list(base
+ i
, 1));
8984 mtx_unlock(&ctx
->Shared
->Mutex
);
8991 * Begin a new display list.
8994 _mesa_NewList(GLuint name
, GLenum mode
)
8996 GET_CURRENT_CONTEXT(ctx
);
8998 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8999 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9001 if (MESA_VERBOSE
& VERBOSE_API
)
9002 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9003 _mesa_lookup_enum_by_nr(mode
));
9006 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9010 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9011 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9015 if (ctx
->ListState
.CurrentList
) {
9016 /* already compiling a display list */
9017 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9021 ctx
->CompileFlag
= GL_TRUE
;
9022 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9024 /* Reset accumulated list state */
9025 invalidate_saved_current_state( ctx
);
9027 /* Allocate new display list */
9028 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9029 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9030 ctx
->ListState
.CurrentPos
= 0;
9032 ctx
->Driver
.NewList(ctx
, name
, mode
);
9034 ctx
->CurrentDispatch
= ctx
->Save
;
9035 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9040 * End definition of current display list.
9045 GET_CURRENT_CONTEXT(ctx
);
9046 SAVE_FLUSH_VERTICES(ctx
);
9047 FLUSH_VERTICES(ctx
, 0);
9049 if (MESA_VERBOSE
& VERBOSE_API
)
9050 _mesa_debug(ctx
, "glEndList\n");
9052 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9053 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9054 "glEndList() called inside glBegin/End");
9057 /* Check that a list is under construction */
9058 if (!ctx
->ListState
.CurrentList
) {
9059 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9063 /* Call before emitting END_OF_LIST, in case the driver wants to
9064 * emit opcodes itself.
9066 ctx
->Driver
.EndList(ctx
);
9068 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9072 /* Destroy old list, if any */
9073 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9075 /* Install the new list */
9076 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9077 ctx
->ListState
.CurrentList
->Name
,
9078 ctx
->ListState
.CurrentList
);
9081 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9082 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9084 ctx
->ListState
.CurrentList
= NULL
;
9085 ctx
->ListState
.CurrentBlock
= NULL
;
9086 ctx
->ListState
.CurrentPos
= 0;
9087 ctx
->ExecuteFlag
= GL_TRUE
;
9088 ctx
->CompileFlag
= GL_FALSE
;
9090 ctx
->CurrentDispatch
= ctx
->Exec
;
9091 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9096 _mesa_CallList(GLuint list
)
9098 GLboolean save_compile_flag
;
9099 GET_CURRENT_CONTEXT(ctx
);
9100 FLUSH_CURRENT(ctx
, 0);
9102 if (MESA_VERBOSE
& VERBOSE_API
)
9103 _mesa_debug(ctx
, "glCallList %d\n", list
);
9106 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9111 mesa_print_display_list( list
);
9113 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9114 * execute the display list, and restore the CompileFlag.
9116 save_compile_flag
= ctx
->CompileFlag
;
9117 if (save_compile_flag
) {
9118 ctx
->CompileFlag
= GL_FALSE
;
9121 execute_list(ctx
, list
);
9122 ctx
->CompileFlag
= save_compile_flag
;
9124 /* also restore API function pointers to point to "save" versions */
9125 if (save_compile_flag
) {
9126 ctx
->CurrentDispatch
= ctx
->Save
;
9127 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9133 * Execute glCallLists: call multiple display lists.
9136 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9138 GET_CURRENT_CONTEXT(ctx
);
9140 GLboolean save_compile_flag
;
9142 if (MESA_VERBOSE
& VERBOSE_API
)
9143 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9147 case GL_UNSIGNED_BYTE
:
9149 case GL_UNSIGNED_SHORT
:
9151 case GL_UNSIGNED_INT
:
9159 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9163 /* Save the CompileFlag status, turn it off, execute display list,
9164 * and restore the CompileFlag.
9166 save_compile_flag
= ctx
->CompileFlag
;
9167 ctx
->CompileFlag
= GL_FALSE
;
9169 for (i
= 0; i
< n
; i
++) {
9170 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9171 execute_list(ctx
, list
);
9174 ctx
->CompileFlag
= save_compile_flag
;
9176 /* also restore API function pointers to point to "save" versions */
9177 if (save_compile_flag
) {
9178 ctx
->CurrentDispatch
= ctx
->Save
;
9179 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9185 * Set the offset added to list numbers in glCallLists.
9188 _mesa_ListBase(GLuint base
)
9190 GET_CURRENT_CONTEXT(ctx
);
9191 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9192 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9193 ctx
->List
.ListBase
= base
;
9197 * Setup the given dispatch table to point to Mesa's display list
9198 * building functions.
9200 * This does not include any of the tnl functions - they are
9201 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9205 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9207 struct _glapi_table
*table
= ctx
->Save
;
9208 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9210 /* Initially populate the dispatch table with the contents of the
9211 * normal-execution dispatch table. This lets us skip populating functions
9212 * that should be called directly instead of compiled into display lists.
9214 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9216 _mesa_loopback_init_api_table(ctx
, table
);
9219 vbo_initialize_save_dispatch(ctx
, table
);
9222 SET_Accum(table
, save_Accum
);
9223 SET_AlphaFunc(table
, save_AlphaFunc
);
9224 SET_Bitmap(table
, save_Bitmap
);
9225 SET_BlendFunc(table
, save_BlendFunc
);
9226 SET_CallList(table
, save_CallList
);
9227 SET_CallLists(table
, save_CallLists
);
9228 SET_Clear(table
, save_Clear
);
9229 SET_ClearAccum(table
, save_ClearAccum
);
9230 SET_ClearColor(table
, save_ClearColor
);
9231 SET_ClearDepth(table
, save_ClearDepth
);
9232 SET_ClearIndex(table
, save_ClearIndex
);
9233 SET_ClearStencil(table
, save_ClearStencil
);
9234 SET_ClipPlane(table
, save_ClipPlane
);
9235 SET_ColorMask(table
, save_ColorMask
);
9236 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9237 SET_ColorMaterial(table
, save_ColorMaterial
);
9238 SET_CopyPixels(table
, save_CopyPixels
);
9239 SET_CullFace(table
, save_CullFace
);
9240 SET_DepthFunc(table
, save_DepthFunc
);
9241 SET_DepthMask(table
, save_DepthMask
);
9242 SET_DepthRange(table
, save_DepthRange
);
9243 SET_Disable(table
, save_Disable
);
9244 SET_Disablei(table
, save_DisableIndexed
);
9245 SET_DrawBuffer(table
, save_DrawBuffer
);
9246 SET_DrawPixels(table
, save_DrawPixels
);
9247 SET_Enable(table
, save_Enable
);
9248 SET_Enablei(table
, save_EnableIndexed
);
9249 SET_EvalMesh1(table
, save_EvalMesh1
);
9250 SET_EvalMesh2(table
, save_EvalMesh2
);
9251 SET_Fogf(table
, save_Fogf
);
9252 SET_Fogfv(table
, save_Fogfv
);
9253 SET_Fogi(table
, save_Fogi
);
9254 SET_Fogiv(table
, save_Fogiv
);
9255 SET_FrontFace(table
, save_FrontFace
);
9256 SET_Frustum(table
, save_Frustum
);
9257 SET_Hint(table
, save_Hint
);
9258 SET_IndexMask(table
, save_IndexMask
);
9259 SET_InitNames(table
, save_InitNames
);
9260 SET_LightModelf(table
, save_LightModelf
);
9261 SET_LightModelfv(table
, save_LightModelfv
);
9262 SET_LightModeli(table
, save_LightModeli
);
9263 SET_LightModeliv(table
, save_LightModeliv
);
9264 SET_Lightf(table
, save_Lightf
);
9265 SET_Lightfv(table
, save_Lightfv
);
9266 SET_Lighti(table
, save_Lighti
);
9267 SET_Lightiv(table
, save_Lightiv
);
9268 SET_LineStipple(table
, save_LineStipple
);
9269 SET_LineWidth(table
, save_LineWidth
);
9270 SET_ListBase(table
, save_ListBase
);
9271 SET_LoadIdentity(table
, save_LoadIdentity
);
9272 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9273 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9274 SET_LoadName(table
, save_LoadName
);
9275 SET_LogicOp(table
, save_LogicOp
);
9276 SET_Map1d(table
, save_Map1d
);
9277 SET_Map1f(table
, save_Map1f
);
9278 SET_Map2d(table
, save_Map2d
);
9279 SET_Map2f(table
, save_Map2f
);
9280 SET_MapGrid1d(table
, save_MapGrid1d
);
9281 SET_MapGrid1f(table
, save_MapGrid1f
);
9282 SET_MapGrid2d(table
, save_MapGrid2d
);
9283 SET_MapGrid2f(table
, save_MapGrid2f
);
9284 SET_MatrixMode(table
, save_MatrixMode
);
9285 SET_MultMatrixd(table
, save_MultMatrixd
);
9286 SET_MultMatrixf(table
, save_MultMatrixf
);
9287 SET_NewList(table
, save_NewList
);
9288 SET_Ortho(table
, save_Ortho
);
9289 SET_PassThrough(table
, save_PassThrough
);
9290 SET_PixelMapfv(table
, save_PixelMapfv
);
9291 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9292 SET_PixelMapusv(table
, save_PixelMapusv
);
9293 SET_PixelTransferf(table
, save_PixelTransferf
);
9294 SET_PixelTransferi(table
, save_PixelTransferi
);
9295 SET_PixelZoom(table
, save_PixelZoom
);
9296 SET_PointSize(table
, save_PointSize
);
9297 SET_PolygonMode(table
, save_PolygonMode
);
9298 SET_PolygonOffset(table
, save_PolygonOffset
);
9299 SET_PolygonStipple(table
, save_PolygonStipple
);
9300 SET_PopAttrib(table
, save_PopAttrib
);
9301 SET_PopMatrix(table
, save_PopMatrix
);
9302 SET_PopName(table
, save_PopName
);
9303 SET_PushAttrib(table
, save_PushAttrib
);
9304 SET_PushMatrix(table
, save_PushMatrix
);
9305 SET_PushName(table
, save_PushName
);
9306 SET_RasterPos2d(table
, save_RasterPos2d
);
9307 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9308 SET_RasterPos2f(table
, save_RasterPos2f
);
9309 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9310 SET_RasterPos2i(table
, save_RasterPos2i
);
9311 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9312 SET_RasterPos2s(table
, save_RasterPos2s
);
9313 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9314 SET_RasterPos3d(table
, save_RasterPos3d
);
9315 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9316 SET_RasterPos3f(table
, save_RasterPos3f
);
9317 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9318 SET_RasterPos3i(table
, save_RasterPos3i
);
9319 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9320 SET_RasterPos3s(table
, save_RasterPos3s
);
9321 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9322 SET_RasterPos4d(table
, save_RasterPos4d
);
9323 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9324 SET_RasterPos4f(table
, save_RasterPos4f
);
9325 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9326 SET_RasterPos4i(table
, save_RasterPos4i
);
9327 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9328 SET_RasterPos4s(table
, save_RasterPos4s
);
9329 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9330 SET_ReadBuffer(table
, save_ReadBuffer
);
9331 SET_Rectf(table
, save_Rectf
);
9332 SET_Rotated(table
, save_Rotated
);
9333 SET_Rotatef(table
, save_Rotatef
);
9334 SET_Scaled(table
, save_Scaled
);
9335 SET_Scalef(table
, save_Scalef
);
9336 SET_Scissor(table
, save_Scissor
);
9337 SET_ShadeModel(table
, save_ShadeModel
);
9338 SET_StencilFunc(table
, save_StencilFunc
);
9339 SET_StencilMask(table
, save_StencilMask
);
9340 SET_StencilOp(table
, save_StencilOp
);
9341 SET_TexEnvf(table
, save_TexEnvf
);
9342 SET_TexEnvfv(table
, save_TexEnvfv
);
9343 SET_TexEnvi(table
, save_TexEnvi
);
9344 SET_TexEnviv(table
, save_TexEnviv
);
9345 SET_TexGend(table
, save_TexGend
);
9346 SET_TexGendv(table
, save_TexGendv
);
9347 SET_TexGenf(table
, save_TexGenf
);
9348 SET_TexGenfv(table
, save_TexGenfv
);
9349 SET_TexGeni(table
, save_TexGeni
);
9350 SET_TexGeniv(table
, save_TexGeniv
);
9351 SET_TexImage1D(table
, save_TexImage1D
);
9352 SET_TexImage2D(table
, save_TexImage2D
);
9353 SET_TexParameterf(table
, save_TexParameterf
);
9354 SET_TexParameterfv(table
, save_TexParameterfv
);
9355 SET_TexParameteri(table
, save_TexParameteri
);
9356 SET_TexParameteriv(table
, save_TexParameteriv
);
9357 SET_Translated(table
, save_Translated
);
9358 SET_Translatef(table
, save_Translatef
);
9359 SET_Viewport(table
, save_Viewport
);
9362 SET_BindTexture(table
, save_BindTexture
);
9363 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9364 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9365 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9366 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9367 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9368 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9369 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9372 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9373 SET_TexImage3D(table
, save_TexImage3D
);
9374 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9377 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9378 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9379 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9381 /* ATI_separate_stencil */
9382 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9384 /* GL_ARB_imaging */
9385 /* Not all are supported */
9386 SET_BlendColor(table
, save_BlendColor
);
9387 SET_BlendEquation(table
, save_BlendEquation
);
9389 /* 2. GL_EXT_blend_color */
9391 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9394 /* 3. GL_EXT_polygon_offset */
9395 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9397 /* 6. GL_EXT_texture3d */
9399 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9400 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9401 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9404 /* 37. GL_EXT_blend_minmax */
9406 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9409 /* 54. GL_EXT_point_parameters */
9410 SET_PointParameterf(table
, save_PointParameterfEXT
);
9411 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9413 /* 173. GL_EXT_blend_func_separate */
9414 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9416 /* 197. GL_MESA_window_pos */
9417 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9418 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9419 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9420 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9421 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9422 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9423 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9424 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9425 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9426 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9427 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9428 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9429 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9430 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9431 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9432 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9433 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9434 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9435 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9436 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9437 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9438 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9439 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9440 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9442 /* 233. GL_NV_vertex_program */
9443 /* The following commands DO NOT go into display lists:
9444 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9445 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9447 SET_BindProgramARB(table
, save_BindProgramNV
);
9449 /* 245. GL_ATI_fragment_shader */
9450 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9451 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9453 /* 262. GL_NV_point_sprite */
9454 SET_PointParameteri(table
, save_PointParameteriNV
);
9455 SET_PointParameteriv(table
, save_PointParameterivNV
);
9457 /* 268. GL_EXT_stencil_two_side */
9458 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9460 /* ???. GL_EXT_depth_bounds_test */
9461 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9463 /* ARB 1. GL_ARB_multitexture */
9464 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9466 /* ARB 3. GL_ARB_transpose_matrix */
9467 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9468 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9469 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9470 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9472 /* ARB 5. GL_ARB_multisample */
9473 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9475 /* ARB 12. GL_ARB_texture_compression */
9476 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9477 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9478 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9479 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9480 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9481 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9483 /* ARB 14. GL_ARB_point_parameters */
9484 /* aliased with EXT_point_parameters functions */
9486 /* ARB 25. GL_ARB_window_pos */
9487 /* aliased with MESA_window_pos functions */
9489 /* ARB 26. GL_ARB_vertex_program */
9490 /* ARB 27. GL_ARB_fragment_program */
9491 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9492 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9493 SET_BindProgramARB(table
, save_BindProgramNV
);
9494 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9495 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9496 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9497 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9498 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9499 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9500 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9501 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9503 SET_BeginQuery(table
, save_BeginQueryARB
);
9504 SET_EndQuery(table
, save_EndQueryARB
);
9505 SET_QueryCounter(table
, save_QueryCounter
);
9507 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9509 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9511 SET_UseProgram(table
, save_UseProgramObjectARB
);
9512 SET_Uniform1f(table
, save_Uniform1fARB
);
9513 SET_Uniform2f(table
, save_Uniform2fARB
);
9514 SET_Uniform3f(table
, save_Uniform3fARB
);
9515 SET_Uniform4f(table
, save_Uniform4fARB
);
9516 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9517 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9518 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9519 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9520 SET_Uniform1i(table
, save_Uniform1iARB
);
9521 SET_Uniform2i(table
, save_Uniform2iARB
);
9522 SET_Uniform3i(table
, save_Uniform3iARB
);
9523 SET_Uniform4i(table
, save_Uniform4iARB
);
9524 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9525 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9526 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9527 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9528 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9529 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9530 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9531 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9532 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9533 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9534 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9535 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9536 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9538 /* 299. GL_EXT_blend_equation_separate */
9539 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9541 /* GL_EXT_gpu_program_parameters */
9542 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9543 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9545 /* 364. GL_EXT_provoking_vertex */
9546 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9548 /* GL_EXT_texture_integer */
9549 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9550 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9551 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9552 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9554 /* GL_ARB_clip_control */
9555 SET_ClipControl(table
, save_ClipControl
);
9557 /* GL_ARB_color_buffer_float */
9558 SET_ClampColor(table
, save_ClampColorARB
);
9561 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9562 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9563 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9564 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9566 SET_Uniform1ui(table
, save_Uniform1ui
);
9567 SET_Uniform2ui(table
, save_Uniform2ui
);
9568 SET_Uniform3ui(table
, save_Uniform3ui
);
9569 SET_Uniform4ui(table
, save_Uniform4ui
);
9570 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9571 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9572 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9573 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9575 (void) save_Uniform1ui
;
9576 (void) save_Uniform2ui
;
9577 (void) save_Uniform3ui
;
9578 (void) save_Uniform4ui
;
9579 (void) save_Uniform1uiv
;
9580 (void) save_Uniform2uiv
;
9581 (void) save_Uniform3uiv
;
9582 (void) save_Uniform4uiv
;
9586 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9587 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9588 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9589 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9590 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9591 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9592 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9593 SET_DrawTransformFeedbackInstanced(table
,
9594 save_DrawTransformFeedbackInstanced
);
9595 SET_DrawTransformFeedbackStreamInstanced(table
,
9596 save_DrawTransformFeedbackStreamInstanced
);
9597 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9598 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9600 /* GL_ARB_instanced_arrays */
9601 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9603 /* GL_NV_texture_barrier */
9604 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9606 SET_BindSampler(table
, save_BindSampler
);
9607 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9608 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9609 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9610 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9611 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9612 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9614 /* GL_ARB_draw_buffer_blend */
9615 SET_BlendFunciARB(table
, save_BlendFunci
);
9616 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9617 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9618 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9621 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9622 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9624 /* GL_NV_conditional_render */
9625 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9626 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9629 SET_WaitSync(table
, save_WaitSync
);
9631 /* GL_ARB_uniform_buffer_object */
9632 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9634 /* GL_ARB_draw_instanced */
9635 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9636 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9638 /* GL_ARB_draw_elements_base_vertex */
9639 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9641 /* GL_ARB_base_instance */
9642 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9643 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9644 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9646 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9647 SET_UseProgramStages(table
, save_UseProgramStages
);
9648 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9649 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9650 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9651 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9652 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9653 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9654 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9655 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9656 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9657 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9658 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9659 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9660 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9661 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9662 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9663 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9664 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9665 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9666 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9667 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9668 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9669 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9670 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9671 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9672 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9673 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9674 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9675 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9676 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9677 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9678 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9679 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9680 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9682 /* GL_EXT_polygon_offset_clamp */
9683 SET_PolygonOffsetClampEXT(table
, save_PolygonOffsetClampEXT
);
9689 enum_string(GLenum k
)
9691 return _mesa_lookup_enum_by_nr(k
);
9696 * Print the commands in a display list. For debugging only.
9697 * TODO: many commands aren't handled yet.
9698 * \param fname filename to write display list to. If null, use stdout.
9700 static void GLAPIENTRY
9701 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9703 struct gl_display_list
*dlist
;
9709 f
= fopen(fname
, "w");
9714 if (!islist(ctx
, list
)) {
9715 fprintf(f
, "%u is not a display list ID\n", list
);
9719 dlist
= _mesa_lookup_list(ctx
, list
);
9725 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9727 done
= n
? GL_FALSE
: GL_TRUE
;
9729 const OpCode opcode
= n
[0].opcode
;
9731 if (is_ext_opcode(opcode
)) {
9732 n
+= ext_opcode_print(ctx
, n
, f
);
9737 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9739 case OPCODE_ACTIVE_TEXTURE
:
9740 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9743 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9744 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9745 get_pointer(&n
[7]));
9747 case OPCODE_CALL_LIST
:
9748 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9750 case OPCODE_CALL_LIST_OFFSET
:
9751 fprintf(f
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9752 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9754 case OPCODE_DISABLE
:
9755 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9758 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9760 case OPCODE_FRUSTUM
:
9761 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9762 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9764 case OPCODE_LINE_STIPPLE
:
9765 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9767 case OPCODE_LOAD_IDENTITY
:
9768 fprintf(f
, "LoadIdentity\n");
9770 case OPCODE_LOAD_MATRIX
:
9771 fprintf(f
, "LoadMatrix\n");
9772 fprintf(f
, " %8f %8f %8f %8f\n",
9773 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9774 fprintf(f
, " %8f %8f %8f %8f\n",
9775 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9776 fprintf(f
, " %8f %8f %8f %8f\n",
9777 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9778 fprintf(f
, " %8f %8f %8f %8f\n",
9779 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9781 case OPCODE_MULT_MATRIX
:
9782 fprintf(f
, "MultMatrix (or Rotate)\n");
9783 fprintf(f
, " %8f %8f %8f %8f\n",
9784 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9785 fprintf(f
, " %8f %8f %8f %8f\n",
9786 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9787 fprintf(f
, " %8f %8f %8f %8f\n",
9788 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9789 fprintf(f
, " %8f %8f %8f %8f\n",
9790 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9793 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9794 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9796 case OPCODE_POP_ATTRIB
:
9797 fprintf(f
, "PopAttrib\n");
9799 case OPCODE_POP_MATRIX
:
9800 fprintf(f
, "PopMatrix\n");
9802 case OPCODE_POP_NAME
:
9803 fprintf(f
, "PopName\n");
9805 case OPCODE_PUSH_ATTRIB
:
9806 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9808 case OPCODE_PUSH_MATRIX
:
9809 fprintf(f
, "PushMatrix\n");
9811 case OPCODE_PUSH_NAME
:
9812 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9814 case OPCODE_RASTER_POS
:
9815 fprintf(f
, "RasterPos %g %g %g %g\n",
9816 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9819 fprintf(f
, "Rotate %g %g %g %g\n",
9820 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9823 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9825 case OPCODE_TRANSLATE
:
9826 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9828 case OPCODE_BIND_TEXTURE
:
9829 fprintf(f
, "BindTexture %s %d\n",
9830 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9832 case OPCODE_SHADE_MODEL
:
9833 fprintf(f
, "ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9836 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9837 _mesa_lookup_enum_by_nr(n
[1].ui
),
9838 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9841 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9842 _mesa_lookup_enum_by_nr(n
[1].ui
),
9843 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9844 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9846 case OPCODE_MAPGRID1
:
9847 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9849 case OPCODE_MAPGRID2
:
9850 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9851 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9853 case OPCODE_EVALMESH1
:
9854 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9856 case OPCODE_EVALMESH2
:
9857 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9858 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9861 case OPCODE_ATTR_1F_NV
:
9862 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9864 case OPCODE_ATTR_2F_NV
:
9865 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9866 n
[1].i
, n
[2].f
, n
[3].f
);
9868 case OPCODE_ATTR_3F_NV
:
9869 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9870 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9872 case OPCODE_ATTR_4F_NV
:
9873 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9874 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9876 case OPCODE_ATTR_1F_ARB
:
9877 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9879 case OPCODE_ATTR_2F_ARB
:
9880 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9881 n
[1].i
, n
[2].f
, n
[3].f
);
9883 case OPCODE_ATTR_3F_ARB
:
9884 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9885 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9887 case OPCODE_ATTR_4F_ARB
:
9888 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9889 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9892 case OPCODE_MATERIAL
:
9893 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9894 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9897 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9900 fprintf(f
, "END\n");
9903 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9906 case OPCODE_EVAL_C1
:
9907 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9909 case OPCODE_EVAL_C2
:
9910 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9912 case OPCODE_EVAL_P1
:
9913 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9915 case OPCODE_EVAL_P2
:
9916 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9919 case OPCODE_PROVOKING_VERTEX
:
9920 fprintf(f
, "ProvokingVertex %s\n",
9921 _mesa_lookup_enum_by_nr(n
[1].ui
));
9925 * meta opcodes/commands
9928 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
9929 (const char *) get_pointer(&n
[2]));
9931 case OPCODE_CONTINUE
:
9932 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
9933 n
= (Node
*) get_pointer(&n
[1]);
9936 fprintf(f
, "NOP\n");
9938 case OPCODE_END_OF_LIST
:
9939 fprintf(f
, "END-LIST %u\n", list
);
9943 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9945 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9946 opcode
, (void *) n
);
9950 fprintf(f
, "command %d, %u operands\n", opcode
,
9954 /* increment n to point to next compiled command */
9955 if (opcode
!= OPCODE_CONTINUE
) {
9956 n
+= InstSize
[opcode
];
9969 * Clients may call this function to help debug display list problems.
9970 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9971 * changed, or break in the future without notice.
9974 mesa_print_display_list(GLuint list
)
9976 GET_CURRENT_CONTEXT(ctx
);
9977 print_list(ctx
, list
, NULL
);
9981 /**********************************************************************/
9982 /***** Initialization *****/
9983 /**********************************************************************/
9986 save_vtxfmt_init(GLvertexformat
* vfmt
)
9988 vfmt
->ArrayElement
= _ae_ArrayElement
;
9990 vfmt
->Begin
= save_Begin
;
9992 vfmt
->CallList
= save_CallList
;
9993 vfmt
->CallLists
= save_CallLists
;
9995 vfmt
->Color3f
= save_Color3f
;
9996 vfmt
->Color3fv
= save_Color3fv
;
9997 vfmt
->Color4f
= save_Color4f
;
9998 vfmt
->Color4fv
= save_Color4fv
;
9999 vfmt
->EdgeFlag
= save_EdgeFlag
;
10000 vfmt
->End
= save_End
;
10002 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10003 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10004 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10005 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10006 vfmt
->EvalPoint1
= save_EvalPoint1
;
10007 vfmt
->EvalPoint2
= save_EvalPoint2
;
10009 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10010 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10011 vfmt
->Indexf
= save_Indexf
;
10012 vfmt
->Indexfv
= save_Indexfv
;
10013 vfmt
->Materialfv
= save_Materialfv
;
10014 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10015 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10016 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10017 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10018 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10019 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10020 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10021 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10022 vfmt
->Normal3f
= save_Normal3f
;
10023 vfmt
->Normal3fv
= save_Normal3fv
;
10024 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10025 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10026 vfmt
->TexCoord1f
= save_TexCoord1f
;
10027 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10028 vfmt
->TexCoord2f
= save_TexCoord2f
;
10029 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10030 vfmt
->TexCoord3f
= save_TexCoord3f
;
10031 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10032 vfmt
->TexCoord4f
= save_TexCoord4f
;
10033 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10034 vfmt
->Vertex2f
= save_Vertex2f
;
10035 vfmt
->Vertex2fv
= save_Vertex2fv
;
10036 vfmt
->Vertex3f
= save_Vertex3f
;
10037 vfmt
->Vertex3fv
= save_Vertex3fv
;
10038 vfmt
->Vertex4f
= save_Vertex4f
;
10039 vfmt
->Vertex4fv
= save_Vertex4fv
;
10040 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10041 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10042 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10043 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10044 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10045 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10046 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10047 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10052 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10053 const GLvertexformat
*vfmt
)
10055 SET_CallList(disp
, vfmt
->CallList
);
10056 SET_CallLists(disp
, vfmt
->CallLists
);
10061 * Initialize display list state for given context.
10064 _mesa_init_display_list(struct gl_context
*ctx
)
10066 static GLboolean tableInitialized
= GL_FALSE
;
10068 /* zero-out the instruction size table, just once */
10069 if (!tableInitialized
) {
10070 memset(InstSize
, 0, sizeof(InstSize
));
10071 tableInitialized
= GL_TRUE
;
10074 /* extension info */
10075 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10078 ctx
->ListState
.CallDepth
= 0;
10079 ctx
->ExecuteFlag
= GL_TRUE
;
10080 ctx
->CompileFlag
= GL_FALSE
;
10081 ctx
->ListState
.CurrentBlock
= NULL
;
10082 ctx
->ListState
.CurrentPos
= 0;
10084 /* Display List group */
10085 ctx
->List
.ListBase
= 0;
10087 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10089 InstSize
[OPCODE_NOP
] = 1;
10094 _mesa_free_display_list_data(struct gl_context
*ctx
)
10096 free(ctx
->ListExt
);
10097 ctx
->ListExt
= NULL
;