2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
36 #include "api_loopback.h"
37 #include "api_validate.h"
38 #include "atifragshader.h"
40 #include "bufferobj.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
61 #include "texstorage.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
67 #include "math/m_matrix.h"
69 #include "main/dispatch.h"
76 * Other parts of Mesa (such as the VBO module) can plug into the display
77 * list system. This structure describes new display list instructions.
79 struct gl_list_instruction
82 void (*Execute
)( struct gl_context
*ctx
, void *data
);
83 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
84 void (*Print
)( struct gl_context
*ctx
, void *data
, FILE *f
);
88 #define MAX_DLIST_EXT_OPCODES 16
91 * Used by device drivers to hook new commands into display lists.
93 struct gl_list_extensions
95 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
104 * \param ctx GL context.
106 * Checks if dd_function_table::SaveNeedFlush is marked to flush
107 * stored (save) vertices, and calls
108 * dd_function_table::SaveFlushVertices if so.
110 #define SAVE_FLUSH_VERTICES(ctx) \
112 if (ctx->Driver.SaveNeedFlush) \
113 ctx->Driver.SaveFlushVertices(ctx); \
118 * Macro to assert that the API call was made outside the
119 * glBegin()/glEnd() pair, with return value.
121 * \param ctx GL context.
122 * \param retval value to return value in case the assertion fails.
124 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
126 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
127 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 * Macro to assert that the API call was made outside the
134 * glBegin()/glEnd() pair.
136 * \param ctx GL context.
138 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
140 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
141 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 * Macro to assert that the API call was made outside the
148 * glBegin()/glEnd() pair and flush the vertices.
150 * \param ctx GL context.
152 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
155 SAVE_FLUSH_VERTICES(ctx); \
159 * Macro to assert that the API call was made outside the
160 * glBegin()/glEnd() pair and flush the vertices, with return value.
162 * \param ctx GL context.
163 * \param retval value to return value in case the assertion fails.
165 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
167 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
168 SAVE_FLUSH_VERTICES(ctx); \
174 * Display list opcodes.
176 * The fact that these identifiers are assigned consecutive
177 * integer values starting at 0 is very important, see InstSize array usage)
181 OPCODE_INVALID
= -1, /* Force signed enum */
187 OPCODE_BLEND_EQUATION
,
188 OPCODE_BLEND_EQUATION_SEPARATE
,
189 OPCODE_BLEND_FUNC_SEPARATE
,
191 OPCODE_BLEND_EQUATION_I
,
192 OPCODE_BLEND_EQUATION_SEPARATE_I
,
194 OPCODE_BLEND_FUNC_SEPARATE_I
,
197 OPCODE_CALL_LIST_OFFSET
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COPY_TEX_IMAGE1D
,
214 OPCODE_COPY_TEX_IMAGE2D
,
215 OPCODE_COPY_TEX_SUB_IMAGE1D
,
216 OPCODE_COPY_TEX_SUB_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE3D
,
223 OPCODE_DISABLE_INDEXED
,
227 OPCODE_ENABLE_INDEXED
,
241 OPCODE_LOAD_IDENTITY
,
254 OPCODE_PIXEL_TRANSFER
,
257 OPCODE_POINT_PARAMETERS
,
259 OPCODE_POLYGON_STIPPLE
,
260 OPCODE_POLYGON_OFFSET
,
264 OPCODE_PRIORITIZE_TEXTURE
,
273 OPCODE_SELECT_TEXTURE_SGIS
,
274 OPCODE_SELECT_TEXTURE_COORD_SET
,
285 OPCODE_TEX_SUB_IMAGE1D
,
286 OPCODE_TEX_SUB_IMAGE2D
,
287 OPCODE_TEX_SUB_IMAGE3D
,
291 /* GL_ARB_multitexture */
292 OPCODE_ACTIVE_TEXTURE
,
293 /* GL_ARB_texture_compression */
294 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
300 /* GL_ARB_multisample */
301 OPCODE_SAMPLE_COVERAGE
,
302 /* GL_ARB_window_pos */
303 OPCODE_WINDOW_POS_ARB
,
304 /* GL_NV_fragment_program */
305 OPCODE_BIND_PROGRAM_NV
,
306 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
307 /* GL_EXT_stencil_two_side */
308 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
309 /* GL_EXT_depth_bounds_test */
310 OPCODE_DEPTH_BOUNDS_EXT
,
311 /* GL_ARB_vertex/fragment_program */
312 OPCODE_PROGRAM_STRING_ARB
,
313 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
314 /* GL_ARB_occlusion_query */
315 OPCODE_BEGIN_QUERY_ARB
,
316 OPCODE_END_QUERY_ARB
,
317 /* GL_ARB_draw_buffers */
318 OPCODE_DRAW_BUFFERS_ARB
,
319 /* GL_ATI_fragment_shader */
320 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
321 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
323 OPCODE_STENCIL_FUNC_SEPARATE
,
324 OPCODE_STENCIL_OP_SEPARATE
,
325 OPCODE_STENCIL_MASK_SEPARATE
,
327 /* GL_ARB_shader_objects */
345 OPCODE_UNIFORM_MATRIX22
,
346 OPCODE_UNIFORM_MATRIX33
,
347 OPCODE_UNIFORM_MATRIX44
,
348 OPCODE_UNIFORM_MATRIX23
,
349 OPCODE_UNIFORM_MATRIX32
,
350 OPCODE_UNIFORM_MATRIX24
,
351 OPCODE_UNIFORM_MATRIX42
,
352 OPCODE_UNIFORM_MATRIX34
,
353 OPCODE_UNIFORM_MATRIX43
,
365 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
366 OPCODE_USE_PROGRAM_STAGES
,
367 OPCODE_PROGRAM_UNIFORM_1F
,
368 OPCODE_PROGRAM_UNIFORM_2F
,
369 OPCODE_PROGRAM_UNIFORM_3F
,
370 OPCODE_PROGRAM_UNIFORM_4F
,
371 OPCODE_PROGRAM_UNIFORM_1FV
,
372 OPCODE_PROGRAM_UNIFORM_2FV
,
373 OPCODE_PROGRAM_UNIFORM_3FV
,
374 OPCODE_PROGRAM_UNIFORM_4FV
,
375 OPCODE_PROGRAM_UNIFORM_1I
,
376 OPCODE_PROGRAM_UNIFORM_2I
,
377 OPCODE_PROGRAM_UNIFORM_3I
,
378 OPCODE_PROGRAM_UNIFORM_4I
,
379 OPCODE_PROGRAM_UNIFORM_1IV
,
380 OPCODE_PROGRAM_UNIFORM_2IV
,
381 OPCODE_PROGRAM_UNIFORM_3IV
,
382 OPCODE_PROGRAM_UNIFORM_4IV
,
383 OPCODE_PROGRAM_UNIFORM_1UI
,
384 OPCODE_PROGRAM_UNIFORM_2UI
,
385 OPCODE_PROGRAM_UNIFORM_3UI
,
386 OPCODE_PROGRAM_UNIFORM_4UI
,
387 OPCODE_PROGRAM_UNIFORM_1UIV
,
388 OPCODE_PROGRAM_UNIFORM_2UIV
,
389 OPCODE_PROGRAM_UNIFORM_3UIV
,
390 OPCODE_PROGRAM_UNIFORM_4UIV
,
391 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
392 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
401 /* GL_ARB_clip_control */
404 /* GL_ARB_color_buffer_float */
407 /* GL_EXT_framebuffer_blit */
408 OPCODE_BLIT_FRAMEBUFFER
,
410 /* Vertex attributes -- fallback for when optimized display
411 * list build isn't active.
430 /* GL_EXT_provoking_vertex */
431 OPCODE_PROVOKING_VERTEX
,
433 /* GL_EXT_transform_feedback */
434 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
435 OPCODE_END_TRANSFORM_FEEDBACK
,
436 OPCODE_BIND_TRANSFORM_FEEDBACK
,
437 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
438 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
439 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
441 /* GL_EXT_texture_integer */
443 OPCODE_CLEARCOLOR_UI
,
444 OPCODE_TEXPARAMETER_I
,
445 OPCODE_TEXPARAMETER_UI
,
447 /* GL_ARB_instanced_arrays */
448 OPCODE_VERTEX_ATTRIB_DIVISOR
,
450 /* GL_NV_texture_barrier */
451 OPCODE_TEXTURE_BARRIER_NV
,
453 /* GL_ARB_sampler_object */
455 OPCODE_SAMPLER_PARAMETERIV
,
456 OPCODE_SAMPLER_PARAMETERFV
,
457 OPCODE_SAMPLER_PARAMETERIIV
,
458 OPCODE_SAMPLER_PARAMETERUIV
,
460 /* GL_ARB_geometry_shader4 */
461 OPCODE_PROGRAM_PARAMETERI
,
462 OPCODE_FRAMEBUFFER_TEXTURE
,
463 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
468 /* GL_NV_conditional_render */
469 OPCODE_BEGIN_CONDITIONAL_RENDER
,
470 OPCODE_END_CONDITIONAL_RENDER
,
472 /* ARB_timer_query */
473 OPCODE_QUERY_COUNTER
,
475 /* ARB_transform_feedback3 */
476 OPCODE_BEGIN_QUERY_INDEXED
,
477 OPCODE_END_QUERY_INDEXED
,
478 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
480 /* ARB_transform_feedback_instanced */
481 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
482 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
484 /* ARB_uniform_buffer_object */
485 OPCODE_UNIFORM_BLOCK_BINDING
,
487 /* The following three are meta instructions */
488 OPCODE_ERROR
, /* raise compiled-in error */
490 OPCODE_NOP
, /* No-op (used for 8-byte alignment */
500 * Display list instructions are stored as sequences of "nodes". Nodes
501 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
502 * are linked together with a pointer.
504 * Each instruction in the display list is stored as a sequence of
505 * contiguous nodes in memory.
506 * Each node is the union of a variety of data types.
508 * Note, all of these members should be 4 bytes in size or less for the
509 * sake of compact display lists. We store 8-byte pointers in a pair of
510 * these nodes using the save/get_pointer() functions below.
528 typedef union gl_dlist_node Node
;
531 /** How many 4-byte dwords to store a pointer */
532 #define POINTER_DWORDS (sizeof(void *) / 4)
534 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
535 * space for display lists. The following types and functions are
536 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
541 GLuint dwords
[POINTER_DWORDS
];
546 * Save a 4 or 8-byte pointer at dest (and dest+1).
549 save_pointer(union gl_dlist_node
*dest
, void *src
)
554 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
555 STATIC_ASSERT(sizeof(union gl_dlist_node
) == 4);
559 for (i
= 0; i
< POINTER_DWORDS
; i
++)
560 dest
[i
].ui
= p
.dwords
[i
];
565 * Retrieve a 4 or 8-byte pointer from node (node+1).
568 get_pointer(const union gl_dlist_node
*node
)
573 for (i
= 0; i
< POINTER_DWORDS
; i
++)
574 p
.dwords
[i
] = node
[i
].ui
;
581 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
582 * environment. In 64-bit env, sizeof(Node)==8 anyway.
592 * How many nodes to allocate at a time. Note that bulk vertex data
593 * from glBegin/glVertex/glEnd primitives will typically wind up in
594 * a VBO, and not directly in the display list itself.
596 #define BLOCK_SIZE 256
601 * Number of nodes of storage needed for each instruction.
602 * Sizes for dynamically allocated opcodes are stored in the context struct.
604 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
607 void mesa_print_display_list(GLuint list
);
611 * Allocate a gl_display_list object with an initial block of storage.
612 * \param count how many display list nodes/tokes to allocate
614 static struct gl_display_list
*
615 make_list(GLuint name
, GLuint count
)
617 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
619 dlist
->Head
= malloc(sizeof(Node
) * count
);
620 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
626 * Lookup function to just encapsulate casting.
628 struct gl_display_list
*
629 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
631 return (struct gl_display_list
*)
632 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
636 /** Is the given opcode an extension code? */
637 static inline GLboolean
638 is_ext_opcode(OpCode opcode
)
640 return (opcode
>= OPCODE_EXT_0
);
644 /** Destroy an extended opcode instruction */
646 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
648 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
650 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
651 step
= ctx
->ListExt
->Opcode
[i
].Size
;
656 /** Execute an extended opcode instruction */
658 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
660 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
662 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
663 step
= ctx
->ListExt
->Opcode
[i
].Size
;
668 /** Print an extended opcode instruction */
670 ext_opcode_print(struct gl_context
*ctx
, Node
*node
, FILE *f
)
672 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
674 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1], f
);
675 step
= ctx
->ListExt
->Opcode
[i
].Size
;
681 * Delete the named display list, but don't remove from hash table.
682 * \param dlist - display list pointer
685 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
690 n
= block
= dlist
->Head
;
692 done
= block
? GL_FALSE
: GL_TRUE
;
694 const OpCode opcode
= n
[0].opcode
;
696 /* check for extension opcodes first */
697 if (is_ext_opcode(opcode
)) {
698 n
+= ext_opcode_destroy(ctx
, n
);
702 /* for some commands, we need to free malloc'd memory */
704 free(get_pointer(&n
[6]));
705 n
+= InstSize
[n
[0].opcode
];
708 free(get_pointer(&n
[10]));
709 n
+= InstSize
[n
[0].opcode
];
711 case OPCODE_DRAW_PIXELS
:
712 free(get_pointer(&n
[5]));
713 n
+= InstSize
[n
[0].opcode
];
716 free(get_pointer(&n
[7]));
717 n
+= InstSize
[n
[0].opcode
];
719 case OPCODE_POLYGON_STIPPLE
:
720 free(get_pointer(&n
[1]));
721 n
+= InstSize
[n
[0].opcode
];
723 case OPCODE_TEX_IMAGE1D
:
724 free(get_pointer(&n
[8]));
725 n
+= InstSize
[n
[0].opcode
];
727 case OPCODE_TEX_IMAGE2D
:
728 free(get_pointer(&n
[9]));
729 n
+= InstSize
[n
[0].opcode
];
731 case OPCODE_TEX_IMAGE3D
:
732 free(get_pointer(&n
[10]));
733 n
+= InstSize
[n
[0].opcode
];
735 case OPCODE_TEX_SUB_IMAGE1D
:
736 free(get_pointer(&n
[7]));
737 n
+= InstSize
[n
[0].opcode
];
739 case OPCODE_TEX_SUB_IMAGE2D
:
740 free(get_pointer(&n
[9]));
741 n
+= InstSize
[n
[0].opcode
];
743 case OPCODE_TEX_SUB_IMAGE3D
:
744 free(get_pointer(&n
[11]));
745 n
+= InstSize
[n
[0].opcode
];
747 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
748 free(get_pointer(&n
[7]));
749 n
+= InstSize
[n
[0].opcode
];
751 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
752 free(get_pointer(&n
[8]));
753 n
+= InstSize
[n
[0].opcode
];
755 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
756 free(get_pointer(&n
[9]));
757 n
+= InstSize
[n
[0].opcode
];
759 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
760 free(get_pointer(&n
[7]));
761 n
+= InstSize
[n
[0].opcode
];
763 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
764 free(get_pointer(&n
[9]));
765 n
+= InstSize
[n
[0].opcode
];
767 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
768 free(get_pointer(&n
[11]));
769 n
+= InstSize
[n
[0].opcode
];
771 case OPCODE_PROGRAM_STRING_ARB
:
772 free(get_pointer(&n
[4])); /* program string */
773 n
+= InstSize
[n
[0].opcode
];
775 case OPCODE_UNIFORM_1FV
:
776 case OPCODE_UNIFORM_2FV
:
777 case OPCODE_UNIFORM_3FV
:
778 case OPCODE_UNIFORM_4FV
:
779 case OPCODE_UNIFORM_1IV
:
780 case OPCODE_UNIFORM_2IV
:
781 case OPCODE_UNIFORM_3IV
:
782 case OPCODE_UNIFORM_4IV
:
783 case OPCODE_UNIFORM_1UIV
:
784 case OPCODE_UNIFORM_2UIV
:
785 case OPCODE_UNIFORM_3UIV
:
786 case OPCODE_UNIFORM_4UIV
:
787 free(get_pointer(&n
[3]));
788 n
+= InstSize
[n
[0].opcode
];
790 case OPCODE_UNIFORM_MATRIX22
:
791 case OPCODE_UNIFORM_MATRIX33
:
792 case OPCODE_UNIFORM_MATRIX44
:
793 case OPCODE_UNIFORM_MATRIX24
:
794 case OPCODE_UNIFORM_MATRIX42
:
795 case OPCODE_UNIFORM_MATRIX23
:
796 case OPCODE_UNIFORM_MATRIX32
:
797 case OPCODE_UNIFORM_MATRIX34
:
798 case OPCODE_UNIFORM_MATRIX43
:
799 free(get_pointer(&n
[4]));
800 n
+= InstSize
[n
[0].opcode
];
802 case OPCODE_PROGRAM_UNIFORM_1FV
:
803 case OPCODE_PROGRAM_UNIFORM_2FV
:
804 case OPCODE_PROGRAM_UNIFORM_3FV
:
805 case OPCODE_PROGRAM_UNIFORM_4FV
:
806 case OPCODE_PROGRAM_UNIFORM_1IV
:
807 case OPCODE_PROGRAM_UNIFORM_2IV
:
808 case OPCODE_PROGRAM_UNIFORM_3IV
:
809 case OPCODE_PROGRAM_UNIFORM_4IV
:
810 case OPCODE_PROGRAM_UNIFORM_1UIV
:
811 case OPCODE_PROGRAM_UNIFORM_2UIV
:
812 case OPCODE_PROGRAM_UNIFORM_3UIV
:
813 case OPCODE_PROGRAM_UNIFORM_4UIV
:
814 free(get_pointer(&n
[4]));
815 n
+= InstSize
[n
[0].opcode
];
817 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
818 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
819 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
820 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
821 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
824 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
825 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
826 free(get_pointer(&n
[5]));
827 n
+= InstSize
[n
[0].opcode
];
829 case OPCODE_PIXEL_MAP
:
830 free(get_pointer(&n
[3]));
831 n
+= InstSize
[n
[0].opcode
];
834 case OPCODE_CONTINUE
:
835 n
= (Node
*) get_pointer(&n
[1]);
839 case OPCODE_END_OF_LIST
:
844 /* Most frequent case */
845 n
+= InstSize
[n
[0].opcode
];
857 * Destroy a display list and remove from hash table.
858 * \param list - display list number
861 destroy_list(struct gl_context
*ctx
, GLuint list
)
863 struct gl_display_list
*dlist
;
868 dlist
= _mesa_lookup_list(ctx
, list
);
872 _mesa_delete_list(ctx
, dlist
);
873 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
878 * Translate the nth element of list from <type> to GLint.
881 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
893 bptr
= (GLbyte
*) list
;
894 return (GLint
) bptr
[n
];
895 case GL_UNSIGNED_BYTE
:
896 ubptr
= (GLubyte
*) list
;
897 return (GLint
) ubptr
[n
];
899 sptr
= (GLshort
*) list
;
900 return (GLint
) sptr
[n
];
901 case GL_UNSIGNED_SHORT
:
902 usptr
= (GLushort
*) list
;
903 return (GLint
) usptr
[n
];
905 iptr
= (GLint
*) list
;
907 case GL_UNSIGNED_INT
:
908 uiptr
= (GLuint
*) list
;
909 return (GLint
) uiptr
[n
];
911 fptr
= (GLfloat
*) list
;
912 return (GLint
) FLOORF(fptr
[n
]);
914 ubptr
= ((GLubyte
*) list
) + 2 * n
;
915 return (GLint
) ubptr
[0] * 256
918 ubptr
= ((GLubyte
*) list
) + 3 * n
;
919 return (GLint
) ubptr
[0] * 65536
920 + (GLint
) ubptr
[1] * 256
923 ubptr
= ((GLubyte
*) list
) + 4 * n
;
924 return (GLint
) ubptr
[0] * 16777216
925 + (GLint
) ubptr
[1] * 65536
926 + (GLint
) ubptr
[2] * 256
935 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
936 * If width < 0 or height < 0 or format or type are invalid we'll just
937 * return NULL. We will not generate an error since OpenGL command
938 * arguments aren't error-checked until the command is actually executed
939 * (not when they're compiled).
940 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
943 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
944 GLsizei width
, GLsizei height
, GLsizei depth
,
945 GLenum format
, GLenum type
, const GLvoid
* pixels
,
946 const struct gl_pixelstore_attrib
*unpack
)
948 if (width
<= 0 || height
<= 0) {
952 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
953 /* bad format and/or type */
957 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
961 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
962 format
, type
, pixels
, unpack
);
963 if (pixels
&& !image
) {
964 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
968 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
969 depth
, format
, type
, INT_MAX
, pixels
)) {
970 const GLubyte
*map
, *src
;
974 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
975 GL_MAP_READ_BIT
, unpack
->BufferObj
,
978 /* unable to map src buffer! */
979 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
983 src
= ADD_POINTERS(map
, pixels
);
984 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
985 format
, type
, src
, unpack
);
987 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
990 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
996 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1001 /** Return copy of memory */
1003 memdup(const void *src
, GLsizei bytes
)
1005 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1007 memcpy(b
, src
, bytes
);
1013 * Allocate space for a display list instruction (opcode + payload space).
1014 * \param opcode the instruction opcode (OPCODE_* value)
1015 * \param bytes instruction payload size (not counting opcode)
1016 * \param align8 does the payload need to be 8-byte aligned?
1017 * This is only relevant in 64-bit environments.
1018 * \return pointer to allocated memory (the payload will be at pointer+1)
1021 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
, bool align8
)
1023 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1024 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1028 if (opcode
< OPCODE_EXT_0
) {
1029 if (InstSize
[opcode
] == 0) {
1030 /* save instruction size now */
1031 InstSize
[opcode
] = numNodes
;
1034 /* make sure instruction size agrees */
1035 ASSERT(numNodes
== InstSize
[opcode
]);
1039 if (sizeof(void *) > sizeof(Node
) && align8
1040 && ctx
->ListState
.CurrentPos
% 2 == 0) {
1041 /* The opcode would get placed at node[0] and the payload would start
1042 * at node[1]. But the payload needs to be at an even offset (8-byte
1051 if (ctx
->ListState
.CurrentPos
+ nopNode
+ numNodes
+ contNodes
1053 /* This block is full. Allocate a new block and chain to it */
1055 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1056 n
[0].opcode
= OPCODE_CONTINUE
;
1057 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1059 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1063 /* a fresh block should be 8-byte aligned on 64-bit systems */
1064 assert(((GLintptr
) newblock
) % sizeof(void *) == 0);
1066 save_pointer(&n
[1], newblock
);
1067 ctx
->ListState
.CurrentBlock
= newblock
;
1068 ctx
->ListState
.CurrentPos
= 0;
1070 /* Display list nodes are always 4 bytes. If we need 8-byte alignment
1071 * we have to insert a NOP so that the payload of the real opcode lands
1072 * on an even location:
1073 * node[0] = OPCODE_NOP
1074 * node[1] = OPCODE_x;
1075 * node[2] = start of payload
1077 nopNode
= sizeof(void *) > sizeof(Node
) && align8
;
1080 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1082 assert(ctx
->ListState
.CurrentPos
% 2 == 0); /* even value */
1083 n
[0].opcode
= OPCODE_NOP
;
1085 /* The "real" opcode will now be at an odd location and the payload
1086 * will be at an even location.
1089 ctx
->ListState
.CurrentPos
+= nopNode
+ numNodes
;
1091 n
[0].opcode
= opcode
;
1099 * Allocate space for a display list instruction. Used by callers outside
1100 * this file for things like VBO vertex data.
1102 * \param opcode the instruction opcode (OPCODE_* value)
1103 * \param bytes instruction size in bytes, not counting opcode.
1104 * \return pointer to the usable data area (not including the internal
1108 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1110 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, false);
1112 return n
+ 1; /* return pointer to payload area, after opcode */
1119 * Same as _mesa_dlist_alloc(), but return a pointer which is 8-byte
1120 * aligned in 64-bit environments, 4-byte aligned otherwise.
1123 _mesa_dlist_alloc_aligned(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1125 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
, true);
1127 return n
+ 1; /* return pointer to payload area, after opcode */
1134 * This function allows modules and drivers to get their own opcodes
1135 * for extending display list functionality.
1136 * \param ctx the rendering context
1137 * \param size number of bytes for storing the new display list command
1138 * \param execute function to execute the new display list command
1139 * \param destroy function to destroy the new display list command
1140 * \param print function to print the new display list command
1141 * \return the new opcode number or -1 if error
1144 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1146 void (*execute
) (struct gl_context
*, void *),
1147 void (*destroy
) (struct gl_context
*, void *),
1148 void (*print
) (struct gl_context
*, void *, FILE *))
1150 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1151 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1152 ctx
->ListExt
->Opcode
[i
].Size
=
1153 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1154 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1155 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1156 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1157 return i
+ OPCODE_EXT_0
;
1164 * Allocate space for a display list instruction. The space is basically
1165 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1166 * function parameter, node[2] is the second parameter, etc.
1168 * \param opcode one of OPCODE_x
1169 * \param nparams number of function parameters
1170 * \return pointer to start of instruction space
1172 static inline Node
*
1173 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1175 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
), false);
1180 * Called by EndList to try to reduce memory used for the list.
1183 trim_list(struct gl_context
*ctx
)
1185 /* If the list we're ending only has one allocated block of nodes/tokens
1186 * and its size isn't a full block size, realloc the block to use less
1187 * memory. This is important for apps that create many small display
1188 * lists and apps that use glXUseXFont (many lists each containing one
1190 * Note: we currently only trim display lists that allocated one block
1191 * of tokens. That hits the short list case which is what we're mainly
1192 * concerned with. Trimming longer lists would involve traversing the
1193 * linked list of blocks.
1195 struct gl_dlist_state
*list
= &ctx
->ListState
;
1197 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1198 (list
->CurrentPos
< BLOCK_SIZE
)) {
1199 /* There's only one block and it's not full, so realloc */
1200 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1201 list
->CurrentList
->Head
=
1202 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1203 if (!list
->CurrentBlock
) {
1204 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1212 * Display List compilation functions
1214 static void GLAPIENTRY
1215 save_Accum(GLenum op
, GLfloat value
)
1217 GET_CURRENT_CONTEXT(ctx
);
1219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1220 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1225 if (ctx
->ExecuteFlag
) {
1226 CALL_Accum(ctx
->Exec
, (op
, value
));
1231 static void GLAPIENTRY
1232 save_AlphaFunc(GLenum func
, GLclampf ref
)
1234 GET_CURRENT_CONTEXT(ctx
);
1236 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1237 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1240 n
[2].f
= (GLfloat
) ref
;
1242 if (ctx
->ExecuteFlag
) {
1243 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1248 static void GLAPIENTRY
1249 save_BindTexture(GLenum target
, GLuint texture
)
1251 GET_CURRENT_CONTEXT(ctx
);
1253 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1254 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1259 if (ctx
->ExecuteFlag
) {
1260 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1265 static void GLAPIENTRY
1266 save_Bitmap(GLsizei width
, GLsizei height
,
1267 GLfloat xorig
, GLfloat yorig
,
1268 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1270 GET_CURRENT_CONTEXT(ctx
);
1272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1273 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1275 n
[1].i
= (GLint
) width
;
1276 n
[2].i
= (GLint
) height
;
1282 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1283 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1285 if (ctx
->ExecuteFlag
) {
1286 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1287 xorig
, yorig
, xmove
, ymove
, pixels
));
1292 static void GLAPIENTRY
1293 save_BlendEquation(GLenum mode
)
1295 GET_CURRENT_CONTEXT(ctx
);
1297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1298 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1302 if (ctx
->ExecuteFlag
) {
1303 CALL_BlendEquation(ctx
->Exec
, (mode
));
1308 static void GLAPIENTRY
1309 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1311 GET_CURRENT_CONTEXT(ctx
);
1313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1314 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1319 if (ctx
->ExecuteFlag
) {
1320 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1325 static void GLAPIENTRY
1326 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1327 GLenum sfactorA
, GLenum dfactorA
)
1329 GET_CURRENT_CONTEXT(ctx
);
1331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1332 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1334 n
[1].e
= sfactorRGB
;
1335 n
[2].e
= dfactorRGB
;
1339 if (ctx
->ExecuteFlag
) {
1340 CALL_BlendFuncSeparate(ctx
->Exec
,
1341 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1346 static void GLAPIENTRY
1347 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1349 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1353 static void GLAPIENTRY
1354 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1356 GET_CURRENT_CONTEXT(ctx
);
1358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1359 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1366 if (ctx
->ExecuteFlag
) {
1367 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1371 /* GL_ARB_draw_buffers_blend */
1372 static void GLAPIENTRY
1373 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1374 GLenum sfactorA
, GLenum dfactorA
)
1376 GET_CURRENT_CONTEXT(ctx
);
1378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1379 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1382 n
[2].e
= sfactorRGB
;
1383 n
[3].e
= dfactorRGB
;
1387 if (ctx
->ExecuteFlag
) {
1388 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1389 sfactorA
, dfactorA
));
1393 /* GL_ARB_draw_buffers_blend */
1394 static void GLAPIENTRY
1395 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1397 GET_CURRENT_CONTEXT(ctx
);
1399 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1400 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1406 if (ctx
->ExecuteFlag
) {
1407 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1411 /* GL_ARB_draw_buffers_blend */
1412 static void GLAPIENTRY
1413 save_BlendEquationi(GLuint buf
, GLenum mode
)
1415 GET_CURRENT_CONTEXT(ctx
);
1417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1418 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1423 if (ctx
->ExecuteFlag
) {
1424 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1428 /* GL_ARB_draw_buffers_blend */
1429 static void GLAPIENTRY
1430 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1432 GET_CURRENT_CONTEXT(ctx
);
1434 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1435 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1441 if (ctx
->ExecuteFlag
) {
1442 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1447 /* GL_ARB_draw_instanced. */
1448 static void GLAPIENTRY
1449 save_DrawArraysInstancedARB(GLenum mode
,
1454 GET_CURRENT_CONTEXT(ctx
);
1455 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1456 "glDrawArraysInstanced() during display list compile");
1459 static void GLAPIENTRY
1460 save_DrawElementsInstancedARB(GLenum mode
,
1463 const GLvoid
*indices
,
1466 GET_CURRENT_CONTEXT(ctx
);
1467 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1468 "glDrawElementsInstanced() during display list compile");
1471 static void GLAPIENTRY
1472 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1475 const GLvoid
*indices
,
1479 GET_CURRENT_CONTEXT(ctx
);
1480 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1481 "glDrawElementsInstancedBaseVertex() during display list compile");
1484 /* GL_ARB_base_instance. */
1485 static void GLAPIENTRY
1486 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1490 GLuint baseinstance
)
1492 GET_CURRENT_CONTEXT(ctx
);
1493 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1494 "glDrawArraysInstancedBaseInstance() during display list compile");
1497 static void APIENTRY
1498 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1501 const void *indices
,
1503 GLuint baseinstance
)
1505 GET_CURRENT_CONTEXT(ctx
);
1506 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1507 "glDrawElementsInstancedBaseInstance() during display list compile");
1510 static void APIENTRY
1511 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1514 const void *indices
,
1517 GLuint baseinstance
)
1519 GET_CURRENT_CONTEXT(ctx
);
1520 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1521 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1526 * While building a display list we cache some OpenGL state.
1527 * Under some circumstances we need to invalidate that state (immediately
1528 * when we start compiling a list, or after glCallList(s)).
1531 invalidate_saved_current_state(struct gl_context
*ctx
)
1535 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1536 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1538 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1539 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1541 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1543 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1547 static void GLAPIENTRY
1548 save_CallList(GLuint list
)
1550 GET_CURRENT_CONTEXT(ctx
);
1552 SAVE_FLUSH_VERTICES(ctx
);
1554 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1559 /* After this, we don't know what state we're in. Invalidate all
1560 * cached information previously gathered:
1562 invalidate_saved_current_state( ctx
);
1564 if (ctx
->ExecuteFlag
) {
1565 _mesa_CallList(list
);
1570 static void GLAPIENTRY
1571 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1573 GET_CURRENT_CONTEXT(ctx
);
1575 GLboolean typeErrorFlag
;
1577 SAVE_FLUSH_VERTICES(ctx
);
1581 case GL_UNSIGNED_BYTE
:
1583 case GL_UNSIGNED_SHORT
:
1585 case GL_UNSIGNED_INT
:
1590 typeErrorFlag
= GL_FALSE
;
1593 typeErrorFlag
= GL_TRUE
;
1596 for (i
= 0; i
< num
; i
++) {
1597 GLint list
= translate_id(i
, type
, lists
);
1598 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1601 n
[2].b
= typeErrorFlag
;
1605 /* After this, we don't know what state we're in. Invalidate all
1606 * cached information previously gathered:
1608 invalidate_saved_current_state( ctx
);
1610 if (ctx
->ExecuteFlag
) {
1611 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1616 static void GLAPIENTRY
1617 save_Clear(GLbitfield mask
)
1619 GET_CURRENT_CONTEXT(ctx
);
1621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1622 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1626 if (ctx
->ExecuteFlag
) {
1627 CALL_Clear(ctx
->Exec
, (mask
));
1632 static void GLAPIENTRY
1633 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1635 GET_CURRENT_CONTEXT(ctx
);
1637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1638 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1641 n
[2].i
= drawbuffer
;
1643 if (buffer
== GL_COLOR
) {
1654 if (ctx
->ExecuteFlag
) {
1655 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1660 static void GLAPIENTRY
1661 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1663 GET_CURRENT_CONTEXT(ctx
);
1665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1666 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1669 n
[2].i
= drawbuffer
;
1671 if (buffer
== GL_COLOR
) {
1682 if (ctx
->ExecuteFlag
) {
1683 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1688 static void GLAPIENTRY
1689 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1691 GET_CURRENT_CONTEXT(ctx
);
1693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1694 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1697 n
[2].i
= drawbuffer
;
1699 if (buffer
== GL_COLOR
) {
1710 if (ctx
->ExecuteFlag
) {
1711 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1716 static void GLAPIENTRY
1717 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1718 GLfloat depth
, GLint stencil
)
1720 GET_CURRENT_CONTEXT(ctx
);
1722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1723 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1726 n
[2].i
= drawbuffer
;
1730 if (ctx
->ExecuteFlag
) {
1731 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1736 static void GLAPIENTRY
1737 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1739 GET_CURRENT_CONTEXT(ctx
);
1741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1742 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1749 if (ctx
->ExecuteFlag
) {
1750 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1755 static void GLAPIENTRY
1756 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1758 GET_CURRENT_CONTEXT(ctx
);
1760 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1761 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1768 if (ctx
->ExecuteFlag
) {
1769 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1774 static void GLAPIENTRY
1775 save_ClearDepth(GLclampd depth
)
1777 GET_CURRENT_CONTEXT(ctx
);
1779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1780 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1782 n
[1].f
= (GLfloat
) depth
;
1784 if (ctx
->ExecuteFlag
) {
1785 CALL_ClearDepth(ctx
->Exec
, (depth
));
1790 static void GLAPIENTRY
1791 save_ClearIndex(GLfloat c
)
1793 GET_CURRENT_CONTEXT(ctx
);
1795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1796 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1800 if (ctx
->ExecuteFlag
) {
1801 CALL_ClearIndex(ctx
->Exec
, (c
));
1806 static void GLAPIENTRY
1807 save_ClearStencil(GLint s
)
1809 GET_CURRENT_CONTEXT(ctx
);
1811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1812 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1816 if (ctx
->ExecuteFlag
) {
1817 CALL_ClearStencil(ctx
->Exec
, (s
));
1822 static void GLAPIENTRY
1823 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1825 GET_CURRENT_CONTEXT(ctx
);
1827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1828 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1831 n
[2].f
= (GLfloat
) equ
[0];
1832 n
[3].f
= (GLfloat
) equ
[1];
1833 n
[4].f
= (GLfloat
) equ
[2];
1834 n
[5].f
= (GLfloat
) equ
[3];
1836 if (ctx
->ExecuteFlag
) {
1837 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1843 static void GLAPIENTRY
1844 save_ColorMask(GLboolean red
, GLboolean green
,
1845 GLboolean blue
, GLboolean alpha
)
1847 GET_CURRENT_CONTEXT(ctx
);
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1850 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1857 if (ctx
->ExecuteFlag
) {
1858 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1863 static void GLAPIENTRY
1864 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1865 GLboolean blue
, GLboolean alpha
)
1867 GET_CURRENT_CONTEXT(ctx
);
1869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1870 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1878 if (ctx
->ExecuteFlag
) {
1879 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1884 static void GLAPIENTRY
1885 save_ColorMaterial(GLenum face
, GLenum mode
)
1887 GET_CURRENT_CONTEXT(ctx
);
1889 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1891 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1896 if (ctx
->ExecuteFlag
) {
1897 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1902 static void GLAPIENTRY
1903 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1905 GET_CURRENT_CONTEXT(ctx
);
1907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1908 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1912 n
[3].i
= (GLint
) width
;
1913 n
[4].i
= (GLint
) height
;
1916 if (ctx
->ExecuteFlag
) {
1917 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1923 static void GLAPIENTRY
1924 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1925 GLint x
, GLint y
, GLsizei width
, GLint border
)
1927 GET_CURRENT_CONTEXT(ctx
);
1929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1930 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1934 n
[3].e
= internalformat
;
1940 if (ctx
->ExecuteFlag
) {
1941 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1942 x
, y
, width
, border
));
1947 static void GLAPIENTRY
1948 save_CopyTexImage2D(GLenum target
, GLint level
,
1949 GLenum internalformat
,
1950 GLint x
, GLint y
, GLsizei width
,
1951 GLsizei height
, GLint border
)
1953 GET_CURRENT_CONTEXT(ctx
);
1955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1956 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1960 n
[3].e
= internalformat
;
1967 if (ctx
->ExecuteFlag
) {
1968 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1969 x
, y
, width
, height
, border
));
1975 static void GLAPIENTRY
1976 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1977 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1979 GET_CURRENT_CONTEXT(ctx
);
1981 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1982 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1991 if (ctx
->ExecuteFlag
) {
1992 CALL_CopyTexSubImage1D(ctx
->Exec
,
1993 (target
, level
, xoffset
, x
, y
, width
));
1998 static void GLAPIENTRY
1999 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2000 GLint xoffset
, GLint yoffset
,
2001 GLint x
, GLint y
, GLsizei width
, GLint height
)
2003 GET_CURRENT_CONTEXT(ctx
);
2005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2006 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2017 if (ctx
->ExecuteFlag
) {
2018 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2019 x
, y
, width
, height
));
2024 static void GLAPIENTRY
2025 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2026 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2027 GLint x
, GLint y
, GLsizei width
, GLint height
)
2029 GET_CURRENT_CONTEXT(ctx
);
2031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2032 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2044 if (ctx
->ExecuteFlag
) {
2045 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2046 xoffset
, yoffset
, zoffset
,
2047 x
, y
, width
, height
));
2052 static void GLAPIENTRY
2053 save_CullFace(GLenum mode
)
2055 GET_CURRENT_CONTEXT(ctx
);
2057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2058 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2062 if (ctx
->ExecuteFlag
) {
2063 CALL_CullFace(ctx
->Exec
, (mode
));
2068 static void GLAPIENTRY
2069 save_DepthFunc(GLenum func
)
2071 GET_CURRENT_CONTEXT(ctx
);
2073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2074 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2078 if (ctx
->ExecuteFlag
) {
2079 CALL_DepthFunc(ctx
->Exec
, (func
));
2084 static void GLAPIENTRY
2085 save_DepthMask(GLboolean mask
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2090 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2094 if (ctx
->ExecuteFlag
) {
2095 CALL_DepthMask(ctx
->Exec
, (mask
));
2100 static void GLAPIENTRY
2101 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2103 GET_CURRENT_CONTEXT(ctx
);
2105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2106 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2108 n
[1].f
= (GLfloat
) nearval
;
2109 n
[2].f
= (GLfloat
) farval
;
2111 if (ctx
->ExecuteFlag
) {
2112 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2117 static void GLAPIENTRY
2118 save_Disable(GLenum cap
)
2120 GET_CURRENT_CONTEXT(ctx
);
2122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2123 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2127 if (ctx
->ExecuteFlag
) {
2128 CALL_Disable(ctx
->Exec
, (cap
));
2133 static void GLAPIENTRY
2134 save_DisableIndexed(GLuint index
, GLenum cap
)
2136 GET_CURRENT_CONTEXT(ctx
);
2138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2139 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2144 if (ctx
->ExecuteFlag
) {
2145 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2150 static void GLAPIENTRY
2151 save_DrawBuffer(GLenum mode
)
2153 GET_CURRENT_CONTEXT(ctx
);
2155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2156 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2160 if (ctx
->ExecuteFlag
) {
2161 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2166 static void GLAPIENTRY
2167 save_DrawPixels(GLsizei width
, GLsizei height
,
2168 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2170 GET_CURRENT_CONTEXT(ctx
);
2173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2175 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2182 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2183 pixels
, &ctx
->Unpack
));
2185 if (ctx
->ExecuteFlag
) {
2186 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2192 static void GLAPIENTRY
2193 save_Enable(GLenum cap
)
2195 GET_CURRENT_CONTEXT(ctx
);
2197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2198 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2202 if (ctx
->ExecuteFlag
) {
2203 CALL_Enable(ctx
->Exec
, (cap
));
2209 static void GLAPIENTRY
2210 save_EnableIndexed(GLuint index
, GLenum cap
)
2212 GET_CURRENT_CONTEXT(ctx
);
2214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2215 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2220 if (ctx
->ExecuteFlag
) {
2221 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2227 static void GLAPIENTRY
2228 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2230 GET_CURRENT_CONTEXT(ctx
);
2232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2233 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2239 if (ctx
->ExecuteFlag
) {
2240 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2245 static void GLAPIENTRY
2246 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2248 GET_CURRENT_CONTEXT(ctx
);
2250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2251 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2259 if (ctx
->ExecuteFlag
) {
2260 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2267 static void GLAPIENTRY
2268 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2270 GET_CURRENT_CONTEXT(ctx
);
2272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2273 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2281 if (ctx
->ExecuteFlag
) {
2282 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2287 static void GLAPIENTRY
2288 save_Fogf(GLenum pname
, GLfloat param
)
2292 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2293 save_Fogfv(pname
, parray
);
2297 static void GLAPIENTRY
2298 save_Fogiv(GLenum pname
, const GLint
*params
)
2303 case GL_FOG_DENSITY
:
2307 p
[0] = (GLfloat
) *params
;
2313 p
[0] = INT_TO_FLOAT(params
[0]);
2314 p
[1] = INT_TO_FLOAT(params
[1]);
2315 p
[2] = INT_TO_FLOAT(params
[2]);
2316 p
[3] = INT_TO_FLOAT(params
[3]);
2319 /* Error will be caught later in gl_Fogfv */
2320 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2322 save_Fogfv(pname
, p
);
2326 static void GLAPIENTRY
2327 save_Fogi(GLenum pname
, GLint param
)
2331 parray
[1] = parray
[2] = parray
[3] = 0;
2332 save_Fogiv(pname
, parray
);
2336 static void GLAPIENTRY
2337 save_FrontFace(GLenum mode
)
2339 GET_CURRENT_CONTEXT(ctx
);
2341 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2342 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2346 if (ctx
->ExecuteFlag
) {
2347 CALL_FrontFace(ctx
->Exec
, (mode
));
2352 static void GLAPIENTRY
2353 save_Frustum(GLdouble left
, GLdouble right
,
2354 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2356 GET_CURRENT_CONTEXT(ctx
);
2358 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2359 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2361 n
[1].f
= (GLfloat
) left
;
2362 n
[2].f
= (GLfloat
) right
;
2363 n
[3].f
= (GLfloat
) bottom
;
2364 n
[4].f
= (GLfloat
) top
;
2365 n
[5].f
= (GLfloat
) nearval
;
2366 n
[6].f
= (GLfloat
) farval
;
2368 if (ctx
->ExecuteFlag
) {
2369 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2374 static void GLAPIENTRY
2375 save_Hint(GLenum target
, GLenum mode
)
2377 GET_CURRENT_CONTEXT(ctx
);
2379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2380 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2385 if (ctx
->ExecuteFlag
) {
2386 CALL_Hint(ctx
->Exec
, (target
, mode
));
2391 static void GLAPIENTRY
2392 save_IndexMask(GLuint mask
)
2394 GET_CURRENT_CONTEXT(ctx
);
2396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2397 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2401 if (ctx
->ExecuteFlag
) {
2402 CALL_IndexMask(ctx
->Exec
, (mask
));
2407 static void GLAPIENTRY
2408 save_InitNames(void)
2410 GET_CURRENT_CONTEXT(ctx
);
2411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2412 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_InitNames(ctx
->Exec
, ());
2419 static void GLAPIENTRY
2420 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2422 GET_CURRENT_CONTEXT(ctx
);
2424 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2425 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2443 case GL_SPOT_DIRECTION
:
2446 case GL_SPOT_EXPONENT
:
2449 case GL_SPOT_CUTOFF
:
2452 case GL_CONSTANT_ATTENUATION
:
2455 case GL_LINEAR_ATTENUATION
:
2458 case GL_QUADRATIC_ATTENUATION
:
2464 for (i
= 0; i
< nParams
; i
++) {
2465 n
[3 + i
].f
= params
[i
];
2468 if (ctx
->ExecuteFlag
) {
2469 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2474 static void GLAPIENTRY
2475 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2479 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2480 save_Lightfv(light
, pname
, parray
);
2484 static void GLAPIENTRY
2485 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2492 fparam
[0] = INT_TO_FLOAT(params
[0]);
2493 fparam
[1] = INT_TO_FLOAT(params
[1]);
2494 fparam
[2] = INT_TO_FLOAT(params
[2]);
2495 fparam
[3] = INT_TO_FLOAT(params
[3]);
2498 fparam
[0] = (GLfloat
) params
[0];
2499 fparam
[1] = (GLfloat
) params
[1];
2500 fparam
[2] = (GLfloat
) params
[2];
2501 fparam
[3] = (GLfloat
) params
[3];
2503 case GL_SPOT_DIRECTION
:
2504 fparam
[0] = (GLfloat
) params
[0];
2505 fparam
[1] = (GLfloat
) params
[1];
2506 fparam
[2] = (GLfloat
) params
[2];
2508 case GL_SPOT_EXPONENT
:
2509 case GL_SPOT_CUTOFF
:
2510 case GL_CONSTANT_ATTENUATION
:
2511 case GL_LINEAR_ATTENUATION
:
2512 case GL_QUADRATIC_ATTENUATION
:
2513 fparam
[0] = (GLfloat
) params
[0];
2516 /* error will be caught later in gl_Lightfv */
2519 save_Lightfv(light
, pname
, fparam
);
2523 static void GLAPIENTRY
2524 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2528 parray
[1] = parray
[2] = parray
[3] = 0;
2529 save_Lightiv(light
, pname
, parray
);
2533 static void GLAPIENTRY
2534 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2536 GET_CURRENT_CONTEXT(ctx
);
2538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2539 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2547 if (ctx
->ExecuteFlag
) {
2548 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2553 static void GLAPIENTRY
2554 save_LightModelf(GLenum pname
, GLfloat param
)
2558 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2559 save_LightModelfv(pname
, parray
);
2563 static void GLAPIENTRY
2564 save_LightModeliv(GLenum pname
, const GLint
*params
)
2568 case GL_LIGHT_MODEL_AMBIENT
:
2569 fparam
[0] = INT_TO_FLOAT(params
[0]);
2570 fparam
[1] = INT_TO_FLOAT(params
[1]);
2571 fparam
[2] = INT_TO_FLOAT(params
[2]);
2572 fparam
[3] = INT_TO_FLOAT(params
[3]);
2574 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2575 case GL_LIGHT_MODEL_TWO_SIDE
:
2576 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2577 fparam
[0] = (GLfloat
) params
[0];
2583 /* Error will be caught later in gl_LightModelfv */
2584 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2586 save_LightModelfv(pname
, fparam
);
2590 static void GLAPIENTRY
2591 save_LightModeli(GLenum pname
, GLint param
)
2595 parray
[1] = parray
[2] = parray
[3] = 0;
2596 save_LightModeliv(pname
, parray
);
2600 static void GLAPIENTRY
2601 save_LineStipple(GLint factor
, GLushort pattern
)
2603 GET_CURRENT_CONTEXT(ctx
);
2605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2606 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2611 if (ctx
->ExecuteFlag
) {
2612 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2617 static void GLAPIENTRY
2618 save_LineWidth(GLfloat width
)
2620 GET_CURRENT_CONTEXT(ctx
);
2622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2623 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2627 if (ctx
->ExecuteFlag
) {
2628 CALL_LineWidth(ctx
->Exec
, (width
));
2633 static void GLAPIENTRY
2634 save_ListBase(GLuint base
)
2636 GET_CURRENT_CONTEXT(ctx
);
2638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2639 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2643 if (ctx
->ExecuteFlag
) {
2644 CALL_ListBase(ctx
->Exec
, (base
));
2649 static void GLAPIENTRY
2650 save_LoadIdentity(void)
2652 GET_CURRENT_CONTEXT(ctx
);
2653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2654 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2655 if (ctx
->ExecuteFlag
) {
2656 CALL_LoadIdentity(ctx
->Exec
, ());
2661 static void GLAPIENTRY
2662 save_LoadMatrixf(const GLfloat
* m
)
2664 GET_CURRENT_CONTEXT(ctx
);
2666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2667 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2670 for (i
= 0; i
< 16; i
++) {
2674 if (ctx
->ExecuteFlag
) {
2675 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2680 static void GLAPIENTRY
2681 save_LoadMatrixd(const GLdouble
* m
)
2685 for (i
= 0; i
< 16; i
++) {
2686 f
[i
] = (GLfloat
) m
[i
];
2688 save_LoadMatrixf(f
);
2692 static void GLAPIENTRY
2693 save_LoadName(GLuint name
)
2695 GET_CURRENT_CONTEXT(ctx
);
2697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2698 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2702 if (ctx
->ExecuteFlag
) {
2703 CALL_LoadName(ctx
->Exec
, (name
));
2708 static void GLAPIENTRY
2709 save_LogicOp(GLenum opcode
)
2711 GET_CURRENT_CONTEXT(ctx
);
2713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2714 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2718 if (ctx
->ExecuteFlag
) {
2719 CALL_LogicOp(ctx
->Exec
, (opcode
));
2724 static void GLAPIENTRY
2725 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2726 GLint order
, const GLdouble
* points
)
2728 GET_CURRENT_CONTEXT(ctx
);
2730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2731 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2733 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2735 n
[2].f
= (GLfloat
) u1
;
2736 n
[3].f
= (GLfloat
) u2
;
2737 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2739 save_pointer(&n
[6], pnts
);
2741 if (ctx
->ExecuteFlag
) {
2742 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2746 static void GLAPIENTRY
2747 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2748 GLint order
, const GLfloat
* points
)
2750 GET_CURRENT_CONTEXT(ctx
);
2752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2753 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2755 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2759 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2761 save_pointer(&n
[6], pnts
);
2763 if (ctx
->ExecuteFlag
) {
2764 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2769 static void GLAPIENTRY
2770 save_Map2d(GLenum target
,
2771 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2772 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2773 const GLdouble
* points
)
2775 GET_CURRENT_CONTEXT(ctx
);
2777 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2778 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2780 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2781 vstride
, vorder
, points
);
2783 n
[2].f
= (GLfloat
) u1
;
2784 n
[3].f
= (GLfloat
) u2
;
2785 n
[4].f
= (GLfloat
) v1
;
2786 n
[5].f
= (GLfloat
) v2
;
2787 /* XXX verify these strides are correct */
2788 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2789 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2792 save_pointer(&n
[10], pnts
);
2794 if (ctx
->ExecuteFlag
) {
2795 CALL_Map2d(ctx
->Exec
, (target
,
2796 u1
, u2
, ustride
, uorder
,
2797 v1
, v2
, vstride
, vorder
, points
));
2802 static void GLAPIENTRY
2803 save_Map2f(GLenum target
,
2804 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2805 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2806 const GLfloat
* points
)
2808 GET_CURRENT_CONTEXT(ctx
);
2810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2811 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2813 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2814 vstride
, vorder
, points
);
2820 /* XXX verify these strides are correct */
2821 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2822 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2825 save_pointer(&n
[10], pnts
);
2827 if (ctx
->ExecuteFlag
) {
2828 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2829 v1
, v2
, vstride
, vorder
, points
));
2834 static void GLAPIENTRY
2835 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2837 GET_CURRENT_CONTEXT(ctx
);
2839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2840 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2846 if (ctx
->ExecuteFlag
) {
2847 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2852 static void GLAPIENTRY
2853 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2855 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2859 static void GLAPIENTRY
2860 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2861 GLint vn
, GLfloat v1
, GLfloat v2
)
2863 GET_CURRENT_CONTEXT(ctx
);
2865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2866 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2875 if (ctx
->ExecuteFlag
) {
2876 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2882 static void GLAPIENTRY
2883 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2884 GLint vn
, GLdouble v1
, GLdouble v2
)
2886 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2887 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2891 static void GLAPIENTRY
2892 save_MatrixMode(GLenum mode
)
2894 GET_CURRENT_CONTEXT(ctx
);
2896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2897 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2901 if (ctx
->ExecuteFlag
) {
2902 CALL_MatrixMode(ctx
->Exec
, (mode
));
2907 static void GLAPIENTRY
2908 save_MultMatrixf(const GLfloat
* m
)
2910 GET_CURRENT_CONTEXT(ctx
);
2912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2913 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2916 for (i
= 0; i
< 16; i
++) {
2920 if (ctx
->ExecuteFlag
) {
2921 CALL_MultMatrixf(ctx
->Exec
, (m
));
2926 static void GLAPIENTRY
2927 save_MultMatrixd(const GLdouble
* m
)
2931 for (i
= 0; i
< 16; i
++) {
2932 f
[i
] = (GLfloat
) m
[i
];
2934 save_MultMatrixf(f
);
2938 static void GLAPIENTRY
2939 save_NewList(GLuint name
, GLenum mode
)
2941 GET_CURRENT_CONTEXT(ctx
);
2942 /* It's an error to call this function while building a display list */
2943 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2950 static void GLAPIENTRY
2951 save_Ortho(GLdouble left
, GLdouble right
,
2952 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2954 GET_CURRENT_CONTEXT(ctx
);
2956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2957 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2959 n
[1].f
= (GLfloat
) left
;
2960 n
[2].f
= (GLfloat
) right
;
2961 n
[3].f
= (GLfloat
) bottom
;
2962 n
[4].f
= (GLfloat
) top
;
2963 n
[5].f
= (GLfloat
) nearval
;
2964 n
[6].f
= (GLfloat
) farval
;
2966 if (ctx
->ExecuteFlag
) {
2967 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2972 static void GLAPIENTRY
2973 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2975 GET_CURRENT_CONTEXT(ctx
);
2977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2978 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2982 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2984 if (ctx
->ExecuteFlag
) {
2985 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2990 static void GLAPIENTRY
2991 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2993 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2995 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2996 for (i
= 0; i
< mapsize
; i
++) {
2997 fvalues
[i
] = (GLfloat
) values
[i
];
3001 for (i
= 0; i
< mapsize
; i
++) {
3002 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3005 save_PixelMapfv(map
, mapsize
, fvalues
);
3009 static void GLAPIENTRY
3010 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3012 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3014 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3015 for (i
= 0; i
< mapsize
; i
++) {
3016 fvalues
[i
] = (GLfloat
) values
[i
];
3020 for (i
= 0; i
< mapsize
; i
++) {
3021 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3024 save_PixelMapfv(map
, mapsize
, fvalues
);
3028 static void GLAPIENTRY
3029 save_PixelTransferf(GLenum pname
, GLfloat param
)
3031 GET_CURRENT_CONTEXT(ctx
);
3033 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3034 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3039 if (ctx
->ExecuteFlag
) {
3040 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3045 static void GLAPIENTRY
3046 save_PixelTransferi(GLenum pname
, GLint param
)
3048 save_PixelTransferf(pname
, (GLfloat
) param
);
3052 static void GLAPIENTRY
3053 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3055 GET_CURRENT_CONTEXT(ctx
);
3057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3058 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3063 if (ctx
->ExecuteFlag
) {
3064 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3069 static void GLAPIENTRY
3070 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3072 GET_CURRENT_CONTEXT(ctx
);
3074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3075 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3082 if (ctx
->ExecuteFlag
) {
3083 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3088 static void GLAPIENTRY
3089 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3093 parray
[1] = parray
[2] = 0.0F
;
3094 save_PointParameterfvEXT(pname
, parray
);
3097 static void GLAPIENTRY
3098 save_PointParameteriNV(GLenum pname
, GLint param
)
3101 parray
[0] = (GLfloat
) param
;
3102 parray
[1] = parray
[2] = 0.0F
;
3103 save_PointParameterfvEXT(pname
, parray
);
3106 static void GLAPIENTRY
3107 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3110 parray
[0] = (GLfloat
) param
[0];
3111 parray
[1] = parray
[2] = 0.0F
;
3112 save_PointParameterfvEXT(pname
, parray
);
3116 static void GLAPIENTRY
3117 save_PointSize(GLfloat size
)
3119 GET_CURRENT_CONTEXT(ctx
);
3121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3122 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3126 if (ctx
->ExecuteFlag
) {
3127 CALL_PointSize(ctx
->Exec
, (size
));
3132 static void GLAPIENTRY
3133 save_PolygonMode(GLenum face
, GLenum mode
)
3135 GET_CURRENT_CONTEXT(ctx
);
3137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3138 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3143 if (ctx
->ExecuteFlag
) {
3144 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3149 static void GLAPIENTRY
3150 save_PolygonStipple(const GLubyte
* pattern
)
3152 GET_CURRENT_CONTEXT(ctx
);
3155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3157 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3160 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3161 pattern
, &ctx
->Unpack
));
3163 if (ctx
->ExecuteFlag
) {
3164 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3169 static void GLAPIENTRY
3170 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3172 GET_CURRENT_CONTEXT(ctx
);
3174 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3175 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3180 if (ctx
->ExecuteFlag
) {
3181 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3186 static void GLAPIENTRY
3187 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3189 GET_CURRENT_CONTEXT(ctx
);
3190 /* XXX mult by DepthMaxF here??? */
3191 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3195 static void GLAPIENTRY
3196 save_PopAttrib(void)
3198 GET_CURRENT_CONTEXT(ctx
);
3199 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3200 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3201 if (ctx
->ExecuteFlag
) {
3202 CALL_PopAttrib(ctx
->Exec
, ());
3207 static void GLAPIENTRY
3208 save_PopMatrix(void)
3210 GET_CURRENT_CONTEXT(ctx
);
3211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3212 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3213 if (ctx
->ExecuteFlag
) {
3214 CALL_PopMatrix(ctx
->Exec
, ());
3219 static void GLAPIENTRY
3222 GET_CURRENT_CONTEXT(ctx
);
3223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3224 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3225 if (ctx
->ExecuteFlag
) {
3226 CALL_PopName(ctx
->Exec
, ());
3231 static void GLAPIENTRY
3232 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3233 const GLclampf
* priorities
)
3235 GET_CURRENT_CONTEXT(ctx
);
3237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3239 for (i
= 0; i
< num
; i
++) {
3241 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3243 n
[1].ui
= textures
[i
];
3244 n
[2].f
= priorities
[i
];
3247 if (ctx
->ExecuteFlag
) {
3248 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3253 static void GLAPIENTRY
3254 save_PushAttrib(GLbitfield mask
)
3256 GET_CURRENT_CONTEXT(ctx
);
3258 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3259 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3263 if (ctx
->ExecuteFlag
) {
3264 CALL_PushAttrib(ctx
->Exec
, (mask
));
3269 static void GLAPIENTRY
3270 save_PushMatrix(void)
3272 GET_CURRENT_CONTEXT(ctx
);
3273 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3274 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3275 if (ctx
->ExecuteFlag
) {
3276 CALL_PushMatrix(ctx
->Exec
, ());
3281 static void GLAPIENTRY
3282 save_PushName(GLuint name
)
3284 GET_CURRENT_CONTEXT(ctx
);
3286 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3287 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3291 if (ctx
->ExecuteFlag
) {
3292 CALL_PushName(ctx
->Exec
, (name
));
3297 static void GLAPIENTRY
3298 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3300 GET_CURRENT_CONTEXT(ctx
);
3302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3303 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3310 if (ctx
->ExecuteFlag
) {
3311 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3315 static void GLAPIENTRY
3316 save_RasterPos2d(GLdouble x
, GLdouble y
)
3318 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3321 static void GLAPIENTRY
3322 save_RasterPos2f(GLfloat x
, GLfloat y
)
3324 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3327 static void GLAPIENTRY
3328 save_RasterPos2i(GLint x
, GLint y
)
3330 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3333 static void GLAPIENTRY
3334 save_RasterPos2s(GLshort x
, GLshort y
)
3336 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3339 static void GLAPIENTRY
3340 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3342 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3345 static void GLAPIENTRY
3346 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3348 save_RasterPos4f(x
, y
, z
, 1.0F
);
3351 static void GLAPIENTRY
3352 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3354 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3357 static void GLAPIENTRY
3358 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3360 save_RasterPos4f(x
, y
, z
, 1.0F
);
3363 static void GLAPIENTRY
3364 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3366 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3369 static void GLAPIENTRY
3370 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3372 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3375 static void GLAPIENTRY
3376 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3378 save_RasterPos4f(x
, y
, z
, w
);
3381 static void GLAPIENTRY
3382 save_RasterPos2dv(const GLdouble
* v
)
3384 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3387 static void GLAPIENTRY
3388 save_RasterPos2fv(const GLfloat
* v
)
3390 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3393 static void GLAPIENTRY
3394 save_RasterPos2iv(const GLint
* v
)
3396 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3399 static void GLAPIENTRY
3400 save_RasterPos2sv(const GLshort
* v
)
3402 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3405 static void GLAPIENTRY
3406 save_RasterPos3dv(const GLdouble
* v
)
3408 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3411 static void GLAPIENTRY
3412 save_RasterPos3fv(const GLfloat
* v
)
3414 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3417 static void GLAPIENTRY
3418 save_RasterPos3iv(const GLint
* v
)
3420 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3423 static void GLAPIENTRY
3424 save_RasterPos3sv(const GLshort
* v
)
3426 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3429 static void GLAPIENTRY
3430 save_RasterPos4dv(const GLdouble
* v
)
3432 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3433 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3436 static void GLAPIENTRY
3437 save_RasterPos4fv(const GLfloat
* v
)
3439 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3442 static void GLAPIENTRY
3443 save_RasterPos4iv(const GLint
* v
)
3445 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3446 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3449 static void GLAPIENTRY
3450 save_RasterPos4sv(const GLshort
* v
)
3452 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3456 static void GLAPIENTRY
3457 save_PassThrough(GLfloat token
)
3459 GET_CURRENT_CONTEXT(ctx
);
3461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3462 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3466 if (ctx
->ExecuteFlag
) {
3467 CALL_PassThrough(ctx
->Exec
, (token
));
3472 static void GLAPIENTRY
3473 save_ReadBuffer(GLenum mode
)
3475 GET_CURRENT_CONTEXT(ctx
);
3477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3478 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3482 if (ctx
->ExecuteFlag
) {
3483 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3488 static void GLAPIENTRY
3489 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3491 GET_CURRENT_CONTEXT(ctx
);
3493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3494 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3501 if (ctx
->ExecuteFlag
) {
3502 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3507 static void GLAPIENTRY
3508 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3510 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3514 static void GLAPIENTRY
3515 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3517 GET_CURRENT_CONTEXT(ctx
);
3519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3520 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3526 if (ctx
->ExecuteFlag
) {
3527 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3532 static void GLAPIENTRY
3533 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3535 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3539 static void GLAPIENTRY
3540 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3542 GET_CURRENT_CONTEXT(ctx
);
3544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3545 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3552 if (ctx
->ExecuteFlag
) {
3553 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3558 static void GLAPIENTRY
3559 save_ShadeModel(GLenum mode
)
3561 GET_CURRENT_CONTEXT(ctx
);
3563 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3565 if (ctx
->ExecuteFlag
) {
3566 CALL_ShadeModel(ctx
->Exec
, (mode
));
3569 /* Don't compile this call if it's a no-op.
3570 * By avoiding this state change we have a better chance of
3571 * coalescing subsequent drawing commands into one batch.
3573 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3576 SAVE_FLUSH_VERTICES(ctx
);
3578 ctx
->ListState
.Current
.ShadeModel
= mode
;
3580 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3587 static void GLAPIENTRY
3588 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3590 GET_CURRENT_CONTEXT(ctx
);
3592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3593 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3599 if (ctx
->ExecuteFlag
) {
3600 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3605 static void GLAPIENTRY
3606 save_StencilMask(GLuint mask
)
3608 GET_CURRENT_CONTEXT(ctx
);
3610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3611 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3615 if (ctx
->ExecuteFlag
) {
3616 CALL_StencilMask(ctx
->Exec
, (mask
));
3621 static void GLAPIENTRY
3622 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3624 GET_CURRENT_CONTEXT(ctx
);
3626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3627 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3633 if (ctx
->ExecuteFlag
) {
3634 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3639 static void GLAPIENTRY
3640 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3642 GET_CURRENT_CONTEXT(ctx
);
3644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3645 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3652 if (ctx
->ExecuteFlag
) {
3653 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3658 static void GLAPIENTRY
3659 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3662 GET_CURRENT_CONTEXT(ctx
);
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3666 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3674 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3681 if (ctx
->ExecuteFlag
) {
3682 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3683 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3688 static void GLAPIENTRY
3689 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3691 GET_CURRENT_CONTEXT(ctx
);
3693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3694 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3699 if (ctx
->ExecuteFlag
) {
3700 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3705 static void GLAPIENTRY
3706 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3708 GET_CURRENT_CONTEXT(ctx
);
3710 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3711 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3718 if (ctx
->ExecuteFlag
) {
3719 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3724 static void GLAPIENTRY
3725 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3727 GET_CURRENT_CONTEXT(ctx
);
3729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3730 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3734 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3742 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3745 if (ctx
->ExecuteFlag
) {
3746 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3751 static void GLAPIENTRY
3752 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3755 parray
[0] = (GLfloat
) param
;
3756 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3757 save_TexEnvfv(target
, pname
, parray
);
3761 static void GLAPIENTRY
3762 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3765 p
[0] = (GLfloat
) param
;
3766 p
[1] = p
[2] = p
[3] = 0.0F
;
3767 save_TexEnvfv(target
, pname
, p
);
3771 static void GLAPIENTRY
3772 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3775 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3776 p
[0] = INT_TO_FLOAT(param
[0]);
3777 p
[1] = INT_TO_FLOAT(param
[1]);
3778 p
[2] = INT_TO_FLOAT(param
[2]);
3779 p
[3] = INT_TO_FLOAT(param
[3]);
3782 p
[0] = (GLfloat
) param
[0];
3783 p
[1] = p
[2] = p
[3] = 0.0F
;
3785 save_TexEnvfv(target
, pname
, p
);
3789 static void GLAPIENTRY
3790 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3792 GET_CURRENT_CONTEXT(ctx
);
3794 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3795 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3804 if (ctx
->ExecuteFlag
) {
3805 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3810 static void GLAPIENTRY
3811 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3814 p
[0] = (GLfloat
) params
[0];
3815 p
[1] = (GLfloat
) params
[1];
3816 p
[2] = (GLfloat
) params
[2];
3817 p
[3] = (GLfloat
) params
[3];
3818 save_TexGenfv(coord
, pname
, p
);
3822 static void GLAPIENTRY
3823 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3826 parray
[0] = (GLfloat
) param
;
3827 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3828 save_TexGenfv(coord
, pname
, parray
);
3832 static void GLAPIENTRY
3833 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3836 p
[0] = (GLfloat
) params
[0];
3837 p
[1] = (GLfloat
) params
[1];
3838 p
[2] = (GLfloat
) params
[2];
3839 p
[3] = (GLfloat
) params
[3];
3840 save_TexGenfv(coord
, pname
, p
);
3844 static void GLAPIENTRY
3845 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3849 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3850 save_TexGenfv(coord
, pname
, parray
);
3854 static void GLAPIENTRY
3855 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3859 parray
[1] = parray
[2] = parray
[3] = 0;
3860 save_TexGeniv(coord
, pname
, parray
);
3864 static void GLAPIENTRY
3865 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3867 GET_CURRENT_CONTEXT(ctx
);
3869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3870 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3879 if (ctx
->ExecuteFlag
) {
3880 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3885 static void GLAPIENTRY
3886 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3890 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3891 save_TexParameterfv(target
, pname
, parray
);
3895 static void GLAPIENTRY
3896 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3899 fparam
[0] = (GLfloat
) param
;
3900 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3901 save_TexParameterfv(target
, pname
, fparam
);
3905 static void GLAPIENTRY
3906 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3909 fparam
[0] = (GLfloat
) params
[0];
3910 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3911 save_TexParameterfv(target
, pname
, fparam
);
3915 static void GLAPIENTRY
3916 save_TexImage1D(GLenum target
,
3917 GLint level
, GLint components
,
3918 GLsizei width
, GLint border
,
3919 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3921 GET_CURRENT_CONTEXT(ctx
);
3922 if (target
== GL_PROXY_TEXTURE_1D
) {
3923 /* don't compile, execute immediately */
3924 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3925 border
, format
, type
, pixels
));
3929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3930 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3934 n
[3].i
= components
;
3935 n
[4].i
= (GLint
) width
;
3940 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3941 pixels
, &ctx
->Unpack
));
3943 if (ctx
->ExecuteFlag
) {
3944 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3945 border
, format
, type
, pixels
));
3951 static void GLAPIENTRY
3952 save_TexImage2D(GLenum target
,
3953 GLint level
, GLint components
,
3954 GLsizei width
, GLsizei height
, GLint border
,
3955 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3957 GET_CURRENT_CONTEXT(ctx
);
3958 if (target
== GL_PROXY_TEXTURE_2D
) {
3959 /* don't compile, execute immediately */
3960 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3961 height
, border
, format
, type
, pixels
));
3965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3966 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3970 n
[3].i
= components
;
3971 n
[4].i
= (GLint
) width
;
3972 n
[5].i
= (GLint
) height
;
3977 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3978 pixels
, &ctx
->Unpack
));
3980 if (ctx
->ExecuteFlag
) {
3981 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3982 height
, border
, format
, type
, pixels
));
3988 static void GLAPIENTRY
3989 save_TexImage3D(GLenum target
,
3990 GLint level
, GLint internalFormat
,
3991 GLsizei width
, GLsizei height
, GLsizei depth
,
3993 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3995 GET_CURRENT_CONTEXT(ctx
);
3996 if (target
== GL_PROXY_TEXTURE_3D
) {
3997 /* don't compile, execute immediately */
3998 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3999 height
, depth
, border
, format
, type
,
4004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4005 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
4009 n
[3].i
= (GLint
) internalFormat
;
4010 n
[4].i
= (GLint
) width
;
4011 n
[5].i
= (GLint
) height
;
4012 n
[6].i
= (GLint
) depth
;
4016 save_pointer(&n
[10],
4017 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4018 pixels
, &ctx
->Unpack
));
4020 if (ctx
->ExecuteFlag
) {
4021 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4022 height
, depth
, border
, format
, type
,
4029 static void GLAPIENTRY
4030 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4031 GLsizei width
, GLenum format
, GLenum type
,
4032 const GLvoid
* pixels
)
4034 GET_CURRENT_CONTEXT(ctx
);
4037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4039 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
4044 n
[4].i
= (GLint
) width
;
4048 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4049 pixels
, &ctx
->Unpack
));
4051 if (ctx
->ExecuteFlag
) {
4052 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4053 format
, type
, pixels
));
4058 static void GLAPIENTRY
4059 save_TexSubImage2D(GLenum target
, GLint level
,
4060 GLint xoffset
, GLint yoffset
,
4061 GLsizei width
, GLsizei height
,
4062 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4064 GET_CURRENT_CONTEXT(ctx
);
4067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4069 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4075 n
[5].i
= (GLint
) width
;
4076 n
[6].i
= (GLint
) height
;
4080 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4081 pixels
, &ctx
->Unpack
));
4083 if (ctx
->ExecuteFlag
) {
4084 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4085 width
, height
, format
, type
, pixels
));
4090 static void GLAPIENTRY
4091 save_TexSubImage3D(GLenum target
, GLint level
,
4092 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4093 GLsizei width
, GLsizei height
, GLsizei depth
,
4094 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4096 GET_CURRENT_CONTEXT(ctx
);
4099 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4101 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4108 n
[6].i
= (GLint
) width
;
4109 n
[7].i
= (GLint
) height
;
4110 n
[8].i
= (GLint
) depth
;
4113 save_pointer(&n
[11],
4114 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4115 pixels
, &ctx
->Unpack
));
4117 if (ctx
->ExecuteFlag
) {
4118 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4119 xoffset
, yoffset
, zoffset
,
4120 width
, height
, depth
, format
, type
,
4126 static void GLAPIENTRY
4127 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4129 GET_CURRENT_CONTEXT(ctx
);
4131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4132 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4138 if (ctx
->ExecuteFlag
) {
4139 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4144 static void GLAPIENTRY
4145 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4147 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4152 static void GLAPIENTRY
4153 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4155 GET_CURRENT_CONTEXT(ctx
);
4157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4158 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4162 n
[3].i
= (GLint
) width
;
4163 n
[4].i
= (GLint
) height
;
4165 if (ctx
->ExecuteFlag
) {
4166 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4171 static void GLAPIENTRY
4172 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4174 GET_CURRENT_CONTEXT(ctx
);
4176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4177 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4184 if (ctx
->ExecuteFlag
) {
4185 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4189 static void GLAPIENTRY
4190 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4192 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4195 static void GLAPIENTRY
4196 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4198 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4201 static void GLAPIENTRY
4202 save_WindowPos2iMESA(GLint x
, GLint y
)
4204 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4207 static void GLAPIENTRY
4208 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4210 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4213 static void GLAPIENTRY
4214 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4216 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4219 static void GLAPIENTRY
4220 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4222 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4225 static void GLAPIENTRY
4226 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4228 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4231 static void GLAPIENTRY
4232 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4234 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4237 static void GLAPIENTRY
4238 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4240 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4243 static void GLAPIENTRY
4244 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4246 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4249 static void GLAPIENTRY
4250 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4252 save_WindowPos4fMESA(x
, y
, z
, w
);
4255 static void GLAPIENTRY
4256 save_WindowPos2dvMESA(const GLdouble
* v
)
4258 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4261 static void GLAPIENTRY
4262 save_WindowPos2fvMESA(const GLfloat
* v
)
4264 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4267 static void GLAPIENTRY
4268 save_WindowPos2ivMESA(const GLint
* v
)
4270 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4273 static void GLAPIENTRY
4274 save_WindowPos2svMESA(const GLshort
* v
)
4276 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4279 static void GLAPIENTRY
4280 save_WindowPos3dvMESA(const GLdouble
* v
)
4282 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4285 static void GLAPIENTRY
4286 save_WindowPos3fvMESA(const GLfloat
* v
)
4288 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4291 static void GLAPIENTRY
4292 save_WindowPos3ivMESA(const GLint
* v
)
4294 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4297 static void GLAPIENTRY
4298 save_WindowPos3svMESA(const GLshort
* v
)
4300 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4303 static void GLAPIENTRY
4304 save_WindowPos4dvMESA(const GLdouble
* v
)
4306 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4307 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4310 static void GLAPIENTRY
4311 save_WindowPos4fvMESA(const GLfloat
* v
)
4313 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4316 static void GLAPIENTRY
4317 save_WindowPos4ivMESA(const GLint
* v
)
4319 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4320 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4323 static void GLAPIENTRY
4324 save_WindowPos4svMESA(const GLshort
* v
)
4326 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4331 /* GL_ARB_multitexture */
4332 static void GLAPIENTRY
4333 save_ActiveTextureARB(GLenum target
)
4335 GET_CURRENT_CONTEXT(ctx
);
4337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4338 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4342 if (ctx
->ExecuteFlag
) {
4343 CALL_ActiveTexture(ctx
->Exec
, (target
));
4348 /* GL_ARB_transpose_matrix */
4350 static void GLAPIENTRY
4351 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4354 _math_transposefd(tm
, m
);
4355 save_LoadMatrixf(tm
);
4359 static void GLAPIENTRY
4360 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4363 _math_transposef(tm
, m
);
4364 save_LoadMatrixf(tm
);
4368 static void GLAPIENTRY
4369 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4372 _math_transposefd(tm
, m
);
4373 save_MultMatrixf(tm
);
4377 static void GLAPIENTRY
4378 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4381 _math_transposef(tm
, m
);
4382 save_MultMatrixf(tm
);
4385 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4387 GET_CURRENT_CONTEXT(ctx
);
4393 image
= malloc(size
);
4395 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4398 memcpy(image
, data
, size
);
4404 /* GL_ARB_texture_compression */
4405 static void GLAPIENTRY
4406 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4407 GLenum internalFormat
, GLsizei width
,
4408 GLint border
, GLsizei imageSize
,
4409 const GLvoid
* data
)
4411 GET_CURRENT_CONTEXT(ctx
);
4412 if (target
== GL_PROXY_TEXTURE_1D
) {
4413 /* don't compile, execute immediately */
4414 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4415 width
, border
, imageSize
,
4420 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4422 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4423 6 + POINTER_DWORDS
);
4427 n
[3].e
= internalFormat
;
4428 n
[4].i
= (GLint
) width
;
4432 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4434 if (ctx
->ExecuteFlag
) {
4435 CALL_CompressedTexImage1D(ctx
->Exec
,
4436 (target
, level
, internalFormat
, width
,
4437 border
, imageSize
, data
));
4443 static void GLAPIENTRY
4444 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4445 GLenum internalFormat
, GLsizei width
,
4446 GLsizei height
, GLint border
, GLsizei imageSize
,
4447 const GLvoid
* data
)
4449 GET_CURRENT_CONTEXT(ctx
);
4450 if (target
== GL_PROXY_TEXTURE_2D
) {
4451 /* don't compile, execute immediately */
4452 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4453 width
, height
, border
,
4458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4460 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4461 7 + POINTER_DWORDS
);
4465 n
[3].e
= internalFormat
;
4466 n
[4].i
= (GLint
) width
;
4467 n
[5].i
= (GLint
) height
;
4471 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4473 if (ctx
->ExecuteFlag
) {
4474 CALL_CompressedTexImage2D(ctx
->Exec
,
4475 (target
, level
, internalFormat
, width
,
4476 height
, border
, imageSize
, data
));
4482 static void GLAPIENTRY
4483 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4484 GLenum internalFormat
, GLsizei width
,
4485 GLsizei height
, GLsizei depth
, GLint border
,
4486 GLsizei imageSize
, const GLvoid
* data
)
4488 GET_CURRENT_CONTEXT(ctx
);
4489 if (target
== GL_PROXY_TEXTURE_3D
) {
4490 /* don't compile, execute immediately */
4491 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4492 width
, height
, depth
, border
,
4497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4499 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4500 8 + POINTER_DWORDS
);
4504 n
[3].e
= internalFormat
;
4505 n
[4].i
= (GLint
) width
;
4506 n
[5].i
= (GLint
) height
;
4507 n
[6].i
= (GLint
) depth
;
4511 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4513 if (ctx
->ExecuteFlag
) {
4514 CALL_CompressedTexImage3D(ctx
->Exec
,
4515 (target
, level
, internalFormat
, width
,
4516 height
, depth
, border
, imageSize
,
4523 static void GLAPIENTRY
4524 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4525 GLsizei width
, GLenum format
,
4526 GLsizei imageSize
, const GLvoid
* data
)
4529 GET_CURRENT_CONTEXT(ctx
);
4530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4532 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4533 6 + POINTER_DWORDS
);
4538 n
[4].i
= (GLint
) width
;
4542 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4544 if (ctx
->ExecuteFlag
) {
4545 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4546 width
, format
, imageSize
,
4552 static void GLAPIENTRY
4553 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4554 GLint yoffset
, GLsizei width
, GLsizei height
,
4555 GLenum format
, GLsizei imageSize
,
4556 const GLvoid
* data
)
4559 GET_CURRENT_CONTEXT(ctx
);
4560 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4562 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4563 8 + POINTER_DWORDS
);
4569 n
[5].i
= (GLint
) width
;
4570 n
[6].i
= (GLint
) height
;
4574 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4576 if (ctx
->ExecuteFlag
) {
4577 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4578 (target
, level
, xoffset
, yoffset
, width
,
4579 height
, format
, imageSize
, data
));
4584 static void GLAPIENTRY
4585 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4586 GLint yoffset
, GLint zoffset
, GLsizei width
,
4587 GLsizei height
, GLsizei depth
, GLenum format
,
4588 GLsizei imageSize
, const GLvoid
* data
)
4591 GET_CURRENT_CONTEXT(ctx
);
4592 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4594 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4595 10 + POINTER_DWORDS
);
4602 n
[6].i
= (GLint
) width
;
4603 n
[7].i
= (GLint
) height
;
4604 n
[8].i
= (GLint
) depth
;
4606 n
[10].i
= imageSize
;
4607 save_pointer(&n
[11],
4608 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4610 if (ctx
->ExecuteFlag
) {
4611 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4612 (target
, level
, xoffset
, yoffset
,
4613 zoffset
, width
, height
, depth
, format
,
4619 /* GL_ARB_multisample */
4620 static void GLAPIENTRY
4621 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4623 GET_CURRENT_CONTEXT(ctx
);
4625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4626 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4631 if (ctx
->ExecuteFlag
) {
4632 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4638 * GL_NV_fragment_program
4640 static void GLAPIENTRY
4641 save_BindProgramNV(GLenum target
, GLuint id
)
4643 GET_CURRENT_CONTEXT(ctx
);
4645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4646 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4651 if (ctx
->ExecuteFlag
) {
4652 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4656 static void GLAPIENTRY
4657 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4658 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4660 GET_CURRENT_CONTEXT(ctx
);
4662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4663 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4672 if (ctx
->ExecuteFlag
) {
4673 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4678 static void GLAPIENTRY
4679 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4680 const GLfloat
*params
)
4682 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4683 params
[2], params
[3]);
4687 static void GLAPIENTRY
4688 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4689 const GLfloat
* params
)
4691 GET_CURRENT_CONTEXT(ctx
);
4693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4697 const GLfloat
* p
= params
;
4699 for (i
= 0 ; i
< count
; i
++) {
4700 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4713 if (ctx
->ExecuteFlag
) {
4714 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4719 static void GLAPIENTRY
4720 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4721 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4723 save_ProgramEnvParameter4fARB(target
, index
,
4725 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4729 static void GLAPIENTRY
4730 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4731 const GLdouble
*params
)
4733 save_ProgramEnvParameter4fARB(target
, index
,
4734 (GLfloat
) params
[0],
4735 (GLfloat
) params
[1],
4736 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4740 static void GLAPIENTRY
4741 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4742 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4744 GET_CURRENT_CONTEXT(ctx
);
4746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4747 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4756 if (ctx
->ExecuteFlag
) {
4757 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4762 static void GLAPIENTRY
4763 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4764 const GLfloat
*params
)
4766 GET_CURRENT_CONTEXT(ctx
);
4768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4769 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4778 if (ctx
->ExecuteFlag
) {
4779 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4784 static void GLAPIENTRY
4785 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4786 const GLfloat
*params
)
4788 GET_CURRENT_CONTEXT(ctx
);
4790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4794 const GLfloat
* p
= params
;
4796 for (i
= 0 ; i
< count
; i
++) {
4797 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4810 if (ctx
->ExecuteFlag
) {
4811 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4816 static void GLAPIENTRY
4817 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4818 GLdouble x
, GLdouble y
,
4819 GLdouble z
, GLdouble w
)
4821 GET_CURRENT_CONTEXT(ctx
);
4823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4824 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4828 n
[3].f
= (GLfloat
) x
;
4829 n
[4].f
= (GLfloat
) y
;
4830 n
[5].f
= (GLfloat
) z
;
4831 n
[6].f
= (GLfloat
) w
;
4833 if (ctx
->ExecuteFlag
) {
4834 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4839 static void GLAPIENTRY
4840 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4841 const GLdouble
*params
)
4843 GET_CURRENT_CONTEXT(ctx
);
4845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4846 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4850 n
[3].f
= (GLfloat
) params
[0];
4851 n
[4].f
= (GLfloat
) params
[1];
4852 n
[5].f
= (GLfloat
) params
[2];
4853 n
[6].f
= (GLfloat
) params
[3];
4855 if (ctx
->ExecuteFlag
) {
4856 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4861 /* GL_EXT_stencil_two_side */
4862 static void GLAPIENTRY
4863 save_ActiveStencilFaceEXT(GLenum face
)
4865 GET_CURRENT_CONTEXT(ctx
);
4867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4868 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4872 if (ctx
->ExecuteFlag
) {
4873 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4878 /* GL_EXT_depth_bounds_test */
4879 static void GLAPIENTRY
4880 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4882 GET_CURRENT_CONTEXT(ctx
);
4884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4885 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4887 n
[1].f
= (GLfloat
) zmin
;
4888 n
[2].f
= (GLfloat
) zmax
;
4890 if (ctx
->ExecuteFlag
) {
4891 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4897 static void GLAPIENTRY
4898 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4899 const GLvoid
* string
)
4901 GET_CURRENT_CONTEXT(ctx
);
4904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4906 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4908 GLubyte
*programCopy
= malloc(len
);
4910 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4913 memcpy(programCopy
, string
, len
);
4917 save_pointer(&n
[4], programCopy
);
4919 if (ctx
->ExecuteFlag
) {
4920 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4925 static void GLAPIENTRY
4926 save_BeginQueryARB(GLenum target
, GLuint id
)
4928 GET_CURRENT_CONTEXT(ctx
);
4930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4931 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4936 if (ctx
->ExecuteFlag
) {
4937 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4941 static void GLAPIENTRY
4942 save_EndQueryARB(GLenum target
)
4944 GET_CURRENT_CONTEXT(ctx
);
4946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4947 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4951 if (ctx
->ExecuteFlag
) {
4952 CALL_EndQuery(ctx
->Exec
, (target
));
4956 static void GLAPIENTRY
4957 save_QueryCounter(GLuint id
, GLenum target
)
4959 GET_CURRENT_CONTEXT(ctx
);
4961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4962 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4967 if (ctx
->ExecuteFlag
) {
4968 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4972 static void GLAPIENTRY
4973 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4975 GET_CURRENT_CONTEXT(ctx
);
4977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4978 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4984 if (ctx
->ExecuteFlag
) {
4985 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4989 static void GLAPIENTRY
4990 save_EndQueryIndexed(GLenum target
, GLuint index
)
4992 GET_CURRENT_CONTEXT(ctx
);
4994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4995 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5000 if (ctx
->ExecuteFlag
) {
5001 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5006 static void GLAPIENTRY
5007 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5009 GET_CURRENT_CONTEXT(ctx
);
5011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5012 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5016 if (count
> MAX_DRAW_BUFFERS
)
5017 count
= MAX_DRAW_BUFFERS
;
5018 for (i
= 0; i
< count
; i
++) {
5019 n
[2 + i
].e
= buffers
[i
];
5022 if (ctx
->ExecuteFlag
) {
5023 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5027 static void GLAPIENTRY
5028 save_BindFragmentShaderATI(GLuint id
)
5030 GET_CURRENT_CONTEXT(ctx
);
5033 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5037 if (ctx
->ExecuteFlag
) {
5038 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5042 static void GLAPIENTRY
5043 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5045 GET_CURRENT_CONTEXT(ctx
);
5048 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5056 if (ctx
->ExecuteFlag
) {
5057 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5061 static void GLAPIENTRY
5062 save_Attr1fNV(GLenum attr
, GLfloat x
)
5064 GET_CURRENT_CONTEXT(ctx
);
5066 SAVE_FLUSH_VERTICES(ctx
);
5067 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5073 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5074 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5075 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5077 if (ctx
->ExecuteFlag
) {
5078 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5082 static void GLAPIENTRY
5083 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5085 GET_CURRENT_CONTEXT(ctx
);
5087 SAVE_FLUSH_VERTICES(ctx
);
5088 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5095 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5096 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5097 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5099 if (ctx
->ExecuteFlag
) {
5100 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5104 static void GLAPIENTRY
5105 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5107 GET_CURRENT_CONTEXT(ctx
);
5109 SAVE_FLUSH_VERTICES(ctx
);
5110 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5118 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5119 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5120 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5122 if (ctx
->ExecuteFlag
) {
5123 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5127 static void GLAPIENTRY
5128 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5130 GET_CURRENT_CONTEXT(ctx
);
5132 SAVE_FLUSH_VERTICES(ctx
);
5133 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5142 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5143 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5144 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5146 if (ctx
->ExecuteFlag
) {
5147 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5152 static void GLAPIENTRY
5153 save_Attr1fARB(GLenum attr
, GLfloat x
)
5155 GET_CURRENT_CONTEXT(ctx
);
5157 SAVE_FLUSH_VERTICES(ctx
);
5158 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5164 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5165 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5166 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5168 if (ctx
->ExecuteFlag
) {
5169 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5173 static void GLAPIENTRY
5174 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5176 GET_CURRENT_CONTEXT(ctx
);
5178 SAVE_FLUSH_VERTICES(ctx
);
5179 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5186 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5187 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5188 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5190 if (ctx
->ExecuteFlag
) {
5191 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5195 static void GLAPIENTRY
5196 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5198 GET_CURRENT_CONTEXT(ctx
);
5200 SAVE_FLUSH_VERTICES(ctx
);
5201 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5209 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5210 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5211 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5213 if (ctx
->ExecuteFlag
) {
5214 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5218 static void GLAPIENTRY
5219 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5221 GET_CURRENT_CONTEXT(ctx
);
5223 SAVE_FLUSH_VERTICES(ctx
);
5224 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5233 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5234 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5235 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5237 if (ctx
->ExecuteFlag
) {
5238 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5243 static void GLAPIENTRY
5244 save_EvalCoord1f(GLfloat x
)
5246 GET_CURRENT_CONTEXT(ctx
);
5248 SAVE_FLUSH_VERTICES(ctx
);
5249 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5253 if (ctx
->ExecuteFlag
) {
5254 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5258 static void GLAPIENTRY
5259 save_EvalCoord1fv(const GLfloat
* v
)
5261 save_EvalCoord1f(v
[0]);
5264 static void GLAPIENTRY
5265 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5267 GET_CURRENT_CONTEXT(ctx
);
5269 SAVE_FLUSH_VERTICES(ctx
);
5270 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5275 if (ctx
->ExecuteFlag
) {
5276 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5280 static void GLAPIENTRY
5281 save_EvalCoord2fv(const GLfloat
* v
)
5283 save_EvalCoord2f(v
[0], v
[1]);
5287 static void GLAPIENTRY
5288 save_EvalPoint1(GLint x
)
5290 GET_CURRENT_CONTEXT(ctx
);
5292 SAVE_FLUSH_VERTICES(ctx
);
5293 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5297 if (ctx
->ExecuteFlag
) {
5298 CALL_EvalPoint1(ctx
->Exec
, (x
));
5302 static void GLAPIENTRY
5303 save_EvalPoint2(GLint x
, GLint y
)
5305 GET_CURRENT_CONTEXT(ctx
);
5307 SAVE_FLUSH_VERTICES(ctx
);
5308 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5313 if (ctx
->ExecuteFlag
) {
5314 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5318 static void GLAPIENTRY
5319 save_Indexf(GLfloat x
)
5321 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5324 static void GLAPIENTRY
5325 save_Indexfv(const GLfloat
* v
)
5327 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5330 static void GLAPIENTRY
5331 save_EdgeFlag(GLboolean x
)
5333 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5338 * Compare 'count' elements of vectors 'a' and 'b'.
5339 * \return GL_TRUE if equal, GL_FALSE if different.
5341 static inline GLboolean
5342 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5344 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5349 * This glMaterial function is used for glMaterial calls that are outside
5350 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5352 static void GLAPIENTRY
5353 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5355 GET_CURRENT_CONTEXT(ctx
);
5363 case GL_FRONT_AND_BACK
:
5366 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5375 case GL_AMBIENT_AND_DIFFUSE
:
5381 case GL_COLOR_INDEXES
:
5385 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5389 if (ctx
->ExecuteFlag
) {
5390 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5393 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5395 /* Try to eliminate redundant statechanges. Because it is legal to
5396 * call glMaterial even inside begin/end calls, don't need to worry
5397 * about ctx->Driver.CurrentSavePrimitive here.
5399 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5400 if (bitmask
& (1 << i
)) {
5401 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5402 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5403 /* no change in material value */
5404 bitmask
&= ~(1 << i
);
5407 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5408 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5413 /* If this call has no effect, return early */
5417 SAVE_FLUSH_VERTICES(ctx
);
5419 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5423 for (i
= 0; i
< args
; i
++)
5424 n
[3 + i
].f
= param
[i
];
5428 static void GLAPIENTRY
5429 save_Begin(GLenum mode
)
5431 GET_CURRENT_CONTEXT(ctx
);
5433 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5434 /* compile this error into the display list */
5435 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5437 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5438 /* compile this error into the display list */
5439 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5444 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5446 /* Give the driver an opportunity to hook in an optimized
5447 * display list compiler.
5449 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5452 SAVE_FLUSH_VERTICES(ctx
);
5453 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5458 if (ctx
->ExecuteFlag
) {
5459 CALL_Begin(ctx
->Exec
, (mode
));
5464 static void GLAPIENTRY
5467 GET_CURRENT_CONTEXT(ctx
);
5468 SAVE_FLUSH_VERTICES(ctx
);
5469 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5470 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5471 if (ctx
->ExecuteFlag
) {
5472 CALL_End(ctx
->Exec
, ());
5476 static void GLAPIENTRY
5477 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5479 GET_CURRENT_CONTEXT(ctx
);
5481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5482 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5489 if (ctx
->ExecuteFlag
) {
5490 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5495 static void GLAPIENTRY
5496 save_Vertex2f(GLfloat x
, GLfloat y
)
5498 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5501 static void GLAPIENTRY
5502 save_Vertex2fv(const GLfloat
* v
)
5504 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5507 static void GLAPIENTRY
5508 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5510 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5513 static void GLAPIENTRY
5514 save_Vertex3fv(const GLfloat
* v
)
5516 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5519 static void GLAPIENTRY
5520 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5522 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5525 static void GLAPIENTRY
5526 save_Vertex4fv(const GLfloat
* v
)
5528 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5531 static void GLAPIENTRY
5532 save_TexCoord1f(GLfloat x
)
5534 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5537 static void GLAPIENTRY
5538 save_TexCoord1fv(const GLfloat
* v
)
5540 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5543 static void GLAPIENTRY
5544 save_TexCoord2f(GLfloat x
, GLfloat y
)
5546 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5549 static void GLAPIENTRY
5550 save_TexCoord2fv(const GLfloat
* v
)
5552 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5555 static void GLAPIENTRY
5556 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5558 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5561 static void GLAPIENTRY
5562 save_TexCoord3fv(const GLfloat
* v
)
5564 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5567 static void GLAPIENTRY
5568 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5570 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5573 static void GLAPIENTRY
5574 save_TexCoord4fv(const GLfloat
* v
)
5576 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5579 static void GLAPIENTRY
5580 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5582 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5585 static void GLAPIENTRY
5586 save_Normal3fv(const GLfloat
* v
)
5588 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5591 static void GLAPIENTRY
5592 save_FogCoordfEXT(GLfloat x
)
5594 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5597 static void GLAPIENTRY
5598 save_FogCoordfvEXT(const GLfloat
* v
)
5600 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5603 static void GLAPIENTRY
5604 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5606 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5609 static void GLAPIENTRY
5610 save_Color3fv(const GLfloat
* v
)
5612 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5615 static void GLAPIENTRY
5616 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5618 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5621 static void GLAPIENTRY
5622 save_Color4fv(const GLfloat
* v
)
5624 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5627 static void GLAPIENTRY
5628 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5630 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5633 static void GLAPIENTRY
5634 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5636 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5640 /* Just call the respective ATTR for texcoord
5642 static void GLAPIENTRY
5643 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5645 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5646 save_Attr1fNV(attr
, x
);
5649 static void GLAPIENTRY
5650 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5652 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5653 save_Attr1fNV(attr
, v
[0]);
5656 static void GLAPIENTRY
5657 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5659 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5660 save_Attr2fNV(attr
, x
, y
);
5663 static void GLAPIENTRY
5664 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5666 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5667 save_Attr2fNV(attr
, v
[0], v
[1]);
5670 static void GLAPIENTRY
5671 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5673 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5674 save_Attr3fNV(attr
, x
, y
, z
);
5677 static void GLAPIENTRY
5678 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5680 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5681 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5684 static void GLAPIENTRY
5685 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5686 GLfloat z
, GLfloat w
)
5688 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5689 save_Attr4fNV(attr
, x
, y
, z
, w
);
5692 static void GLAPIENTRY
5693 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5695 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5696 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5701 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5707 GET_CURRENT_CONTEXT(ctx
);
5708 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5713 static void GLAPIENTRY
5714 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5716 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5717 save_Attr1fARB(index
, x
);
5722 static void GLAPIENTRY
5723 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5725 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5726 save_Attr1fARB(index
, v
[0]);
5731 static void GLAPIENTRY
5732 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5734 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5735 save_Attr2fARB(index
, x
, y
);
5740 static void GLAPIENTRY
5741 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5743 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5744 save_Attr2fARB(index
, v
[0], v
[1]);
5749 static void GLAPIENTRY
5750 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5752 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5753 save_Attr3fARB(index
, x
, y
, z
);
5758 static void GLAPIENTRY
5759 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5761 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5762 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5767 static void GLAPIENTRY
5768 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5771 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5772 save_Attr4fARB(index
, x
, y
, z
, w
);
5777 static void GLAPIENTRY
5778 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5780 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5781 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5786 static void GLAPIENTRY
5787 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5788 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5789 GLbitfield mask
, GLenum filter
)
5791 GET_CURRENT_CONTEXT(ctx
);
5793 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5794 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5807 if (ctx
->ExecuteFlag
) {
5808 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5809 dstX0
, dstY0
, dstX1
, dstY1
,
5815 /** GL_EXT_provoking_vertex */
5816 static void GLAPIENTRY
5817 save_ProvokingVertexEXT(GLenum mode
)
5819 GET_CURRENT_CONTEXT(ctx
);
5821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5822 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5826 if (ctx
->ExecuteFlag
) {
5827 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5828 _mesa_ProvokingVertex(mode
);
5833 /** GL_EXT_transform_feedback */
5834 static void GLAPIENTRY
5835 save_BeginTransformFeedback(GLenum mode
)
5837 GET_CURRENT_CONTEXT(ctx
);
5839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5840 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5844 if (ctx
->ExecuteFlag
) {
5845 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5850 /** GL_EXT_transform_feedback */
5851 static void GLAPIENTRY
5852 save_EndTransformFeedback(void)
5854 GET_CURRENT_CONTEXT(ctx
);
5855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5856 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5857 if (ctx
->ExecuteFlag
) {
5858 CALL_EndTransformFeedback(ctx
->Exec
, ());
5862 static void GLAPIENTRY
5863 save_BindTransformFeedback(GLenum target
, GLuint name
)
5865 GET_CURRENT_CONTEXT(ctx
);
5867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5868 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5873 if (ctx
->ExecuteFlag
) {
5874 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5878 static void GLAPIENTRY
5879 save_PauseTransformFeedback(void)
5881 GET_CURRENT_CONTEXT(ctx
);
5882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5883 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5884 if (ctx
->ExecuteFlag
) {
5885 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5889 static void GLAPIENTRY
5890 save_ResumeTransformFeedback(void)
5892 GET_CURRENT_CONTEXT(ctx
);
5893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5894 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5895 if (ctx
->ExecuteFlag
) {
5896 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5900 static void GLAPIENTRY
5901 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5903 GET_CURRENT_CONTEXT(ctx
);
5905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5906 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5911 if (ctx
->ExecuteFlag
) {
5912 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5916 static void GLAPIENTRY
5917 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5919 GET_CURRENT_CONTEXT(ctx
);
5921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5922 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5928 if (ctx
->ExecuteFlag
) {
5929 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5933 static void GLAPIENTRY
5934 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5937 GET_CURRENT_CONTEXT(ctx
);
5939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5940 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5944 n
[3].si
= primcount
;
5946 if (ctx
->ExecuteFlag
) {
5947 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5951 static void GLAPIENTRY
5952 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5953 GLuint stream
, GLsizei primcount
)
5955 GET_CURRENT_CONTEXT(ctx
);
5957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5958 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5963 n
[4].si
= primcount
;
5965 if (ctx
->ExecuteFlag
) {
5966 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5971 /* aka UseProgram() */
5972 static void GLAPIENTRY
5973 save_UseProgramObjectARB(GLhandleARB program
)
5975 GET_CURRENT_CONTEXT(ctx
);
5977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5978 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5982 if (ctx
->ExecuteFlag
) {
5983 CALL_UseProgram(ctx
->Exec
, (program
));
5988 static void GLAPIENTRY
5989 save_Uniform1fARB(GLint location
, GLfloat x
)
5991 GET_CURRENT_CONTEXT(ctx
);
5993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5994 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5999 if (ctx
->ExecuteFlag
) {
6000 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6005 static void GLAPIENTRY
6006 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6008 GET_CURRENT_CONTEXT(ctx
);
6010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6011 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6017 if (ctx
->ExecuteFlag
) {
6018 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6023 static void GLAPIENTRY
6024 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6026 GET_CURRENT_CONTEXT(ctx
);
6028 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6029 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6036 if (ctx
->ExecuteFlag
) {
6037 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6042 static void GLAPIENTRY
6043 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6045 GET_CURRENT_CONTEXT(ctx
);
6047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6048 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6056 if (ctx
->ExecuteFlag
) {
6057 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6062 static void GLAPIENTRY
6063 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6065 GET_CURRENT_CONTEXT(ctx
);
6067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6068 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6072 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6074 if (ctx
->ExecuteFlag
) {
6075 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6079 static void GLAPIENTRY
6080 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6082 GET_CURRENT_CONTEXT(ctx
);
6084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6085 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6089 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6091 if (ctx
->ExecuteFlag
) {
6092 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6096 static void GLAPIENTRY
6097 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6099 GET_CURRENT_CONTEXT(ctx
);
6101 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6102 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6106 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6108 if (ctx
->ExecuteFlag
) {
6109 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6113 static void GLAPIENTRY
6114 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6116 GET_CURRENT_CONTEXT(ctx
);
6118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6119 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6123 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6125 if (ctx
->ExecuteFlag
) {
6126 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6131 static void GLAPIENTRY
6132 save_Uniform1iARB(GLint location
, GLint x
)
6134 GET_CURRENT_CONTEXT(ctx
);
6136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6137 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6142 if (ctx
->ExecuteFlag
) {
6143 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6147 static void GLAPIENTRY
6148 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6150 GET_CURRENT_CONTEXT(ctx
);
6152 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6153 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6159 if (ctx
->ExecuteFlag
) {
6160 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6164 static void GLAPIENTRY
6165 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6167 GET_CURRENT_CONTEXT(ctx
);
6169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6170 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6177 if (ctx
->ExecuteFlag
) {
6178 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6182 static void GLAPIENTRY
6183 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6185 GET_CURRENT_CONTEXT(ctx
);
6187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6188 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6196 if (ctx
->ExecuteFlag
) {
6197 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6203 static void GLAPIENTRY
6204 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6206 GET_CURRENT_CONTEXT(ctx
);
6208 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6209 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6213 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6215 if (ctx
->ExecuteFlag
) {
6216 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6220 static void GLAPIENTRY
6221 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6223 GET_CURRENT_CONTEXT(ctx
);
6225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6226 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6230 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6232 if (ctx
->ExecuteFlag
) {
6233 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6237 static void GLAPIENTRY
6238 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6240 GET_CURRENT_CONTEXT(ctx
);
6242 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6243 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6247 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6249 if (ctx
->ExecuteFlag
) {
6250 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6254 static void GLAPIENTRY
6255 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6257 GET_CURRENT_CONTEXT(ctx
);
6259 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6260 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6264 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6266 if (ctx
->ExecuteFlag
) {
6267 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6273 static void GLAPIENTRY
6274 save_Uniform1ui(GLint location
, GLuint x
)
6276 GET_CURRENT_CONTEXT(ctx
);
6278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6279 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6284 if (ctx
->ExecuteFlag
) {
6285 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6289 static void GLAPIENTRY
6290 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6292 GET_CURRENT_CONTEXT(ctx
);
6294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6295 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6301 if (ctx
->ExecuteFlag
) {
6302 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6306 static void GLAPIENTRY
6307 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6309 GET_CURRENT_CONTEXT(ctx
);
6311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6312 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6319 if (ctx
->ExecuteFlag
) {
6320 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6324 static void GLAPIENTRY
6325 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6327 GET_CURRENT_CONTEXT(ctx
);
6329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6330 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6338 if (ctx
->ExecuteFlag
) {
6339 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6345 static void GLAPIENTRY
6346 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6348 GET_CURRENT_CONTEXT(ctx
);
6350 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6351 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6355 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6357 if (ctx
->ExecuteFlag
) {
6358 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6362 static void GLAPIENTRY
6363 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6365 GET_CURRENT_CONTEXT(ctx
);
6367 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6368 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6372 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6374 if (ctx
->ExecuteFlag
) {
6375 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6379 static void GLAPIENTRY
6380 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6382 GET_CURRENT_CONTEXT(ctx
);
6384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6385 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6389 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6391 if (ctx
->ExecuteFlag
) {
6392 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6396 static void GLAPIENTRY
6397 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6399 GET_CURRENT_CONTEXT(ctx
);
6401 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6402 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6406 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6408 if (ctx
->ExecuteFlag
) {
6409 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6415 static void GLAPIENTRY
6416 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6419 GET_CURRENT_CONTEXT(ctx
);
6421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6422 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6427 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6429 if (ctx
->ExecuteFlag
) {
6430 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6434 static void GLAPIENTRY
6435 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6438 GET_CURRENT_CONTEXT(ctx
);
6440 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6441 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6446 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6448 if (ctx
->ExecuteFlag
) {
6449 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6453 static void GLAPIENTRY
6454 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6457 GET_CURRENT_CONTEXT(ctx
);
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6460 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6465 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6467 if (ctx
->ExecuteFlag
) {
6468 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6473 static void GLAPIENTRY
6474 save_UniformMatrix2x3fv(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_MATRIX23
, 3 + POINTER_DWORDS
);
6485 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6487 if (ctx
->ExecuteFlag
) {
6488 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6492 static void GLAPIENTRY
6493 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6496 GET_CURRENT_CONTEXT(ctx
);
6498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6499 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6504 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6506 if (ctx
->ExecuteFlag
) {
6507 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6512 static void GLAPIENTRY
6513 save_UniformMatrix2x4fv(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_MATRIX24
, 3 + POINTER_DWORDS
);
6524 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6526 if (ctx
->ExecuteFlag
) {
6527 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6531 static void GLAPIENTRY
6532 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6535 GET_CURRENT_CONTEXT(ctx
);
6537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6538 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6543 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6545 if (ctx
->ExecuteFlag
) {
6546 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6551 static void GLAPIENTRY
6552 save_UniformMatrix3x4fv(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_MATRIX34
, 3 + POINTER_DWORDS
);
6563 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6565 if (ctx
->ExecuteFlag
) {
6566 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6570 static void GLAPIENTRY
6571 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6574 GET_CURRENT_CONTEXT(ctx
);
6576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6577 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6582 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6584 if (ctx
->ExecuteFlag
) {
6585 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6589 static void GLAPIENTRY
6590 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6592 GET_CURRENT_CONTEXT(ctx
);
6594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6595 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6601 if (ctx
->ExecuteFlag
) {
6602 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6606 static void GLAPIENTRY
6607 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6609 GET_CURRENT_CONTEXT(ctx
);
6611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6612 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6618 if (ctx
->ExecuteFlag
) {
6619 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6623 static void GLAPIENTRY
6624 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6626 GET_CURRENT_CONTEXT(ctx
);
6628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6629 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6636 if (ctx
->ExecuteFlag
) {
6637 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6641 static void GLAPIENTRY
6642 save_ProgramUniform3f(GLuint program
, GLint location
,
6643 GLfloat x
, GLfloat y
, GLfloat z
)
6645 GET_CURRENT_CONTEXT(ctx
);
6647 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6648 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6656 if (ctx
->ExecuteFlag
) {
6657 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6661 static void GLAPIENTRY
6662 save_ProgramUniform4f(GLuint program
, GLint location
,
6663 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6665 GET_CURRENT_CONTEXT(ctx
);
6667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6668 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6677 if (ctx
->ExecuteFlag
) {
6678 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6682 static void GLAPIENTRY
6683 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6686 GET_CURRENT_CONTEXT(ctx
);
6688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6689 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6694 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6696 if (ctx
->ExecuteFlag
) {
6697 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6701 static void GLAPIENTRY
6702 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6705 GET_CURRENT_CONTEXT(ctx
);
6707 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6708 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6713 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6715 if (ctx
->ExecuteFlag
) {
6716 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6720 static void GLAPIENTRY
6721 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6724 GET_CURRENT_CONTEXT(ctx
);
6726 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6727 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6732 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6734 if (ctx
->ExecuteFlag
) {
6735 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6739 static void GLAPIENTRY
6740 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6743 GET_CURRENT_CONTEXT(ctx
);
6745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6746 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6751 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6753 if (ctx
->ExecuteFlag
) {
6754 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6758 static void GLAPIENTRY
6759 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6761 GET_CURRENT_CONTEXT(ctx
);
6763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6764 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6770 if (ctx
->ExecuteFlag
) {
6771 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6775 static void GLAPIENTRY
6776 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6778 GET_CURRENT_CONTEXT(ctx
);
6780 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6781 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6788 if (ctx
->ExecuteFlag
) {
6789 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6793 static void GLAPIENTRY
6794 save_ProgramUniform3i(GLuint program
, GLint location
,
6795 GLint x
, GLint y
, GLint z
)
6797 GET_CURRENT_CONTEXT(ctx
);
6799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6800 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6808 if (ctx
->ExecuteFlag
) {
6809 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6813 static void GLAPIENTRY
6814 save_ProgramUniform4i(GLuint program
, GLint location
,
6815 GLint x
, GLint y
, GLint z
, GLint w
)
6817 GET_CURRENT_CONTEXT(ctx
);
6819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6820 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6829 if (ctx
->ExecuteFlag
) {
6830 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6834 static void GLAPIENTRY
6835 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6838 GET_CURRENT_CONTEXT(ctx
);
6840 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6841 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6846 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6848 if (ctx
->ExecuteFlag
) {
6849 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6853 static void GLAPIENTRY
6854 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6857 GET_CURRENT_CONTEXT(ctx
);
6859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6860 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6865 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6867 if (ctx
->ExecuteFlag
) {
6868 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6872 static void GLAPIENTRY
6873 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6876 GET_CURRENT_CONTEXT(ctx
);
6878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6879 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6884 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6886 if (ctx
->ExecuteFlag
) {
6887 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6891 static void GLAPIENTRY
6892 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6895 GET_CURRENT_CONTEXT(ctx
);
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6898 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6903 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6905 if (ctx
->ExecuteFlag
) {
6906 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6910 static void GLAPIENTRY
6911 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6913 GET_CURRENT_CONTEXT(ctx
);
6915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6916 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6922 if (ctx
->ExecuteFlag
) {
6923 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6927 static void GLAPIENTRY
6928 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6930 GET_CURRENT_CONTEXT(ctx
);
6932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6933 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6940 if (ctx
->ExecuteFlag
) {
6941 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6945 static void GLAPIENTRY
6946 save_ProgramUniform3ui(GLuint program
, GLint location
,
6947 GLuint x
, GLuint y
, GLuint z
)
6949 GET_CURRENT_CONTEXT(ctx
);
6951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6952 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6960 if (ctx
->ExecuteFlag
) {
6961 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6965 static void GLAPIENTRY
6966 save_ProgramUniform4ui(GLuint program
, GLint location
,
6967 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6969 GET_CURRENT_CONTEXT(ctx
);
6971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6972 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
6981 if (ctx
->ExecuteFlag
) {
6982 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6986 static void GLAPIENTRY
6987 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
6990 GET_CURRENT_CONTEXT(ctx
);
6992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6993 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
6998 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
7000 if (ctx
->ExecuteFlag
) {
7001 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
7005 static void GLAPIENTRY
7006 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
7009 GET_CURRENT_CONTEXT(ctx
);
7011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7012 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
7017 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7019 if (ctx
->ExecuteFlag
) {
7020 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7024 static void GLAPIENTRY
7025 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7028 GET_CURRENT_CONTEXT(ctx
);
7030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7031 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7036 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7038 if (ctx
->ExecuteFlag
) {
7039 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7043 static void GLAPIENTRY
7044 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7047 GET_CURRENT_CONTEXT(ctx
);
7049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7050 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7055 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7057 if (ctx
->ExecuteFlag
) {
7058 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7062 static void GLAPIENTRY
7063 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7064 GLboolean transpose
, const GLfloat
*v
)
7066 GET_CURRENT_CONTEXT(ctx
);
7068 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7069 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7070 4 + POINTER_DWORDS
);
7076 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7078 if (ctx
->ExecuteFlag
) {
7079 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7080 (program
, location
, count
, transpose
, v
));
7084 static void GLAPIENTRY
7085 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7086 GLboolean transpose
, const GLfloat
*v
)
7088 GET_CURRENT_CONTEXT(ctx
);
7090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7091 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7092 4 + POINTER_DWORDS
);
7098 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7100 if (ctx
->ExecuteFlag
) {
7101 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7102 (program
, location
, count
, transpose
, v
));
7106 static void GLAPIENTRY
7107 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7108 GLboolean transpose
, const GLfloat
*v
)
7110 GET_CURRENT_CONTEXT(ctx
);
7112 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7113 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7114 4 + POINTER_DWORDS
);
7120 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7122 if (ctx
->ExecuteFlag
) {
7123 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7124 (program
, location
, count
, transpose
, v
));
7128 static void GLAPIENTRY
7129 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7130 GLboolean transpose
, const GLfloat
*v
)
7132 GET_CURRENT_CONTEXT(ctx
);
7134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7135 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7136 4 + POINTER_DWORDS
);
7142 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7144 if (ctx
->ExecuteFlag
) {
7145 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7146 (program
, location
, count
, transpose
, v
));
7150 static void GLAPIENTRY
7151 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7152 GLboolean transpose
, const GLfloat
*v
)
7154 GET_CURRENT_CONTEXT(ctx
);
7156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7157 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7158 4 + POINTER_DWORDS
);
7164 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7166 if (ctx
->ExecuteFlag
) {
7167 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7168 (program
, location
, count
, transpose
, v
));
7172 static void GLAPIENTRY
7173 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7174 GLboolean transpose
, const GLfloat
*v
)
7176 GET_CURRENT_CONTEXT(ctx
);
7178 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7179 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7180 4 + POINTER_DWORDS
);
7186 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7188 if (ctx
->ExecuteFlag
) {
7189 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7190 (program
, location
, count
, transpose
, v
));
7194 static void GLAPIENTRY
7195 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7196 GLboolean transpose
, const GLfloat
*v
)
7198 GET_CURRENT_CONTEXT(ctx
);
7200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7201 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7202 4 + POINTER_DWORDS
);
7208 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7210 if (ctx
->ExecuteFlag
) {
7211 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7212 (program
, location
, count
, transpose
, v
));
7216 static void GLAPIENTRY
7217 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7218 GLboolean transpose
, const GLfloat
*v
)
7220 GET_CURRENT_CONTEXT(ctx
);
7222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7223 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7224 4 + POINTER_DWORDS
);
7230 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7232 if (ctx
->ExecuteFlag
) {
7233 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7234 (program
, location
, count
, transpose
, v
));
7238 static void GLAPIENTRY
7239 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7240 GLboolean transpose
, const GLfloat
*v
)
7242 GET_CURRENT_CONTEXT(ctx
);
7244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7245 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7246 4 + POINTER_DWORDS
);
7252 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7254 if (ctx
->ExecuteFlag
) {
7255 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7256 (program
, location
, count
, transpose
, v
));
7260 static void GLAPIENTRY
7261 save_ClipControl(GLenum origin
, GLenum depth
)
7263 GET_CURRENT_CONTEXT(ctx
);
7265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7266 n
= alloc_instruction(ctx
, OPCODE_CLIP_CONTROL
, 2);
7271 if (ctx
->ExecuteFlag
) {
7272 CALL_ClipControl(ctx
->Exec
, (origin
, depth
));
7276 static void GLAPIENTRY
7277 save_ClampColorARB(GLenum target
, GLenum clamp
)
7279 GET_CURRENT_CONTEXT(ctx
);
7281 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7282 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7287 if (ctx
->ExecuteFlag
) {
7288 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7292 /** GL_EXT_texture_integer */
7293 static void GLAPIENTRY
7294 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7296 GET_CURRENT_CONTEXT(ctx
);
7298 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7299 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7306 if (ctx
->ExecuteFlag
) {
7307 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7311 /** GL_EXT_texture_integer */
7312 static void GLAPIENTRY
7313 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7315 GET_CURRENT_CONTEXT(ctx
);
7317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7318 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7325 if (ctx
->ExecuteFlag
) {
7326 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7330 /** GL_EXT_texture_integer */
7331 static void GLAPIENTRY
7332 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7334 GET_CURRENT_CONTEXT(ctx
);
7336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7337 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7346 if (ctx
->ExecuteFlag
) {
7347 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7351 /** GL_EXT_texture_integer */
7352 static void GLAPIENTRY
7353 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7355 GET_CURRENT_CONTEXT(ctx
);
7357 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7358 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7362 n
[3].ui
= params
[0];
7363 n
[4].ui
= params
[1];
7364 n
[5].ui
= params
[2];
7365 n
[6].ui
= params
[3];
7367 if (ctx
->ExecuteFlag
) {
7368 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7372 /* GL_ARB_instanced_arrays */
7373 static void GLAPIENTRY
7374 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7376 GET_CURRENT_CONTEXT(ctx
);
7378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7379 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7384 if (ctx
->ExecuteFlag
) {
7385 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7390 /* GL_NV_texture_barrier */
7391 static void GLAPIENTRY
7392 save_TextureBarrierNV(void)
7394 GET_CURRENT_CONTEXT(ctx
);
7395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7396 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7397 if (ctx
->ExecuteFlag
) {
7398 CALL_TextureBarrierNV(ctx
->Exec
, ());
7403 /* GL_ARB_sampler_objects */
7404 static void GLAPIENTRY
7405 save_BindSampler(GLuint unit
, GLuint sampler
)
7408 GET_CURRENT_CONTEXT(ctx
);
7409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7410 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7415 if (ctx
->ExecuteFlag
) {
7416 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7420 static void GLAPIENTRY
7421 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7424 GET_CURRENT_CONTEXT(ctx
);
7425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7426 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7431 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7437 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7440 if (ctx
->ExecuteFlag
) {
7441 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7445 static void GLAPIENTRY
7446 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7450 parray
[1] = parray
[2] = parray
[3] = 0;
7451 save_SamplerParameteriv(sampler
, pname
, parray
);
7454 static void GLAPIENTRY
7455 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7458 GET_CURRENT_CONTEXT(ctx
);
7459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7460 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7465 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7471 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7474 if (ctx
->ExecuteFlag
) {
7475 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7479 static void GLAPIENTRY
7480 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7484 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7485 save_SamplerParameterfv(sampler
, pname
, parray
);
7488 static void GLAPIENTRY
7489 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7492 GET_CURRENT_CONTEXT(ctx
);
7493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7494 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7499 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7505 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7508 if (ctx
->ExecuteFlag
) {
7509 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7513 static void GLAPIENTRY
7514 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7517 GET_CURRENT_CONTEXT(ctx
);
7518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7519 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7523 n
[3].ui
= params
[0];
7524 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7525 n
[4].ui
= params
[1];
7526 n
[5].ui
= params
[2];
7527 n
[6].ui
= params
[3];
7530 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7533 if (ctx
->ExecuteFlag
) {
7534 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7538 /* GL_ARB_geometry_shader4 */
7539 static void GLAPIENTRY
7540 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7543 GET_CURRENT_CONTEXT(ctx
);
7544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7545 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7551 if (ctx
->ExecuteFlag
) {
7552 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7556 static void GLAPIENTRY
7557 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7558 GLuint texture
, GLint level
)
7561 GET_CURRENT_CONTEXT(ctx
);
7562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7563 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7566 n
[2].e
= attachment
;
7570 if (ctx
->ExecuteFlag
) {
7571 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7575 static void GLAPIENTRY
7576 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7577 GLuint texture
, GLint level
, GLenum face
)
7580 GET_CURRENT_CONTEXT(ctx
);
7581 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7582 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7585 n
[2].e
= attachment
;
7590 if (ctx
->ExecuteFlag
) {
7591 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7598 static void GLAPIENTRY
7599 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7602 GET_CURRENT_CONTEXT(ctx
);
7603 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7604 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7606 union uint64_pair p
;
7609 n
[2].ui
= p
.uint32
[0];
7610 n
[3].ui
= p
.uint32
[1];
7611 save_pointer(&n
[4], sync
);
7613 if (ctx
->ExecuteFlag
) {
7614 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7619 /** GL_NV_conditional_render */
7620 static void GLAPIENTRY
7621 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7623 GET_CURRENT_CONTEXT(ctx
);
7625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7626 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7631 if (ctx
->ExecuteFlag
) {
7632 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7636 static void GLAPIENTRY
7637 save_EndConditionalRender(void)
7639 GET_CURRENT_CONTEXT(ctx
);
7640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7641 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7642 if (ctx
->ExecuteFlag
) {
7643 CALL_EndConditionalRender(ctx
->Exec
, ());
7647 static void GLAPIENTRY
7648 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7650 GET_CURRENT_CONTEXT(ctx
);
7652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7653 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7659 if (ctx
->ExecuteFlag
) {
7660 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7666 * Save an error-generating command into display list.
7668 * KW: Will appear in the list before the vertex buffer containing the
7669 * command that provoked the error. I don't see this as a problem.
7672 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7675 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7678 save_pointer(&n
[2], (void *) s
);
7679 /* note: the data/string here doesn't have to be freed in
7680 * _mesa_delete_list() since the string is never dynamically
7688 * Compile an error into current display list.
7691 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7693 if (ctx
->CompileFlag
)
7694 save_error(ctx
, error
, s
);
7695 if (ctx
->ExecuteFlag
)
7696 _mesa_error(ctx
, error
, "%s", s
);
7701 * Test if ID names a display list.
7704 islist(struct gl_context
*ctx
, GLuint list
)
7706 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7716 /**********************************************************************/
7717 /* Display list execution */
7718 /**********************************************************************/
7722 * Execute a display list. Note that the ListBase offset must have already
7723 * been added before calling this function. I.e. the list argument is
7724 * the absolute list number, not relative to ListBase.
7725 * \param list - display list number
7728 execute_list(struct gl_context
*ctx
, GLuint list
)
7730 struct gl_display_list
*dlist
;
7734 if (list
== 0 || !islist(ctx
, list
))
7737 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7738 /* raise an error? */
7742 dlist
= _mesa_lookup_list(ctx
, list
);
7746 ctx
->ListState
.CallDepth
++;
7748 if (ctx
->Driver
.BeginCallList
)
7749 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7755 const OpCode opcode
= n
[0].opcode
;
7757 if (is_ext_opcode(opcode
)) {
7758 n
+= ext_opcode_execute(ctx
, n
);
7763 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7766 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7768 case OPCODE_ALPHA_FUNC
:
7769 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7771 case OPCODE_BIND_TEXTURE
:
7772 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7776 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7777 ctx
->Unpack
= ctx
->DefaultPacking
;
7778 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7779 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7780 get_pointer(&n
[7])));
7781 ctx
->Unpack
= save
; /* restore */
7784 case OPCODE_BLEND_COLOR
:
7785 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7787 case OPCODE_BLEND_EQUATION
:
7788 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7790 case OPCODE_BLEND_EQUATION_SEPARATE
:
7791 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7793 case OPCODE_BLEND_FUNC_SEPARATE
:
7794 CALL_BlendFuncSeparate(ctx
->Exec
,
7795 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7798 case OPCODE_BLEND_FUNC_I
:
7799 /* GL_ARB_draw_buffers_blend */
7800 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7802 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7803 /* GL_ARB_draw_buffers_blend */
7804 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7807 case OPCODE_BLEND_EQUATION_I
:
7808 /* GL_ARB_draw_buffers_blend */
7809 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7811 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7812 /* GL_ARB_draw_buffers_blend */
7813 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7814 (n
[1].ui
, n
[2].e
, n
[3].e
));
7817 case OPCODE_CALL_LIST
:
7818 /* Generated by glCallList(), don't add ListBase */
7819 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7820 execute_list(ctx
, n
[1].ui
);
7823 case OPCODE_CALL_LIST_OFFSET
:
7824 /* Generated by glCallLists() so we must add ListBase */
7826 /* user specified a bad data type at compile time */
7827 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7829 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7830 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7831 execute_list(ctx
, list
);
7835 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7837 case OPCODE_CLEAR_BUFFER_IV
:
7844 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7847 case OPCODE_CLEAR_BUFFER_UIV
:
7854 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7857 case OPCODE_CLEAR_BUFFER_FV
:
7864 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7867 case OPCODE_CLEAR_BUFFER_FI
:
7868 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7870 case OPCODE_CLEAR_COLOR
:
7871 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7873 case OPCODE_CLEAR_ACCUM
:
7874 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7876 case OPCODE_CLEAR_DEPTH
:
7877 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7879 case OPCODE_CLEAR_INDEX
:
7880 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7882 case OPCODE_CLEAR_STENCIL
:
7883 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7885 case OPCODE_CLIP_PLANE
:
7892 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7895 case OPCODE_COLOR_MASK
:
7896 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7898 case OPCODE_COLOR_MASK_INDEXED
:
7899 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7902 case OPCODE_COLOR_MATERIAL
:
7903 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7905 case OPCODE_COPY_PIXELS
:
7906 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7907 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7910 case OPCODE_COPY_TEX_IMAGE1D
:
7911 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7912 n
[5].i
, n
[6].i
, n
[7].i
));
7914 case OPCODE_COPY_TEX_IMAGE2D
:
7915 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7916 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7918 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7919 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7920 n
[4].i
, n
[5].i
, n
[6].i
));
7922 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7923 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7924 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7927 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7928 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7929 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7932 case OPCODE_CULL_FACE
:
7933 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7935 case OPCODE_DEPTH_FUNC
:
7936 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7938 case OPCODE_DEPTH_MASK
:
7939 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7941 case OPCODE_DEPTH_RANGE
:
7942 CALL_DepthRange(ctx
->Exec
,
7943 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7945 case OPCODE_DISABLE
:
7946 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7948 case OPCODE_DISABLE_INDEXED
:
7949 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7951 case OPCODE_DRAW_BUFFER
:
7952 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7954 case OPCODE_DRAW_PIXELS
:
7956 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7957 ctx
->Unpack
= ctx
->DefaultPacking
;
7958 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7959 get_pointer(&n
[5])));
7960 ctx
->Unpack
= save
; /* restore */
7964 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7966 case OPCODE_ENABLE_INDEXED
:
7967 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7969 case OPCODE_EVALMESH1
:
7970 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7972 case OPCODE_EVALMESH2
:
7973 CALL_EvalMesh2(ctx
->Exec
,
7974 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7983 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7986 case OPCODE_FRONT_FACE
:
7987 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7989 case OPCODE_FRUSTUM
:
7990 CALL_Frustum(ctx
->Exec
,
7991 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7994 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7996 case OPCODE_INDEX_MASK
:
7997 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7999 case OPCODE_INIT_NAMES
:
8000 CALL_InitNames(ctx
->Exec
, ());
8009 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
8012 case OPCODE_LIGHT_MODEL
:
8019 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
8022 case OPCODE_LINE_STIPPLE
:
8023 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
8025 case OPCODE_LINE_WIDTH
:
8026 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
8028 case OPCODE_LIST_BASE
:
8029 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
8031 case OPCODE_LOAD_IDENTITY
:
8032 CALL_LoadIdentity(ctx
->Exec
, ());
8034 case OPCODE_LOAD_MATRIX
:
8035 if (sizeof(Node
) == sizeof(GLfloat
)) {
8036 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8041 for (i
= 0; i
< 16; i
++) {
8044 CALL_LoadMatrixf(ctx
->Exec
, (m
));
8047 case OPCODE_LOAD_NAME
:
8048 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8050 case OPCODE_LOGIC_OP
:
8051 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8055 GLenum target
= n
[1].e
;
8056 GLint ustride
= _mesa_evaluator_components(target
);
8057 GLint uorder
= n
[5].i
;
8058 GLfloat u1
= n
[2].f
;
8059 GLfloat u2
= n
[3].f
;
8060 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8061 (GLfloat
*) get_pointer(&n
[6])));
8066 GLenum target
= n
[1].e
;
8067 GLfloat u1
= n
[2].f
;
8068 GLfloat u2
= n
[3].f
;
8069 GLfloat v1
= n
[4].f
;
8070 GLfloat v2
= n
[5].f
;
8071 GLint ustride
= n
[6].i
;
8072 GLint vstride
= n
[7].i
;
8073 GLint uorder
= n
[8].i
;
8074 GLint vorder
= n
[9].i
;
8075 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8076 v1
, v2
, vstride
, vorder
,
8077 (GLfloat
*) get_pointer(&n
[10])));
8080 case OPCODE_MAPGRID1
:
8081 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8083 case OPCODE_MAPGRID2
:
8084 CALL_MapGrid2f(ctx
->Exec
,
8085 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8087 case OPCODE_MATRIX_MODE
:
8088 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8090 case OPCODE_MULT_MATRIX
:
8091 if (sizeof(Node
) == sizeof(GLfloat
)) {
8092 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8097 for (i
= 0; i
< 16; i
++) {
8100 CALL_MultMatrixf(ctx
->Exec
, (m
));
8104 CALL_Ortho(ctx
->Exec
,
8105 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8107 case OPCODE_PASSTHROUGH
:
8108 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8110 case OPCODE_PIXEL_MAP
:
8111 CALL_PixelMapfv(ctx
->Exec
,
8112 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8114 case OPCODE_PIXEL_TRANSFER
:
8115 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8117 case OPCODE_PIXEL_ZOOM
:
8118 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8120 case OPCODE_POINT_SIZE
:
8121 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8123 case OPCODE_POINT_PARAMETERS
:
8129 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8132 case OPCODE_POLYGON_MODE
:
8133 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8135 case OPCODE_POLYGON_STIPPLE
:
8137 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8138 ctx
->Unpack
= ctx
->DefaultPacking
;
8139 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8140 ctx
->Unpack
= save
; /* restore */
8143 case OPCODE_POLYGON_OFFSET
:
8144 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8146 case OPCODE_POP_ATTRIB
:
8147 CALL_PopAttrib(ctx
->Exec
, ());
8149 case OPCODE_POP_MATRIX
:
8150 CALL_PopMatrix(ctx
->Exec
, ());
8152 case OPCODE_POP_NAME
:
8153 CALL_PopName(ctx
->Exec
, ());
8155 case OPCODE_PRIORITIZE_TEXTURE
:
8156 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8158 case OPCODE_PUSH_ATTRIB
:
8159 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8161 case OPCODE_PUSH_MATRIX
:
8162 CALL_PushMatrix(ctx
->Exec
, ());
8164 case OPCODE_PUSH_NAME
:
8165 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8167 case OPCODE_RASTER_POS
:
8168 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8170 case OPCODE_READ_BUFFER
:
8171 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8174 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8177 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8179 case OPCODE_SCISSOR
:
8180 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8182 case OPCODE_SHADE_MODEL
:
8183 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8185 case OPCODE_PROVOKING_VERTEX
:
8186 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8188 case OPCODE_STENCIL_FUNC
:
8189 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8191 case OPCODE_STENCIL_MASK
:
8192 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8194 case OPCODE_STENCIL_OP
:
8195 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8197 case OPCODE_STENCIL_FUNC_SEPARATE
:
8198 CALL_StencilFuncSeparate(ctx
->Exec
,
8199 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8201 case OPCODE_STENCIL_MASK_SEPARATE
:
8202 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8204 case OPCODE_STENCIL_OP_SEPARATE
:
8205 CALL_StencilOpSeparate(ctx
->Exec
,
8206 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8215 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8225 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8228 case OPCODE_TEXPARAMETER
:
8235 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8238 case OPCODE_TEX_IMAGE1D
:
8240 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8241 ctx
->Unpack
= ctx
->DefaultPacking
;
8242 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8244 n
[3].i
, /* components */
8246 n
[5].e
, /* border */
8247 n
[6].e
, /* format */
8249 get_pointer(&n
[8])));
8250 ctx
->Unpack
= save
; /* restore */
8253 case OPCODE_TEX_IMAGE2D
:
8255 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8256 ctx
->Unpack
= ctx
->DefaultPacking
;
8257 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8259 n
[3].i
, /* components */
8261 n
[5].i
, /* height */
8262 n
[6].e
, /* border */
8263 n
[7].e
, /* format */
8265 get_pointer(&n
[9])));
8266 ctx
->Unpack
= save
; /* restore */
8269 case OPCODE_TEX_IMAGE3D
:
8271 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8272 ctx
->Unpack
= ctx
->DefaultPacking
;
8273 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8275 n
[3].i
, /* components */
8277 n
[5].i
, /* height */
8279 n
[7].e
, /* border */
8280 n
[8].e
, /* format */
8282 get_pointer(&n
[10])));
8283 ctx
->Unpack
= save
; /* restore */
8286 case OPCODE_TEX_SUB_IMAGE1D
:
8288 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8289 ctx
->Unpack
= ctx
->DefaultPacking
;
8290 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8292 n
[6].e
, get_pointer(&n
[7])));
8293 ctx
->Unpack
= save
; /* restore */
8296 case OPCODE_TEX_SUB_IMAGE2D
:
8298 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8299 ctx
->Unpack
= ctx
->DefaultPacking
;
8300 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8302 n
[6].i
, n
[7].e
, n
[8].e
,
8303 get_pointer(&n
[9])));
8304 ctx
->Unpack
= save
; /* restore */
8307 case OPCODE_TEX_SUB_IMAGE3D
:
8309 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8310 ctx
->Unpack
= ctx
->DefaultPacking
;
8311 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8312 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8313 n
[8].i
, n
[9].e
, n
[10].e
,
8314 get_pointer(&n
[11])));
8315 ctx
->Unpack
= save
; /* restore */
8318 case OPCODE_TRANSLATE
:
8319 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8321 case OPCODE_VIEWPORT
:
8322 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8323 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8325 case OPCODE_WINDOW_POS
:
8326 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8328 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8329 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8331 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8332 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8333 n
[4].i
, n
[5].i
, n
[6].i
,
8334 get_pointer(&n
[7])));
8336 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8337 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8338 n
[4].i
, n
[5].i
, n
[6].i
,
8339 n
[7].i
, get_pointer(&n
[8])));
8341 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8342 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8343 n
[4].i
, n
[5].i
, n
[6].i
,
8345 get_pointer(&n
[9])));
8347 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8348 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8349 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8351 get_pointer(&n
[7])));
8353 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8354 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8355 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8356 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8357 get_pointer(&n
[9])));
8359 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8360 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8361 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8362 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8364 get_pointer(&n
[11])));
8366 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8367 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8369 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8370 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8372 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8373 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8375 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8376 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8377 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8380 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8381 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8383 case OPCODE_DEPTH_BOUNDS_EXT
:
8384 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8386 case OPCODE_PROGRAM_STRING_ARB
:
8387 CALL_ProgramStringARB(ctx
->Exec
,
8388 (n
[1].e
, n
[2].e
, n
[3].i
,
8389 get_pointer(&n
[4])));
8391 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8392 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8396 case OPCODE_BEGIN_QUERY_ARB
:
8397 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8399 case OPCODE_END_QUERY_ARB
:
8400 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8402 case OPCODE_QUERY_COUNTER
:
8403 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8405 case OPCODE_BEGIN_QUERY_INDEXED
:
8406 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8408 case OPCODE_END_QUERY_INDEXED
:
8409 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8411 case OPCODE_DRAW_BUFFERS_ARB
:
8413 GLenum buffers
[MAX_DRAW_BUFFERS
];
8414 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8415 for (i
= 0; i
< count
; i
++)
8416 buffers
[i
] = n
[2 + i
].e
;
8417 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8420 case OPCODE_BLIT_FRAMEBUFFER
:
8421 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8422 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8425 case OPCODE_USE_PROGRAM
:
8426 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8428 case OPCODE_UNIFORM_1F
:
8429 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8431 case OPCODE_UNIFORM_2F
:
8432 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8434 case OPCODE_UNIFORM_3F
:
8435 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8437 case OPCODE_UNIFORM_4F
:
8438 CALL_Uniform4f(ctx
->Exec
,
8439 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8441 case OPCODE_UNIFORM_1FV
:
8442 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8444 case OPCODE_UNIFORM_2FV
:
8445 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8447 case OPCODE_UNIFORM_3FV
:
8448 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8450 case OPCODE_UNIFORM_4FV
:
8451 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8453 case OPCODE_UNIFORM_1I
:
8454 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8456 case OPCODE_UNIFORM_2I
:
8457 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8459 case OPCODE_UNIFORM_3I
:
8460 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8462 case OPCODE_UNIFORM_4I
:
8463 CALL_Uniform4i(ctx
->Exec
,
8464 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8466 case OPCODE_UNIFORM_1IV
:
8467 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8469 case OPCODE_UNIFORM_2IV
:
8470 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8472 case OPCODE_UNIFORM_3IV
:
8473 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8475 case OPCODE_UNIFORM_4IV
:
8476 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8478 case OPCODE_UNIFORM_1UI
:
8479 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8481 case OPCODE_UNIFORM_2UI
:
8482 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8484 case OPCODE_UNIFORM_3UI
:
8485 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8487 case OPCODE_UNIFORM_4UI
:
8488 /*CALL_Uniform4uiARB(ctx->Exec,
8489 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8492 case OPCODE_UNIFORM_1UIV
:
8493 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8494 get_pointer(&n[3])));*/
8496 case OPCODE_UNIFORM_2UIV
:
8497 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8498 get_pointer(&n[3])));*/
8500 case OPCODE_UNIFORM_3UIV
:
8501 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8502 get_pointer(&n[3])));*/
8504 case OPCODE_UNIFORM_4UIV
:
8505 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8506 get_pointer(&n[3])));*/
8508 case OPCODE_UNIFORM_MATRIX22
:
8509 CALL_UniformMatrix2fv(ctx
->Exec
,
8510 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8512 case OPCODE_UNIFORM_MATRIX33
:
8513 CALL_UniformMatrix3fv(ctx
->Exec
,
8514 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8516 case OPCODE_UNIFORM_MATRIX44
:
8517 CALL_UniformMatrix4fv(ctx
->Exec
,
8518 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8520 case OPCODE_UNIFORM_MATRIX23
:
8521 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8522 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8524 case OPCODE_UNIFORM_MATRIX32
:
8525 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8526 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8528 case OPCODE_UNIFORM_MATRIX24
:
8529 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8530 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8532 case OPCODE_UNIFORM_MATRIX42
:
8533 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8534 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8536 case OPCODE_UNIFORM_MATRIX34
:
8537 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8538 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8540 case OPCODE_UNIFORM_MATRIX43
:
8541 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8542 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8545 case OPCODE_USE_PROGRAM_STAGES
:
8546 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8548 case OPCODE_PROGRAM_UNIFORM_1F
:
8549 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8551 case OPCODE_PROGRAM_UNIFORM_2F
:
8552 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8554 case OPCODE_PROGRAM_UNIFORM_3F
:
8555 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8556 n
[3].f
, n
[4].f
, n
[5].f
));
8558 case OPCODE_PROGRAM_UNIFORM_4F
:
8559 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8560 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8562 case OPCODE_PROGRAM_UNIFORM_1FV
:
8563 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8564 get_pointer(&n
[4])));
8566 case OPCODE_PROGRAM_UNIFORM_2FV
:
8567 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8568 get_pointer(&n
[4])));
8570 case OPCODE_PROGRAM_UNIFORM_3FV
:
8571 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8572 get_pointer(&n
[4])));
8574 case OPCODE_PROGRAM_UNIFORM_4FV
:
8575 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8576 get_pointer(&n
[4])));
8578 case OPCODE_PROGRAM_UNIFORM_1I
:
8579 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8581 case OPCODE_PROGRAM_UNIFORM_2I
:
8582 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8584 case OPCODE_PROGRAM_UNIFORM_3I
:
8585 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8586 n
[3].i
, n
[4].i
, n
[5].i
));
8588 case OPCODE_PROGRAM_UNIFORM_4I
:
8589 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8590 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8592 case OPCODE_PROGRAM_UNIFORM_1IV
:
8593 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8594 get_pointer(&n
[4])));
8596 case OPCODE_PROGRAM_UNIFORM_2IV
:
8597 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8598 get_pointer(&n
[4])));
8600 case OPCODE_PROGRAM_UNIFORM_3IV
:
8601 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8602 get_pointer(&n
[4])));
8604 case OPCODE_PROGRAM_UNIFORM_4IV
:
8605 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8606 get_pointer(&n
[4])));
8608 case OPCODE_PROGRAM_UNIFORM_1UI
:
8609 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8611 case OPCODE_PROGRAM_UNIFORM_2UI
:
8612 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8615 case OPCODE_PROGRAM_UNIFORM_3UI
:
8616 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8617 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8619 case OPCODE_PROGRAM_UNIFORM_4UI
:
8620 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8622 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8624 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8625 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8626 get_pointer(&n
[4])));
8628 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8629 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8630 get_pointer(&n
[4])));
8632 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8633 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8634 get_pointer(&n
[4])));
8636 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8637 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8638 get_pointer(&n
[4])));
8640 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8641 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8642 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8643 get_pointer(&n
[5])));
8645 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8646 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8647 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8648 get_pointer(&n
[5])));
8650 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8651 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8652 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8653 get_pointer(&n
[5])));
8655 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8656 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8657 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8658 get_pointer(&n
[5])));
8660 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8661 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8662 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8663 get_pointer(&n
[5])));
8665 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8666 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8667 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8668 get_pointer(&n
[5])));
8670 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8671 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8672 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8673 get_pointer(&n
[5])));
8675 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8676 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8677 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8678 get_pointer(&n
[5])));
8680 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8681 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8682 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8683 get_pointer(&n
[5])));
8686 case OPCODE_CLIP_CONTROL
:
8687 CALL_ClipControl(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8690 case OPCODE_CLAMP_COLOR
:
8691 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8694 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8695 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8697 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8700 GLuint i
, dst
= n
[1].ui
;
8702 for (i
= 0; i
< 4; i
++)
8703 values
[i
] = n
[1 + i
].f
;
8704 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8707 case OPCODE_ATTR_1F_NV
:
8708 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8710 case OPCODE_ATTR_2F_NV
:
8711 /* Really shouldn't have to do this - the Node structure
8712 * is convenient, but it would be better to store the data
8713 * packed appropriately so that it can be sent directly
8714 * on. With x86_64 becoming common, this will start to
8717 if (sizeof(Node
) == sizeof(GLfloat
))
8718 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8720 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8722 case OPCODE_ATTR_3F_NV
:
8723 if (sizeof(Node
) == sizeof(GLfloat
))
8724 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8726 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8729 case OPCODE_ATTR_4F_NV
:
8730 if (sizeof(Node
) == sizeof(GLfloat
))
8731 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8733 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8736 case OPCODE_ATTR_1F_ARB
:
8737 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8739 case OPCODE_ATTR_2F_ARB
:
8740 /* Really shouldn't have to do this - the Node structure
8741 * is convenient, but it would be better to store the data
8742 * packed appropriately so that it can be sent directly
8743 * on. With x86_64 becoming common, this will start to
8746 if (sizeof(Node
) == sizeof(GLfloat
))
8747 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8749 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8751 case OPCODE_ATTR_3F_ARB
:
8752 if (sizeof(Node
) == sizeof(GLfloat
))
8753 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8755 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8758 case OPCODE_ATTR_4F_ARB
:
8759 if (sizeof(Node
) == sizeof(GLfloat
))
8760 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8762 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8765 case OPCODE_MATERIAL
:
8766 if (sizeof(Node
) == sizeof(GLfloat
))
8767 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8774 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8778 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8781 CALL_End(ctx
->Exec
, ());
8784 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8786 case OPCODE_EVAL_C1
:
8787 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8789 case OPCODE_EVAL_C2
:
8790 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8792 case OPCODE_EVAL_P1
:
8793 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8795 case OPCODE_EVAL_P2
:
8796 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8799 /* GL_EXT_texture_integer */
8800 case OPCODE_CLEARCOLOR_I
:
8801 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8803 case OPCODE_CLEARCOLOR_UI
:
8804 CALL_ClearColorIuiEXT(ctx
->Exec
,
8805 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8807 case OPCODE_TEXPARAMETER_I
:
8814 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8817 case OPCODE_TEXPARAMETER_UI
:
8820 params
[0] = n
[3].ui
;
8821 params
[1] = n
[4].ui
;
8822 params
[2] = n
[5].ui
;
8823 params
[3] = n
[6].ui
;
8824 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8828 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8829 /* GL_ARB_instanced_arrays */
8830 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8833 case OPCODE_TEXTURE_BARRIER_NV
:
8834 CALL_TextureBarrierNV(ctx
->Exec
, ());
8837 /* GL_EXT/ARB_transform_feedback */
8838 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8839 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8841 case OPCODE_END_TRANSFORM_FEEDBACK
:
8842 CALL_EndTransformFeedback(ctx
->Exec
, ());
8844 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8845 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8847 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8848 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8850 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8851 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8853 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8854 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8856 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8857 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8858 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8860 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8861 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8862 (n
[1].e
, n
[2].ui
, n
[3].si
));
8864 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8865 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8866 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8870 case OPCODE_BIND_SAMPLER
:
8871 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8873 case OPCODE_SAMPLER_PARAMETERIV
:
8880 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8883 case OPCODE_SAMPLER_PARAMETERFV
:
8890 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8893 case OPCODE_SAMPLER_PARAMETERIIV
:
8900 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8903 case OPCODE_SAMPLER_PARAMETERUIV
:
8906 params
[0] = n
[3].ui
;
8907 params
[1] = n
[4].ui
;
8908 params
[2] = n
[5].ui
;
8909 params
[3] = n
[6].ui
;
8910 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8914 /* GL_ARB_geometry_shader4 */
8915 case OPCODE_PROGRAM_PARAMETERI
:
8916 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8918 case OPCODE_FRAMEBUFFER_TEXTURE
:
8919 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8922 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8923 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8924 n
[3].ui
, n
[4].i
, n
[5].e
));
8928 case OPCODE_WAIT_SYNC
:
8930 union uint64_pair p
;
8931 p
.uint32
[0] = n
[2].ui
;
8932 p
.uint32
[1] = n
[3].ui
;
8933 CALL_WaitSync(ctx
->Exec
,
8934 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8938 /* GL_NV_conditional_render */
8939 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8940 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8942 case OPCODE_END_CONDITIONAL_RENDER
:
8943 CALL_EndConditionalRender(ctx
->Exec
, ());
8946 case OPCODE_UNIFORM_BLOCK_BINDING
:
8947 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8950 case OPCODE_CONTINUE
:
8951 n
= (Node
*) get_pointer(&n
[1]);
8956 case OPCODE_END_OF_LIST
:
8962 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8964 _mesa_problem(ctx
, "%s", msg
);
8969 /* increment n to point to next compiled command */
8970 if (opcode
!= OPCODE_CONTINUE
) {
8971 n
+= InstSize
[opcode
];
8976 if (ctx
->Driver
.EndCallList
)
8977 ctx
->Driver
.EndCallList(ctx
);
8979 ctx
->ListState
.CallDepth
--;
8984 /**********************************************************************/
8986 /**********************************************************************/
8989 * Test if a display list number is valid.
8991 GLboolean GLAPIENTRY
8992 _mesa_IsList(GLuint list
)
8994 GET_CURRENT_CONTEXT(ctx
);
8995 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8996 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8997 return islist(ctx
, list
);
9002 * Delete a sequence of consecutive display lists.
9005 _mesa_DeleteLists(GLuint list
, GLsizei range
)
9007 GET_CURRENT_CONTEXT(ctx
);
9009 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9010 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9013 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
9016 for (i
= list
; i
< list
+ range
; i
++) {
9017 destroy_list(ctx
, i
);
9023 * Return a display list number, n, such that lists n through n+range-1
9027 _mesa_GenLists(GLsizei range
)
9029 GET_CURRENT_CONTEXT(ctx
);
9031 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9032 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9035 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9043 * Make this an atomic operation
9045 mtx_lock(&ctx
->Shared
->Mutex
);
9047 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9049 /* reserve the list IDs by with empty/dummy lists */
9051 for (i
= 0; i
< range
; i
++) {
9052 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
9053 make_list(base
+ i
, 1));
9057 mtx_unlock(&ctx
->Shared
->Mutex
);
9064 * Begin a new display list.
9067 _mesa_NewList(GLuint name
, GLenum mode
)
9069 GET_CURRENT_CONTEXT(ctx
);
9071 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9072 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9074 if (MESA_VERBOSE
& VERBOSE_API
)
9075 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9076 _mesa_lookup_enum_by_nr(mode
));
9079 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9083 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9084 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9088 if (ctx
->ListState
.CurrentList
) {
9089 /* already compiling a display list */
9090 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9094 ctx
->CompileFlag
= GL_TRUE
;
9095 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9097 /* Reset accumulated list state */
9098 invalidate_saved_current_state( ctx
);
9100 /* Allocate new display list */
9101 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9102 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9103 ctx
->ListState
.CurrentPos
= 0;
9105 ctx
->Driver
.NewList(ctx
, name
, mode
);
9107 ctx
->CurrentDispatch
= ctx
->Save
;
9108 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9113 * End definition of current display list.
9118 GET_CURRENT_CONTEXT(ctx
);
9119 SAVE_FLUSH_VERTICES(ctx
);
9120 FLUSH_VERTICES(ctx
, 0);
9122 if (MESA_VERBOSE
& VERBOSE_API
)
9123 _mesa_debug(ctx
, "glEndList\n");
9125 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9126 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9127 "glEndList() called inside glBegin/End");
9130 /* Check that a list is under construction */
9131 if (!ctx
->ListState
.CurrentList
) {
9132 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9136 /* Call before emitting END_OF_LIST, in case the driver wants to
9137 * emit opcodes itself.
9139 ctx
->Driver
.EndList(ctx
);
9141 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9145 /* Destroy old list, if any */
9146 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9148 /* Install the new list */
9149 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9150 ctx
->ListState
.CurrentList
->Name
,
9151 ctx
->ListState
.CurrentList
);
9154 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9155 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9157 ctx
->ListState
.CurrentList
= NULL
;
9158 ctx
->ListState
.CurrentBlock
= NULL
;
9159 ctx
->ListState
.CurrentPos
= 0;
9160 ctx
->ExecuteFlag
= GL_TRUE
;
9161 ctx
->CompileFlag
= GL_FALSE
;
9163 ctx
->CurrentDispatch
= ctx
->Exec
;
9164 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9169 _mesa_CallList(GLuint list
)
9171 GLboolean save_compile_flag
;
9172 GET_CURRENT_CONTEXT(ctx
);
9173 FLUSH_CURRENT(ctx
, 0);
9175 if (MESA_VERBOSE
& VERBOSE_API
)
9176 _mesa_debug(ctx
, "glCallList %d\n", list
);
9179 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9184 mesa_print_display_list( list
);
9186 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9187 * execute the display list, and restore the CompileFlag.
9189 save_compile_flag
= ctx
->CompileFlag
;
9190 if (save_compile_flag
) {
9191 ctx
->CompileFlag
= GL_FALSE
;
9194 execute_list(ctx
, list
);
9195 ctx
->CompileFlag
= save_compile_flag
;
9197 /* also restore API function pointers to point to "save" versions */
9198 if (save_compile_flag
) {
9199 ctx
->CurrentDispatch
= ctx
->Save
;
9200 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9206 * Execute glCallLists: call multiple display lists.
9209 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9211 GET_CURRENT_CONTEXT(ctx
);
9213 GLboolean save_compile_flag
;
9215 if (MESA_VERBOSE
& VERBOSE_API
)
9216 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9220 case GL_UNSIGNED_BYTE
:
9222 case GL_UNSIGNED_SHORT
:
9224 case GL_UNSIGNED_INT
:
9232 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9236 /* Save the CompileFlag status, turn it off, execute display list,
9237 * and restore the CompileFlag.
9239 save_compile_flag
= ctx
->CompileFlag
;
9240 ctx
->CompileFlag
= GL_FALSE
;
9242 for (i
= 0; i
< n
; i
++) {
9243 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9244 execute_list(ctx
, list
);
9247 ctx
->CompileFlag
= save_compile_flag
;
9249 /* also restore API function pointers to point to "save" versions */
9250 if (save_compile_flag
) {
9251 ctx
->CurrentDispatch
= ctx
->Save
;
9252 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9258 * Set the offset added to list numbers in glCallLists.
9261 _mesa_ListBase(GLuint base
)
9263 GET_CURRENT_CONTEXT(ctx
);
9264 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9265 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9266 ctx
->List
.ListBase
= base
;
9270 * Setup the given dispatch table to point to Mesa's display list
9271 * building functions.
9273 * This does not include any of the tnl functions - they are
9274 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9278 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9280 struct _glapi_table
*table
= ctx
->Save
;
9281 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9283 /* Initially populate the dispatch table with the contents of the
9284 * normal-execution dispatch table. This lets us skip populating functions
9285 * that should be called directly instead of compiled into display lists.
9287 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9289 _mesa_loopback_init_api_table(ctx
, table
);
9292 vbo_initialize_save_dispatch(ctx
, table
);
9295 SET_Accum(table
, save_Accum
);
9296 SET_AlphaFunc(table
, save_AlphaFunc
);
9297 SET_Bitmap(table
, save_Bitmap
);
9298 SET_BlendFunc(table
, save_BlendFunc
);
9299 SET_CallList(table
, save_CallList
);
9300 SET_CallLists(table
, save_CallLists
);
9301 SET_Clear(table
, save_Clear
);
9302 SET_ClearAccum(table
, save_ClearAccum
);
9303 SET_ClearColor(table
, save_ClearColor
);
9304 SET_ClearDepth(table
, save_ClearDepth
);
9305 SET_ClearIndex(table
, save_ClearIndex
);
9306 SET_ClearStencil(table
, save_ClearStencil
);
9307 SET_ClipPlane(table
, save_ClipPlane
);
9308 SET_ColorMask(table
, save_ColorMask
);
9309 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9310 SET_ColorMaterial(table
, save_ColorMaterial
);
9311 SET_CopyPixels(table
, save_CopyPixels
);
9312 SET_CullFace(table
, save_CullFace
);
9313 SET_DepthFunc(table
, save_DepthFunc
);
9314 SET_DepthMask(table
, save_DepthMask
);
9315 SET_DepthRange(table
, save_DepthRange
);
9316 SET_Disable(table
, save_Disable
);
9317 SET_Disablei(table
, save_DisableIndexed
);
9318 SET_DrawBuffer(table
, save_DrawBuffer
);
9319 SET_DrawPixels(table
, save_DrawPixels
);
9320 SET_Enable(table
, save_Enable
);
9321 SET_Enablei(table
, save_EnableIndexed
);
9322 SET_EvalMesh1(table
, save_EvalMesh1
);
9323 SET_EvalMesh2(table
, save_EvalMesh2
);
9324 SET_Fogf(table
, save_Fogf
);
9325 SET_Fogfv(table
, save_Fogfv
);
9326 SET_Fogi(table
, save_Fogi
);
9327 SET_Fogiv(table
, save_Fogiv
);
9328 SET_FrontFace(table
, save_FrontFace
);
9329 SET_Frustum(table
, save_Frustum
);
9330 SET_Hint(table
, save_Hint
);
9331 SET_IndexMask(table
, save_IndexMask
);
9332 SET_InitNames(table
, save_InitNames
);
9333 SET_LightModelf(table
, save_LightModelf
);
9334 SET_LightModelfv(table
, save_LightModelfv
);
9335 SET_LightModeli(table
, save_LightModeli
);
9336 SET_LightModeliv(table
, save_LightModeliv
);
9337 SET_Lightf(table
, save_Lightf
);
9338 SET_Lightfv(table
, save_Lightfv
);
9339 SET_Lighti(table
, save_Lighti
);
9340 SET_Lightiv(table
, save_Lightiv
);
9341 SET_LineStipple(table
, save_LineStipple
);
9342 SET_LineWidth(table
, save_LineWidth
);
9343 SET_ListBase(table
, save_ListBase
);
9344 SET_LoadIdentity(table
, save_LoadIdentity
);
9345 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9346 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9347 SET_LoadName(table
, save_LoadName
);
9348 SET_LogicOp(table
, save_LogicOp
);
9349 SET_Map1d(table
, save_Map1d
);
9350 SET_Map1f(table
, save_Map1f
);
9351 SET_Map2d(table
, save_Map2d
);
9352 SET_Map2f(table
, save_Map2f
);
9353 SET_MapGrid1d(table
, save_MapGrid1d
);
9354 SET_MapGrid1f(table
, save_MapGrid1f
);
9355 SET_MapGrid2d(table
, save_MapGrid2d
);
9356 SET_MapGrid2f(table
, save_MapGrid2f
);
9357 SET_MatrixMode(table
, save_MatrixMode
);
9358 SET_MultMatrixd(table
, save_MultMatrixd
);
9359 SET_MultMatrixf(table
, save_MultMatrixf
);
9360 SET_NewList(table
, save_NewList
);
9361 SET_Ortho(table
, save_Ortho
);
9362 SET_PassThrough(table
, save_PassThrough
);
9363 SET_PixelMapfv(table
, save_PixelMapfv
);
9364 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9365 SET_PixelMapusv(table
, save_PixelMapusv
);
9366 SET_PixelTransferf(table
, save_PixelTransferf
);
9367 SET_PixelTransferi(table
, save_PixelTransferi
);
9368 SET_PixelZoom(table
, save_PixelZoom
);
9369 SET_PointSize(table
, save_PointSize
);
9370 SET_PolygonMode(table
, save_PolygonMode
);
9371 SET_PolygonOffset(table
, save_PolygonOffset
);
9372 SET_PolygonStipple(table
, save_PolygonStipple
);
9373 SET_PopAttrib(table
, save_PopAttrib
);
9374 SET_PopMatrix(table
, save_PopMatrix
);
9375 SET_PopName(table
, save_PopName
);
9376 SET_PushAttrib(table
, save_PushAttrib
);
9377 SET_PushMatrix(table
, save_PushMatrix
);
9378 SET_PushName(table
, save_PushName
);
9379 SET_RasterPos2d(table
, save_RasterPos2d
);
9380 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9381 SET_RasterPos2f(table
, save_RasterPos2f
);
9382 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9383 SET_RasterPos2i(table
, save_RasterPos2i
);
9384 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9385 SET_RasterPos2s(table
, save_RasterPos2s
);
9386 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9387 SET_RasterPos3d(table
, save_RasterPos3d
);
9388 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9389 SET_RasterPos3f(table
, save_RasterPos3f
);
9390 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9391 SET_RasterPos3i(table
, save_RasterPos3i
);
9392 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9393 SET_RasterPos3s(table
, save_RasterPos3s
);
9394 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9395 SET_RasterPos4d(table
, save_RasterPos4d
);
9396 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9397 SET_RasterPos4f(table
, save_RasterPos4f
);
9398 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9399 SET_RasterPos4i(table
, save_RasterPos4i
);
9400 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9401 SET_RasterPos4s(table
, save_RasterPos4s
);
9402 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9403 SET_ReadBuffer(table
, save_ReadBuffer
);
9404 SET_Rectf(table
, save_Rectf
);
9405 SET_Rotated(table
, save_Rotated
);
9406 SET_Rotatef(table
, save_Rotatef
);
9407 SET_Scaled(table
, save_Scaled
);
9408 SET_Scalef(table
, save_Scalef
);
9409 SET_Scissor(table
, save_Scissor
);
9410 SET_ShadeModel(table
, save_ShadeModel
);
9411 SET_StencilFunc(table
, save_StencilFunc
);
9412 SET_StencilMask(table
, save_StencilMask
);
9413 SET_StencilOp(table
, save_StencilOp
);
9414 SET_TexEnvf(table
, save_TexEnvf
);
9415 SET_TexEnvfv(table
, save_TexEnvfv
);
9416 SET_TexEnvi(table
, save_TexEnvi
);
9417 SET_TexEnviv(table
, save_TexEnviv
);
9418 SET_TexGend(table
, save_TexGend
);
9419 SET_TexGendv(table
, save_TexGendv
);
9420 SET_TexGenf(table
, save_TexGenf
);
9421 SET_TexGenfv(table
, save_TexGenfv
);
9422 SET_TexGeni(table
, save_TexGeni
);
9423 SET_TexGeniv(table
, save_TexGeniv
);
9424 SET_TexImage1D(table
, save_TexImage1D
);
9425 SET_TexImage2D(table
, save_TexImage2D
);
9426 SET_TexParameterf(table
, save_TexParameterf
);
9427 SET_TexParameterfv(table
, save_TexParameterfv
);
9428 SET_TexParameteri(table
, save_TexParameteri
);
9429 SET_TexParameteriv(table
, save_TexParameteriv
);
9430 SET_Translated(table
, save_Translated
);
9431 SET_Translatef(table
, save_Translatef
);
9432 SET_Viewport(table
, save_Viewport
);
9435 SET_BindTexture(table
, save_BindTexture
);
9436 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9437 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9438 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9439 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9440 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9441 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9442 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9445 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9446 SET_TexImage3D(table
, save_TexImage3D
);
9447 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9450 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9451 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9452 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9454 /* ATI_separate_stencil */
9455 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9457 /* GL_ARB_imaging */
9458 /* Not all are supported */
9459 SET_BlendColor(table
, save_BlendColor
);
9460 SET_BlendEquation(table
, save_BlendEquation
);
9462 /* 2. GL_EXT_blend_color */
9464 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9467 /* 3. GL_EXT_polygon_offset */
9468 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9470 /* 6. GL_EXT_texture3d */
9472 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9473 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9474 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9477 /* 37. GL_EXT_blend_minmax */
9479 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9482 /* 54. GL_EXT_point_parameters */
9483 SET_PointParameterf(table
, save_PointParameterfEXT
);
9484 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9486 /* 173. GL_EXT_blend_func_separate */
9487 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9489 /* 197. GL_MESA_window_pos */
9490 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9491 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9492 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9493 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9494 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9495 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9496 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9497 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9498 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9499 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9500 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9501 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9502 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9503 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9504 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9505 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9506 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9507 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9508 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9509 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9510 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9511 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9512 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9513 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9515 /* 233. GL_NV_vertex_program */
9516 /* The following commands DO NOT go into display lists:
9517 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9518 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9520 SET_BindProgramARB(table
, save_BindProgramNV
);
9522 /* 245. GL_ATI_fragment_shader */
9523 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9524 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9526 /* 262. GL_NV_point_sprite */
9527 SET_PointParameteri(table
, save_PointParameteriNV
);
9528 SET_PointParameteriv(table
, save_PointParameterivNV
);
9530 /* 268. GL_EXT_stencil_two_side */
9531 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9533 /* ???. GL_EXT_depth_bounds_test */
9534 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9536 /* ARB 1. GL_ARB_multitexture */
9537 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9539 /* ARB 3. GL_ARB_transpose_matrix */
9540 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9541 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9542 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9543 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9545 /* ARB 5. GL_ARB_multisample */
9546 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9548 /* ARB 12. GL_ARB_texture_compression */
9549 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9550 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9551 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9552 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9553 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9554 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9556 /* ARB 14. GL_ARB_point_parameters */
9557 /* aliased with EXT_point_parameters functions */
9559 /* ARB 25. GL_ARB_window_pos */
9560 /* aliased with MESA_window_pos functions */
9562 /* ARB 26. GL_ARB_vertex_program */
9563 /* ARB 27. GL_ARB_fragment_program */
9564 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9565 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9566 SET_BindProgramARB(table
, save_BindProgramNV
);
9567 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9568 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9569 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9570 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9571 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9572 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9573 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9574 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9576 SET_BeginQuery(table
, save_BeginQueryARB
);
9577 SET_EndQuery(table
, save_EndQueryARB
);
9578 SET_QueryCounter(table
, save_QueryCounter
);
9580 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9582 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9584 SET_UseProgram(table
, save_UseProgramObjectARB
);
9585 SET_Uniform1f(table
, save_Uniform1fARB
);
9586 SET_Uniform2f(table
, save_Uniform2fARB
);
9587 SET_Uniform3f(table
, save_Uniform3fARB
);
9588 SET_Uniform4f(table
, save_Uniform4fARB
);
9589 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9590 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9591 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9592 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9593 SET_Uniform1i(table
, save_Uniform1iARB
);
9594 SET_Uniform2i(table
, save_Uniform2iARB
);
9595 SET_Uniform3i(table
, save_Uniform3iARB
);
9596 SET_Uniform4i(table
, save_Uniform4iARB
);
9597 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9598 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9599 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9600 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9601 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9602 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9603 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9604 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9605 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9606 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9607 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9608 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9609 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9611 /* 299. GL_EXT_blend_equation_separate */
9612 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9614 /* GL_EXT_gpu_program_parameters */
9615 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9616 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9618 /* 364. GL_EXT_provoking_vertex */
9619 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9621 /* GL_EXT_texture_integer */
9622 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9623 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9624 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9625 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9627 /* GL_ARB_clip_control */
9628 SET_ClipControl(table
, save_ClipControl
);
9630 /* GL_ARB_color_buffer_float */
9631 SET_ClampColor(table
, save_ClampColorARB
);
9634 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9635 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9636 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9637 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9639 SET_Uniform1ui(table
, save_Uniform1ui
);
9640 SET_Uniform2ui(table
, save_Uniform2ui
);
9641 SET_Uniform3ui(table
, save_Uniform3ui
);
9642 SET_Uniform4ui(table
, save_Uniform4ui
);
9643 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9644 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9645 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9646 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9648 (void) save_Uniform1ui
;
9649 (void) save_Uniform2ui
;
9650 (void) save_Uniform3ui
;
9651 (void) save_Uniform4ui
;
9652 (void) save_Uniform1uiv
;
9653 (void) save_Uniform2uiv
;
9654 (void) save_Uniform3uiv
;
9655 (void) save_Uniform4uiv
;
9659 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9660 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9661 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9662 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9663 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9664 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9665 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9666 SET_DrawTransformFeedbackInstanced(table
,
9667 save_DrawTransformFeedbackInstanced
);
9668 SET_DrawTransformFeedbackStreamInstanced(table
,
9669 save_DrawTransformFeedbackStreamInstanced
);
9670 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9671 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9673 /* GL_ARB_instanced_arrays */
9674 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9676 /* GL_NV_texture_barrier */
9677 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9679 SET_BindSampler(table
, save_BindSampler
);
9680 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9681 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9682 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9683 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9684 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9685 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9687 /* GL_ARB_draw_buffer_blend */
9688 SET_BlendFunciARB(table
, save_BlendFunci
);
9689 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9690 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9691 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9693 /* GL_ARB_geometry_shader4 */
9694 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9695 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9696 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9698 /* GL_NV_conditional_render */
9699 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9700 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9703 SET_WaitSync(table
, save_WaitSync
);
9705 /* GL_ARB_uniform_buffer_object */
9706 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9708 /* GL_ARB_draw_instanced */
9709 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9710 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9712 /* GL_ARB_draw_elements_base_vertex */
9713 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9715 /* GL_ARB_base_instance */
9716 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9717 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9718 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9720 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9721 SET_UseProgramStages(table
, save_UseProgramStages
);
9722 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9723 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9724 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9725 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9726 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9727 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9728 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9729 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9730 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9731 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9732 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9733 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9734 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9735 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9736 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9737 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9738 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9739 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9740 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9741 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9742 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9743 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9744 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9745 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9746 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9747 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9748 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9749 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9750 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9751 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9752 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9753 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9754 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9760 enum_string(GLenum k
)
9762 return _mesa_lookup_enum_by_nr(k
);
9767 * Print the commands in a display list. For debugging only.
9768 * TODO: many commands aren't handled yet.
9769 * \param fname filename to write display list to. If null, use stdout.
9771 static void GLAPIENTRY
9772 print_list(struct gl_context
*ctx
, GLuint list
, const char *fname
)
9774 struct gl_display_list
*dlist
;
9780 f
= fopen(fname
, "w");
9785 if (!islist(ctx
, list
)) {
9786 fprintf(f
, "%u is not a display list ID\n", list
);
9790 dlist
= _mesa_lookup_list(ctx
, list
);
9796 fprintf(f
, "START-LIST %u, address %p\n", list
, (void *) n
);
9798 done
= n
? GL_FALSE
: GL_TRUE
;
9800 const OpCode opcode
= n
[0].opcode
;
9802 if (is_ext_opcode(opcode
)) {
9803 n
+= ext_opcode_print(ctx
, n
, f
);
9808 fprintf(f
, "Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9810 case OPCODE_ACTIVE_TEXTURE
:
9811 fprintf(f
, "ActiveTexture(%s)\n", enum_string(n
[1].e
));
9814 fprintf(f
, "Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9815 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9816 get_pointer(&n
[7]));
9818 case OPCODE_CALL_LIST
:
9819 fprintf(f
, "CallList %d\n", (int) n
[1].ui
);
9821 case OPCODE_CALL_LIST_OFFSET
:
9822 fprintf(f
, "CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9823 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9825 case OPCODE_DISABLE
:
9826 fprintf(f
, "Disable %s\n", enum_string(n
[1].e
));
9829 fprintf(f
, "Enable %s\n", enum_string(n
[1].e
));
9831 case OPCODE_FRUSTUM
:
9832 fprintf(f
, "Frustum %g %g %g %g %g %g\n",
9833 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9835 case OPCODE_LINE_STIPPLE
:
9836 fprintf(f
, "LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9838 case OPCODE_LOAD_IDENTITY
:
9839 fprintf(f
, "LoadIdentity\n");
9841 case OPCODE_LOAD_MATRIX
:
9842 fprintf(f
, "LoadMatrix\n");
9843 fprintf(f
, " %8f %8f %8f %8f\n",
9844 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9845 fprintf(f
, " %8f %8f %8f %8f\n",
9846 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9847 fprintf(f
, " %8f %8f %8f %8f\n",
9848 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9849 fprintf(f
, " %8f %8f %8f %8f\n",
9850 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9852 case OPCODE_MULT_MATRIX
:
9853 fprintf(f
, "MultMatrix (or Rotate)\n");
9854 fprintf(f
, " %8f %8f %8f %8f\n",
9855 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9856 fprintf(f
, " %8f %8f %8f %8f\n",
9857 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9858 fprintf(f
, " %8f %8f %8f %8f\n",
9859 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9860 fprintf(f
, " %8f %8f %8f %8f\n",
9861 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9864 fprintf(f
, "Ortho %g %g %g %g %g %g\n",
9865 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9867 case OPCODE_POP_ATTRIB
:
9868 fprintf(f
, "PopAttrib\n");
9870 case OPCODE_POP_MATRIX
:
9871 fprintf(f
, "PopMatrix\n");
9873 case OPCODE_POP_NAME
:
9874 fprintf(f
, "PopName\n");
9876 case OPCODE_PUSH_ATTRIB
:
9877 fprintf(f
, "PushAttrib %x\n", n
[1].bf
);
9879 case OPCODE_PUSH_MATRIX
:
9880 fprintf(f
, "PushMatrix\n");
9882 case OPCODE_PUSH_NAME
:
9883 fprintf(f
, "PushName %d\n", (int) n
[1].ui
);
9885 case OPCODE_RASTER_POS
:
9886 fprintf(f
, "RasterPos %g %g %g %g\n",
9887 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9890 fprintf(f
, "Rotate %g %g %g %g\n",
9891 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9894 fprintf(f
, "Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9896 case OPCODE_TRANSLATE
:
9897 fprintf(f
, "Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9899 case OPCODE_BIND_TEXTURE
:
9900 fprintf(f
, "BindTexture %s %d\n",
9901 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9903 case OPCODE_SHADE_MODEL
:
9904 fprintf(f
, "ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9907 fprintf(f
, "Map1 %s %.3f %.3f %d %d\n",
9908 _mesa_lookup_enum_by_nr(n
[1].ui
),
9909 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9912 fprintf(f
, "Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9913 _mesa_lookup_enum_by_nr(n
[1].ui
),
9914 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9915 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9917 case OPCODE_MAPGRID1
:
9918 fprintf(f
, "MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9920 case OPCODE_MAPGRID2
:
9921 fprintf(f
, "MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9922 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9924 case OPCODE_EVALMESH1
:
9925 fprintf(f
, "EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9927 case OPCODE_EVALMESH2
:
9928 fprintf(f
, "EvalMesh2 %d %d %d %d\n",
9929 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9932 case OPCODE_ATTR_1F_NV
:
9933 fprintf(f
, "ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9935 case OPCODE_ATTR_2F_NV
:
9936 fprintf(f
, "ATTR_2F_NV attr %d: %f %f\n",
9937 n
[1].i
, n
[2].f
, n
[3].f
);
9939 case OPCODE_ATTR_3F_NV
:
9940 fprintf(f
, "ATTR_3F_NV attr %d: %f %f %f\n",
9941 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9943 case OPCODE_ATTR_4F_NV
:
9944 fprintf(f
, "ATTR_4F_NV attr %d: %f %f %f %f\n",
9945 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9947 case OPCODE_ATTR_1F_ARB
:
9948 fprintf(f
, "ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9950 case OPCODE_ATTR_2F_ARB
:
9951 fprintf(f
, "ATTR_2F_ARB attr %d: %f %f\n",
9952 n
[1].i
, n
[2].f
, n
[3].f
);
9954 case OPCODE_ATTR_3F_ARB
:
9955 fprintf(f
, "ATTR_3F_ARB attr %d: %f %f %f\n",
9956 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9958 case OPCODE_ATTR_4F_ARB
:
9959 fprintf(f
, "ATTR_4F_ARB attr %d: %f %f %f %f\n",
9960 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9963 case OPCODE_MATERIAL
:
9964 fprintf(f
, "MATERIAL %x %x: %f %f %f %f\n",
9965 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9968 fprintf(f
, "BEGIN %x\n", n
[1].i
);
9971 fprintf(f
, "END\n");
9974 fprintf(f
, "RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9977 case OPCODE_EVAL_C1
:
9978 fprintf(f
, "EVAL_C1 %f\n", n
[1].f
);
9980 case OPCODE_EVAL_C2
:
9981 fprintf(f
, "EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9983 case OPCODE_EVAL_P1
:
9984 fprintf(f
, "EVAL_P1 %d\n", n
[1].i
);
9986 case OPCODE_EVAL_P2
:
9987 fprintf(f
, "EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9990 case OPCODE_PROVOKING_VERTEX
:
9991 fprintf(f
, "ProvokingVertex %s\n",
9992 _mesa_lookup_enum_by_nr(n
[1].ui
));
9996 * meta opcodes/commands
9999 fprintf(f
, "Error: %s %s\n", enum_string(n
[1].e
),
10000 (const char *) get_pointer(&n
[2]));
10002 case OPCODE_CONTINUE
:
10003 fprintf(f
, "DISPLAY-LIST-CONTINUE\n");
10004 n
= (Node
*) get_pointer(&n
[1]);
10007 fprintf(f
, "NOP\n");
10009 case OPCODE_END_OF_LIST
:
10010 fprintf(f
, "END-LIST %u\n", list
);
10014 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
10016 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
10017 opcode
, (void *) n
);
10021 fprintf(f
, "command %d, %u operands\n", opcode
,
10025 /* increment n to point to next compiled command */
10026 if (opcode
!= OPCODE_CONTINUE
) {
10027 n
+= InstSize
[opcode
];
10040 * Clients may call this function to help debug display list problems.
10041 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
10042 * changed, or break in the future without notice.
10045 mesa_print_display_list(GLuint list
)
10047 GET_CURRENT_CONTEXT(ctx
);
10048 print_list(ctx
, list
, NULL
);
10052 /**********************************************************************/
10053 /***** Initialization *****/
10054 /**********************************************************************/
10057 save_vtxfmt_init(GLvertexformat
* vfmt
)
10059 vfmt
->ArrayElement
= _ae_ArrayElement
;
10061 vfmt
->Begin
= save_Begin
;
10063 vfmt
->CallList
= save_CallList
;
10064 vfmt
->CallLists
= save_CallLists
;
10066 vfmt
->Color3f
= save_Color3f
;
10067 vfmt
->Color3fv
= save_Color3fv
;
10068 vfmt
->Color4f
= save_Color4f
;
10069 vfmt
->Color4fv
= save_Color4fv
;
10070 vfmt
->EdgeFlag
= save_EdgeFlag
;
10071 vfmt
->End
= save_End
;
10073 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10074 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10075 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10076 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10077 vfmt
->EvalPoint1
= save_EvalPoint1
;
10078 vfmt
->EvalPoint2
= save_EvalPoint2
;
10080 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10081 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10082 vfmt
->Indexf
= save_Indexf
;
10083 vfmt
->Indexfv
= save_Indexfv
;
10084 vfmt
->Materialfv
= save_Materialfv
;
10085 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10086 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10087 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10088 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10089 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10090 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10091 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10092 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10093 vfmt
->Normal3f
= save_Normal3f
;
10094 vfmt
->Normal3fv
= save_Normal3fv
;
10095 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10096 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10097 vfmt
->TexCoord1f
= save_TexCoord1f
;
10098 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10099 vfmt
->TexCoord2f
= save_TexCoord2f
;
10100 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10101 vfmt
->TexCoord3f
= save_TexCoord3f
;
10102 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10103 vfmt
->TexCoord4f
= save_TexCoord4f
;
10104 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10105 vfmt
->Vertex2f
= save_Vertex2f
;
10106 vfmt
->Vertex2fv
= save_Vertex2fv
;
10107 vfmt
->Vertex3f
= save_Vertex3f
;
10108 vfmt
->Vertex3fv
= save_Vertex3fv
;
10109 vfmt
->Vertex4f
= save_Vertex4f
;
10110 vfmt
->Vertex4fv
= save_Vertex4fv
;
10111 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10112 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10113 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10114 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10115 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10116 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10117 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10118 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10123 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10124 const GLvertexformat
*vfmt
)
10126 SET_CallList(disp
, vfmt
->CallList
);
10127 SET_CallLists(disp
, vfmt
->CallLists
);
10132 * Initialize display list state for given context.
10135 _mesa_init_display_list(struct gl_context
*ctx
)
10137 static GLboolean tableInitialized
= GL_FALSE
;
10139 /* zero-out the instruction size table, just once */
10140 if (!tableInitialized
) {
10141 memset(InstSize
, 0, sizeof(InstSize
));
10142 tableInitialized
= GL_TRUE
;
10145 /* extension info */
10146 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10149 ctx
->ListState
.CallDepth
= 0;
10150 ctx
->ExecuteFlag
= GL_TRUE
;
10151 ctx
->CompileFlag
= GL_FALSE
;
10152 ctx
->ListState
.CurrentBlock
= NULL
;
10153 ctx
->ListState
.CurrentPos
= 0;
10155 /* Display List group */
10156 ctx
->List
.ListBase
= 0;
10158 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10160 InstSize
[OPCODE_NOP
] = 1;
10165 _mesa_free_display_list_data(struct gl_context
*ctx
)
10167 free(ctx
->ListExt
);
10168 ctx
->ListExt
= NULL
;