2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
36 #include "api_loopback.h"
37 #include "api_validate.h"
38 #include "atifragshader.h"
40 #include "bufferobj.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
61 #include "texstorage.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
67 #include "math/m_matrix.h"
69 #include "main/dispatch.h"
76 * Other parts of Mesa (such as the VBO module) can plug into the display
77 * list system. This structure describes new display list instructions.
79 struct gl_list_instruction
82 void (*Execute
)( struct gl_context
*ctx
, void *data
);
83 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
84 void (*Print
)( struct gl_context
*ctx
, void *data
);
88 #define MAX_DLIST_EXT_OPCODES 16
91 * Used by device drivers to hook new commands into display lists.
93 struct gl_list_extensions
95 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
104 * \param ctx GL context.
106 * Checks if dd_function_table::SaveNeedFlush is marked to flush
107 * stored (save) vertices, and calls
108 * dd_function_table::SaveFlushVertices if so.
110 #define SAVE_FLUSH_VERTICES(ctx) \
112 if (ctx->Driver.SaveNeedFlush) \
113 ctx->Driver.SaveFlushVertices(ctx); \
118 * Macro to assert that the API call was made outside the
119 * glBegin()/glEnd() pair, with return value.
121 * \param ctx GL context.
122 * \param retval value to return value in case the assertion fails.
124 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
126 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
127 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 * Macro to assert that the API call was made outside the
134 * glBegin()/glEnd() pair.
136 * \param ctx GL context.
138 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
140 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
141 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 * Macro to assert that the API call was made outside the
148 * glBegin()/glEnd() pair and flush the vertices.
150 * \param ctx GL context.
152 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
155 SAVE_FLUSH_VERTICES(ctx); \
159 * Macro to assert that the API call was made outside the
160 * glBegin()/glEnd() pair and flush the vertices, with return value.
162 * \param ctx GL context.
163 * \param retval value to return value in case the assertion fails.
165 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
167 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
168 SAVE_FLUSH_VERTICES(ctx); \
174 * Display list opcodes.
176 * The fact that these identifiers are assigned consecutive
177 * integer values starting at 0 is very important, see InstSize array usage)
181 OPCODE_INVALID
= -1, /* Force signed enum */
187 OPCODE_BLEND_EQUATION
,
188 OPCODE_BLEND_EQUATION_SEPARATE
,
189 OPCODE_BLEND_FUNC_SEPARATE
,
191 OPCODE_BLEND_EQUATION_I
,
192 OPCODE_BLEND_EQUATION_SEPARATE_I
,
194 OPCODE_BLEND_FUNC_SEPARATE_I
,
197 OPCODE_CALL_LIST_OFFSET
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COPY_TEX_IMAGE1D
,
214 OPCODE_COPY_TEX_IMAGE2D
,
215 OPCODE_COPY_TEX_SUB_IMAGE1D
,
216 OPCODE_COPY_TEX_SUB_IMAGE2D
,
217 OPCODE_COPY_TEX_SUB_IMAGE3D
,
223 OPCODE_DISABLE_INDEXED
,
227 OPCODE_ENABLE_INDEXED
,
241 OPCODE_LOAD_IDENTITY
,
254 OPCODE_PIXEL_TRANSFER
,
257 OPCODE_POINT_PARAMETERS
,
259 OPCODE_POLYGON_STIPPLE
,
260 OPCODE_POLYGON_OFFSET
,
264 OPCODE_PRIORITIZE_TEXTURE
,
273 OPCODE_SELECT_TEXTURE_SGIS
,
274 OPCODE_SELECT_TEXTURE_COORD_SET
,
285 OPCODE_TEX_SUB_IMAGE1D
,
286 OPCODE_TEX_SUB_IMAGE2D
,
287 OPCODE_TEX_SUB_IMAGE3D
,
291 /* GL_ARB_multitexture */
292 OPCODE_ACTIVE_TEXTURE
,
293 /* GL_ARB_texture_compression */
294 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
295 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
296 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
297 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
298 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
299 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
300 /* GL_ARB_multisample */
301 OPCODE_SAMPLE_COVERAGE
,
302 /* GL_ARB_window_pos */
303 OPCODE_WINDOW_POS_ARB
,
304 /* GL_NV_fragment_program */
305 OPCODE_BIND_PROGRAM_NV
,
306 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
307 /* GL_EXT_stencil_two_side */
308 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
309 /* GL_EXT_depth_bounds_test */
310 OPCODE_DEPTH_BOUNDS_EXT
,
311 /* GL_ARB_vertex/fragment_program */
312 OPCODE_PROGRAM_STRING_ARB
,
313 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
314 /* GL_ARB_occlusion_query */
315 OPCODE_BEGIN_QUERY_ARB
,
316 OPCODE_END_QUERY_ARB
,
317 /* GL_ARB_draw_buffers */
318 OPCODE_DRAW_BUFFERS_ARB
,
319 /* GL_ATI_fragment_shader */
320 OPCODE_TEX_BUMP_PARAMETER_ATI
,
321 /* GL_ATI_fragment_shader */
322 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
323 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
325 OPCODE_STENCIL_FUNC_SEPARATE
,
326 OPCODE_STENCIL_OP_SEPARATE
,
327 OPCODE_STENCIL_MASK_SEPARATE
,
329 /* GL_ARB_shader_objects */
347 OPCODE_UNIFORM_MATRIX22
,
348 OPCODE_UNIFORM_MATRIX33
,
349 OPCODE_UNIFORM_MATRIX44
,
350 OPCODE_UNIFORM_MATRIX23
,
351 OPCODE_UNIFORM_MATRIX32
,
352 OPCODE_UNIFORM_MATRIX24
,
353 OPCODE_UNIFORM_MATRIX42
,
354 OPCODE_UNIFORM_MATRIX34
,
355 OPCODE_UNIFORM_MATRIX43
,
367 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
368 OPCODE_USE_PROGRAM_STAGES
,
369 OPCODE_PROGRAM_UNIFORM_1F
,
370 OPCODE_PROGRAM_UNIFORM_2F
,
371 OPCODE_PROGRAM_UNIFORM_3F
,
372 OPCODE_PROGRAM_UNIFORM_4F
,
373 OPCODE_PROGRAM_UNIFORM_1FV
,
374 OPCODE_PROGRAM_UNIFORM_2FV
,
375 OPCODE_PROGRAM_UNIFORM_3FV
,
376 OPCODE_PROGRAM_UNIFORM_4FV
,
377 OPCODE_PROGRAM_UNIFORM_1I
,
378 OPCODE_PROGRAM_UNIFORM_2I
,
379 OPCODE_PROGRAM_UNIFORM_3I
,
380 OPCODE_PROGRAM_UNIFORM_4I
,
381 OPCODE_PROGRAM_UNIFORM_1IV
,
382 OPCODE_PROGRAM_UNIFORM_2IV
,
383 OPCODE_PROGRAM_UNIFORM_3IV
,
384 OPCODE_PROGRAM_UNIFORM_4IV
,
385 OPCODE_PROGRAM_UNIFORM_1UI
,
386 OPCODE_PROGRAM_UNIFORM_2UI
,
387 OPCODE_PROGRAM_UNIFORM_3UI
,
388 OPCODE_PROGRAM_UNIFORM_4UI
,
389 OPCODE_PROGRAM_UNIFORM_1UIV
,
390 OPCODE_PROGRAM_UNIFORM_2UIV
,
391 OPCODE_PROGRAM_UNIFORM_3UIV
,
392 OPCODE_PROGRAM_UNIFORM_4UIV
,
393 OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
394 OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
395 OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
396 OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
397 OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
398 OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
399 OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
400 OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
401 OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
403 /* GL_ARB_color_buffer_float */
406 /* GL_EXT_framebuffer_blit */
407 OPCODE_BLIT_FRAMEBUFFER
,
409 /* Vertex attributes -- fallback for when optimized display
410 * list build isn't active.
429 /* GL_EXT_provoking_vertex */
430 OPCODE_PROVOKING_VERTEX
,
432 /* GL_EXT_transform_feedback */
433 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
434 OPCODE_END_TRANSFORM_FEEDBACK
,
435 OPCODE_BIND_TRANSFORM_FEEDBACK
,
436 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
437 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
438 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
440 /* GL_EXT_texture_integer */
442 OPCODE_CLEARCOLOR_UI
,
443 OPCODE_TEXPARAMETER_I
,
444 OPCODE_TEXPARAMETER_UI
,
446 /* GL_ARB_instanced_arrays */
447 OPCODE_VERTEX_ATTRIB_DIVISOR
,
449 /* GL_NV_texture_barrier */
450 OPCODE_TEXTURE_BARRIER_NV
,
452 /* GL_ARB_sampler_object */
454 OPCODE_SAMPLER_PARAMETERIV
,
455 OPCODE_SAMPLER_PARAMETERFV
,
456 OPCODE_SAMPLER_PARAMETERIIV
,
457 OPCODE_SAMPLER_PARAMETERUIV
,
459 /* GL_ARB_geometry_shader4 */
460 OPCODE_PROGRAM_PARAMETERI
,
461 OPCODE_FRAMEBUFFER_TEXTURE
,
462 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
467 /* GL_NV_conditional_render */
468 OPCODE_BEGIN_CONDITIONAL_RENDER
,
469 OPCODE_END_CONDITIONAL_RENDER
,
471 /* ARB_timer_query */
472 OPCODE_QUERY_COUNTER
,
474 /* ARB_transform_feedback3 */
475 OPCODE_BEGIN_QUERY_INDEXED
,
476 OPCODE_END_QUERY_INDEXED
,
477 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
479 /* ARB_transform_feedback_instanced */
480 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
481 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
483 /* ARB_uniform_buffer_object */
484 OPCODE_UNIFORM_BLOCK_BINDING
,
486 /* The following three are meta instructions */
487 OPCODE_ERROR
, /* raise compiled-in error */
498 * Display list instructions are stored as sequences of "nodes". Nodes
499 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
500 * are linked together with a pointer.
502 * Each instruction in the display list is stored as a sequence of
503 * contiguous nodes in memory.
504 * Each node is the union of a variety of data types.
506 * Note, all of these members should be 4 bytes in size or less for the
507 * sake of compact display lists. We store 8-byte pointers in a pair of
508 * these nodes using the save/get_pointer() functions below.
526 typedef union gl_dlist_node Node
;
529 /** How many 4-byte dwords to store a pointer */
530 #define POINTER_DWORDS (sizeof(void *) / 4)
532 /* We want to keep sizeof(union gl_dlist_node) == 4 to minimize
533 * space for display lists. The following types and functions are
534 * used to help store 4- and 8-byte pointers in 1 or 2 dlist_nodes.
539 GLuint dwords
[POINTER_DWORDS
];
544 * Save a 4 or 8-byte pointer at dest (and dest+1).
547 save_pointer(union gl_dlist_node
*dest
, void *src
)
552 STATIC_ASSERT(POINTER_DWORDS
== 1 || POINTER_DWORDS
== 2);
553 STATIC_ASSERT(sizeof(union gl_dlist_node
) == 4);
557 for (i
= 0; i
< POINTER_DWORDS
; i
++)
558 dest
[i
].ui
= p
.dwords
[i
];
563 * Retrieve a 4 or 8-byte pointer from node (node+1).
566 get_pointer(const union gl_dlist_node
*node
)
571 for (i
= 0; i
< POINTER_DWORDS
; i
++)
572 p
.dwords
[i
] = node
[i
].ui
;
579 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
580 * environment. In 64-bit env, sizeof(Node)==8 anyway.
590 * How many nodes to allocate at a time. Note that bulk vertex data
591 * from glBegin/glVertex/glEnd primitives will typically wind up in
592 * a VBO, and not directly in the display list itself.
594 #define BLOCK_SIZE 256
599 * Number of nodes of storage needed for each instruction.
600 * Sizes for dynamically allocated opcodes are stored in the context struct.
602 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
605 void mesa_print_display_list(GLuint list
);
609 * Allocate a gl_display_list object with an initial block of storage.
610 * \param count how many display list nodes/tokes to allocate
612 static struct gl_display_list
*
613 make_list(GLuint name
, GLuint count
)
615 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
617 dlist
->Head
= malloc(sizeof(Node
) * count
);
618 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
624 * Lookup function to just encapsulate casting.
626 struct gl_display_list
*
627 _mesa_lookup_list(struct gl_context
*ctx
, GLuint list
)
629 return (struct gl_display_list
*)
630 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
634 /** Is the given opcode an extension code? */
635 static inline GLboolean
636 is_ext_opcode(OpCode opcode
)
638 return (opcode
>= OPCODE_EXT_0
);
642 /** Destroy an extended opcode instruction */
644 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
646 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
648 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
649 step
= ctx
->ListExt
->Opcode
[i
].Size
;
654 /** Execute an extended opcode instruction */
656 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
658 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
660 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
661 step
= ctx
->ListExt
->Opcode
[i
].Size
;
666 /** Print an extended opcode instruction */
668 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
670 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
672 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
673 step
= ctx
->ListExt
->Opcode
[i
].Size
;
679 * Delete the named display list, but don't remove from hash table.
680 * \param dlist - display list pointer
683 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
688 n
= block
= dlist
->Head
;
690 done
= block
? GL_FALSE
: GL_TRUE
;
692 const OpCode opcode
= n
[0].opcode
;
694 /* check for extension opcodes first */
695 if (is_ext_opcode(opcode
)) {
696 n
+= ext_opcode_destroy(ctx
, n
);
700 /* for some commands, we need to free malloc'd memory */
702 free(get_pointer(&n
[6]));
703 n
+= InstSize
[n
[0].opcode
];
706 free(get_pointer(&n
[10]));
707 n
+= InstSize
[n
[0].opcode
];
709 case OPCODE_DRAW_PIXELS
:
710 free(get_pointer(&n
[5]));
711 n
+= InstSize
[n
[0].opcode
];
714 free(get_pointer(&n
[7]));
715 n
+= InstSize
[n
[0].opcode
];
717 case OPCODE_POLYGON_STIPPLE
:
718 free(get_pointer(&n
[1]));
719 n
+= InstSize
[n
[0].opcode
];
721 case OPCODE_TEX_IMAGE1D
:
722 free(get_pointer(&n
[8]));
723 n
+= InstSize
[n
[0].opcode
];
725 case OPCODE_TEX_IMAGE2D
:
726 free(get_pointer(&n
[9]));
727 n
+= InstSize
[n
[0].opcode
];
729 case OPCODE_TEX_IMAGE3D
:
730 free(get_pointer(&n
[10]));
731 n
+= InstSize
[n
[0].opcode
];
733 case OPCODE_TEX_SUB_IMAGE1D
:
734 free(get_pointer(&n
[7]));
735 n
+= InstSize
[n
[0].opcode
];
737 case OPCODE_TEX_SUB_IMAGE2D
:
738 free(get_pointer(&n
[9]));
739 n
+= InstSize
[n
[0].opcode
];
741 case OPCODE_TEX_SUB_IMAGE3D
:
742 free(get_pointer(&n
[11]));
743 n
+= InstSize
[n
[0].opcode
];
745 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
746 free(get_pointer(&n
[7]));
747 n
+= InstSize
[n
[0].opcode
];
749 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
750 free(get_pointer(&n
[8]));
751 n
+= InstSize
[n
[0].opcode
];
753 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
754 free(get_pointer(&n
[9]));
755 n
+= InstSize
[n
[0].opcode
];
757 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
758 free(get_pointer(&n
[7]));
759 n
+= InstSize
[n
[0].opcode
];
761 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
762 free(get_pointer(&n
[9]));
763 n
+= InstSize
[n
[0].opcode
];
765 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
766 free(get_pointer(&n
[11]));
767 n
+= InstSize
[n
[0].opcode
];
769 case OPCODE_PROGRAM_STRING_ARB
:
770 free(get_pointer(&n
[4])); /* program string */
771 n
+= InstSize
[n
[0].opcode
];
773 case OPCODE_UNIFORM_1FV
:
774 case OPCODE_UNIFORM_2FV
:
775 case OPCODE_UNIFORM_3FV
:
776 case OPCODE_UNIFORM_4FV
:
777 case OPCODE_UNIFORM_1IV
:
778 case OPCODE_UNIFORM_2IV
:
779 case OPCODE_UNIFORM_3IV
:
780 case OPCODE_UNIFORM_4IV
:
781 case OPCODE_UNIFORM_1UIV
:
782 case OPCODE_UNIFORM_2UIV
:
783 case OPCODE_UNIFORM_3UIV
:
784 case OPCODE_UNIFORM_4UIV
:
785 free(get_pointer(&n
[3]));
786 n
+= InstSize
[n
[0].opcode
];
788 case OPCODE_UNIFORM_MATRIX22
:
789 case OPCODE_UNIFORM_MATRIX33
:
790 case OPCODE_UNIFORM_MATRIX44
:
791 case OPCODE_UNIFORM_MATRIX24
:
792 case OPCODE_UNIFORM_MATRIX42
:
793 case OPCODE_UNIFORM_MATRIX23
:
794 case OPCODE_UNIFORM_MATRIX32
:
795 case OPCODE_UNIFORM_MATRIX34
:
796 case OPCODE_UNIFORM_MATRIX43
:
797 free(get_pointer(&n
[4]));
798 n
+= InstSize
[n
[0].opcode
];
800 case OPCODE_PROGRAM_UNIFORM_1FV
:
801 case OPCODE_PROGRAM_UNIFORM_2FV
:
802 case OPCODE_PROGRAM_UNIFORM_3FV
:
803 case OPCODE_PROGRAM_UNIFORM_4FV
:
804 case OPCODE_PROGRAM_UNIFORM_1IV
:
805 case OPCODE_PROGRAM_UNIFORM_2IV
:
806 case OPCODE_PROGRAM_UNIFORM_3IV
:
807 case OPCODE_PROGRAM_UNIFORM_4IV
:
808 case OPCODE_PROGRAM_UNIFORM_1UIV
:
809 case OPCODE_PROGRAM_UNIFORM_2UIV
:
810 case OPCODE_PROGRAM_UNIFORM_3UIV
:
811 case OPCODE_PROGRAM_UNIFORM_4UIV
:
812 free(get_pointer(&n
[4]));
813 n
+= InstSize
[n
[0].opcode
];
815 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
816 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
817 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
818 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
819 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
820 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
821 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
822 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
823 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
824 free(get_pointer(&n
[5]));
825 n
+= InstSize
[n
[0].opcode
];
827 case OPCODE_PIXEL_MAP
:
828 free(get_pointer(&n
[3]));
829 n
+= InstSize
[n
[0].opcode
];
832 case OPCODE_CONTINUE
:
833 n
= (Node
*) get_pointer(&n
[1]);
837 case OPCODE_END_OF_LIST
:
842 /* Most frequent case */
843 n
+= InstSize
[n
[0].opcode
];
855 * Destroy a display list and remove from hash table.
856 * \param list - display list number
859 destroy_list(struct gl_context
*ctx
, GLuint list
)
861 struct gl_display_list
*dlist
;
866 dlist
= _mesa_lookup_list(ctx
, list
);
870 _mesa_delete_list(ctx
, dlist
);
871 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
876 * Translate the nth element of list from <type> to GLint.
879 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
891 bptr
= (GLbyte
*) list
;
892 return (GLint
) bptr
[n
];
893 case GL_UNSIGNED_BYTE
:
894 ubptr
= (GLubyte
*) list
;
895 return (GLint
) ubptr
[n
];
897 sptr
= (GLshort
*) list
;
898 return (GLint
) sptr
[n
];
899 case GL_UNSIGNED_SHORT
:
900 usptr
= (GLushort
*) list
;
901 return (GLint
) usptr
[n
];
903 iptr
= (GLint
*) list
;
905 case GL_UNSIGNED_INT
:
906 uiptr
= (GLuint
*) list
;
907 return (GLint
) uiptr
[n
];
909 fptr
= (GLfloat
*) list
;
910 return (GLint
) FLOORF(fptr
[n
]);
912 ubptr
= ((GLubyte
*) list
) + 2 * n
;
913 return (GLint
) ubptr
[0] * 256
916 ubptr
= ((GLubyte
*) list
) + 3 * n
;
917 return (GLint
) ubptr
[0] * 65536
918 + (GLint
) ubptr
[1] * 256
921 ubptr
= ((GLubyte
*) list
) + 4 * n
;
922 return (GLint
) ubptr
[0] * 16777216
923 + (GLint
) ubptr
[1] * 65536
924 + (GLint
) ubptr
[2] * 256
933 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
934 * If width < 0 or height < 0 or format or type are invalid we'll just
935 * return NULL. We will not generate an error since OpenGL command
936 * arguments aren't error-checked until the command is actually executed
937 * (not when they're compiled).
938 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
941 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
942 GLsizei width
, GLsizei height
, GLsizei depth
,
943 GLenum format
, GLenum type
, const GLvoid
* pixels
,
944 const struct gl_pixelstore_attrib
*unpack
)
946 if (width
<= 0 || height
<= 0) {
950 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
951 /* bad format and/or type */
955 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
959 if (type
== GL_BITMAP
)
960 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
962 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
963 format
, type
, pixels
, unpack
);
964 if (pixels
&& !image
) {
965 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
969 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
970 depth
, format
, type
, INT_MAX
, pixels
)) {
971 const GLubyte
*map
, *src
;
975 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
976 GL_MAP_READ_BIT
, unpack
->BufferObj
,
979 /* unable to map src buffer! */
980 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
984 src
= ADD_POINTERS(map
, pixels
);
985 if (type
== GL_BITMAP
)
986 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
988 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
989 format
, type
, src
, unpack
);
991 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
, MAP_INTERNAL
);
994 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
1000 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
1005 /** Return copy of memory */
1007 memdup(const void *src
, GLsizei bytes
)
1009 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
1011 memcpy(b
, src
, bytes
);
1017 * Allocate space for a display list instruction (opcode + payload space).
1018 * \param opcode the instruction opcode (OPCODE_* value)
1019 * \param bytes instruction payload size (not counting opcode)
1020 * \return pointer to allocated memory (the opcode space)
1023 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
1025 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
1026 const GLuint contNodes
= 1 + POINTER_DWORDS
; /* size of continue info */
1029 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
1030 if (InstSize
[opcode
] == 0) {
1031 /* save instruction size now */
1032 InstSize
[opcode
] = numNodes
;
1035 /* make sure instruction size agrees */
1036 ASSERT(numNodes
== InstSize
[opcode
]);
1040 if (ctx
->ListState
.CurrentPos
+ numNodes
+ contNodes
> BLOCK_SIZE
) {
1041 /* This block is full. Allocate a new block and chain to it */
1043 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1044 n
[0].opcode
= OPCODE_CONTINUE
;
1045 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
1047 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
1050 save_pointer(&n
[1], newblock
);
1051 ctx
->ListState
.CurrentBlock
= newblock
;
1052 ctx
->ListState
.CurrentPos
= 0;
1055 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
1056 ctx
->ListState
.CurrentPos
+= numNodes
;
1058 n
[0].opcode
= opcode
;
1066 * Allocate space for a display list instruction. Used by callers outside
1067 * this file for things like VBO vertex data.
1069 * \param opcode the instruction opcode (OPCODE_* value)
1070 * \param bytes instruction size in bytes, not counting opcode.
1071 * \return pointer to the usable data area (not including the internal
1075 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
1077 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
1079 return n
+ 1; /* return pointer to payload area, after opcode */
1086 * This function allows modules and drivers to get their own opcodes
1087 * for extending display list functionality.
1088 * \param ctx the rendering context
1089 * \param size number of bytes for storing the new display list command
1090 * \param execute function to execute the new display list command
1091 * \param destroy function to destroy the new display list command
1092 * \param print function to print the new display list command
1093 * \return the new opcode number or -1 if error
1096 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1098 void (*execute
) (struct gl_context
*, void *),
1099 void (*destroy
) (struct gl_context
*, void *),
1100 void (*print
) (struct gl_context
*, void *))
1102 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1103 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1104 ctx
->ListExt
->Opcode
[i
].Size
=
1105 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1106 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1107 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1108 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1109 return i
+ OPCODE_EXT_0
;
1116 * Allocate space for a display list instruction. The space is basically
1117 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1118 * function parameter, node[2] is the second parameter, etc.
1120 * \param opcode one of OPCODE_x
1121 * \param nparams number of function parameters
1122 * \return pointer to start of instruction space
1124 static inline Node
*
1125 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1127 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1132 * Called by EndList to try to reduce memory used for the list.
1135 trim_list(struct gl_context
*ctx
)
1137 /* If the list we're ending only has one allocated block of nodes/tokens
1138 * and its size isn't a full block size, realloc the block to use less
1139 * memory. This is important for apps that create many small display
1140 * lists and apps that use glXUseXFont (many lists each containing one
1142 * Note: we currently only trim display lists that allocated one block
1143 * of tokens. That hits the short list case which is what we're mainly
1144 * concerned with. Trimming longer lists would involve traversing the
1145 * linked list of blocks.
1147 struct gl_dlist_state
*list
= &ctx
->ListState
;
1149 if ((list
->CurrentList
->Head
== list
->CurrentBlock
) &&
1150 (list
->CurrentPos
< BLOCK_SIZE
)) {
1151 /* There's only one block and it's not full, so realloc */
1152 GLuint newSize
= list
->CurrentPos
* sizeof(Node
);
1153 list
->CurrentList
->Head
=
1154 list
->CurrentBlock
= realloc(list
->CurrentBlock
, newSize
);
1155 if (!list
->CurrentBlock
) {
1156 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glEndList");
1164 * Display List compilation functions
1166 static void GLAPIENTRY
1167 save_Accum(GLenum op
, GLfloat value
)
1169 GET_CURRENT_CONTEXT(ctx
);
1171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1172 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1177 if (ctx
->ExecuteFlag
) {
1178 CALL_Accum(ctx
->Exec
, (op
, value
));
1183 static void GLAPIENTRY
1184 save_AlphaFunc(GLenum func
, GLclampf ref
)
1186 GET_CURRENT_CONTEXT(ctx
);
1188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1189 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1192 n
[2].f
= (GLfloat
) ref
;
1194 if (ctx
->ExecuteFlag
) {
1195 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1200 static void GLAPIENTRY
1201 save_BindTexture(GLenum target
, GLuint texture
)
1203 GET_CURRENT_CONTEXT(ctx
);
1205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1206 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1211 if (ctx
->ExecuteFlag
) {
1212 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1217 static void GLAPIENTRY
1218 save_Bitmap(GLsizei width
, GLsizei height
,
1219 GLfloat xorig
, GLfloat yorig
,
1220 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1222 GET_CURRENT_CONTEXT(ctx
);
1224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1225 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 6 + POINTER_DWORDS
);
1227 n
[1].i
= (GLint
) width
;
1228 n
[2].i
= (GLint
) height
;
1234 unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1235 GL_BITMAP
, pixels
, &ctx
->Unpack
));
1237 if (ctx
->ExecuteFlag
) {
1238 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1239 xorig
, yorig
, xmove
, ymove
, pixels
));
1244 static void GLAPIENTRY
1245 save_BlendEquation(GLenum mode
)
1247 GET_CURRENT_CONTEXT(ctx
);
1249 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1250 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1254 if (ctx
->ExecuteFlag
) {
1255 CALL_BlendEquation(ctx
->Exec
, (mode
));
1260 static void GLAPIENTRY
1261 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1263 GET_CURRENT_CONTEXT(ctx
);
1265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1266 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1271 if (ctx
->ExecuteFlag
) {
1272 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1277 static void GLAPIENTRY
1278 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1279 GLenum sfactorA
, GLenum dfactorA
)
1281 GET_CURRENT_CONTEXT(ctx
);
1283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1284 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1286 n
[1].e
= sfactorRGB
;
1287 n
[2].e
= dfactorRGB
;
1291 if (ctx
->ExecuteFlag
) {
1292 CALL_BlendFuncSeparate(ctx
->Exec
,
1293 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1298 static void GLAPIENTRY
1299 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1301 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1305 static void GLAPIENTRY
1306 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1308 GET_CURRENT_CONTEXT(ctx
);
1310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1311 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1318 if (ctx
->ExecuteFlag
) {
1319 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1323 /* GL_ARB_draw_buffers_blend */
1324 static void GLAPIENTRY
1325 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1326 GLenum sfactorA
, GLenum dfactorA
)
1328 GET_CURRENT_CONTEXT(ctx
);
1330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1331 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1334 n
[2].e
= sfactorRGB
;
1335 n
[3].e
= dfactorRGB
;
1339 if (ctx
->ExecuteFlag
) {
1340 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1341 sfactorA
, dfactorA
));
1345 /* GL_ARB_draw_buffers_blend */
1346 static void GLAPIENTRY
1347 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1349 GET_CURRENT_CONTEXT(ctx
);
1351 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1352 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1358 if (ctx
->ExecuteFlag
) {
1359 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1363 /* GL_ARB_draw_buffers_blend */
1364 static void GLAPIENTRY
1365 save_BlendEquationi(GLuint buf
, GLenum mode
)
1367 GET_CURRENT_CONTEXT(ctx
);
1369 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1370 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1375 if (ctx
->ExecuteFlag
) {
1376 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1380 /* GL_ARB_draw_buffers_blend */
1381 static void GLAPIENTRY
1382 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1384 GET_CURRENT_CONTEXT(ctx
);
1386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1387 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1393 if (ctx
->ExecuteFlag
) {
1394 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1399 /* GL_ARB_draw_instanced. */
1400 static void GLAPIENTRY
1401 save_DrawArraysInstancedARB(GLenum mode
,
1406 GET_CURRENT_CONTEXT(ctx
);
1407 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1408 "glDrawArraysInstanced() during display list compile");
1411 static void GLAPIENTRY
1412 save_DrawElementsInstancedARB(GLenum mode
,
1415 const GLvoid
*indices
,
1418 GET_CURRENT_CONTEXT(ctx
);
1419 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1420 "glDrawElementsInstanced() during display list compile");
1423 static void GLAPIENTRY
1424 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1427 const GLvoid
*indices
,
1431 GET_CURRENT_CONTEXT(ctx
);
1432 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1433 "glDrawElementsInstancedBaseVertex() during display list compile");
1436 /* GL_ARB_base_instance. */
1437 static void GLAPIENTRY
1438 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1442 GLuint baseinstance
)
1444 GET_CURRENT_CONTEXT(ctx
);
1445 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1446 "glDrawArraysInstancedBaseInstance() during display list compile");
1449 static void APIENTRY
1450 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1453 const void *indices
,
1455 GLuint baseinstance
)
1457 GET_CURRENT_CONTEXT(ctx
);
1458 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1459 "glDrawElementsInstancedBaseInstance() during display list compile");
1462 static void APIENTRY
1463 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1466 const void *indices
,
1469 GLuint baseinstance
)
1471 GET_CURRENT_CONTEXT(ctx
);
1472 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1473 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1478 * While building a display list we cache some OpenGL state.
1479 * Under some circumstances we need to invalidate that state (immediately
1480 * when we start compiling a list, or after glCallList(s)).
1483 invalidate_saved_current_state(struct gl_context
*ctx
)
1487 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1488 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1490 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1491 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1493 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1495 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1499 static void GLAPIENTRY
1500 save_CallList(GLuint list
)
1502 GET_CURRENT_CONTEXT(ctx
);
1504 SAVE_FLUSH_VERTICES(ctx
);
1506 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1511 /* After this, we don't know what state we're in. Invalidate all
1512 * cached information previously gathered:
1514 invalidate_saved_current_state( ctx
);
1516 if (ctx
->ExecuteFlag
) {
1517 _mesa_CallList(list
);
1522 static void GLAPIENTRY
1523 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1525 GET_CURRENT_CONTEXT(ctx
);
1527 GLboolean typeErrorFlag
;
1529 SAVE_FLUSH_VERTICES(ctx
);
1533 case GL_UNSIGNED_BYTE
:
1535 case GL_UNSIGNED_SHORT
:
1537 case GL_UNSIGNED_INT
:
1542 typeErrorFlag
= GL_FALSE
;
1545 typeErrorFlag
= GL_TRUE
;
1548 for (i
= 0; i
< num
; i
++) {
1549 GLint list
= translate_id(i
, type
, lists
);
1550 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1553 n
[2].b
= typeErrorFlag
;
1557 /* After this, we don't know what state we're in. Invalidate all
1558 * cached information previously gathered:
1560 invalidate_saved_current_state( ctx
);
1562 if (ctx
->ExecuteFlag
) {
1563 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1568 static void GLAPIENTRY
1569 save_Clear(GLbitfield mask
)
1571 GET_CURRENT_CONTEXT(ctx
);
1573 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1574 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1578 if (ctx
->ExecuteFlag
) {
1579 CALL_Clear(ctx
->Exec
, (mask
));
1584 static void GLAPIENTRY
1585 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1587 GET_CURRENT_CONTEXT(ctx
);
1589 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1590 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1593 n
[2].i
= drawbuffer
;
1595 if (buffer
== GL_COLOR
) {
1606 if (ctx
->ExecuteFlag
) {
1607 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1612 static void GLAPIENTRY
1613 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1615 GET_CURRENT_CONTEXT(ctx
);
1617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1618 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1621 n
[2].i
= drawbuffer
;
1623 if (buffer
== GL_COLOR
) {
1634 if (ctx
->ExecuteFlag
) {
1635 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1640 static void GLAPIENTRY
1641 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1643 GET_CURRENT_CONTEXT(ctx
);
1645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1646 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1649 n
[2].i
= drawbuffer
;
1651 if (buffer
== GL_COLOR
) {
1662 if (ctx
->ExecuteFlag
) {
1663 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1668 static void GLAPIENTRY
1669 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1670 GLfloat depth
, GLint stencil
)
1672 GET_CURRENT_CONTEXT(ctx
);
1674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1675 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1678 n
[2].i
= drawbuffer
;
1682 if (ctx
->ExecuteFlag
) {
1683 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1688 static void GLAPIENTRY
1689 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1691 GET_CURRENT_CONTEXT(ctx
);
1693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1694 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1701 if (ctx
->ExecuteFlag
) {
1702 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1707 static void GLAPIENTRY
1708 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1710 GET_CURRENT_CONTEXT(ctx
);
1712 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1713 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1720 if (ctx
->ExecuteFlag
) {
1721 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1726 static void GLAPIENTRY
1727 save_ClearDepth(GLclampd depth
)
1729 GET_CURRENT_CONTEXT(ctx
);
1731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1732 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1734 n
[1].f
= (GLfloat
) depth
;
1736 if (ctx
->ExecuteFlag
) {
1737 CALL_ClearDepth(ctx
->Exec
, (depth
));
1742 static void GLAPIENTRY
1743 save_ClearIndex(GLfloat c
)
1745 GET_CURRENT_CONTEXT(ctx
);
1747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1748 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1752 if (ctx
->ExecuteFlag
) {
1753 CALL_ClearIndex(ctx
->Exec
, (c
));
1758 static void GLAPIENTRY
1759 save_ClearStencil(GLint s
)
1761 GET_CURRENT_CONTEXT(ctx
);
1763 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1764 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1768 if (ctx
->ExecuteFlag
) {
1769 CALL_ClearStencil(ctx
->Exec
, (s
));
1774 static void GLAPIENTRY
1775 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1777 GET_CURRENT_CONTEXT(ctx
);
1779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1780 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1783 n
[2].f
= (GLfloat
) equ
[0];
1784 n
[3].f
= (GLfloat
) equ
[1];
1785 n
[4].f
= (GLfloat
) equ
[2];
1786 n
[5].f
= (GLfloat
) equ
[3];
1788 if (ctx
->ExecuteFlag
) {
1789 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1795 static void GLAPIENTRY
1796 save_ColorMask(GLboolean red
, GLboolean green
,
1797 GLboolean blue
, GLboolean alpha
)
1799 GET_CURRENT_CONTEXT(ctx
);
1801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1802 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1809 if (ctx
->ExecuteFlag
) {
1810 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1815 static void GLAPIENTRY
1816 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1817 GLboolean blue
, GLboolean alpha
)
1819 GET_CURRENT_CONTEXT(ctx
);
1821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1822 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1830 if (ctx
->ExecuteFlag
) {
1831 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1836 static void GLAPIENTRY
1837 save_ColorMaterial(GLenum face
, GLenum mode
)
1839 GET_CURRENT_CONTEXT(ctx
);
1841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1843 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1848 if (ctx
->ExecuteFlag
) {
1849 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1854 static void GLAPIENTRY
1855 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
1857 GET_CURRENT_CONTEXT(ctx
);
1859 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1860 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
1864 n
[3].i
= (GLint
) width
;
1865 n
[4].i
= (GLint
) height
;
1868 if (ctx
->ExecuteFlag
) {
1869 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
1875 static void GLAPIENTRY
1876 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
1877 GLint x
, GLint y
, GLsizei width
, GLint border
)
1879 GET_CURRENT_CONTEXT(ctx
);
1881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1882 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
1886 n
[3].e
= internalformat
;
1892 if (ctx
->ExecuteFlag
) {
1893 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
1894 x
, y
, width
, border
));
1899 static void GLAPIENTRY
1900 save_CopyTexImage2D(GLenum target
, GLint level
,
1901 GLenum internalformat
,
1902 GLint x
, GLint y
, GLsizei width
,
1903 GLsizei height
, GLint border
)
1905 GET_CURRENT_CONTEXT(ctx
);
1907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1908 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
1912 n
[3].e
= internalformat
;
1919 if (ctx
->ExecuteFlag
) {
1920 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
1921 x
, y
, width
, height
, border
));
1927 static void GLAPIENTRY
1928 save_CopyTexSubImage1D(GLenum target
, GLint level
,
1929 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
1931 GET_CURRENT_CONTEXT(ctx
);
1933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1934 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
1943 if (ctx
->ExecuteFlag
) {
1944 CALL_CopyTexSubImage1D(ctx
->Exec
,
1945 (target
, level
, xoffset
, x
, y
, width
));
1950 static void GLAPIENTRY
1951 save_CopyTexSubImage2D(GLenum target
, GLint level
,
1952 GLint xoffset
, GLint yoffset
,
1953 GLint x
, GLint y
, GLsizei width
, GLint height
)
1955 GET_CURRENT_CONTEXT(ctx
);
1957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1958 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
1969 if (ctx
->ExecuteFlag
) {
1970 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
1971 x
, y
, width
, height
));
1976 static void GLAPIENTRY
1977 save_CopyTexSubImage3D(GLenum target
, GLint level
,
1978 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1979 GLint x
, GLint y
, GLsizei width
, GLint height
)
1981 GET_CURRENT_CONTEXT(ctx
);
1983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1984 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
1996 if (ctx
->ExecuteFlag
) {
1997 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
1998 xoffset
, yoffset
, zoffset
,
1999 x
, y
, width
, height
));
2004 static void GLAPIENTRY
2005 save_CullFace(GLenum mode
)
2007 GET_CURRENT_CONTEXT(ctx
);
2009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2010 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2014 if (ctx
->ExecuteFlag
) {
2015 CALL_CullFace(ctx
->Exec
, (mode
));
2020 static void GLAPIENTRY
2021 save_DepthFunc(GLenum func
)
2023 GET_CURRENT_CONTEXT(ctx
);
2025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2026 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2030 if (ctx
->ExecuteFlag
) {
2031 CALL_DepthFunc(ctx
->Exec
, (func
));
2036 static void GLAPIENTRY
2037 save_DepthMask(GLboolean mask
)
2039 GET_CURRENT_CONTEXT(ctx
);
2041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2042 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2046 if (ctx
->ExecuteFlag
) {
2047 CALL_DepthMask(ctx
->Exec
, (mask
));
2052 static void GLAPIENTRY
2053 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2055 GET_CURRENT_CONTEXT(ctx
);
2057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2058 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2060 n
[1].f
= (GLfloat
) nearval
;
2061 n
[2].f
= (GLfloat
) farval
;
2063 if (ctx
->ExecuteFlag
) {
2064 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2069 static void GLAPIENTRY
2070 save_Disable(GLenum cap
)
2072 GET_CURRENT_CONTEXT(ctx
);
2074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2075 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2079 if (ctx
->ExecuteFlag
) {
2080 CALL_Disable(ctx
->Exec
, (cap
));
2085 static void GLAPIENTRY
2086 save_DisableIndexed(GLuint index
, GLenum cap
)
2088 GET_CURRENT_CONTEXT(ctx
);
2090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2091 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2096 if (ctx
->ExecuteFlag
) {
2097 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2102 static void GLAPIENTRY
2103 save_DrawBuffer(GLenum mode
)
2105 GET_CURRENT_CONTEXT(ctx
);
2107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2108 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2112 if (ctx
->ExecuteFlag
) {
2113 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2118 static void GLAPIENTRY
2119 save_DrawPixels(GLsizei width
, GLsizei height
,
2120 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2122 GET_CURRENT_CONTEXT(ctx
);
2125 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2127 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 4 + POINTER_DWORDS
);
2134 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2135 pixels
, &ctx
->Unpack
));
2137 if (ctx
->ExecuteFlag
) {
2138 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2144 static void GLAPIENTRY
2145 save_Enable(GLenum cap
)
2147 GET_CURRENT_CONTEXT(ctx
);
2149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2150 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2154 if (ctx
->ExecuteFlag
) {
2155 CALL_Enable(ctx
->Exec
, (cap
));
2161 static void GLAPIENTRY
2162 save_EnableIndexed(GLuint index
, GLenum cap
)
2164 GET_CURRENT_CONTEXT(ctx
);
2166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2167 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2172 if (ctx
->ExecuteFlag
) {
2173 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2179 static void GLAPIENTRY
2180 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2182 GET_CURRENT_CONTEXT(ctx
);
2184 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2185 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2191 if (ctx
->ExecuteFlag
) {
2192 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2197 static void GLAPIENTRY
2198 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2200 GET_CURRENT_CONTEXT(ctx
);
2202 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2203 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2211 if (ctx
->ExecuteFlag
) {
2212 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2219 static void GLAPIENTRY
2220 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2222 GET_CURRENT_CONTEXT(ctx
);
2224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2225 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2233 if (ctx
->ExecuteFlag
) {
2234 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2239 static void GLAPIENTRY
2240 save_Fogf(GLenum pname
, GLfloat param
)
2244 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2245 save_Fogfv(pname
, parray
);
2249 static void GLAPIENTRY
2250 save_Fogiv(GLenum pname
, const GLint
*params
)
2255 case GL_FOG_DENSITY
:
2259 p
[0] = (GLfloat
) *params
;
2265 p
[0] = INT_TO_FLOAT(params
[0]);
2266 p
[1] = INT_TO_FLOAT(params
[1]);
2267 p
[2] = INT_TO_FLOAT(params
[2]);
2268 p
[3] = INT_TO_FLOAT(params
[3]);
2271 /* Error will be caught later in gl_Fogfv */
2272 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2274 save_Fogfv(pname
, p
);
2278 static void GLAPIENTRY
2279 save_Fogi(GLenum pname
, GLint param
)
2283 parray
[1] = parray
[2] = parray
[3] = 0;
2284 save_Fogiv(pname
, parray
);
2288 static void GLAPIENTRY
2289 save_FrontFace(GLenum mode
)
2291 GET_CURRENT_CONTEXT(ctx
);
2293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2294 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2298 if (ctx
->ExecuteFlag
) {
2299 CALL_FrontFace(ctx
->Exec
, (mode
));
2304 static void GLAPIENTRY
2305 save_Frustum(GLdouble left
, GLdouble right
,
2306 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2308 GET_CURRENT_CONTEXT(ctx
);
2310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2311 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2313 n
[1].f
= (GLfloat
) left
;
2314 n
[2].f
= (GLfloat
) right
;
2315 n
[3].f
= (GLfloat
) bottom
;
2316 n
[4].f
= (GLfloat
) top
;
2317 n
[5].f
= (GLfloat
) nearval
;
2318 n
[6].f
= (GLfloat
) farval
;
2320 if (ctx
->ExecuteFlag
) {
2321 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2326 static void GLAPIENTRY
2327 save_Hint(GLenum target
, GLenum mode
)
2329 GET_CURRENT_CONTEXT(ctx
);
2331 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2332 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2337 if (ctx
->ExecuteFlag
) {
2338 CALL_Hint(ctx
->Exec
, (target
, mode
));
2343 static void GLAPIENTRY
2344 save_IndexMask(GLuint mask
)
2346 GET_CURRENT_CONTEXT(ctx
);
2348 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2349 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2353 if (ctx
->ExecuteFlag
) {
2354 CALL_IndexMask(ctx
->Exec
, (mask
));
2359 static void GLAPIENTRY
2360 save_InitNames(void)
2362 GET_CURRENT_CONTEXT(ctx
);
2363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2364 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2365 if (ctx
->ExecuteFlag
) {
2366 CALL_InitNames(ctx
->Exec
, ());
2371 static void GLAPIENTRY
2372 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2374 GET_CURRENT_CONTEXT(ctx
);
2376 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2377 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2395 case GL_SPOT_DIRECTION
:
2398 case GL_SPOT_EXPONENT
:
2401 case GL_SPOT_CUTOFF
:
2404 case GL_CONSTANT_ATTENUATION
:
2407 case GL_LINEAR_ATTENUATION
:
2410 case GL_QUADRATIC_ATTENUATION
:
2416 for (i
= 0; i
< nParams
; i
++) {
2417 n
[3 + i
].f
= params
[i
];
2420 if (ctx
->ExecuteFlag
) {
2421 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2426 static void GLAPIENTRY
2427 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2431 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2432 save_Lightfv(light
, pname
, parray
);
2436 static void GLAPIENTRY
2437 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2444 fparam
[0] = INT_TO_FLOAT(params
[0]);
2445 fparam
[1] = INT_TO_FLOAT(params
[1]);
2446 fparam
[2] = INT_TO_FLOAT(params
[2]);
2447 fparam
[3] = INT_TO_FLOAT(params
[3]);
2450 fparam
[0] = (GLfloat
) params
[0];
2451 fparam
[1] = (GLfloat
) params
[1];
2452 fparam
[2] = (GLfloat
) params
[2];
2453 fparam
[3] = (GLfloat
) params
[3];
2455 case GL_SPOT_DIRECTION
:
2456 fparam
[0] = (GLfloat
) params
[0];
2457 fparam
[1] = (GLfloat
) params
[1];
2458 fparam
[2] = (GLfloat
) params
[2];
2460 case GL_SPOT_EXPONENT
:
2461 case GL_SPOT_CUTOFF
:
2462 case GL_CONSTANT_ATTENUATION
:
2463 case GL_LINEAR_ATTENUATION
:
2464 case GL_QUADRATIC_ATTENUATION
:
2465 fparam
[0] = (GLfloat
) params
[0];
2468 /* error will be caught later in gl_Lightfv */
2471 save_Lightfv(light
, pname
, fparam
);
2475 static void GLAPIENTRY
2476 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2480 parray
[1] = parray
[2] = parray
[3] = 0;
2481 save_Lightiv(light
, pname
, parray
);
2485 static void GLAPIENTRY
2486 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2488 GET_CURRENT_CONTEXT(ctx
);
2490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2491 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2499 if (ctx
->ExecuteFlag
) {
2500 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2505 static void GLAPIENTRY
2506 save_LightModelf(GLenum pname
, GLfloat param
)
2510 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2511 save_LightModelfv(pname
, parray
);
2515 static void GLAPIENTRY
2516 save_LightModeliv(GLenum pname
, const GLint
*params
)
2520 case GL_LIGHT_MODEL_AMBIENT
:
2521 fparam
[0] = INT_TO_FLOAT(params
[0]);
2522 fparam
[1] = INT_TO_FLOAT(params
[1]);
2523 fparam
[2] = INT_TO_FLOAT(params
[2]);
2524 fparam
[3] = INT_TO_FLOAT(params
[3]);
2526 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2527 case GL_LIGHT_MODEL_TWO_SIDE
:
2528 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2529 fparam
[0] = (GLfloat
) params
[0];
2535 /* Error will be caught later in gl_LightModelfv */
2536 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2538 save_LightModelfv(pname
, fparam
);
2542 static void GLAPIENTRY
2543 save_LightModeli(GLenum pname
, GLint param
)
2547 parray
[1] = parray
[2] = parray
[3] = 0;
2548 save_LightModeliv(pname
, parray
);
2552 static void GLAPIENTRY
2553 save_LineStipple(GLint factor
, GLushort pattern
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2563 if (ctx
->ExecuteFlag
) {
2564 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2569 static void GLAPIENTRY
2570 save_LineWidth(GLfloat width
)
2572 GET_CURRENT_CONTEXT(ctx
);
2574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2575 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2579 if (ctx
->ExecuteFlag
) {
2580 CALL_LineWidth(ctx
->Exec
, (width
));
2585 static void GLAPIENTRY
2586 save_ListBase(GLuint base
)
2588 GET_CURRENT_CONTEXT(ctx
);
2590 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2591 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2595 if (ctx
->ExecuteFlag
) {
2596 CALL_ListBase(ctx
->Exec
, (base
));
2601 static void GLAPIENTRY
2602 save_LoadIdentity(void)
2604 GET_CURRENT_CONTEXT(ctx
);
2605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2606 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2607 if (ctx
->ExecuteFlag
) {
2608 CALL_LoadIdentity(ctx
->Exec
, ());
2613 static void GLAPIENTRY
2614 save_LoadMatrixf(const GLfloat
* m
)
2616 GET_CURRENT_CONTEXT(ctx
);
2618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2619 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2622 for (i
= 0; i
< 16; i
++) {
2626 if (ctx
->ExecuteFlag
) {
2627 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2632 static void GLAPIENTRY
2633 save_LoadMatrixd(const GLdouble
* m
)
2637 for (i
= 0; i
< 16; i
++) {
2638 f
[i
] = (GLfloat
) m
[i
];
2640 save_LoadMatrixf(f
);
2644 static void GLAPIENTRY
2645 save_LoadName(GLuint name
)
2647 GET_CURRENT_CONTEXT(ctx
);
2649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2650 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2654 if (ctx
->ExecuteFlag
) {
2655 CALL_LoadName(ctx
->Exec
, (name
));
2660 static void GLAPIENTRY
2661 save_LogicOp(GLenum opcode
)
2663 GET_CURRENT_CONTEXT(ctx
);
2665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2666 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2670 if (ctx
->ExecuteFlag
) {
2671 CALL_LogicOp(ctx
->Exec
, (opcode
));
2676 static void GLAPIENTRY
2677 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2678 GLint order
, const GLdouble
* points
)
2680 GET_CURRENT_CONTEXT(ctx
);
2682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2683 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2685 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2687 n
[2].f
= (GLfloat
) u1
;
2688 n
[3].f
= (GLfloat
) u2
;
2689 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2691 save_pointer(&n
[6], pnts
);
2693 if (ctx
->ExecuteFlag
) {
2694 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2698 static void GLAPIENTRY
2699 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2700 GLint order
, const GLfloat
* points
)
2702 GET_CURRENT_CONTEXT(ctx
);
2704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2705 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 5 + POINTER_DWORDS
);
2707 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2711 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2713 save_pointer(&n
[6], pnts
);
2715 if (ctx
->ExecuteFlag
) {
2716 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2721 static void GLAPIENTRY
2722 save_Map2d(GLenum target
,
2723 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2724 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2725 const GLdouble
* points
)
2727 GET_CURRENT_CONTEXT(ctx
);
2729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2730 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2732 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2733 vstride
, vorder
, points
);
2735 n
[2].f
= (GLfloat
) u1
;
2736 n
[3].f
= (GLfloat
) u2
;
2737 n
[4].f
= (GLfloat
) v1
;
2738 n
[5].f
= (GLfloat
) v2
;
2739 /* XXX verify these strides are correct */
2740 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2741 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2744 save_pointer(&n
[10], pnts
);
2746 if (ctx
->ExecuteFlag
) {
2747 CALL_Map2d(ctx
->Exec
, (target
,
2748 u1
, u2
, ustride
, uorder
,
2749 v1
, v2
, vstride
, vorder
, points
));
2754 static void GLAPIENTRY
2755 save_Map2f(GLenum target
,
2756 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2757 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2758 const GLfloat
* points
)
2760 GET_CURRENT_CONTEXT(ctx
);
2762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2763 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 9 + POINTER_DWORDS
);
2765 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2766 vstride
, vorder
, points
);
2772 /* XXX verify these strides are correct */
2773 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2774 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2777 save_pointer(&n
[10], pnts
);
2779 if (ctx
->ExecuteFlag
) {
2780 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2781 v1
, v2
, vstride
, vorder
, points
));
2786 static void GLAPIENTRY
2787 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2789 GET_CURRENT_CONTEXT(ctx
);
2791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2792 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2798 if (ctx
->ExecuteFlag
) {
2799 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
2804 static void GLAPIENTRY
2805 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
2807 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
2811 static void GLAPIENTRY
2812 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
2813 GLint vn
, GLfloat v1
, GLfloat v2
)
2815 GET_CURRENT_CONTEXT(ctx
);
2817 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2818 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
2827 if (ctx
->ExecuteFlag
) {
2828 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
2834 static void GLAPIENTRY
2835 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
2836 GLint vn
, GLdouble v1
, GLdouble v2
)
2838 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
2839 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
2843 static void GLAPIENTRY
2844 save_MatrixMode(GLenum mode
)
2846 GET_CURRENT_CONTEXT(ctx
);
2848 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2849 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
2853 if (ctx
->ExecuteFlag
) {
2854 CALL_MatrixMode(ctx
->Exec
, (mode
));
2859 static void GLAPIENTRY
2860 save_MultMatrixf(const GLfloat
* m
)
2862 GET_CURRENT_CONTEXT(ctx
);
2864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2865 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
2868 for (i
= 0; i
< 16; i
++) {
2872 if (ctx
->ExecuteFlag
) {
2873 CALL_MultMatrixf(ctx
->Exec
, (m
));
2878 static void GLAPIENTRY
2879 save_MultMatrixd(const GLdouble
* m
)
2883 for (i
= 0; i
< 16; i
++) {
2884 f
[i
] = (GLfloat
) m
[i
];
2886 save_MultMatrixf(f
);
2890 static void GLAPIENTRY
2891 save_NewList(GLuint name
, GLenum mode
)
2893 GET_CURRENT_CONTEXT(ctx
);
2894 /* It's an error to call this function while building a display list */
2895 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
2902 static void GLAPIENTRY
2903 save_Ortho(GLdouble left
, GLdouble right
,
2904 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2906 GET_CURRENT_CONTEXT(ctx
);
2908 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2909 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
2911 n
[1].f
= (GLfloat
) left
;
2912 n
[2].f
= (GLfloat
) right
;
2913 n
[3].f
= (GLfloat
) bottom
;
2914 n
[4].f
= (GLfloat
) top
;
2915 n
[5].f
= (GLfloat
) nearval
;
2916 n
[6].f
= (GLfloat
) farval
;
2918 if (ctx
->ExecuteFlag
) {
2919 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2924 static void GLAPIENTRY
2925 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
2927 GET_CURRENT_CONTEXT(ctx
);
2929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2930 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 2 + POINTER_DWORDS
);
2934 save_pointer(&n
[3], memdup(values
, mapsize
* sizeof(GLfloat
)));
2936 if (ctx
->ExecuteFlag
) {
2937 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
2942 static void GLAPIENTRY
2943 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
2945 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2947 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2948 for (i
= 0; i
< mapsize
; i
++) {
2949 fvalues
[i
] = (GLfloat
) values
[i
];
2953 for (i
= 0; i
< mapsize
; i
++) {
2954 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
2957 save_PixelMapfv(map
, mapsize
, fvalues
);
2961 static void GLAPIENTRY
2962 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
2964 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
2966 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
2967 for (i
= 0; i
< mapsize
; i
++) {
2968 fvalues
[i
] = (GLfloat
) values
[i
];
2972 for (i
= 0; i
< mapsize
; i
++) {
2973 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
2976 save_PixelMapfv(map
, mapsize
, fvalues
);
2980 static void GLAPIENTRY
2981 save_PixelTransferf(GLenum pname
, GLfloat param
)
2983 GET_CURRENT_CONTEXT(ctx
);
2985 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2986 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
2991 if (ctx
->ExecuteFlag
) {
2992 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
2997 static void GLAPIENTRY
2998 save_PixelTransferi(GLenum pname
, GLint param
)
3000 save_PixelTransferf(pname
, (GLfloat
) param
);
3004 static void GLAPIENTRY
3005 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3007 GET_CURRENT_CONTEXT(ctx
);
3009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3010 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3015 if (ctx
->ExecuteFlag
) {
3016 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3021 static void GLAPIENTRY
3022 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3024 GET_CURRENT_CONTEXT(ctx
);
3026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3027 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3034 if (ctx
->ExecuteFlag
) {
3035 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3040 static void GLAPIENTRY
3041 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3045 parray
[1] = parray
[2] = 0.0F
;
3046 save_PointParameterfvEXT(pname
, parray
);
3049 static void GLAPIENTRY
3050 save_PointParameteriNV(GLenum pname
, GLint param
)
3053 parray
[0] = (GLfloat
) param
;
3054 parray
[1] = parray
[2] = 0.0F
;
3055 save_PointParameterfvEXT(pname
, parray
);
3058 static void GLAPIENTRY
3059 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3062 parray
[0] = (GLfloat
) param
[0];
3063 parray
[1] = parray
[2] = 0.0F
;
3064 save_PointParameterfvEXT(pname
, parray
);
3068 static void GLAPIENTRY
3069 save_PointSize(GLfloat size
)
3071 GET_CURRENT_CONTEXT(ctx
);
3073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3074 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3078 if (ctx
->ExecuteFlag
) {
3079 CALL_PointSize(ctx
->Exec
, (size
));
3084 static void GLAPIENTRY
3085 save_PolygonMode(GLenum face
, GLenum mode
)
3087 GET_CURRENT_CONTEXT(ctx
);
3089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3090 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3095 if (ctx
->ExecuteFlag
) {
3096 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3101 static void GLAPIENTRY
3102 save_PolygonStipple(const GLubyte
* pattern
)
3104 GET_CURRENT_CONTEXT(ctx
);
3107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3109 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, POINTER_DWORDS
);
3112 unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3113 pattern
, &ctx
->Unpack
));
3115 if (ctx
->ExecuteFlag
) {
3116 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3121 static void GLAPIENTRY
3122 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3124 GET_CURRENT_CONTEXT(ctx
);
3126 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3127 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3132 if (ctx
->ExecuteFlag
) {
3133 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3138 static void GLAPIENTRY
3139 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3141 GET_CURRENT_CONTEXT(ctx
);
3142 /* XXX mult by DepthMaxF here??? */
3143 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3147 static void GLAPIENTRY
3148 save_PopAttrib(void)
3150 GET_CURRENT_CONTEXT(ctx
);
3151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3152 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3153 if (ctx
->ExecuteFlag
) {
3154 CALL_PopAttrib(ctx
->Exec
, ());
3159 static void GLAPIENTRY
3160 save_PopMatrix(void)
3162 GET_CURRENT_CONTEXT(ctx
);
3163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3164 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3165 if (ctx
->ExecuteFlag
) {
3166 CALL_PopMatrix(ctx
->Exec
, ());
3171 static void GLAPIENTRY
3174 GET_CURRENT_CONTEXT(ctx
);
3175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3176 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3177 if (ctx
->ExecuteFlag
) {
3178 CALL_PopName(ctx
->Exec
, ());
3183 static void GLAPIENTRY
3184 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3185 const GLclampf
* priorities
)
3187 GET_CURRENT_CONTEXT(ctx
);
3189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3191 for (i
= 0; i
< num
; i
++) {
3193 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3195 n
[1].ui
= textures
[i
];
3196 n
[2].f
= priorities
[i
];
3199 if (ctx
->ExecuteFlag
) {
3200 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3205 static void GLAPIENTRY
3206 save_PushAttrib(GLbitfield mask
)
3208 GET_CURRENT_CONTEXT(ctx
);
3210 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3211 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3215 if (ctx
->ExecuteFlag
) {
3216 CALL_PushAttrib(ctx
->Exec
, (mask
));
3221 static void GLAPIENTRY
3222 save_PushMatrix(void)
3224 GET_CURRENT_CONTEXT(ctx
);
3225 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3226 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3227 if (ctx
->ExecuteFlag
) {
3228 CALL_PushMatrix(ctx
->Exec
, ());
3233 static void GLAPIENTRY
3234 save_PushName(GLuint name
)
3236 GET_CURRENT_CONTEXT(ctx
);
3238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3239 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3243 if (ctx
->ExecuteFlag
) {
3244 CALL_PushName(ctx
->Exec
, (name
));
3249 static void GLAPIENTRY
3250 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3252 GET_CURRENT_CONTEXT(ctx
);
3254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3255 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3262 if (ctx
->ExecuteFlag
) {
3263 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3267 static void GLAPIENTRY
3268 save_RasterPos2d(GLdouble x
, GLdouble y
)
3270 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3273 static void GLAPIENTRY
3274 save_RasterPos2f(GLfloat x
, GLfloat y
)
3276 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3279 static void GLAPIENTRY
3280 save_RasterPos2i(GLint x
, GLint y
)
3282 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3285 static void GLAPIENTRY
3286 save_RasterPos2s(GLshort x
, GLshort y
)
3288 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3291 static void GLAPIENTRY
3292 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3294 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3297 static void GLAPIENTRY
3298 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3300 save_RasterPos4f(x
, y
, z
, 1.0F
);
3303 static void GLAPIENTRY
3304 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3306 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3309 static void GLAPIENTRY
3310 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3312 save_RasterPos4f(x
, y
, z
, 1.0F
);
3315 static void GLAPIENTRY
3316 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3318 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3321 static void GLAPIENTRY
3322 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3324 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3327 static void GLAPIENTRY
3328 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3330 save_RasterPos4f(x
, y
, z
, w
);
3333 static void GLAPIENTRY
3334 save_RasterPos2dv(const GLdouble
* v
)
3336 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3339 static void GLAPIENTRY
3340 save_RasterPos2fv(const GLfloat
* v
)
3342 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3345 static void GLAPIENTRY
3346 save_RasterPos2iv(const GLint
* v
)
3348 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3351 static void GLAPIENTRY
3352 save_RasterPos2sv(const GLshort
* v
)
3354 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3357 static void GLAPIENTRY
3358 save_RasterPos3dv(const GLdouble
* v
)
3360 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3363 static void GLAPIENTRY
3364 save_RasterPos3fv(const GLfloat
* v
)
3366 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3369 static void GLAPIENTRY
3370 save_RasterPos3iv(const GLint
* v
)
3372 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3375 static void GLAPIENTRY
3376 save_RasterPos3sv(const GLshort
* v
)
3378 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3381 static void GLAPIENTRY
3382 save_RasterPos4dv(const GLdouble
* v
)
3384 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3385 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3388 static void GLAPIENTRY
3389 save_RasterPos4fv(const GLfloat
* v
)
3391 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3394 static void GLAPIENTRY
3395 save_RasterPos4iv(const GLint
* v
)
3397 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3398 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3401 static void GLAPIENTRY
3402 save_RasterPos4sv(const GLshort
* v
)
3404 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3408 static void GLAPIENTRY
3409 save_PassThrough(GLfloat token
)
3411 GET_CURRENT_CONTEXT(ctx
);
3413 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3414 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3418 if (ctx
->ExecuteFlag
) {
3419 CALL_PassThrough(ctx
->Exec
, (token
));
3424 static void GLAPIENTRY
3425 save_ReadBuffer(GLenum mode
)
3427 GET_CURRENT_CONTEXT(ctx
);
3429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3430 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3434 if (ctx
->ExecuteFlag
) {
3435 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3440 static void GLAPIENTRY
3441 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3443 GET_CURRENT_CONTEXT(ctx
);
3445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3446 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3453 if (ctx
->ExecuteFlag
) {
3454 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3459 static void GLAPIENTRY
3460 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3462 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3466 static void GLAPIENTRY
3467 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3469 GET_CURRENT_CONTEXT(ctx
);
3471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3472 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3478 if (ctx
->ExecuteFlag
) {
3479 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3484 static void GLAPIENTRY
3485 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3487 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3491 static void GLAPIENTRY
3492 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3494 GET_CURRENT_CONTEXT(ctx
);
3496 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3497 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3504 if (ctx
->ExecuteFlag
) {
3505 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3510 static void GLAPIENTRY
3511 save_ShadeModel(GLenum mode
)
3513 GET_CURRENT_CONTEXT(ctx
);
3515 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3517 if (ctx
->ExecuteFlag
) {
3518 CALL_ShadeModel(ctx
->Exec
, (mode
));
3521 /* Don't compile this call if it's a no-op.
3522 * By avoiding this state change we have a better chance of
3523 * coalescing subsequent drawing commands into one batch.
3525 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3528 SAVE_FLUSH_VERTICES(ctx
);
3530 ctx
->ListState
.Current
.ShadeModel
= mode
;
3532 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3539 static void GLAPIENTRY
3540 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3542 GET_CURRENT_CONTEXT(ctx
);
3544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3545 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3551 if (ctx
->ExecuteFlag
) {
3552 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3557 static void GLAPIENTRY
3558 save_StencilMask(GLuint mask
)
3560 GET_CURRENT_CONTEXT(ctx
);
3562 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3563 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3567 if (ctx
->ExecuteFlag
) {
3568 CALL_StencilMask(ctx
->Exec
, (mask
));
3573 static void GLAPIENTRY
3574 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3576 GET_CURRENT_CONTEXT(ctx
);
3578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3579 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3585 if (ctx
->ExecuteFlag
) {
3586 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3591 static void GLAPIENTRY
3592 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3594 GET_CURRENT_CONTEXT(ctx
);
3596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3597 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3604 if (ctx
->ExecuteFlag
) {
3605 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3610 static void GLAPIENTRY
3611 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3614 GET_CURRENT_CONTEXT(ctx
);
3616 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3618 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3626 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3633 if (ctx
->ExecuteFlag
) {
3634 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3635 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3640 static void GLAPIENTRY
3641 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3643 GET_CURRENT_CONTEXT(ctx
);
3645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3646 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3651 if (ctx
->ExecuteFlag
) {
3652 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3657 static void GLAPIENTRY
3658 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3660 GET_CURRENT_CONTEXT(ctx
);
3662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3663 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3670 if (ctx
->ExecuteFlag
) {
3671 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3676 static void GLAPIENTRY
3677 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3679 GET_CURRENT_CONTEXT(ctx
);
3681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3682 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3686 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3694 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3697 if (ctx
->ExecuteFlag
) {
3698 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3703 static void GLAPIENTRY
3704 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3707 parray
[0] = (GLfloat
) param
;
3708 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3709 save_TexEnvfv(target
, pname
, parray
);
3713 static void GLAPIENTRY
3714 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3717 p
[0] = (GLfloat
) param
;
3718 p
[1] = p
[2] = p
[3] = 0.0F
;
3719 save_TexEnvfv(target
, pname
, p
);
3723 static void GLAPIENTRY
3724 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3727 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3728 p
[0] = INT_TO_FLOAT(param
[0]);
3729 p
[1] = INT_TO_FLOAT(param
[1]);
3730 p
[2] = INT_TO_FLOAT(param
[2]);
3731 p
[3] = INT_TO_FLOAT(param
[3]);
3734 p
[0] = (GLfloat
) param
[0];
3735 p
[1] = p
[2] = p
[3] = 0.0F
;
3737 save_TexEnvfv(target
, pname
, p
);
3741 static void GLAPIENTRY
3742 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3744 GET_CURRENT_CONTEXT(ctx
);
3746 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3747 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
3756 if (ctx
->ExecuteFlag
) {
3757 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
3762 static void GLAPIENTRY
3763 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
3766 p
[0] = (GLfloat
) params
[0];
3767 p
[1] = (GLfloat
) params
[1];
3768 p
[2] = (GLfloat
) params
[2];
3769 p
[3] = (GLfloat
) params
[3];
3770 save_TexGenfv(coord
, pname
, p
);
3774 static void GLAPIENTRY
3775 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
3778 parray
[0] = (GLfloat
) param
;
3779 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3780 save_TexGenfv(coord
, pname
, parray
);
3784 static void GLAPIENTRY
3785 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
3788 p
[0] = (GLfloat
) params
[0];
3789 p
[1] = (GLfloat
) params
[1];
3790 p
[2] = (GLfloat
) params
[2];
3791 p
[3] = (GLfloat
) params
[3];
3792 save_TexGenfv(coord
, pname
, p
);
3796 static void GLAPIENTRY
3797 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
3801 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3802 save_TexGenfv(coord
, pname
, parray
);
3806 static void GLAPIENTRY
3807 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
3811 parray
[1] = parray
[2] = parray
[3] = 0;
3812 save_TexGeniv(coord
, pname
, parray
);
3816 static void GLAPIENTRY
3817 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3819 GET_CURRENT_CONTEXT(ctx
);
3821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3822 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
3831 if (ctx
->ExecuteFlag
) {
3832 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
3837 static void GLAPIENTRY
3838 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
3842 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3843 save_TexParameterfv(target
, pname
, parray
);
3847 static void GLAPIENTRY
3848 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
3851 fparam
[0] = (GLfloat
) param
;
3852 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3853 save_TexParameterfv(target
, pname
, fparam
);
3857 static void GLAPIENTRY
3858 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
3861 fparam
[0] = (GLfloat
) params
[0];
3862 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
3863 save_TexParameterfv(target
, pname
, fparam
);
3867 static void GLAPIENTRY
3868 save_TexImage1D(GLenum target
,
3869 GLint level
, GLint components
,
3870 GLsizei width
, GLint border
,
3871 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3873 GET_CURRENT_CONTEXT(ctx
);
3874 if (target
== GL_PROXY_TEXTURE_1D
) {
3875 /* don't compile, execute immediately */
3876 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3877 border
, format
, type
, pixels
));
3881 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3882 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 7 + POINTER_DWORDS
);
3886 n
[3].i
= components
;
3887 n
[4].i
= (GLint
) width
;
3892 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
3893 pixels
, &ctx
->Unpack
));
3895 if (ctx
->ExecuteFlag
) {
3896 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
3897 border
, format
, type
, pixels
));
3903 static void GLAPIENTRY
3904 save_TexImage2D(GLenum target
,
3905 GLint level
, GLint components
,
3906 GLsizei width
, GLsizei height
, GLint border
,
3907 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3909 GET_CURRENT_CONTEXT(ctx
);
3910 if (target
== GL_PROXY_TEXTURE_2D
) {
3911 /* don't compile, execute immediately */
3912 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3913 height
, border
, format
, type
, pixels
));
3917 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3918 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 8 + POINTER_DWORDS
);
3922 n
[3].i
= components
;
3923 n
[4].i
= (GLint
) width
;
3924 n
[5].i
= (GLint
) height
;
3929 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
3930 pixels
, &ctx
->Unpack
));
3932 if (ctx
->ExecuteFlag
) {
3933 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
3934 height
, border
, format
, type
, pixels
));
3940 static void GLAPIENTRY
3941 save_TexImage3D(GLenum target
,
3942 GLint level
, GLint internalFormat
,
3943 GLsizei width
, GLsizei height
, GLsizei depth
,
3945 GLenum format
, GLenum type
, const GLvoid
* pixels
)
3947 GET_CURRENT_CONTEXT(ctx
);
3948 if (target
== GL_PROXY_TEXTURE_3D
) {
3949 /* don't compile, execute immediately */
3950 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3951 height
, depth
, border
, format
, type
,
3956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3957 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 9 + POINTER_DWORDS
);
3961 n
[3].i
= (GLint
) internalFormat
;
3962 n
[4].i
= (GLint
) width
;
3963 n
[5].i
= (GLint
) height
;
3964 n
[6].i
= (GLint
) depth
;
3968 save_pointer(&n
[10],
3969 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
3970 pixels
, &ctx
->Unpack
));
3972 if (ctx
->ExecuteFlag
) {
3973 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
3974 height
, depth
, border
, format
, type
,
3981 static void GLAPIENTRY
3982 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
3983 GLsizei width
, GLenum format
, GLenum type
,
3984 const GLvoid
* pixels
)
3986 GET_CURRENT_CONTEXT(ctx
);
3989 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3991 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 6 + POINTER_DWORDS
);
3996 n
[4].i
= (GLint
) width
;
4000 unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4001 pixels
, &ctx
->Unpack
));
4003 if (ctx
->ExecuteFlag
) {
4004 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4005 format
, type
, pixels
));
4010 static void GLAPIENTRY
4011 save_TexSubImage2D(GLenum target
, GLint level
,
4012 GLint xoffset
, GLint yoffset
,
4013 GLsizei width
, GLsizei height
,
4014 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4016 GET_CURRENT_CONTEXT(ctx
);
4019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4021 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 8 + POINTER_DWORDS
);
4027 n
[5].i
= (GLint
) width
;
4028 n
[6].i
= (GLint
) height
;
4032 unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4033 pixels
, &ctx
->Unpack
));
4035 if (ctx
->ExecuteFlag
) {
4036 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4037 width
, height
, format
, type
, pixels
));
4042 static void GLAPIENTRY
4043 save_TexSubImage3D(GLenum target
, GLint level
,
4044 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4045 GLsizei width
, GLsizei height
, GLsizei depth
,
4046 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4048 GET_CURRENT_CONTEXT(ctx
);
4051 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4053 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 10 + POINTER_DWORDS
);
4060 n
[6].i
= (GLint
) width
;
4061 n
[7].i
= (GLint
) height
;
4062 n
[8].i
= (GLint
) depth
;
4065 save_pointer(&n
[11],
4066 unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4067 pixels
, &ctx
->Unpack
));
4069 if (ctx
->ExecuteFlag
) {
4070 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4071 xoffset
, yoffset
, zoffset
,
4072 width
, height
, depth
, format
, type
,
4078 static void GLAPIENTRY
4079 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4081 GET_CURRENT_CONTEXT(ctx
);
4083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4084 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4090 if (ctx
->ExecuteFlag
) {
4091 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4096 static void GLAPIENTRY
4097 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4099 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4104 static void GLAPIENTRY
4105 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4107 GET_CURRENT_CONTEXT(ctx
);
4109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4110 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4114 n
[3].i
= (GLint
) width
;
4115 n
[4].i
= (GLint
) height
;
4117 if (ctx
->ExecuteFlag
) {
4118 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4123 static void GLAPIENTRY
4124 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4126 GET_CURRENT_CONTEXT(ctx
);
4128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4129 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4136 if (ctx
->ExecuteFlag
) {
4137 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4141 static void GLAPIENTRY
4142 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4144 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4147 static void GLAPIENTRY
4148 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4150 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4153 static void GLAPIENTRY
4154 save_WindowPos2iMESA(GLint x
, GLint y
)
4156 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4159 static void GLAPIENTRY
4160 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4162 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4165 static void GLAPIENTRY
4166 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4168 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4171 static void GLAPIENTRY
4172 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4174 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4177 static void GLAPIENTRY
4178 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4180 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4183 static void GLAPIENTRY
4184 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4186 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4189 static void GLAPIENTRY
4190 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4192 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4195 static void GLAPIENTRY
4196 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4198 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4201 static void GLAPIENTRY
4202 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4204 save_WindowPos4fMESA(x
, y
, z
, w
);
4207 static void GLAPIENTRY
4208 save_WindowPos2dvMESA(const GLdouble
* v
)
4210 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4213 static void GLAPIENTRY
4214 save_WindowPos2fvMESA(const GLfloat
* v
)
4216 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4219 static void GLAPIENTRY
4220 save_WindowPos2ivMESA(const GLint
* v
)
4222 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4225 static void GLAPIENTRY
4226 save_WindowPos2svMESA(const GLshort
* v
)
4228 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4231 static void GLAPIENTRY
4232 save_WindowPos3dvMESA(const GLdouble
* v
)
4234 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4237 static void GLAPIENTRY
4238 save_WindowPos3fvMESA(const GLfloat
* v
)
4240 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4243 static void GLAPIENTRY
4244 save_WindowPos3ivMESA(const GLint
* v
)
4246 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4249 static void GLAPIENTRY
4250 save_WindowPos3svMESA(const GLshort
* v
)
4252 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4255 static void GLAPIENTRY
4256 save_WindowPos4dvMESA(const GLdouble
* v
)
4258 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4259 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4262 static void GLAPIENTRY
4263 save_WindowPos4fvMESA(const GLfloat
* v
)
4265 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4268 static void GLAPIENTRY
4269 save_WindowPos4ivMESA(const GLint
* v
)
4271 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4272 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4275 static void GLAPIENTRY
4276 save_WindowPos4svMESA(const GLshort
* v
)
4278 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4283 /* GL_ARB_multitexture */
4284 static void GLAPIENTRY
4285 save_ActiveTextureARB(GLenum target
)
4287 GET_CURRENT_CONTEXT(ctx
);
4289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4290 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4294 if (ctx
->ExecuteFlag
) {
4295 CALL_ActiveTexture(ctx
->Exec
, (target
));
4300 /* GL_ARB_transpose_matrix */
4302 static void GLAPIENTRY
4303 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4306 _math_transposefd(tm
, m
);
4307 save_LoadMatrixf(tm
);
4311 static void GLAPIENTRY
4312 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4315 _math_transposef(tm
, m
);
4316 save_LoadMatrixf(tm
);
4320 static void GLAPIENTRY
4321 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4324 _math_transposefd(tm
, m
);
4325 save_MultMatrixf(tm
);
4329 static void GLAPIENTRY
4330 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4333 _math_transposef(tm
, m
);
4334 save_MultMatrixf(tm
);
4337 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4339 GET_CURRENT_CONTEXT(ctx
);
4345 image
= malloc(size
);
4347 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4350 memcpy(image
, data
, size
);
4356 /* GL_ARB_texture_compression */
4357 static void GLAPIENTRY
4358 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4359 GLenum internalFormat
, GLsizei width
,
4360 GLint border
, GLsizei imageSize
,
4361 const GLvoid
* data
)
4363 GET_CURRENT_CONTEXT(ctx
);
4364 if (target
== GL_PROXY_TEXTURE_1D
) {
4365 /* don't compile, execute immediately */
4366 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4367 width
, border
, imageSize
,
4372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4374 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
,
4375 6 + POINTER_DWORDS
);
4379 n
[3].e
= internalFormat
;
4380 n
[4].i
= (GLint
) width
;
4384 copy_data(data
, imageSize
, "glCompressedTexImage1DARB"));
4386 if (ctx
->ExecuteFlag
) {
4387 CALL_CompressedTexImage1D(ctx
->Exec
,
4388 (target
, level
, internalFormat
, width
,
4389 border
, imageSize
, data
));
4395 static void GLAPIENTRY
4396 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4397 GLenum internalFormat
, GLsizei width
,
4398 GLsizei height
, GLint border
, GLsizei imageSize
,
4399 const GLvoid
* data
)
4401 GET_CURRENT_CONTEXT(ctx
);
4402 if (target
== GL_PROXY_TEXTURE_2D
) {
4403 /* don't compile, execute immediately */
4404 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4405 width
, height
, border
,
4410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4412 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
,
4413 7 + POINTER_DWORDS
);
4417 n
[3].e
= internalFormat
;
4418 n
[4].i
= (GLint
) width
;
4419 n
[5].i
= (GLint
) height
;
4423 copy_data(data
, imageSize
, "glCompressedTexImage2DARB"));
4425 if (ctx
->ExecuteFlag
) {
4426 CALL_CompressedTexImage2D(ctx
->Exec
,
4427 (target
, level
, internalFormat
, width
,
4428 height
, border
, imageSize
, data
));
4434 static void GLAPIENTRY
4435 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4436 GLenum internalFormat
, GLsizei width
,
4437 GLsizei height
, GLsizei depth
, GLint border
,
4438 GLsizei imageSize
, const GLvoid
* data
)
4440 GET_CURRENT_CONTEXT(ctx
);
4441 if (target
== GL_PROXY_TEXTURE_3D
) {
4442 /* don't compile, execute immediately */
4443 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4444 width
, height
, depth
, border
,
4449 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4451 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
,
4452 8 + POINTER_DWORDS
);
4456 n
[3].e
= internalFormat
;
4457 n
[4].i
= (GLint
) width
;
4458 n
[5].i
= (GLint
) height
;
4459 n
[6].i
= (GLint
) depth
;
4463 copy_data(data
, imageSize
, "glCompressedTexImage3DARB"));
4465 if (ctx
->ExecuteFlag
) {
4466 CALL_CompressedTexImage3D(ctx
->Exec
,
4467 (target
, level
, internalFormat
, width
,
4468 height
, depth
, border
, imageSize
,
4475 static void GLAPIENTRY
4476 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4477 GLsizei width
, GLenum format
,
4478 GLsizei imageSize
, const GLvoid
* data
)
4481 GET_CURRENT_CONTEXT(ctx
);
4482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4484 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
4485 6 + POINTER_DWORDS
);
4490 n
[4].i
= (GLint
) width
;
4494 copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB"));
4496 if (ctx
->ExecuteFlag
) {
4497 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4498 width
, format
, imageSize
,
4504 static void GLAPIENTRY
4505 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4506 GLint yoffset
, GLsizei width
, GLsizei height
,
4507 GLenum format
, GLsizei imageSize
,
4508 const GLvoid
* data
)
4511 GET_CURRENT_CONTEXT(ctx
);
4512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4514 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
4515 8 + POINTER_DWORDS
);
4521 n
[5].i
= (GLint
) width
;
4522 n
[6].i
= (GLint
) height
;
4526 copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB"));
4528 if (ctx
->ExecuteFlag
) {
4529 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4530 (target
, level
, xoffset
, yoffset
, width
,
4531 height
, format
, imageSize
, data
));
4536 static void GLAPIENTRY
4537 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4538 GLint yoffset
, GLint zoffset
, GLsizei width
,
4539 GLsizei height
, GLsizei depth
, GLenum format
,
4540 GLsizei imageSize
, const GLvoid
* data
)
4543 GET_CURRENT_CONTEXT(ctx
);
4544 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4546 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
4547 10 + POINTER_DWORDS
);
4554 n
[6].i
= (GLint
) width
;
4555 n
[7].i
= (GLint
) height
;
4556 n
[8].i
= (GLint
) depth
;
4558 n
[10].i
= imageSize
;
4559 save_pointer(&n
[11],
4560 copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB"));
4562 if (ctx
->ExecuteFlag
) {
4563 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4564 (target
, level
, xoffset
, yoffset
,
4565 zoffset
, width
, height
, depth
, format
,
4571 /* GL_ARB_multisample */
4572 static void GLAPIENTRY
4573 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4575 GET_CURRENT_CONTEXT(ctx
);
4577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4578 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4583 if (ctx
->ExecuteFlag
) {
4584 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4590 * GL_NV_fragment_program
4592 static void GLAPIENTRY
4593 save_BindProgramNV(GLenum target
, GLuint id
)
4595 GET_CURRENT_CONTEXT(ctx
);
4597 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4598 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4603 if (ctx
->ExecuteFlag
) {
4604 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4608 static void GLAPIENTRY
4609 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4610 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4612 GET_CURRENT_CONTEXT(ctx
);
4614 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4615 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4624 if (ctx
->ExecuteFlag
) {
4625 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4630 static void GLAPIENTRY
4631 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4632 const GLfloat
*params
)
4634 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4635 params
[2], params
[3]);
4639 static void GLAPIENTRY
4640 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4641 const GLfloat
* params
)
4643 GET_CURRENT_CONTEXT(ctx
);
4645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4649 const GLfloat
* p
= params
;
4651 for (i
= 0 ; i
< count
; i
++) {
4652 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4665 if (ctx
->ExecuteFlag
) {
4666 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4671 static void GLAPIENTRY
4672 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4673 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4675 save_ProgramEnvParameter4fARB(target
, index
,
4677 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4681 static void GLAPIENTRY
4682 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4683 const GLdouble
*params
)
4685 save_ProgramEnvParameter4fARB(target
, index
,
4686 (GLfloat
) params
[0],
4687 (GLfloat
) params
[1],
4688 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4692 static void GLAPIENTRY
4693 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4694 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4696 GET_CURRENT_CONTEXT(ctx
);
4698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4699 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4708 if (ctx
->ExecuteFlag
) {
4709 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4714 static void GLAPIENTRY
4715 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4716 const GLfloat
*params
)
4718 GET_CURRENT_CONTEXT(ctx
);
4720 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4721 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4730 if (ctx
->ExecuteFlag
) {
4731 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4736 static void GLAPIENTRY
4737 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4738 const GLfloat
*params
)
4740 GET_CURRENT_CONTEXT(ctx
);
4742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4746 const GLfloat
* p
= params
;
4748 for (i
= 0 ; i
< count
; i
++) {
4749 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4762 if (ctx
->ExecuteFlag
) {
4763 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4768 static void GLAPIENTRY
4769 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
4770 GLdouble x
, GLdouble y
,
4771 GLdouble z
, GLdouble w
)
4773 GET_CURRENT_CONTEXT(ctx
);
4775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4776 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4780 n
[3].f
= (GLfloat
) x
;
4781 n
[4].f
= (GLfloat
) y
;
4782 n
[5].f
= (GLfloat
) z
;
4783 n
[6].f
= (GLfloat
) w
;
4785 if (ctx
->ExecuteFlag
) {
4786 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4791 static void GLAPIENTRY
4792 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
4793 const GLdouble
*params
)
4795 GET_CURRENT_CONTEXT(ctx
);
4797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4798 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4802 n
[3].f
= (GLfloat
) params
[0];
4803 n
[4].f
= (GLfloat
) params
[1];
4804 n
[5].f
= (GLfloat
) params
[2];
4805 n
[6].f
= (GLfloat
) params
[3];
4807 if (ctx
->ExecuteFlag
) {
4808 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
4813 /* GL_EXT_stencil_two_side */
4814 static void GLAPIENTRY
4815 save_ActiveStencilFaceEXT(GLenum face
)
4817 GET_CURRENT_CONTEXT(ctx
);
4819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4820 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
4824 if (ctx
->ExecuteFlag
) {
4825 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
4830 /* GL_EXT_depth_bounds_test */
4831 static void GLAPIENTRY
4832 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
4834 GET_CURRENT_CONTEXT(ctx
);
4836 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4837 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
4839 n
[1].f
= (GLfloat
) zmin
;
4840 n
[2].f
= (GLfloat
) zmax
;
4842 if (ctx
->ExecuteFlag
) {
4843 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
4849 static void GLAPIENTRY
4850 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
4851 const GLvoid
* string
)
4853 GET_CURRENT_CONTEXT(ctx
);
4856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4858 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 3 + POINTER_DWORDS
);
4860 GLubyte
*programCopy
= malloc(len
);
4862 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
4865 memcpy(programCopy
, string
, len
);
4869 save_pointer(&n
[4], programCopy
);
4871 if (ctx
->ExecuteFlag
) {
4872 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
4877 static void GLAPIENTRY
4878 save_BeginQueryARB(GLenum target
, GLuint id
)
4880 GET_CURRENT_CONTEXT(ctx
);
4882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4883 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
4888 if (ctx
->ExecuteFlag
) {
4889 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
4893 static void GLAPIENTRY
4894 save_EndQueryARB(GLenum target
)
4896 GET_CURRENT_CONTEXT(ctx
);
4898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4899 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
4903 if (ctx
->ExecuteFlag
) {
4904 CALL_EndQuery(ctx
->Exec
, (target
));
4908 static void GLAPIENTRY
4909 save_QueryCounter(GLuint id
, GLenum target
)
4911 GET_CURRENT_CONTEXT(ctx
);
4913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4914 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
4919 if (ctx
->ExecuteFlag
) {
4920 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
4924 static void GLAPIENTRY
4925 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
4927 GET_CURRENT_CONTEXT(ctx
);
4929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4930 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
4936 if (ctx
->ExecuteFlag
) {
4937 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
4941 static void GLAPIENTRY
4942 save_EndQueryIndexed(GLenum target
, GLuint index
)
4944 GET_CURRENT_CONTEXT(ctx
);
4946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4947 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
4952 if (ctx
->ExecuteFlag
) {
4953 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
4958 static void GLAPIENTRY
4959 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
4961 GET_CURRENT_CONTEXT(ctx
);
4963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4964 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
4968 if (count
> MAX_DRAW_BUFFERS
)
4969 count
= MAX_DRAW_BUFFERS
;
4970 for (i
= 0; i
< count
; i
++) {
4971 n
[2 + i
].e
= buffers
[i
];
4974 if (ctx
->ExecuteFlag
) {
4975 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
4979 static void GLAPIENTRY
4980 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
4982 GET_CURRENT_CONTEXT(ctx
);
4985 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
4993 if (ctx
->ExecuteFlag
) {
4994 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
4998 static void GLAPIENTRY
4999 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5002 p
[0] = INT_TO_FLOAT(param
[0]);
5003 p
[1] = INT_TO_FLOAT(param
[1]);
5004 p
[2] = INT_TO_FLOAT(param
[2]);
5005 p
[3] = INT_TO_FLOAT(param
[3]);
5006 save_TexBumpParameterfvATI(pname
, p
);
5009 static void GLAPIENTRY
5010 save_BindFragmentShaderATI(GLuint id
)
5012 GET_CURRENT_CONTEXT(ctx
);
5015 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5019 if (ctx
->ExecuteFlag
) {
5020 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5024 static void GLAPIENTRY
5025 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5027 GET_CURRENT_CONTEXT(ctx
);
5030 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5038 if (ctx
->ExecuteFlag
) {
5039 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5043 static void GLAPIENTRY
5044 save_Attr1fNV(GLenum attr
, GLfloat x
)
5046 GET_CURRENT_CONTEXT(ctx
);
5048 SAVE_FLUSH_VERTICES(ctx
);
5049 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5055 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5056 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5057 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5059 if (ctx
->ExecuteFlag
) {
5060 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5064 static void GLAPIENTRY
5065 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5067 GET_CURRENT_CONTEXT(ctx
);
5069 SAVE_FLUSH_VERTICES(ctx
);
5070 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5077 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5078 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5079 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5081 if (ctx
->ExecuteFlag
) {
5082 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5086 static void GLAPIENTRY
5087 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5089 GET_CURRENT_CONTEXT(ctx
);
5091 SAVE_FLUSH_VERTICES(ctx
);
5092 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5100 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5101 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5102 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5104 if (ctx
->ExecuteFlag
) {
5105 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5109 static void GLAPIENTRY
5110 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5112 GET_CURRENT_CONTEXT(ctx
);
5114 SAVE_FLUSH_VERTICES(ctx
);
5115 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5124 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5125 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5126 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5128 if (ctx
->ExecuteFlag
) {
5129 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5134 static void GLAPIENTRY
5135 save_Attr1fARB(GLenum attr
, GLfloat x
)
5137 GET_CURRENT_CONTEXT(ctx
);
5139 SAVE_FLUSH_VERTICES(ctx
);
5140 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5146 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5147 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5148 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5150 if (ctx
->ExecuteFlag
) {
5151 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5155 static void GLAPIENTRY
5156 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5158 GET_CURRENT_CONTEXT(ctx
);
5160 SAVE_FLUSH_VERTICES(ctx
);
5161 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5168 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5169 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5170 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5172 if (ctx
->ExecuteFlag
) {
5173 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5177 static void GLAPIENTRY
5178 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5180 GET_CURRENT_CONTEXT(ctx
);
5182 SAVE_FLUSH_VERTICES(ctx
);
5183 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5191 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5192 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5193 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5195 if (ctx
->ExecuteFlag
) {
5196 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5200 static void GLAPIENTRY
5201 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5203 GET_CURRENT_CONTEXT(ctx
);
5205 SAVE_FLUSH_VERTICES(ctx
);
5206 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5215 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5216 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5217 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5219 if (ctx
->ExecuteFlag
) {
5220 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5225 static void GLAPIENTRY
5226 save_EvalCoord1f(GLfloat x
)
5228 GET_CURRENT_CONTEXT(ctx
);
5230 SAVE_FLUSH_VERTICES(ctx
);
5231 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5235 if (ctx
->ExecuteFlag
) {
5236 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5240 static void GLAPIENTRY
5241 save_EvalCoord1fv(const GLfloat
* v
)
5243 save_EvalCoord1f(v
[0]);
5246 static void GLAPIENTRY
5247 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5249 GET_CURRENT_CONTEXT(ctx
);
5251 SAVE_FLUSH_VERTICES(ctx
);
5252 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5257 if (ctx
->ExecuteFlag
) {
5258 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5262 static void GLAPIENTRY
5263 save_EvalCoord2fv(const GLfloat
* v
)
5265 save_EvalCoord2f(v
[0], v
[1]);
5269 static void GLAPIENTRY
5270 save_EvalPoint1(GLint x
)
5272 GET_CURRENT_CONTEXT(ctx
);
5274 SAVE_FLUSH_VERTICES(ctx
);
5275 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_EvalPoint1(ctx
->Exec
, (x
));
5284 static void GLAPIENTRY
5285 save_EvalPoint2(GLint x
, GLint y
)
5287 GET_CURRENT_CONTEXT(ctx
);
5289 SAVE_FLUSH_VERTICES(ctx
);
5290 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5295 if (ctx
->ExecuteFlag
) {
5296 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5300 static void GLAPIENTRY
5301 save_Indexf(GLfloat x
)
5303 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5306 static void GLAPIENTRY
5307 save_Indexfv(const GLfloat
* v
)
5309 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5312 static void GLAPIENTRY
5313 save_EdgeFlag(GLboolean x
)
5315 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5320 * Compare 'count' elements of vectors 'a' and 'b'.
5321 * \return GL_TRUE if equal, GL_FALSE if different.
5323 static inline GLboolean
5324 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5326 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5331 * This glMaterial function is used for glMaterial calls that are outside
5332 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5334 static void GLAPIENTRY
5335 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5337 GET_CURRENT_CONTEXT(ctx
);
5345 case GL_FRONT_AND_BACK
:
5348 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5357 case GL_AMBIENT_AND_DIFFUSE
:
5363 case GL_COLOR_INDEXES
:
5367 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5371 if (ctx
->ExecuteFlag
) {
5372 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5375 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5377 /* Try to eliminate redundant statechanges. Because it is legal to
5378 * call glMaterial even inside begin/end calls, don't need to worry
5379 * about ctx->Driver.CurrentSavePrimitive here.
5381 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5382 if (bitmask
& (1 << i
)) {
5383 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5384 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5385 /* no change in material value */
5386 bitmask
&= ~(1 << i
);
5389 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5390 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5395 /* If this call has no effect, return early */
5399 SAVE_FLUSH_VERTICES(ctx
);
5401 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5405 for (i
= 0; i
< args
; i
++)
5406 n
[3 + i
].f
= param
[i
];
5410 static void GLAPIENTRY
5411 save_Begin(GLenum mode
)
5413 GET_CURRENT_CONTEXT(ctx
);
5415 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5416 /* compile this error into the display list */
5417 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5419 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5420 /* compile this error into the display list */
5421 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5426 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5428 /* Give the driver an opportunity to hook in an optimized
5429 * display list compiler.
5431 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5434 SAVE_FLUSH_VERTICES(ctx
);
5435 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5440 if (ctx
->ExecuteFlag
) {
5441 CALL_Begin(ctx
->Exec
, (mode
));
5446 static void GLAPIENTRY
5449 GET_CURRENT_CONTEXT(ctx
);
5450 SAVE_FLUSH_VERTICES(ctx
);
5451 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5452 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5453 if (ctx
->ExecuteFlag
) {
5454 CALL_End(ctx
->Exec
, ());
5458 static void GLAPIENTRY
5459 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5461 GET_CURRENT_CONTEXT(ctx
);
5463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5464 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5471 if (ctx
->ExecuteFlag
) {
5472 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5477 static void GLAPIENTRY
5478 save_Vertex2f(GLfloat x
, GLfloat y
)
5480 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5483 static void GLAPIENTRY
5484 save_Vertex2fv(const GLfloat
* v
)
5486 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5489 static void GLAPIENTRY
5490 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5492 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5495 static void GLAPIENTRY
5496 save_Vertex3fv(const GLfloat
* v
)
5498 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5501 static void GLAPIENTRY
5502 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5504 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5507 static void GLAPIENTRY
5508 save_Vertex4fv(const GLfloat
* v
)
5510 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5513 static void GLAPIENTRY
5514 save_TexCoord1f(GLfloat x
)
5516 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5519 static void GLAPIENTRY
5520 save_TexCoord1fv(const GLfloat
* v
)
5522 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5525 static void GLAPIENTRY
5526 save_TexCoord2f(GLfloat x
, GLfloat y
)
5528 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5531 static void GLAPIENTRY
5532 save_TexCoord2fv(const GLfloat
* v
)
5534 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5537 static void GLAPIENTRY
5538 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5540 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5543 static void GLAPIENTRY
5544 save_TexCoord3fv(const GLfloat
* v
)
5546 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5549 static void GLAPIENTRY
5550 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5552 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5555 static void GLAPIENTRY
5556 save_TexCoord4fv(const GLfloat
* v
)
5558 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5561 static void GLAPIENTRY
5562 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5564 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5567 static void GLAPIENTRY
5568 save_Normal3fv(const GLfloat
* v
)
5570 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5573 static void GLAPIENTRY
5574 save_FogCoordfEXT(GLfloat x
)
5576 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5579 static void GLAPIENTRY
5580 save_FogCoordfvEXT(const GLfloat
* v
)
5582 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5585 static void GLAPIENTRY
5586 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5588 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5591 static void GLAPIENTRY
5592 save_Color3fv(const GLfloat
* v
)
5594 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5597 static void GLAPIENTRY
5598 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5600 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5603 static void GLAPIENTRY
5604 save_Color4fv(const GLfloat
* v
)
5606 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5609 static void GLAPIENTRY
5610 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5612 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5615 static void GLAPIENTRY
5616 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5618 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5622 /* Just call the respective ATTR for texcoord
5624 static void GLAPIENTRY
5625 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5627 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5628 save_Attr1fNV(attr
, x
);
5631 static void GLAPIENTRY
5632 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5634 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5635 save_Attr1fNV(attr
, v
[0]);
5638 static void GLAPIENTRY
5639 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5641 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5642 save_Attr2fNV(attr
, x
, y
);
5645 static void GLAPIENTRY
5646 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5648 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5649 save_Attr2fNV(attr
, v
[0], v
[1]);
5652 static void GLAPIENTRY
5653 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5655 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5656 save_Attr3fNV(attr
, x
, y
, z
);
5659 static void GLAPIENTRY
5660 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5662 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5663 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5666 static void GLAPIENTRY
5667 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5668 GLfloat z
, GLfloat w
)
5670 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5671 save_Attr4fNV(attr
, x
, y
, z
, w
);
5674 static void GLAPIENTRY
5675 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5677 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5678 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5683 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5689 GET_CURRENT_CONTEXT(ctx
);
5690 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5695 static void GLAPIENTRY
5696 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5698 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5699 save_Attr1fARB(index
, x
);
5704 static void GLAPIENTRY
5705 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5707 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5708 save_Attr1fARB(index
, v
[0]);
5713 static void GLAPIENTRY
5714 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5716 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5717 save_Attr2fARB(index
, x
, y
);
5722 static void GLAPIENTRY
5723 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5725 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5726 save_Attr2fARB(index
, v
[0], v
[1]);
5731 static void GLAPIENTRY
5732 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5734 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5735 save_Attr3fARB(index
, x
, y
, z
);
5740 static void GLAPIENTRY
5741 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5743 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5744 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5749 static void GLAPIENTRY
5750 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5753 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5754 save_Attr4fARB(index
, x
, y
, z
, w
);
5759 static void GLAPIENTRY
5760 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5762 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5763 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
5768 static void GLAPIENTRY
5769 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
5770 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
5771 GLbitfield mask
, GLenum filter
)
5773 GET_CURRENT_CONTEXT(ctx
);
5775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5776 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
5789 if (ctx
->ExecuteFlag
) {
5790 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
5791 dstX0
, dstY0
, dstX1
, dstY1
,
5797 /** GL_EXT_provoking_vertex */
5798 static void GLAPIENTRY
5799 save_ProvokingVertexEXT(GLenum mode
)
5801 GET_CURRENT_CONTEXT(ctx
);
5803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5804 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
5808 if (ctx
->ExecuteFlag
) {
5809 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
5810 _mesa_ProvokingVertex(mode
);
5815 /** GL_EXT_transform_feedback */
5816 static void GLAPIENTRY
5817 save_BeginTransformFeedback(GLenum mode
)
5819 GET_CURRENT_CONTEXT(ctx
);
5821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5822 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
5826 if (ctx
->ExecuteFlag
) {
5827 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
5832 /** GL_EXT_transform_feedback */
5833 static void GLAPIENTRY
5834 save_EndTransformFeedback(void)
5836 GET_CURRENT_CONTEXT(ctx
);
5837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5838 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
5839 if (ctx
->ExecuteFlag
) {
5840 CALL_EndTransformFeedback(ctx
->Exec
, ());
5844 static void GLAPIENTRY
5845 save_BindTransformFeedback(GLenum target
, GLuint name
)
5847 GET_CURRENT_CONTEXT(ctx
);
5849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5850 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
5855 if (ctx
->ExecuteFlag
) {
5856 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
5860 static void GLAPIENTRY
5861 save_PauseTransformFeedback(void)
5863 GET_CURRENT_CONTEXT(ctx
);
5864 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5865 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
5866 if (ctx
->ExecuteFlag
) {
5867 CALL_PauseTransformFeedback(ctx
->Exec
, ());
5871 static void GLAPIENTRY
5872 save_ResumeTransformFeedback(void)
5874 GET_CURRENT_CONTEXT(ctx
);
5875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5876 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
5877 if (ctx
->ExecuteFlag
) {
5878 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
5882 static void GLAPIENTRY
5883 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
5885 GET_CURRENT_CONTEXT(ctx
);
5887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5888 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
5893 if (ctx
->ExecuteFlag
) {
5894 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
5898 static void GLAPIENTRY
5899 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
5901 GET_CURRENT_CONTEXT(ctx
);
5903 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5904 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
5910 if (ctx
->ExecuteFlag
) {
5911 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
5915 static void GLAPIENTRY
5916 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
5919 GET_CURRENT_CONTEXT(ctx
);
5921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5922 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
5926 n
[3].si
= primcount
;
5928 if (ctx
->ExecuteFlag
) {
5929 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
5933 static void GLAPIENTRY
5934 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
5935 GLuint stream
, GLsizei primcount
)
5937 GET_CURRENT_CONTEXT(ctx
);
5939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5940 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
5945 n
[4].si
= primcount
;
5947 if (ctx
->ExecuteFlag
) {
5948 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
5953 /* aka UseProgram() */
5954 static void GLAPIENTRY
5955 save_UseProgramObjectARB(GLhandleARB program
)
5957 GET_CURRENT_CONTEXT(ctx
);
5959 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5960 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
5964 if (ctx
->ExecuteFlag
) {
5965 CALL_UseProgram(ctx
->Exec
, (program
));
5970 static void GLAPIENTRY
5971 save_Uniform1fARB(GLint location
, GLfloat x
)
5973 GET_CURRENT_CONTEXT(ctx
);
5975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5976 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
5981 if (ctx
->ExecuteFlag
) {
5982 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
5987 static void GLAPIENTRY
5988 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
5990 GET_CURRENT_CONTEXT(ctx
);
5992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5993 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
5999 if (ctx
->ExecuteFlag
) {
6000 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6005 static void GLAPIENTRY
6006 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6008 GET_CURRENT_CONTEXT(ctx
);
6010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6011 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6018 if (ctx
->ExecuteFlag
) {
6019 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6024 static void GLAPIENTRY
6025 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6027 GET_CURRENT_CONTEXT(ctx
);
6029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6030 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6038 if (ctx
->ExecuteFlag
) {
6039 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6044 static void GLAPIENTRY
6045 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6047 GET_CURRENT_CONTEXT(ctx
);
6049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6050 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 2 + POINTER_DWORDS
);
6054 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6056 if (ctx
->ExecuteFlag
) {
6057 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6061 static void GLAPIENTRY
6062 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6064 GET_CURRENT_CONTEXT(ctx
);
6066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6067 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 2 + POINTER_DWORDS
);
6071 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6073 if (ctx
->ExecuteFlag
) {
6074 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6078 static void GLAPIENTRY
6079 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6081 GET_CURRENT_CONTEXT(ctx
);
6083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6084 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 2 + POINTER_DWORDS
);
6088 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6090 if (ctx
->ExecuteFlag
) {
6091 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6095 static void GLAPIENTRY
6096 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6098 GET_CURRENT_CONTEXT(ctx
);
6100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6101 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 2 + POINTER_DWORDS
);
6105 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6107 if (ctx
->ExecuteFlag
) {
6108 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6113 static void GLAPIENTRY
6114 save_Uniform1iARB(GLint location
, GLint x
)
6116 GET_CURRENT_CONTEXT(ctx
);
6118 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6119 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6124 if (ctx
->ExecuteFlag
) {
6125 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6129 static void GLAPIENTRY
6130 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6132 GET_CURRENT_CONTEXT(ctx
);
6134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6135 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6141 if (ctx
->ExecuteFlag
) {
6142 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6146 static void GLAPIENTRY
6147 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6149 GET_CURRENT_CONTEXT(ctx
);
6151 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6152 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6159 if (ctx
->ExecuteFlag
) {
6160 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6164 static void GLAPIENTRY
6165 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6167 GET_CURRENT_CONTEXT(ctx
);
6169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6170 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6178 if (ctx
->ExecuteFlag
) {
6179 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6185 static void GLAPIENTRY
6186 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6188 GET_CURRENT_CONTEXT(ctx
);
6190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6191 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 2 + POINTER_DWORDS
);
6195 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(GLint
)));
6197 if (ctx
->ExecuteFlag
) {
6198 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6202 static void GLAPIENTRY
6203 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6205 GET_CURRENT_CONTEXT(ctx
);
6207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6208 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 2 + POINTER_DWORDS
);
6212 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(GLint
)));
6214 if (ctx
->ExecuteFlag
) {
6215 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6219 static void GLAPIENTRY
6220 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6222 GET_CURRENT_CONTEXT(ctx
);
6224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6225 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 2 + POINTER_DWORDS
);
6229 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(GLint
)));
6231 if (ctx
->ExecuteFlag
) {
6232 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6236 static void GLAPIENTRY
6237 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6239 GET_CURRENT_CONTEXT(ctx
);
6241 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6242 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 2 + POINTER_DWORDS
);
6246 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6248 if (ctx
->ExecuteFlag
) {
6249 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6255 static void GLAPIENTRY
6256 save_Uniform1ui(GLint location
, GLuint x
)
6258 GET_CURRENT_CONTEXT(ctx
);
6260 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6261 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6266 if (ctx
->ExecuteFlag
) {
6267 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6271 static void GLAPIENTRY
6272 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6274 GET_CURRENT_CONTEXT(ctx
);
6276 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6277 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6283 if (ctx
->ExecuteFlag
) {
6284 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6288 static void GLAPIENTRY
6289 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6291 GET_CURRENT_CONTEXT(ctx
);
6293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6294 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6301 if (ctx
->ExecuteFlag
) {
6302 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6306 static void GLAPIENTRY
6307 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6309 GET_CURRENT_CONTEXT(ctx
);
6311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6312 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6320 if (ctx
->ExecuteFlag
) {
6321 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6327 static void GLAPIENTRY
6328 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6330 GET_CURRENT_CONTEXT(ctx
);
6332 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6333 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 2 + POINTER_DWORDS
);
6337 save_pointer(&n
[3], memdup(v
, count
* 1 * sizeof(*v
)));
6339 if (ctx
->ExecuteFlag
) {
6340 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6344 static void GLAPIENTRY
6345 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6347 GET_CURRENT_CONTEXT(ctx
);
6349 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6350 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 2 + POINTER_DWORDS
);
6354 save_pointer(&n
[3], memdup(v
, count
* 2 * sizeof(*v
)));
6356 if (ctx
->ExecuteFlag
) {
6357 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6361 static void GLAPIENTRY
6362 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6364 GET_CURRENT_CONTEXT(ctx
);
6366 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6367 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 2 + POINTER_DWORDS
);
6371 save_pointer(&n
[3], memdup(v
, count
* 3 * sizeof(*v
)));
6373 if (ctx
->ExecuteFlag
) {
6374 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6378 static void GLAPIENTRY
6379 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6381 GET_CURRENT_CONTEXT(ctx
);
6383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6384 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 2 + POINTER_DWORDS
);
6388 save_pointer(&n
[3], memdup(v
, count
* 4 * sizeof(*v
)));
6390 if (ctx
->ExecuteFlag
) {
6391 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6397 static void GLAPIENTRY
6398 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6401 GET_CURRENT_CONTEXT(ctx
);
6403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6404 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 3 + POINTER_DWORDS
);
6409 save_pointer(&n
[4], memdup(m
, count
* 2 * 2 * sizeof(GLfloat
)));
6411 if (ctx
->ExecuteFlag
) {
6412 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6416 static void GLAPIENTRY
6417 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6420 GET_CURRENT_CONTEXT(ctx
);
6422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6423 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 3 + POINTER_DWORDS
);
6428 save_pointer(&n
[4], memdup(m
, count
* 3 * 3 * sizeof(GLfloat
)));
6430 if (ctx
->ExecuteFlag
) {
6431 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6435 static void GLAPIENTRY
6436 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6439 GET_CURRENT_CONTEXT(ctx
);
6441 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6442 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 3 + POINTER_DWORDS
);
6447 save_pointer(&n
[4], memdup(m
, count
* 4 * 4 * sizeof(GLfloat
)));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6455 static void GLAPIENTRY
6456 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6459 GET_CURRENT_CONTEXT(ctx
);
6461 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6462 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 3 + POINTER_DWORDS
);
6467 save_pointer(&n
[4], memdup(m
, count
* 2 * 3 * sizeof(GLfloat
)));
6469 if (ctx
->ExecuteFlag
) {
6470 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6474 static void GLAPIENTRY
6475 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6478 GET_CURRENT_CONTEXT(ctx
);
6480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6481 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 3 + POINTER_DWORDS
);
6486 save_pointer(&n
[4], memdup(m
, count
* 3 * 2 * sizeof(GLfloat
)));
6488 if (ctx
->ExecuteFlag
) {
6489 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6494 static void GLAPIENTRY
6495 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6498 GET_CURRENT_CONTEXT(ctx
);
6500 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6501 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 3 + POINTER_DWORDS
);
6506 save_pointer(&n
[4], memdup(m
, count
* 2 * 4 * sizeof(GLfloat
)));
6508 if (ctx
->ExecuteFlag
) {
6509 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6513 static void GLAPIENTRY
6514 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6517 GET_CURRENT_CONTEXT(ctx
);
6519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6520 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 3 + POINTER_DWORDS
);
6525 save_pointer(&n
[4], memdup(m
, count
* 4 * 2 * sizeof(GLfloat
)));
6527 if (ctx
->ExecuteFlag
) {
6528 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6533 static void GLAPIENTRY
6534 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6537 GET_CURRENT_CONTEXT(ctx
);
6539 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6540 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 3 + POINTER_DWORDS
);
6545 save_pointer(&n
[4], memdup(m
, count
* 3 * 4 * sizeof(GLfloat
)));
6547 if (ctx
->ExecuteFlag
) {
6548 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6552 static void GLAPIENTRY
6553 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6556 GET_CURRENT_CONTEXT(ctx
);
6558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6559 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 3 + POINTER_DWORDS
);
6564 save_pointer(&n
[4], memdup(m
, count
* 4 * 3 * sizeof(GLfloat
)));
6566 if (ctx
->ExecuteFlag
) {
6567 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6571 static void GLAPIENTRY
6572 save_UseProgramStages(GLuint pipeline
, GLbitfield stages
, GLuint program
)
6574 GET_CURRENT_CONTEXT(ctx
);
6576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6577 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM_STAGES
, 3);
6583 if (ctx
->ExecuteFlag
) {
6584 CALL_UseProgramStages(ctx
->Exec
, (pipeline
, stages
, program
));
6588 static void GLAPIENTRY
6589 save_ProgramUniform1f(GLuint program
, GLint location
, GLfloat x
)
6591 GET_CURRENT_CONTEXT(ctx
);
6593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6594 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1F
, 3);
6600 if (ctx
->ExecuteFlag
) {
6601 CALL_ProgramUniform1f(ctx
->Exec
, (program
, location
, x
));
6605 static void GLAPIENTRY
6606 save_ProgramUniform2f(GLuint program
, GLint location
, GLfloat x
, GLfloat y
)
6608 GET_CURRENT_CONTEXT(ctx
);
6610 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6611 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2F
, 4);
6618 if (ctx
->ExecuteFlag
) {
6619 CALL_ProgramUniform2f(ctx
->Exec
, (program
, location
, x
, y
));
6623 static void GLAPIENTRY
6624 save_ProgramUniform3f(GLuint program
, GLint location
,
6625 GLfloat x
, GLfloat y
, GLfloat z
)
6627 GET_CURRENT_CONTEXT(ctx
);
6629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6630 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3F
, 5);
6638 if (ctx
->ExecuteFlag
) {
6639 CALL_ProgramUniform3f(ctx
->Exec
, (program
, location
, x
, y
, z
));
6643 static void GLAPIENTRY
6644 save_ProgramUniform4f(GLuint program
, GLint location
,
6645 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6647 GET_CURRENT_CONTEXT(ctx
);
6649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6650 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4F
, 6);
6659 if (ctx
->ExecuteFlag
) {
6660 CALL_ProgramUniform4f(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6664 static void GLAPIENTRY
6665 save_ProgramUniform1fv(GLuint program
, GLint location
, GLsizei count
,
6668 GET_CURRENT_CONTEXT(ctx
);
6670 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6671 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1FV
, 3 + POINTER_DWORDS
);
6676 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLfloat
)));
6678 if (ctx
->ExecuteFlag
) {
6679 CALL_ProgramUniform1fv(ctx
->Exec
, (program
, location
, count
, v
));
6683 static void GLAPIENTRY
6684 save_ProgramUniform2fv(GLuint program
, GLint location
, GLsizei count
,
6687 GET_CURRENT_CONTEXT(ctx
);
6689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6690 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2FV
, 3 + POINTER_DWORDS
);
6695 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLfloat
)));
6697 if (ctx
->ExecuteFlag
) {
6698 CALL_ProgramUniform2fv(ctx
->Exec
, (program
, location
, count
, v
));
6702 static void GLAPIENTRY
6703 save_ProgramUniform3fv(GLuint program
, GLint location
, GLsizei count
,
6706 GET_CURRENT_CONTEXT(ctx
);
6708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6709 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3FV
, 3 + POINTER_DWORDS
);
6714 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLfloat
)));
6716 if (ctx
->ExecuteFlag
) {
6717 CALL_ProgramUniform3fv(ctx
->Exec
, (program
, location
, count
, v
));
6721 static void GLAPIENTRY
6722 save_ProgramUniform4fv(GLuint program
, GLint location
, GLsizei count
,
6725 GET_CURRENT_CONTEXT(ctx
);
6727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6728 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4FV
, 3 + POINTER_DWORDS
);
6733 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLfloat
)));
6735 if (ctx
->ExecuteFlag
) {
6736 CALL_ProgramUniform4fv(ctx
->Exec
, (program
, location
, count
, v
));
6740 static void GLAPIENTRY
6741 save_ProgramUniform1i(GLuint program
, GLint location
, GLint x
)
6743 GET_CURRENT_CONTEXT(ctx
);
6745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6746 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1I
, 3);
6752 if (ctx
->ExecuteFlag
) {
6753 CALL_ProgramUniform1i(ctx
->Exec
, (program
, location
, x
));
6757 static void GLAPIENTRY
6758 save_ProgramUniform2i(GLuint program
, GLint location
, GLint x
, GLint y
)
6760 GET_CURRENT_CONTEXT(ctx
);
6762 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6763 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2I
, 4);
6770 if (ctx
->ExecuteFlag
) {
6771 CALL_ProgramUniform2i(ctx
->Exec
, (program
, location
, x
, y
));
6775 static void GLAPIENTRY
6776 save_ProgramUniform3i(GLuint program
, GLint location
,
6777 GLint x
, GLint y
, GLint z
)
6779 GET_CURRENT_CONTEXT(ctx
);
6781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6782 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3I
, 5);
6790 if (ctx
->ExecuteFlag
) {
6791 CALL_ProgramUniform3i(ctx
->Exec
, (program
, location
, x
, y
, z
));
6795 static void GLAPIENTRY
6796 save_ProgramUniform4i(GLuint program
, GLint location
,
6797 GLint x
, GLint y
, GLint z
, GLint w
)
6799 GET_CURRENT_CONTEXT(ctx
);
6801 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6802 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4I
, 6);
6811 if (ctx
->ExecuteFlag
) {
6812 CALL_ProgramUniform4i(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6816 static void GLAPIENTRY
6817 save_ProgramUniform1iv(GLuint program
, GLint location
, GLsizei count
,
6820 GET_CURRENT_CONTEXT(ctx
);
6822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6823 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1IV
, 3 + POINTER_DWORDS
);
6828 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLint
)));
6830 if (ctx
->ExecuteFlag
) {
6831 CALL_ProgramUniform1iv(ctx
->Exec
, (program
, location
, count
, v
));
6835 static void GLAPIENTRY
6836 save_ProgramUniform2iv(GLuint program
, GLint location
, GLsizei count
,
6839 GET_CURRENT_CONTEXT(ctx
);
6841 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6842 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2IV
, 3 + POINTER_DWORDS
);
6847 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLint
)));
6849 if (ctx
->ExecuteFlag
) {
6850 CALL_ProgramUniform2iv(ctx
->Exec
, (program
, location
, count
, v
));
6854 static void GLAPIENTRY
6855 save_ProgramUniform3iv(GLuint program
, GLint location
, GLsizei count
,
6858 GET_CURRENT_CONTEXT(ctx
);
6860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6861 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3IV
, 3 + POINTER_DWORDS
);
6866 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLint
)));
6868 if (ctx
->ExecuteFlag
) {
6869 CALL_ProgramUniform3iv(ctx
->Exec
, (program
, location
, count
, v
));
6873 static void GLAPIENTRY
6874 save_ProgramUniform4iv(GLuint program
, GLint location
, GLsizei count
,
6877 GET_CURRENT_CONTEXT(ctx
);
6879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6880 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4IV
, 3 + POINTER_DWORDS
);
6885 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLint
)));
6887 if (ctx
->ExecuteFlag
) {
6888 CALL_ProgramUniform4iv(ctx
->Exec
, (program
, location
, count
, v
));
6892 static void GLAPIENTRY
6893 save_ProgramUniform1ui(GLuint program
, GLint location
, GLuint x
)
6895 GET_CURRENT_CONTEXT(ctx
);
6897 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6898 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UI
, 3);
6904 if (ctx
->ExecuteFlag
) {
6905 CALL_ProgramUniform1ui(ctx
->Exec
, (program
, location
, x
));
6909 static void GLAPIENTRY
6910 save_ProgramUniform2ui(GLuint program
, GLint location
, GLuint x
, GLuint y
)
6912 GET_CURRENT_CONTEXT(ctx
);
6914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6915 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UI
, 4);
6922 if (ctx
->ExecuteFlag
) {
6923 CALL_ProgramUniform2ui(ctx
->Exec
, (program
, location
, x
, y
));
6927 static void GLAPIENTRY
6928 save_ProgramUniform3ui(GLuint program
, GLint location
,
6929 GLuint x
, GLuint y
, GLuint z
)
6931 GET_CURRENT_CONTEXT(ctx
);
6933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6934 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UI
, 5);
6942 if (ctx
->ExecuteFlag
) {
6943 CALL_ProgramUniform3ui(ctx
->Exec
, (program
, location
, x
, y
, z
));
6947 static void GLAPIENTRY
6948 save_ProgramUniform4ui(GLuint program
, GLint location
,
6949 GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6951 GET_CURRENT_CONTEXT(ctx
);
6953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6954 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UI
, 6);
6963 if (ctx
->ExecuteFlag
) {
6964 CALL_ProgramUniform4ui(ctx
->Exec
, (program
, location
, x
, y
, z
, w
));
6968 static void GLAPIENTRY
6969 save_ProgramUniform1uiv(GLuint program
, GLint location
, GLsizei count
,
6972 GET_CURRENT_CONTEXT(ctx
);
6974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6975 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_1UIV
, 3 + POINTER_DWORDS
);
6980 save_pointer(&n
[4], memdup(v
, count
* 1 * sizeof(GLuint
)));
6982 if (ctx
->ExecuteFlag
) {
6983 CALL_ProgramUniform1uiv(ctx
->Exec
, (program
, location
, count
, v
));
6987 static void GLAPIENTRY
6988 save_ProgramUniform2uiv(GLuint program
, GLint location
, GLsizei count
,
6991 GET_CURRENT_CONTEXT(ctx
);
6993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6994 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_2UIV
, 3 + POINTER_DWORDS
);
6999 save_pointer(&n
[4], memdup(v
, count
* 2 * sizeof(GLuint
)));
7001 if (ctx
->ExecuteFlag
) {
7002 CALL_ProgramUniform2uiv(ctx
->Exec
, (program
, location
, count
, v
));
7006 static void GLAPIENTRY
7007 save_ProgramUniform3uiv(GLuint program
, GLint location
, GLsizei count
,
7010 GET_CURRENT_CONTEXT(ctx
);
7012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7013 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_3UIV
, 3 + POINTER_DWORDS
);
7018 save_pointer(&n
[4], memdup(v
, count
* 3 * sizeof(GLuint
)));
7020 if (ctx
->ExecuteFlag
) {
7021 CALL_ProgramUniform3uiv(ctx
->Exec
, (program
, location
, count
, v
));
7025 static void GLAPIENTRY
7026 save_ProgramUniform4uiv(GLuint program
, GLint location
, GLsizei count
,
7029 GET_CURRENT_CONTEXT(ctx
);
7031 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7032 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_4UIV
, 3 + POINTER_DWORDS
);
7037 save_pointer(&n
[4], memdup(v
, count
* 4 * sizeof(GLuint
)));
7039 if (ctx
->ExecuteFlag
) {
7040 CALL_ProgramUniform4uiv(ctx
->Exec
, (program
, location
, count
, v
));
7044 static void GLAPIENTRY
7045 save_ProgramUniformMatrix2fv(GLuint program
, GLint location
, GLsizei count
,
7046 GLboolean transpose
, const GLfloat
*v
)
7048 GET_CURRENT_CONTEXT(ctx
);
7050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7051 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX22F
,
7052 4 + POINTER_DWORDS
);
7058 save_pointer(&n
[5], memdup(v
, count
* 2 * 2 * sizeof(GLfloat
)));
7060 if (ctx
->ExecuteFlag
) {
7061 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
7062 (program
, location
, count
, transpose
, v
));
7066 static void GLAPIENTRY
7067 save_ProgramUniformMatrix2x3fv(GLuint program
, GLint location
, GLsizei count
,
7068 GLboolean transpose
, const GLfloat
*v
)
7070 GET_CURRENT_CONTEXT(ctx
);
7072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7073 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX23F
,
7074 4 + POINTER_DWORDS
);
7080 save_pointer(&n
[5], memdup(v
, count
* 2 * 3 * sizeof(GLfloat
)));
7082 if (ctx
->ExecuteFlag
) {
7083 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
7084 (program
, location
, count
, transpose
, v
));
7088 static void GLAPIENTRY
7089 save_ProgramUniformMatrix2x4fv(GLuint program
, GLint location
, GLsizei count
,
7090 GLboolean transpose
, const GLfloat
*v
)
7092 GET_CURRENT_CONTEXT(ctx
);
7094 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7095 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX24F
,
7096 4 + POINTER_DWORDS
);
7102 save_pointer(&n
[5], memdup(v
, count
* 2 * 4 * sizeof(GLfloat
)));
7104 if (ctx
->ExecuteFlag
) {
7105 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
7106 (program
, location
, count
, transpose
, v
));
7110 static void GLAPIENTRY
7111 save_ProgramUniformMatrix3x2fv(GLuint program
, GLint location
, GLsizei count
,
7112 GLboolean transpose
, const GLfloat
*v
)
7114 GET_CURRENT_CONTEXT(ctx
);
7116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7117 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX32F
,
7118 4 + POINTER_DWORDS
);
7124 save_pointer(&n
[5], memdup(v
, count
* 3 * 2 * sizeof(GLfloat
)));
7126 if (ctx
->ExecuteFlag
) {
7127 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
7128 (program
, location
, count
, transpose
, v
));
7132 static void GLAPIENTRY
7133 save_ProgramUniformMatrix3fv(GLuint program
, GLint location
, GLsizei count
,
7134 GLboolean transpose
, const GLfloat
*v
)
7136 GET_CURRENT_CONTEXT(ctx
);
7138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7139 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX33F
,
7140 4 + POINTER_DWORDS
);
7146 save_pointer(&n
[5], memdup(v
, count
* 3 * 3 * sizeof(GLfloat
)));
7148 if (ctx
->ExecuteFlag
) {
7149 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
7150 (program
, location
, count
, transpose
, v
));
7154 static void GLAPIENTRY
7155 save_ProgramUniformMatrix3x4fv(GLuint program
, GLint location
, GLsizei count
,
7156 GLboolean transpose
, const GLfloat
*v
)
7158 GET_CURRENT_CONTEXT(ctx
);
7160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7161 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX34F
,
7162 4 + POINTER_DWORDS
);
7168 save_pointer(&n
[5], memdup(v
, count
* 3 * 4 * sizeof(GLfloat
)));
7170 if (ctx
->ExecuteFlag
) {
7171 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
7172 (program
, location
, count
, transpose
, v
));
7176 static void GLAPIENTRY
7177 save_ProgramUniformMatrix4x2fv(GLuint program
, GLint location
, GLsizei count
,
7178 GLboolean transpose
, const GLfloat
*v
)
7180 GET_CURRENT_CONTEXT(ctx
);
7182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7183 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX42F
,
7184 4 + POINTER_DWORDS
);
7190 save_pointer(&n
[5], memdup(v
, count
* 4 * 2 * sizeof(GLfloat
)));
7192 if (ctx
->ExecuteFlag
) {
7193 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
7194 (program
, location
, count
, transpose
, v
));
7198 static void GLAPIENTRY
7199 save_ProgramUniformMatrix4x3fv(GLuint program
, GLint location
, GLsizei count
,
7200 GLboolean transpose
, const GLfloat
*v
)
7202 GET_CURRENT_CONTEXT(ctx
);
7204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7205 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX43F
,
7206 4 + POINTER_DWORDS
);
7212 save_pointer(&n
[5], memdup(v
, count
* 4 * 3 * sizeof(GLfloat
)));
7214 if (ctx
->ExecuteFlag
) {
7215 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
7216 (program
, location
, count
, transpose
, v
));
7220 static void GLAPIENTRY
7221 save_ProgramUniformMatrix4fv(GLuint program
, GLint location
, GLsizei count
,
7222 GLboolean transpose
, const GLfloat
*v
)
7224 GET_CURRENT_CONTEXT(ctx
);
7226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7227 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_UNIFORM_MATRIX44F
,
7228 4 + POINTER_DWORDS
);
7234 save_pointer(&n
[5], memdup(v
, count
* 4 * 4 * sizeof(GLfloat
)));
7236 if (ctx
->ExecuteFlag
) {
7237 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
7238 (program
, location
, count
, transpose
, v
));
7242 static void GLAPIENTRY
7243 save_ClampColorARB(GLenum target
, GLenum clamp
)
7245 GET_CURRENT_CONTEXT(ctx
);
7247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7248 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
7253 if (ctx
->ExecuteFlag
) {
7254 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
7258 /** GL_EXT_texture_integer */
7259 static void GLAPIENTRY
7260 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
7262 GET_CURRENT_CONTEXT(ctx
);
7264 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7265 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
7272 if (ctx
->ExecuteFlag
) {
7273 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7277 /** GL_EXT_texture_integer */
7278 static void GLAPIENTRY
7279 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
7281 GET_CURRENT_CONTEXT(ctx
);
7283 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7284 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
7291 if (ctx
->ExecuteFlag
) {
7292 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
7296 /** GL_EXT_texture_integer */
7297 static void GLAPIENTRY
7298 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
7300 GET_CURRENT_CONTEXT(ctx
);
7302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7303 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
7312 if (ctx
->ExecuteFlag
) {
7313 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
7317 /** GL_EXT_texture_integer */
7318 static void GLAPIENTRY
7319 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
7321 GET_CURRENT_CONTEXT(ctx
);
7323 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7324 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
7328 n
[3].ui
= params
[0];
7329 n
[4].ui
= params
[1];
7330 n
[5].ui
= params
[2];
7331 n
[6].ui
= params
[3];
7333 if (ctx
->ExecuteFlag
) {
7334 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
7338 /* GL_ARB_instanced_arrays */
7339 static void GLAPIENTRY
7340 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
7342 GET_CURRENT_CONTEXT(ctx
);
7344 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7345 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
7350 if (ctx
->ExecuteFlag
) {
7351 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
7356 /* GL_NV_texture_barrier */
7357 static void GLAPIENTRY
7358 save_TextureBarrierNV(void)
7360 GET_CURRENT_CONTEXT(ctx
);
7361 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7362 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
7363 if (ctx
->ExecuteFlag
) {
7364 CALL_TextureBarrierNV(ctx
->Exec
, ());
7369 /* GL_ARB_sampler_objects */
7370 static void GLAPIENTRY
7371 save_BindSampler(GLuint unit
, GLuint sampler
)
7374 GET_CURRENT_CONTEXT(ctx
);
7375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7376 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
7381 if (ctx
->ExecuteFlag
) {
7382 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
7386 static void GLAPIENTRY
7387 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7390 GET_CURRENT_CONTEXT(ctx
);
7391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7392 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7397 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7403 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7406 if (ctx
->ExecuteFlag
) {
7407 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7411 static void GLAPIENTRY
7412 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7416 parray
[1] = parray
[2] = parray
[3] = 0;
7417 save_SamplerParameteriv(sampler
, pname
, parray
);
7420 static void GLAPIENTRY
7421 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7424 GET_CURRENT_CONTEXT(ctx
);
7425 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7426 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7431 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7437 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7440 if (ctx
->ExecuteFlag
) {
7441 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7445 static void GLAPIENTRY
7446 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7450 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7451 save_SamplerParameterfv(sampler
, pname
, parray
);
7454 static void GLAPIENTRY
7455 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7458 GET_CURRENT_CONTEXT(ctx
);
7459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7460 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7465 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7471 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7474 if (ctx
->ExecuteFlag
) {
7475 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7479 static void GLAPIENTRY
7480 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7483 GET_CURRENT_CONTEXT(ctx
);
7484 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7485 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7489 n
[3].ui
= params
[0];
7490 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7491 n
[4].ui
= params
[1];
7492 n
[5].ui
= params
[2];
7493 n
[6].ui
= params
[3];
7496 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7499 if (ctx
->ExecuteFlag
) {
7500 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7504 /* GL_ARB_geometry_shader4 */
7505 static void GLAPIENTRY
7506 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7509 GET_CURRENT_CONTEXT(ctx
);
7510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7511 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7517 if (ctx
->ExecuteFlag
) {
7518 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7522 static void GLAPIENTRY
7523 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7524 GLuint texture
, GLint level
)
7527 GET_CURRENT_CONTEXT(ctx
);
7528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7529 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7532 n
[2].e
= attachment
;
7536 if (ctx
->ExecuteFlag
) {
7537 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7541 static void GLAPIENTRY
7542 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7543 GLuint texture
, GLint level
, GLenum face
)
7546 GET_CURRENT_CONTEXT(ctx
);
7547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7548 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7551 n
[2].e
= attachment
;
7556 if (ctx
->ExecuteFlag
) {
7557 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7564 static void GLAPIENTRY
7565 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7568 GET_CURRENT_CONTEXT(ctx
);
7569 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7570 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7572 union uint64_pair p
;
7575 n
[2].ui
= p
.uint32
[0];
7576 n
[3].ui
= p
.uint32
[1];
7577 save_pointer(&n
[4], sync
);
7579 if (ctx
->ExecuteFlag
) {
7580 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7585 /** GL_NV_conditional_render */
7586 static void GLAPIENTRY
7587 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7589 GET_CURRENT_CONTEXT(ctx
);
7591 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7592 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7597 if (ctx
->ExecuteFlag
) {
7598 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7602 static void GLAPIENTRY
7603 save_EndConditionalRender(void)
7605 GET_CURRENT_CONTEXT(ctx
);
7606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7607 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7608 if (ctx
->ExecuteFlag
) {
7609 CALL_EndConditionalRender(ctx
->Exec
, ());
7613 static void GLAPIENTRY
7614 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7616 GET_CURRENT_CONTEXT(ctx
);
7618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7619 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7625 if (ctx
->ExecuteFlag
) {
7626 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7632 * Save an error-generating command into display list.
7634 * KW: Will appear in the list before the vertex buffer containing the
7635 * command that provoked the error. I don't see this as a problem.
7638 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7641 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 1 + POINTER_DWORDS
);
7644 save_pointer(&n
[2], (void *) s
);
7645 /* note: the data/string here doesn't have to be freed in
7646 * _mesa_delete_list() since the string is never dynamically
7654 * Compile an error into current display list.
7657 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7659 if (ctx
->CompileFlag
)
7660 save_error(ctx
, error
, s
);
7661 if (ctx
->ExecuteFlag
)
7662 _mesa_error(ctx
, error
, "%s", s
);
7667 * Test if ID names a display list.
7670 islist(struct gl_context
*ctx
, GLuint list
)
7672 if (list
> 0 && _mesa_lookup_list(ctx
, list
)) {
7682 /**********************************************************************/
7683 /* Display list execution */
7684 /**********************************************************************/
7688 * Execute a display list. Note that the ListBase offset must have already
7689 * been added before calling this function. I.e. the list argument is
7690 * the absolute list number, not relative to ListBase.
7691 * \param list - display list number
7694 execute_list(struct gl_context
*ctx
, GLuint list
)
7696 struct gl_display_list
*dlist
;
7700 if (list
== 0 || !islist(ctx
, list
))
7703 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7704 /* raise an error? */
7708 dlist
= _mesa_lookup_list(ctx
, list
);
7712 ctx
->ListState
.CallDepth
++;
7714 if (ctx
->Driver
.BeginCallList
)
7715 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7721 const OpCode opcode
= n
[0].opcode
;
7723 if (is_ext_opcode(opcode
)) {
7724 n
+= ext_opcode_execute(ctx
, n
);
7729 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) get_pointer(&n
[2]));
7732 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7734 case OPCODE_ALPHA_FUNC
:
7735 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7737 case OPCODE_BIND_TEXTURE
:
7738 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7742 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7743 ctx
->Unpack
= ctx
->DefaultPacking
;
7744 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7745 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7746 get_pointer(&n
[7])));
7747 ctx
->Unpack
= save
; /* restore */
7750 case OPCODE_BLEND_COLOR
:
7751 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7753 case OPCODE_BLEND_EQUATION
:
7754 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7756 case OPCODE_BLEND_EQUATION_SEPARATE
:
7757 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7759 case OPCODE_BLEND_FUNC_SEPARATE
:
7760 CALL_BlendFuncSeparate(ctx
->Exec
,
7761 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7764 case OPCODE_BLEND_FUNC_I
:
7765 /* GL_ARB_draw_buffers_blend */
7766 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7768 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7769 /* GL_ARB_draw_buffers_blend */
7770 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7773 case OPCODE_BLEND_EQUATION_I
:
7774 /* GL_ARB_draw_buffers_blend */
7775 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7777 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7778 /* GL_ARB_draw_buffers_blend */
7779 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7780 (n
[1].ui
, n
[2].e
, n
[3].e
));
7783 case OPCODE_CALL_LIST
:
7784 /* Generated by glCallList(), don't add ListBase */
7785 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7786 execute_list(ctx
, n
[1].ui
);
7789 case OPCODE_CALL_LIST_OFFSET
:
7790 /* Generated by glCallLists() so we must add ListBase */
7792 /* user specified a bad data type at compile time */
7793 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7795 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7796 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7797 execute_list(ctx
, list
);
7801 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7803 case OPCODE_CLEAR_BUFFER_IV
:
7810 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7813 case OPCODE_CLEAR_BUFFER_UIV
:
7820 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7823 case OPCODE_CLEAR_BUFFER_FV
:
7830 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7833 case OPCODE_CLEAR_BUFFER_FI
:
7834 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7836 case OPCODE_CLEAR_COLOR
:
7837 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7839 case OPCODE_CLEAR_ACCUM
:
7840 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7842 case OPCODE_CLEAR_DEPTH
:
7843 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7845 case OPCODE_CLEAR_INDEX
:
7846 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7848 case OPCODE_CLEAR_STENCIL
:
7849 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7851 case OPCODE_CLIP_PLANE
:
7858 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7861 case OPCODE_COLOR_MASK
:
7862 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7864 case OPCODE_COLOR_MASK_INDEXED
:
7865 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7868 case OPCODE_COLOR_MATERIAL
:
7869 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7871 case OPCODE_COPY_PIXELS
:
7872 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7873 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7876 case OPCODE_COPY_TEX_IMAGE1D
:
7877 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7878 n
[5].i
, n
[6].i
, n
[7].i
));
7880 case OPCODE_COPY_TEX_IMAGE2D
:
7881 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7882 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7884 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7885 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7886 n
[4].i
, n
[5].i
, n
[6].i
));
7888 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7889 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7890 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7893 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7894 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7895 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7898 case OPCODE_CULL_FACE
:
7899 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7901 case OPCODE_DEPTH_FUNC
:
7902 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7904 case OPCODE_DEPTH_MASK
:
7905 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7907 case OPCODE_DEPTH_RANGE
:
7908 CALL_DepthRange(ctx
->Exec
,
7909 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7911 case OPCODE_DISABLE
:
7912 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7914 case OPCODE_DISABLE_INDEXED
:
7915 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7917 case OPCODE_DRAW_BUFFER
:
7918 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7920 case OPCODE_DRAW_PIXELS
:
7922 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7923 ctx
->Unpack
= ctx
->DefaultPacking
;
7924 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7925 get_pointer(&n
[5])));
7926 ctx
->Unpack
= save
; /* restore */
7930 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7932 case OPCODE_ENABLE_INDEXED
:
7933 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7935 case OPCODE_EVALMESH1
:
7936 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7938 case OPCODE_EVALMESH2
:
7939 CALL_EvalMesh2(ctx
->Exec
,
7940 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7949 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7952 case OPCODE_FRONT_FACE
:
7953 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7955 case OPCODE_FRUSTUM
:
7956 CALL_Frustum(ctx
->Exec
,
7957 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7960 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7962 case OPCODE_INDEX_MASK
:
7963 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7965 case OPCODE_INIT_NAMES
:
7966 CALL_InitNames(ctx
->Exec
, ());
7975 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7978 case OPCODE_LIGHT_MODEL
:
7985 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7988 case OPCODE_LINE_STIPPLE
:
7989 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7991 case OPCODE_LINE_WIDTH
:
7992 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7994 case OPCODE_LIST_BASE
:
7995 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7997 case OPCODE_LOAD_IDENTITY
:
7998 CALL_LoadIdentity(ctx
->Exec
, ());
8000 case OPCODE_LOAD_MATRIX
:
8001 if (sizeof(Node
) == sizeof(GLfloat
)) {
8002 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
8007 for (i
= 0; i
< 16; i
++) {
8010 CALL_LoadMatrixf(ctx
->Exec
, (m
));
8013 case OPCODE_LOAD_NAME
:
8014 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
8016 case OPCODE_LOGIC_OP
:
8017 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
8021 GLenum target
= n
[1].e
;
8022 GLint ustride
= _mesa_evaluator_components(target
);
8023 GLint uorder
= n
[5].i
;
8024 GLfloat u1
= n
[2].f
;
8025 GLfloat u2
= n
[3].f
;
8026 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8027 (GLfloat
*) get_pointer(&n
[6])));
8032 GLenum target
= n
[1].e
;
8033 GLfloat u1
= n
[2].f
;
8034 GLfloat u2
= n
[3].f
;
8035 GLfloat v1
= n
[4].f
;
8036 GLfloat v2
= n
[5].f
;
8037 GLint ustride
= n
[6].i
;
8038 GLint vstride
= n
[7].i
;
8039 GLint uorder
= n
[8].i
;
8040 GLint vorder
= n
[9].i
;
8041 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
8042 v1
, v2
, vstride
, vorder
,
8043 (GLfloat
*) get_pointer(&n
[10])));
8046 case OPCODE_MAPGRID1
:
8047 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8049 case OPCODE_MAPGRID2
:
8050 CALL_MapGrid2f(ctx
->Exec
,
8051 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
8053 case OPCODE_MATRIX_MODE
:
8054 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
8056 case OPCODE_MULT_MATRIX
:
8057 if (sizeof(Node
) == sizeof(GLfloat
)) {
8058 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
8063 for (i
= 0; i
< 16; i
++) {
8066 CALL_MultMatrixf(ctx
->Exec
, (m
));
8070 CALL_Ortho(ctx
->Exec
,
8071 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8073 case OPCODE_PASSTHROUGH
:
8074 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
8076 case OPCODE_PIXEL_MAP
:
8077 CALL_PixelMapfv(ctx
->Exec
,
8078 (n
[1].e
, n
[2].i
, get_pointer(&n
[3])));
8080 case OPCODE_PIXEL_TRANSFER
:
8081 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8083 case OPCODE_PIXEL_ZOOM
:
8084 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8086 case OPCODE_POINT_SIZE
:
8087 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
8089 case OPCODE_POINT_PARAMETERS
:
8095 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
8098 case OPCODE_POLYGON_MODE
:
8099 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8101 case OPCODE_POLYGON_STIPPLE
:
8103 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8104 ctx
->Unpack
= ctx
->DefaultPacking
;
8105 CALL_PolygonStipple(ctx
->Exec
, (get_pointer(&n
[1])));
8106 ctx
->Unpack
= save
; /* restore */
8109 case OPCODE_POLYGON_OFFSET
:
8110 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8112 case OPCODE_POP_ATTRIB
:
8113 CALL_PopAttrib(ctx
->Exec
, ());
8115 case OPCODE_POP_MATRIX
:
8116 CALL_PopMatrix(ctx
->Exec
, ());
8118 case OPCODE_POP_NAME
:
8119 CALL_PopName(ctx
->Exec
, ());
8121 case OPCODE_PRIORITIZE_TEXTURE
:
8122 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
8124 case OPCODE_PUSH_ATTRIB
:
8125 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
8127 case OPCODE_PUSH_MATRIX
:
8128 CALL_PushMatrix(ctx
->Exec
, ());
8130 case OPCODE_PUSH_NAME
:
8131 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
8133 case OPCODE_RASTER_POS
:
8134 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8136 case OPCODE_READ_BUFFER
:
8137 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
8140 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8143 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8145 case OPCODE_SCISSOR
:
8146 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8148 case OPCODE_SHADE_MODEL
:
8149 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
8151 case OPCODE_PROVOKING_VERTEX
:
8152 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
8154 case OPCODE_STENCIL_FUNC
:
8155 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
8157 case OPCODE_STENCIL_MASK
:
8158 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
8160 case OPCODE_STENCIL_OP
:
8161 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
8163 case OPCODE_STENCIL_FUNC_SEPARATE
:
8164 CALL_StencilFuncSeparate(ctx
->Exec
,
8165 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
8167 case OPCODE_STENCIL_MASK_SEPARATE
:
8168 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8170 case OPCODE_STENCIL_OP_SEPARATE
:
8171 CALL_StencilOpSeparate(ctx
->Exec
,
8172 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
8181 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8191 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8194 case OPCODE_TEXPARAMETER
:
8201 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8204 case OPCODE_TEX_IMAGE1D
:
8206 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8207 ctx
->Unpack
= ctx
->DefaultPacking
;
8208 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
8210 n
[3].i
, /* components */
8212 n
[5].e
, /* border */
8213 n
[6].e
, /* format */
8215 get_pointer(&n
[8])));
8216 ctx
->Unpack
= save
; /* restore */
8219 case OPCODE_TEX_IMAGE2D
:
8221 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8222 ctx
->Unpack
= ctx
->DefaultPacking
;
8223 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
8225 n
[3].i
, /* components */
8227 n
[5].i
, /* height */
8228 n
[6].e
, /* border */
8229 n
[7].e
, /* format */
8231 get_pointer(&n
[9])));
8232 ctx
->Unpack
= save
; /* restore */
8235 case OPCODE_TEX_IMAGE3D
:
8237 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8238 ctx
->Unpack
= ctx
->DefaultPacking
;
8239 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
8241 n
[3].i
, /* components */
8243 n
[5].i
, /* height */
8245 n
[7].e
, /* border */
8246 n
[8].e
, /* format */
8248 get_pointer(&n
[10])));
8249 ctx
->Unpack
= save
; /* restore */
8252 case OPCODE_TEX_SUB_IMAGE1D
:
8254 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8255 ctx
->Unpack
= ctx
->DefaultPacking
;
8256 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8258 n
[6].e
, get_pointer(&n
[7])));
8259 ctx
->Unpack
= save
; /* restore */
8262 case OPCODE_TEX_SUB_IMAGE2D
:
8264 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8265 ctx
->Unpack
= ctx
->DefaultPacking
;
8266 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8268 n
[6].i
, n
[7].e
, n
[8].e
,
8269 get_pointer(&n
[9])));
8270 ctx
->Unpack
= save
; /* restore */
8273 case OPCODE_TEX_SUB_IMAGE3D
:
8275 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
8276 ctx
->Unpack
= ctx
->DefaultPacking
;
8277 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
8278 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
8279 n
[8].i
, n
[9].e
, n
[10].e
,
8280 get_pointer(&n
[11])));
8281 ctx
->Unpack
= save
; /* restore */
8284 case OPCODE_TRANSLATE
:
8285 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8287 case OPCODE_VIEWPORT
:
8288 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8289 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8291 case OPCODE_WINDOW_POS
:
8292 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8294 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8295 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8297 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8298 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8299 n
[4].i
, n
[5].i
, n
[6].i
,
8300 get_pointer(&n
[7])));
8302 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8303 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8304 n
[4].i
, n
[5].i
, n
[6].i
,
8305 n
[7].i
, get_pointer(&n
[8])));
8307 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8308 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8309 n
[4].i
, n
[5].i
, n
[6].i
,
8311 get_pointer(&n
[9])));
8313 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8314 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8315 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8317 get_pointer(&n
[7])));
8319 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8320 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8321 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8322 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8323 get_pointer(&n
[9])));
8325 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8326 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8327 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8328 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8330 get_pointer(&n
[11])));
8332 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8333 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8335 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8336 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8338 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8339 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8341 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8342 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8343 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8346 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8347 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8349 case OPCODE_DEPTH_BOUNDS_EXT
:
8350 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8352 case OPCODE_PROGRAM_STRING_ARB
:
8353 CALL_ProgramStringARB(ctx
->Exec
,
8354 (n
[1].e
, n
[2].e
, n
[3].i
,
8355 get_pointer(&n
[4])));
8357 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8358 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8362 case OPCODE_BEGIN_QUERY_ARB
:
8363 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8365 case OPCODE_END_QUERY_ARB
:
8366 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8368 case OPCODE_QUERY_COUNTER
:
8369 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8371 case OPCODE_BEGIN_QUERY_INDEXED
:
8372 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8374 case OPCODE_END_QUERY_INDEXED
:
8375 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8377 case OPCODE_DRAW_BUFFERS_ARB
:
8379 GLenum buffers
[MAX_DRAW_BUFFERS
];
8380 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8381 for (i
= 0; i
< count
; i
++)
8382 buffers
[i
] = n
[2 + i
].e
;
8383 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8386 case OPCODE_BLIT_FRAMEBUFFER
:
8387 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8388 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8391 case OPCODE_USE_PROGRAM
:
8392 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8394 case OPCODE_UNIFORM_1F
:
8395 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8397 case OPCODE_UNIFORM_2F
:
8398 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8400 case OPCODE_UNIFORM_3F
:
8401 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8403 case OPCODE_UNIFORM_4F
:
8404 CALL_Uniform4f(ctx
->Exec
,
8405 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8407 case OPCODE_UNIFORM_1FV
:
8408 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8410 case OPCODE_UNIFORM_2FV
:
8411 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8413 case OPCODE_UNIFORM_3FV
:
8414 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8416 case OPCODE_UNIFORM_4FV
:
8417 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8419 case OPCODE_UNIFORM_1I
:
8420 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8422 case OPCODE_UNIFORM_2I
:
8423 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8425 case OPCODE_UNIFORM_3I
:
8426 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8428 case OPCODE_UNIFORM_4I
:
8429 CALL_Uniform4i(ctx
->Exec
,
8430 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8432 case OPCODE_UNIFORM_1IV
:
8433 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8435 case OPCODE_UNIFORM_2IV
:
8436 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8438 case OPCODE_UNIFORM_3IV
:
8439 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8441 case OPCODE_UNIFORM_4IV
:
8442 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, get_pointer(&n
[3])));
8444 case OPCODE_UNIFORM_1UI
:
8445 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8447 case OPCODE_UNIFORM_2UI
:
8448 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8450 case OPCODE_UNIFORM_3UI
:
8451 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8453 case OPCODE_UNIFORM_4UI
:
8454 /*CALL_Uniform4uiARB(ctx->Exec,
8455 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8458 case OPCODE_UNIFORM_1UIV
:
8459 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i,
8460 get_pointer(&n[3])));*/
8462 case OPCODE_UNIFORM_2UIV
:
8463 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i,
8464 get_pointer(&n[3])));*/
8466 case OPCODE_UNIFORM_3UIV
:
8467 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i,
8468 get_pointer(&n[3])));*/
8470 case OPCODE_UNIFORM_4UIV
:
8471 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i,
8472 get_pointer(&n[3])));*/
8474 case OPCODE_UNIFORM_MATRIX22
:
8475 CALL_UniformMatrix2fv(ctx
->Exec
,
8476 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8478 case OPCODE_UNIFORM_MATRIX33
:
8479 CALL_UniformMatrix3fv(ctx
->Exec
,
8480 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8482 case OPCODE_UNIFORM_MATRIX44
:
8483 CALL_UniformMatrix4fv(ctx
->Exec
,
8484 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8486 case OPCODE_UNIFORM_MATRIX23
:
8487 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8488 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8490 case OPCODE_UNIFORM_MATRIX32
:
8491 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8492 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8494 case OPCODE_UNIFORM_MATRIX24
:
8495 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8496 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8498 case OPCODE_UNIFORM_MATRIX42
:
8499 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8500 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8502 case OPCODE_UNIFORM_MATRIX34
:
8503 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8504 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8506 case OPCODE_UNIFORM_MATRIX43
:
8507 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8508 (n
[1].i
, n
[2].i
, n
[3].b
, get_pointer(&n
[4])));
8511 case OPCODE_USE_PROGRAM_STAGES
:
8512 CALL_UseProgramStages(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8514 case OPCODE_PROGRAM_UNIFORM_1F
:
8515 CALL_ProgramUniform1f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
));
8517 case OPCODE_PROGRAM_UNIFORM_2F
:
8518 CALL_ProgramUniform2f(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].f
, n
[4].f
));
8520 case OPCODE_PROGRAM_UNIFORM_3F
:
8521 CALL_ProgramUniform3f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8522 n
[3].f
, n
[4].f
, n
[5].f
));
8524 case OPCODE_PROGRAM_UNIFORM_4F
:
8525 CALL_ProgramUniform4f(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8526 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
8528 case OPCODE_PROGRAM_UNIFORM_1FV
:
8529 CALL_ProgramUniform1fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8530 get_pointer(&n
[4])));
8532 case OPCODE_PROGRAM_UNIFORM_2FV
:
8533 CALL_ProgramUniform2fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8534 get_pointer(&n
[4])));
8536 case OPCODE_PROGRAM_UNIFORM_3FV
:
8537 CALL_ProgramUniform3fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8538 get_pointer(&n
[4])));
8540 case OPCODE_PROGRAM_UNIFORM_4FV
:
8541 CALL_ProgramUniform4fv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8542 get_pointer(&n
[4])));
8544 case OPCODE_PROGRAM_UNIFORM_1I
:
8545 CALL_ProgramUniform1i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
));
8547 case OPCODE_PROGRAM_UNIFORM_2I
:
8548 CALL_ProgramUniform2i(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].i
));
8550 case OPCODE_PROGRAM_UNIFORM_3I
:
8551 CALL_ProgramUniform3i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8552 n
[3].i
, n
[4].i
, n
[5].i
));
8554 case OPCODE_PROGRAM_UNIFORM_4I
:
8555 CALL_ProgramUniform4i(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8556 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
));
8558 case OPCODE_PROGRAM_UNIFORM_1IV
:
8559 CALL_ProgramUniform1iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8560 get_pointer(&n
[4])));
8562 case OPCODE_PROGRAM_UNIFORM_2IV
:
8563 CALL_ProgramUniform2iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8564 get_pointer(&n
[4])));
8566 case OPCODE_PROGRAM_UNIFORM_3IV
:
8567 CALL_ProgramUniform3iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8568 get_pointer(&n
[4])));
8570 case OPCODE_PROGRAM_UNIFORM_4IV
:
8571 CALL_ProgramUniform4iv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8572 get_pointer(&n
[4])));
8574 case OPCODE_PROGRAM_UNIFORM_1UI
:
8575 CALL_ProgramUniform1ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].ui
));
8577 case OPCODE_PROGRAM_UNIFORM_2UI
:
8578 CALL_ProgramUniform2ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8581 case OPCODE_PROGRAM_UNIFORM_3UI
:
8582 CALL_ProgramUniform3ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8583 n
[3].ui
, n
[4].ui
, n
[5].ui
));
8585 case OPCODE_PROGRAM_UNIFORM_4UI
:
8586 CALL_ProgramUniform4ui(ctx
->Exec
, (n
[1].ui
, n
[2].i
,
8588 n
[4].ui
, n
[5].ui
, n
[6].ui
));
8590 case OPCODE_PROGRAM_UNIFORM_1UIV
:
8591 CALL_ProgramUniform1uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8592 get_pointer(&n
[4])));
8594 case OPCODE_PROGRAM_UNIFORM_2UIV
:
8595 CALL_ProgramUniform2uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8596 get_pointer(&n
[4])));
8598 case OPCODE_PROGRAM_UNIFORM_3UIV
:
8599 CALL_ProgramUniform3uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8600 get_pointer(&n
[4])));
8602 case OPCODE_PROGRAM_UNIFORM_4UIV
:
8603 CALL_ProgramUniform4uiv(ctx
->Exec
, (n
[1].ui
, n
[2].i
, n
[3].i
,
8604 get_pointer(&n
[4])));
8606 case OPCODE_PROGRAM_UNIFORM_MATRIX22F
:
8607 CALL_ProgramUniformMatrix2fv(ctx
->Exec
,
8608 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8609 get_pointer(&n
[5])));
8611 case OPCODE_PROGRAM_UNIFORM_MATRIX23F
:
8612 CALL_ProgramUniformMatrix2x3fv(ctx
->Exec
,
8613 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8614 get_pointer(&n
[5])));
8616 case OPCODE_PROGRAM_UNIFORM_MATRIX24F
:
8617 CALL_ProgramUniformMatrix2x4fv(ctx
->Exec
,
8618 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8619 get_pointer(&n
[5])));
8621 case OPCODE_PROGRAM_UNIFORM_MATRIX32F
:
8622 CALL_ProgramUniformMatrix3x2fv(ctx
->Exec
,
8623 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8624 get_pointer(&n
[5])));
8626 case OPCODE_PROGRAM_UNIFORM_MATRIX33F
:
8627 CALL_ProgramUniformMatrix3fv(ctx
->Exec
,
8628 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8629 get_pointer(&n
[5])));
8631 case OPCODE_PROGRAM_UNIFORM_MATRIX34F
:
8632 CALL_ProgramUniformMatrix3x4fv(ctx
->Exec
,
8633 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8634 get_pointer(&n
[5])));
8636 case OPCODE_PROGRAM_UNIFORM_MATRIX42F
:
8637 CALL_ProgramUniformMatrix4x2fv(ctx
->Exec
,
8638 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8639 get_pointer(&n
[5])));
8641 case OPCODE_PROGRAM_UNIFORM_MATRIX43F
:
8642 CALL_ProgramUniformMatrix4x3fv(ctx
->Exec
,
8643 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8644 get_pointer(&n
[5])));
8646 case OPCODE_PROGRAM_UNIFORM_MATRIX44F
:
8647 CALL_ProgramUniformMatrix4fv(ctx
->Exec
,
8648 (n
[1].ui
, n
[2].i
, n
[3].i
, n
[4].b
,
8649 get_pointer(&n
[5])));
8652 case OPCODE_CLAMP_COLOR
:
8653 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8656 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8659 GLuint i
, pname
= n
[1].ui
;
8661 for (i
= 0; i
< 4; i
++)
8662 values
[i
] = n
[1 + i
].f
;
8663 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8666 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8667 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8669 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8672 GLuint i
, dst
= n
[1].ui
;
8674 for (i
= 0; i
< 4; i
++)
8675 values
[i
] = n
[1 + i
].f
;
8676 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8679 case OPCODE_ATTR_1F_NV
:
8680 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8682 case OPCODE_ATTR_2F_NV
:
8683 /* Really shouldn't have to do this - the Node structure
8684 * is convenient, but it would be better to store the data
8685 * packed appropriately so that it can be sent directly
8686 * on. With x86_64 becoming common, this will start to
8689 if (sizeof(Node
) == sizeof(GLfloat
))
8690 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8692 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8694 case OPCODE_ATTR_3F_NV
:
8695 if (sizeof(Node
) == sizeof(GLfloat
))
8696 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8698 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8701 case OPCODE_ATTR_4F_NV
:
8702 if (sizeof(Node
) == sizeof(GLfloat
))
8703 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8705 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8708 case OPCODE_ATTR_1F_ARB
:
8709 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8711 case OPCODE_ATTR_2F_ARB
:
8712 /* Really shouldn't have to do this - the Node structure
8713 * is convenient, but it would be better to store the data
8714 * packed appropriately so that it can be sent directly
8715 * on. With x86_64 becoming common, this will start to
8718 if (sizeof(Node
) == sizeof(GLfloat
))
8719 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8721 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8723 case OPCODE_ATTR_3F_ARB
:
8724 if (sizeof(Node
) == sizeof(GLfloat
))
8725 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8727 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8730 case OPCODE_ATTR_4F_ARB
:
8731 if (sizeof(Node
) == sizeof(GLfloat
))
8732 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8734 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8737 case OPCODE_MATERIAL
:
8738 if (sizeof(Node
) == sizeof(GLfloat
))
8739 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8746 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8750 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8753 CALL_End(ctx
->Exec
, ());
8756 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8758 case OPCODE_EVAL_C1
:
8759 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8761 case OPCODE_EVAL_C2
:
8762 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8764 case OPCODE_EVAL_P1
:
8765 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8767 case OPCODE_EVAL_P2
:
8768 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8771 /* GL_EXT_texture_integer */
8772 case OPCODE_CLEARCOLOR_I
:
8773 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8775 case OPCODE_CLEARCOLOR_UI
:
8776 CALL_ClearColorIuiEXT(ctx
->Exec
,
8777 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8779 case OPCODE_TEXPARAMETER_I
:
8786 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8789 case OPCODE_TEXPARAMETER_UI
:
8792 params
[0] = n
[3].ui
;
8793 params
[1] = n
[4].ui
;
8794 params
[2] = n
[5].ui
;
8795 params
[3] = n
[6].ui
;
8796 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8800 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8801 /* GL_ARB_instanced_arrays */
8802 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8805 case OPCODE_TEXTURE_BARRIER_NV
:
8806 CALL_TextureBarrierNV(ctx
->Exec
, ());
8809 /* GL_EXT/ARB_transform_feedback */
8810 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8811 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8813 case OPCODE_END_TRANSFORM_FEEDBACK
:
8814 CALL_EndTransformFeedback(ctx
->Exec
, ());
8816 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8817 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8819 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8820 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8822 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8823 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8825 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8826 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8828 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8829 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8830 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8832 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8833 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8834 (n
[1].e
, n
[2].ui
, n
[3].si
));
8836 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8837 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8838 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8842 case OPCODE_BIND_SAMPLER
:
8843 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8845 case OPCODE_SAMPLER_PARAMETERIV
:
8852 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8855 case OPCODE_SAMPLER_PARAMETERFV
:
8862 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8865 case OPCODE_SAMPLER_PARAMETERIIV
:
8872 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8875 case OPCODE_SAMPLER_PARAMETERUIV
:
8878 params
[0] = n
[3].ui
;
8879 params
[1] = n
[4].ui
;
8880 params
[2] = n
[5].ui
;
8881 params
[3] = n
[6].ui
;
8882 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8886 /* GL_ARB_geometry_shader4 */
8887 case OPCODE_PROGRAM_PARAMETERI
:
8888 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8890 case OPCODE_FRAMEBUFFER_TEXTURE
:
8891 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8894 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8895 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8896 n
[3].ui
, n
[4].i
, n
[5].e
));
8900 case OPCODE_WAIT_SYNC
:
8902 union uint64_pair p
;
8903 p
.uint32
[0] = n
[2].ui
;
8904 p
.uint32
[1] = n
[3].ui
;
8905 CALL_WaitSync(ctx
->Exec
,
8906 (get_pointer(&n
[4]), n
[1].bf
, p
.uint64
));
8910 /* GL_NV_conditional_render */
8911 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8912 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8914 case OPCODE_END_CONDITIONAL_RENDER
:
8915 CALL_EndConditionalRender(ctx
->Exec
, ());
8918 case OPCODE_UNIFORM_BLOCK_BINDING
:
8919 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8922 case OPCODE_CONTINUE
:
8923 n
= (Node
*) get_pointer(&n
[1]);
8925 case OPCODE_END_OF_LIST
:
8931 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8933 _mesa_problem(ctx
, "%s", msg
);
8938 /* increment n to point to next compiled command */
8939 if (opcode
!= OPCODE_CONTINUE
) {
8940 n
+= InstSize
[opcode
];
8945 if (ctx
->Driver
.EndCallList
)
8946 ctx
->Driver
.EndCallList(ctx
);
8948 ctx
->ListState
.CallDepth
--;
8953 /**********************************************************************/
8955 /**********************************************************************/
8958 * Test if a display list number is valid.
8960 GLboolean GLAPIENTRY
8961 _mesa_IsList(GLuint list
)
8963 GET_CURRENT_CONTEXT(ctx
);
8964 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8965 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8966 return islist(ctx
, list
);
8971 * Delete a sequence of consecutive display lists.
8974 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8976 GET_CURRENT_CONTEXT(ctx
);
8978 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8979 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8982 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8985 for (i
= list
; i
< list
+ range
; i
++) {
8986 destroy_list(ctx
, i
);
8992 * Return a display list number, n, such that lists n through n+range-1
8996 _mesa_GenLists(GLsizei range
)
8998 GET_CURRENT_CONTEXT(ctx
);
9000 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9001 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
9004 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
9012 * Make this an atomic operation
9014 mtx_lock(&ctx
->Shared
->Mutex
);
9016 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
9018 /* reserve the list IDs by with empty/dummy lists */
9020 for (i
= 0; i
< range
; i
++) {
9021 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
9022 make_list(base
+ i
, 1));
9026 mtx_unlock(&ctx
->Shared
->Mutex
);
9033 * Begin a new display list.
9036 _mesa_NewList(GLuint name
, GLenum mode
)
9038 GET_CURRENT_CONTEXT(ctx
);
9040 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
9041 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9043 if (MESA_VERBOSE
& VERBOSE_API
)
9044 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
9045 _mesa_lookup_enum_by_nr(mode
));
9048 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
9052 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
9053 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
9057 if (ctx
->ListState
.CurrentList
) {
9058 /* already compiling a display list */
9059 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
9063 ctx
->CompileFlag
= GL_TRUE
;
9064 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
9066 /* Reset accumulated list state */
9067 invalidate_saved_current_state( ctx
);
9069 /* Allocate new display list */
9070 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
9071 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
9072 ctx
->ListState
.CurrentPos
= 0;
9074 ctx
->Driver
.NewList(ctx
, name
, mode
);
9076 ctx
->CurrentDispatch
= ctx
->Save
;
9077 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9082 * End definition of current display list.
9087 GET_CURRENT_CONTEXT(ctx
);
9088 SAVE_FLUSH_VERTICES(ctx
);
9089 FLUSH_VERTICES(ctx
, 0);
9091 if (MESA_VERBOSE
& VERBOSE_API
)
9092 _mesa_debug(ctx
, "glEndList\n");
9094 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
9095 _mesa_error(ctx
, GL_INVALID_OPERATION
,
9096 "glEndList() called inside glBegin/End");
9099 /* Check that a list is under construction */
9100 if (!ctx
->ListState
.CurrentList
) {
9101 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
9105 /* Call before emitting END_OF_LIST, in case the driver wants to
9106 * emit opcodes itself.
9108 ctx
->Driver
.EndList(ctx
);
9110 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
9114 /* Destroy old list, if any */
9115 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
9117 /* Install the new list */
9118 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
9119 ctx
->ListState
.CurrentList
->Name
,
9120 ctx
->ListState
.CurrentList
);
9123 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
9124 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
9126 ctx
->ListState
.CurrentList
= NULL
;
9127 ctx
->ListState
.CurrentBlock
= NULL
;
9128 ctx
->ListState
.CurrentPos
= 0;
9129 ctx
->ExecuteFlag
= GL_TRUE
;
9130 ctx
->CompileFlag
= GL_FALSE
;
9132 ctx
->CurrentDispatch
= ctx
->Exec
;
9133 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9138 _mesa_CallList(GLuint list
)
9140 GLboolean save_compile_flag
;
9141 GET_CURRENT_CONTEXT(ctx
);
9142 FLUSH_CURRENT(ctx
, 0);
9144 if (MESA_VERBOSE
& VERBOSE_API
)
9145 _mesa_debug(ctx
, "glCallList %d\n", list
);
9148 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
9153 mesa_print_display_list( list
);
9155 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
9156 * execute the display list, and restore the CompileFlag.
9158 save_compile_flag
= ctx
->CompileFlag
;
9159 if (save_compile_flag
) {
9160 ctx
->CompileFlag
= GL_FALSE
;
9163 execute_list(ctx
, list
);
9164 ctx
->CompileFlag
= save_compile_flag
;
9166 /* also restore API function pointers to point to "save" versions */
9167 if (save_compile_flag
) {
9168 ctx
->CurrentDispatch
= ctx
->Save
;
9169 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9175 * Execute glCallLists: call multiple display lists.
9178 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
9180 GET_CURRENT_CONTEXT(ctx
);
9182 GLboolean save_compile_flag
;
9184 if (MESA_VERBOSE
& VERBOSE_API
)
9185 _mesa_debug(ctx
, "glCallLists %d\n", n
);
9189 case GL_UNSIGNED_BYTE
:
9191 case GL_UNSIGNED_SHORT
:
9193 case GL_UNSIGNED_INT
:
9201 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
9205 /* Save the CompileFlag status, turn it off, execute display list,
9206 * and restore the CompileFlag.
9208 save_compile_flag
= ctx
->CompileFlag
;
9209 ctx
->CompileFlag
= GL_FALSE
;
9211 for (i
= 0; i
< n
; i
++) {
9212 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
9213 execute_list(ctx
, list
);
9216 ctx
->CompileFlag
= save_compile_flag
;
9218 /* also restore API function pointers to point to "save" versions */
9219 if (save_compile_flag
) {
9220 ctx
->CurrentDispatch
= ctx
->Save
;
9221 _glapi_set_dispatch(ctx
->CurrentDispatch
);
9227 * Set the offset added to list numbers in glCallLists.
9230 _mesa_ListBase(GLuint base
)
9232 GET_CURRENT_CONTEXT(ctx
);
9233 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
9234 ASSERT_OUTSIDE_BEGIN_END(ctx
);
9235 ctx
->List
.ListBase
= base
;
9239 * Setup the given dispatch table to point to Mesa's display list
9240 * building functions.
9242 * This does not include any of the tnl functions - they are
9243 * initialized from _mesa_init_api_defaults and from the active vtxfmt
9247 _mesa_initialize_save_table(const struct gl_context
*ctx
)
9249 struct _glapi_table
*table
= ctx
->Save
;
9250 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
9252 /* Initially populate the dispatch table with the contents of the
9253 * normal-execution dispatch table. This lets us skip populating functions
9254 * that should be called directly instead of compiled into display lists.
9256 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
9258 _mesa_loopback_init_api_table(ctx
, table
);
9261 vbo_initialize_save_dispatch(ctx
, table
);
9264 SET_Accum(table
, save_Accum
);
9265 SET_AlphaFunc(table
, save_AlphaFunc
);
9266 SET_Bitmap(table
, save_Bitmap
);
9267 SET_BlendFunc(table
, save_BlendFunc
);
9268 SET_CallList(table
, save_CallList
);
9269 SET_CallLists(table
, save_CallLists
);
9270 SET_Clear(table
, save_Clear
);
9271 SET_ClearAccum(table
, save_ClearAccum
);
9272 SET_ClearColor(table
, save_ClearColor
);
9273 SET_ClearDepth(table
, save_ClearDepth
);
9274 SET_ClearIndex(table
, save_ClearIndex
);
9275 SET_ClearStencil(table
, save_ClearStencil
);
9276 SET_ClipPlane(table
, save_ClipPlane
);
9277 SET_ColorMask(table
, save_ColorMask
);
9278 SET_ColorMaski(table
, save_ColorMaskIndexed
);
9279 SET_ColorMaterial(table
, save_ColorMaterial
);
9280 SET_CopyPixels(table
, save_CopyPixels
);
9281 SET_CullFace(table
, save_CullFace
);
9282 SET_DepthFunc(table
, save_DepthFunc
);
9283 SET_DepthMask(table
, save_DepthMask
);
9284 SET_DepthRange(table
, save_DepthRange
);
9285 SET_Disable(table
, save_Disable
);
9286 SET_Disablei(table
, save_DisableIndexed
);
9287 SET_DrawBuffer(table
, save_DrawBuffer
);
9288 SET_DrawPixels(table
, save_DrawPixels
);
9289 SET_Enable(table
, save_Enable
);
9290 SET_Enablei(table
, save_EnableIndexed
);
9291 SET_EvalMesh1(table
, save_EvalMesh1
);
9292 SET_EvalMesh2(table
, save_EvalMesh2
);
9293 SET_Fogf(table
, save_Fogf
);
9294 SET_Fogfv(table
, save_Fogfv
);
9295 SET_Fogi(table
, save_Fogi
);
9296 SET_Fogiv(table
, save_Fogiv
);
9297 SET_FrontFace(table
, save_FrontFace
);
9298 SET_Frustum(table
, save_Frustum
);
9299 SET_Hint(table
, save_Hint
);
9300 SET_IndexMask(table
, save_IndexMask
);
9301 SET_InitNames(table
, save_InitNames
);
9302 SET_LightModelf(table
, save_LightModelf
);
9303 SET_LightModelfv(table
, save_LightModelfv
);
9304 SET_LightModeli(table
, save_LightModeli
);
9305 SET_LightModeliv(table
, save_LightModeliv
);
9306 SET_Lightf(table
, save_Lightf
);
9307 SET_Lightfv(table
, save_Lightfv
);
9308 SET_Lighti(table
, save_Lighti
);
9309 SET_Lightiv(table
, save_Lightiv
);
9310 SET_LineStipple(table
, save_LineStipple
);
9311 SET_LineWidth(table
, save_LineWidth
);
9312 SET_ListBase(table
, save_ListBase
);
9313 SET_LoadIdentity(table
, save_LoadIdentity
);
9314 SET_LoadMatrixd(table
, save_LoadMatrixd
);
9315 SET_LoadMatrixf(table
, save_LoadMatrixf
);
9316 SET_LoadName(table
, save_LoadName
);
9317 SET_LogicOp(table
, save_LogicOp
);
9318 SET_Map1d(table
, save_Map1d
);
9319 SET_Map1f(table
, save_Map1f
);
9320 SET_Map2d(table
, save_Map2d
);
9321 SET_Map2f(table
, save_Map2f
);
9322 SET_MapGrid1d(table
, save_MapGrid1d
);
9323 SET_MapGrid1f(table
, save_MapGrid1f
);
9324 SET_MapGrid2d(table
, save_MapGrid2d
);
9325 SET_MapGrid2f(table
, save_MapGrid2f
);
9326 SET_MatrixMode(table
, save_MatrixMode
);
9327 SET_MultMatrixd(table
, save_MultMatrixd
);
9328 SET_MultMatrixf(table
, save_MultMatrixf
);
9329 SET_NewList(table
, save_NewList
);
9330 SET_Ortho(table
, save_Ortho
);
9331 SET_PassThrough(table
, save_PassThrough
);
9332 SET_PixelMapfv(table
, save_PixelMapfv
);
9333 SET_PixelMapuiv(table
, save_PixelMapuiv
);
9334 SET_PixelMapusv(table
, save_PixelMapusv
);
9335 SET_PixelTransferf(table
, save_PixelTransferf
);
9336 SET_PixelTransferi(table
, save_PixelTransferi
);
9337 SET_PixelZoom(table
, save_PixelZoom
);
9338 SET_PointSize(table
, save_PointSize
);
9339 SET_PolygonMode(table
, save_PolygonMode
);
9340 SET_PolygonOffset(table
, save_PolygonOffset
);
9341 SET_PolygonStipple(table
, save_PolygonStipple
);
9342 SET_PopAttrib(table
, save_PopAttrib
);
9343 SET_PopMatrix(table
, save_PopMatrix
);
9344 SET_PopName(table
, save_PopName
);
9345 SET_PushAttrib(table
, save_PushAttrib
);
9346 SET_PushMatrix(table
, save_PushMatrix
);
9347 SET_PushName(table
, save_PushName
);
9348 SET_RasterPos2d(table
, save_RasterPos2d
);
9349 SET_RasterPos2dv(table
, save_RasterPos2dv
);
9350 SET_RasterPos2f(table
, save_RasterPos2f
);
9351 SET_RasterPos2fv(table
, save_RasterPos2fv
);
9352 SET_RasterPos2i(table
, save_RasterPos2i
);
9353 SET_RasterPos2iv(table
, save_RasterPos2iv
);
9354 SET_RasterPos2s(table
, save_RasterPos2s
);
9355 SET_RasterPos2sv(table
, save_RasterPos2sv
);
9356 SET_RasterPos3d(table
, save_RasterPos3d
);
9357 SET_RasterPos3dv(table
, save_RasterPos3dv
);
9358 SET_RasterPos3f(table
, save_RasterPos3f
);
9359 SET_RasterPos3fv(table
, save_RasterPos3fv
);
9360 SET_RasterPos3i(table
, save_RasterPos3i
);
9361 SET_RasterPos3iv(table
, save_RasterPos3iv
);
9362 SET_RasterPos3s(table
, save_RasterPos3s
);
9363 SET_RasterPos3sv(table
, save_RasterPos3sv
);
9364 SET_RasterPos4d(table
, save_RasterPos4d
);
9365 SET_RasterPos4dv(table
, save_RasterPos4dv
);
9366 SET_RasterPos4f(table
, save_RasterPos4f
);
9367 SET_RasterPos4fv(table
, save_RasterPos4fv
);
9368 SET_RasterPos4i(table
, save_RasterPos4i
);
9369 SET_RasterPos4iv(table
, save_RasterPos4iv
);
9370 SET_RasterPos4s(table
, save_RasterPos4s
);
9371 SET_RasterPos4sv(table
, save_RasterPos4sv
);
9372 SET_ReadBuffer(table
, save_ReadBuffer
);
9373 SET_Rectf(table
, save_Rectf
);
9374 SET_Rotated(table
, save_Rotated
);
9375 SET_Rotatef(table
, save_Rotatef
);
9376 SET_Scaled(table
, save_Scaled
);
9377 SET_Scalef(table
, save_Scalef
);
9378 SET_Scissor(table
, save_Scissor
);
9379 SET_ShadeModel(table
, save_ShadeModel
);
9380 SET_StencilFunc(table
, save_StencilFunc
);
9381 SET_StencilMask(table
, save_StencilMask
);
9382 SET_StencilOp(table
, save_StencilOp
);
9383 SET_TexEnvf(table
, save_TexEnvf
);
9384 SET_TexEnvfv(table
, save_TexEnvfv
);
9385 SET_TexEnvi(table
, save_TexEnvi
);
9386 SET_TexEnviv(table
, save_TexEnviv
);
9387 SET_TexGend(table
, save_TexGend
);
9388 SET_TexGendv(table
, save_TexGendv
);
9389 SET_TexGenf(table
, save_TexGenf
);
9390 SET_TexGenfv(table
, save_TexGenfv
);
9391 SET_TexGeni(table
, save_TexGeni
);
9392 SET_TexGeniv(table
, save_TexGeniv
);
9393 SET_TexImage1D(table
, save_TexImage1D
);
9394 SET_TexImage2D(table
, save_TexImage2D
);
9395 SET_TexParameterf(table
, save_TexParameterf
);
9396 SET_TexParameterfv(table
, save_TexParameterfv
);
9397 SET_TexParameteri(table
, save_TexParameteri
);
9398 SET_TexParameteriv(table
, save_TexParameteriv
);
9399 SET_Translated(table
, save_Translated
);
9400 SET_Translatef(table
, save_Translatef
);
9401 SET_Viewport(table
, save_Viewport
);
9404 SET_BindTexture(table
, save_BindTexture
);
9405 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
9406 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
9407 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
9408 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
9409 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
9410 SET_TexSubImage1D(table
, save_TexSubImage1D
);
9411 SET_TexSubImage2D(table
, save_TexSubImage2D
);
9414 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
9415 SET_TexImage3D(table
, save_TexImage3D
);
9416 SET_TexSubImage3D(table
, save_TexSubImage3D
);
9419 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
9420 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
9421 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
9423 /* ATI_separate_stencil */
9424 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
9426 /* GL_ARB_imaging */
9427 /* Not all are supported */
9428 SET_BlendColor(table
, save_BlendColor
);
9429 SET_BlendEquation(table
, save_BlendEquation
);
9431 /* 2. GL_EXT_blend_color */
9433 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9436 /* 3. GL_EXT_polygon_offset */
9437 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9439 /* 6. GL_EXT_texture3d */
9441 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9442 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9443 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9446 /* 37. GL_EXT_blend_minmax */
9448 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9451 /* 54. GL_EXT_point_parameters */
9452 SET_PointParameterf(table
, save_PointParameterfEXT
);
9453 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9455 /* 173. GL_EXT_blend_func_separate */
9456 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9458 /* 197. GL_MESA_window_pos */
9459 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9460 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9461 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9462 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9463 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9464 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9465 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9466 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9467 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9468 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9469 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9470 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9471 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9472 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9473 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9474 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9475 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9476 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9477 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9478 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9479 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9480 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9481 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9482 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9484 /* 233. GL_NV_vertex_program */
9485 /* The following commands DO NOT go into display lists:
9486 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9487 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9489 SET_BindProgramARB(table
, save_BindProgramNV
);
9491 /* 244. GL_ATI_envmap_bumpmap */
9492 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9493 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9495 /* 245. GL_ATI_fragment_shader */
9496 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9497 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9499 /* 262. GL_NV_point_sprite */
9500 SET_PointParameteri(table
, save_PointParameteriNV
);
9501 SET_PointParameteriv(table
, save_PointParameterivNV
);
9503 /* 268. GL_EXT_stencil_two_side */
9504 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9506 /* ???. GL_EXT_depth_bounds_test */
9507 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9509 /* ARB 1. GL_ARB_multitexture */
9510 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9512 /* ARB 3. GL_ARB_transpose_matrix */
9513 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9514 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9515 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9516 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9518 /* ARB 5. GL_ARB_multisample */
9519 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9521 /* ARB 12. GL_ARB_texture_compression */
9522 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9523 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9524 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9525 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9526 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9527 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9529 /* ARB 14. GL_ARB_point_parameters */
9530 /* aliased with EXT_point_parameters functions */
9532 /* ARB 25. GL_ARB_window_pos */
9533 /* aliased with MESA_window_pos functions */
9535 /* ARB 26. GL_ARB_vertex_program */
9536 /* ARB 27. GL_ARB_fragment_program */
9537 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9538 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9539 SET_BindProgramARB(table
, save_BindProgramNV
);
9540 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9541 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9542 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9543 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9544 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9545 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9546 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9547 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9549 SET_BeginQuery(table
, save_BeginQueryARB
);
9550 SET_EndQuery(table
, save_EndQueryARB
);
9551 SET_QueryCounter(table
, save_QueryCounter
);
9553 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9555 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9557 SET_UseProgram(table
, save_UseProgramObjectARB
);
9558 SET_Uniform1f(table
, save_Uniform1fARB
);
9559 SET_Uniform2f(table
, save_Uniform2fARB
);
9560 SET_Uniform3f(table
, save_Uniform3fARB
);
9561 SET_Uniform4f(table
, save_Uniform4fARB
);
9562 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9563 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9564 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9565 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9566 SET_Uniform1i(table
, save_Uniform1iARB
);
9567 SET_Uniform2i(table
, save_Uniform2iARB
);
9568 SET_Uniform3i(table
, save_Uniform3iARB
);
9569 SET_Uniform4i(table
, save_Uniform4iARB
);
9570 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9571 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9572 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9573 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9574 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9575 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9576 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9577 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9578 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9579 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9580 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9581 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9582 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9584 /* 299. GL_EXT_blend_equation_separate */
9585 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9587 /* GL_EXT_gpu_program_parameters */
9588 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9589 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9591 /* 364. GL_EXT_provoking_vertex */
9592 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9594 /* GL_EXT_texture_integer */
9595 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9596 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9597 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9598 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9600 /* GL_ARB_color_buffer_float */
9601 SET_ClampColor(table
, save_ClampColorARB
);
9604 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9605 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9606 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9607 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9609 SET_Uniform1ui(table
, save_Uniform1ui
);
9610 SET_Uniform2ui(table
, save_Uniform2ui
);
9611 SET_Uniform3ui(table
, save_Uniform3ui
);
9612 SET_Uniform4ui(table
, save_Uniform4ui
);
9613 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9614 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9615 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9616 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9618 (void) save_Uniform1ui
;
9619 (void) save_Uniform2ui
;
9620 (void) save_Uniform3ui
;
9621 (void) save_Uniform4ui
;
9622 (void) save_Uniform1uiv
;
9623 (void) save_Uniform2uiv
;
9624 (void) save_Uniform3uiv
;
9625 (void) save_Uniform4uiv
;
9629 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9630 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9631 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9632 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9633 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9634 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9635 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9636 SET_DrawTransformFeedbackInstanced(table
,
9637 save_DrawTransformFeedbackInstanced
);
9638 SET_DrawTransformFeedbackStreamInstanced(table
,
9639 save_DrawTransformFeedbackStreamInstanced
);
9640 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9641 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9643 /* GL_ARB_instanced_arrays */
9644 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9646 /* GL_NV_texture_barrier */
9647 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9649 SET_BindSampler(table
, save_BindSampler
);
9650 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9651 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9652 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9653 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9654 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9655 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9657 /* GL_ARB_draw_buffer_blend */
9658 SET_BlendFunciARB(table
, save_BlendFunci
);
9659 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9660 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9661 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9663 /* GL_ARB_geometry_shader4 */
9664 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9665 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9666 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9668 /* GL_NV_conditional_render */
9669 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9670 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9673 SET_WaitSync(table
, save_WaitSync
);
9675 /* GL_ARB_uniform_buffer_object */
9676 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9678 /* GL_ARB_draw_instanced */
9679 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9680 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9682 /* GL_ARB_draw_elements_base_vertex */
9683 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9685 /* GL_ARB_base_instance */
9686 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9687 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9688 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9690 /* OpenGL 4.2 / GL_ARB_separate_shader_objects */
9691 SET_UseProgramStages(table
, save_UseProgramStages
);
9692 SET_ProgramUniform1f(table
, save_ProgramUniform1f
);
9693 SET_ProgramUniform2f(table
, save_ProgramUniform2f
);
9694 SET_ProgramUniform3f(table
, save_ProgramUniform3f
);
9695 SET_ProgramUniform4f(table
, save_ProgramUniform4f
);
9696 SET_ProgramUniform1fv(table
, save_ProgramUniform1fv
);
9697 SET_ProgramUniform2fv(table
, save_ProgramUniform2fv
);
9698 SET_ProgramUniform3fv(table
, save_ProgramUniform3fv
);
9699 SET_ProgramUniform4fv(table
, save_ProgramUniform4fv
);
9700 SET_ProgramUniform1i(table
, save_ProgramUniform1i
);
9701 SET_ProgramUniform2i(table
, save_ProgramUniform2i
);
9702 SET_ProgramUniform3i(table
, save_ProgramUniform3i
);
9703 SET_ProgramUniform4i(table
, save_ProgramUniform4i
);
9704 SET_ProgramUniform1iv(table
, save_ProgramUniform1iv
);
9705 SET_ProgramUniform2iv(table
, save_ProgramUniform2iv
);
9706 SET_ProgramUniform3iv(table
, save_ProgramUniform3iv
);
9707 SET_ProgramUniform4iv(table
, save_ProgramUniform4iv
);
9708 SET_ProgramUniform1ui(table
, save_ProgramUniform1ui
);
9709 SET_ProgramUniform2ui(table
, save_ProgramUniform2ui
);
9710 SET_ProgramUniform3ui(table
, save_ProgramUniform3ui
);
9711 SET_ProgramUniform4ui(table
, save_ProgramUniform4ui
);
9712 SET_ProgramUniform1uiv(table
, save_ProgramUniform1uiv
);
9713 SET_ProgramUniform2uiv(table
, save_ProgramUniform2uiv
);
9714 SET_ProgramUniform3uiv(table
, save_ProgramUniform3uiv
);
9715 SET_ProgramUniform4uiv(table
, save_ProgramUniform4uiv
);
9716 SET_ProgramUniformMatrix2fv(table
, save_ProgramUniformMatrix2fv
);
9717 SET_ProgramUniformMatrix3fv(table
, save_ProgramUniformMatrix3fv
);
9718 SET_ProgramUniformMatrix4fv(table
, save_ProgramUniformMatrix4fv
);
9719 SET_ProgramUniformMatrix2x3fv(table
, save_ProgramUniformMatrix2x3fv
);
9720 SET_ProgramUniformMatrix3x2fv(table
, save_ProgramUniformMatrix3x2fv
);
9721 SET_ProgramUniformMatrix2x4fv(table
, save_ProgramUniformMatrix2x4fv
);
9722 SET_ProgramUniformMatrix4x2fv(table
, save_ProgramUniformMatrix4x2fv
);
9723 SET_ProgramUniformMatrix3x4fv(table
, save_ProgramUniformMatrix3x4fv
);
9724 SET_ProgramUniformMatrix4x3fv(table
, save_ProgramUniformMatrix4x3fv
);
9730 enum_string(GLenum k
)
9732 return _mesa_lookup_enum_by_nr(k
);
9737 * Print the commands in a display list. For debugging only.
9738 * TODO: many commands aren't handled yet.
9740 static void GLAPIENTRY
9741 print_list(struct gl_context
*ctx
, GLuint list
)
9743 struct gl_display_list
*dlist
;
9747 if (!islist(ctx
, list
)) {
9748 printf("%u is not a display list ID\n", list
);
9752 dlist
= _mesa_lookup_list(ctx
, list
);
9758 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9760 done
= n
? GL_FALSE
: GL_TRUE
;
9762 const OpCode opcode
= n
[0].opcode
;
9764 if (is_ext_opcode(opcode
)) {
9765 n
+= ext_opcode_print(ctx
, n
);
9770 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9773 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9774 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
9775 get_pointer(&n
[7]));
9777 case OPCODE_CALL_LIST
:
9778 printf("CallList %d\n", (int) n
[1].ui
);
9780 case OPCODE_CALL_LIST_OFFSET
:
9781 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9782 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9784 case OPCODE_DISABLE
:
9785 printf("Disable %s\n", enum_string(n
[1].e
));
9788 printf("Enable %s\n", enum_string(n
[1].e
));
9790 case OPCODE_FRUSTUM
:
9791 printf("Frustum %g %g %g %g %g %g\n",
9792 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9794 case OPCODE_LINE_STIPPLE
:
9795 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9797 case OPCODE_LOAD_IDENTITY
:
9798 printf("LoadIdentity\n");
9800 case OPCODE_LOAD_MATRIX
:
9801 printf("LoadMatrix\n");
9802 printf(" %8f %8f %8f %8f\n",
9803 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9804 printf(" %8f %8f %8f %8f\n",
9805 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9806 printf(" %8f %8f %8f %8f\n",
9807 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9808 printf(" %8f %8f %8f %8f\n",
9809 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9811 case OPCODE_MULT_MATRIX
:
9812 printf("MultMatrix (or Rotate)\n");
9813 printf(" %8f %8f %8f %8f\n",
9814 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9815 printf(" %8f %8f %8f %8f\n",
9816 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9817 printf(" %8f %8f %8f %8f\n",
9818 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9819 printf(" %8f %8f %8f %8f\n",
9820 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9823 printf("Ortho %g %g %g %g %g %g\n",
9824 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9826 case OPCODE_POP_ATTRIB
:
9827 printf("PopAttrib\n");
9829 case OPCODE_POP_MATRIX
:
9830 printf("PopMatrix\n");
9832 case OPCODE_POP_NAME
:
9833 printf("PopName\n");
9835 case OPCODE_PUSH_ATTRIB
:
9836 printf("PushAttrib %x\n", n
[1].bf
);
9838 case OPCODE_PUSH_MATRIX
:
9839 printf("PushMatrix\n");
9841 case OPCODE_PUSH_NAME
:
9842 printf("PushName %d\n", (int) n
[1].ui
);
9844 case OPCODE_RASTER_POS
:
9845 printf("RasterPos %g %g %g %g\n",
9846 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9849 printf("Rotate %g %g %g %g\n",
9850 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9853 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9855 case OPCODE_TRANSLATE
:
9856 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9858 case OPCODE_BIND_TEXTURE
:
9859 printf("BindTexture %s %d\n",
9860 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9862 case OPCODE_SHADE_MODEL
:
9863 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9866 printf("Map1 %s %.3f %.3f %d %d\n",
9867 _mesa_lookup_enum_by_nr(n
[1].ui
),
9868 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9871 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9872 _mesa_lookup_enum_by_nr(n
[1].ui
),
9873 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9874 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9876 case OPCODE_MAPGRID1
:
9877 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9879 case OPCODE_MAPGRID2
:
9880 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9881 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9883 case OPCODE_EVALMESH1
:
9884 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9886 case OPCODE_EVALMESH2
:
9887 printf("EvalMesh2 %d %d %d %d\n",
9888 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9891 case OPCODE_ATTR_1F_NV
:
9892 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9894 case OPCODE_ATTR_2F_NV
:
9895 printf("ATTR_2F_NV attr %d: %f %f\n",
9896 n
[1].i
, n
[2].f
, n
[3].f
);
9898 case OPCODE_ATTR_3F_NV
:
9899 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9900 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9902 case OPCODE_ATTR_4F_NV
:
9903 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9904 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9906 case OPCODE_ATTR_1F_ARB
:
9907 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9909 case OPCODE_ATTR_2F_ARB
:
9910 printf("ATTR_2F_ARB attr %d: %f %f\n",
9911 n
[1].i
, n
[2].f
, n
[3].f
);
9913 case OPCODE_ATTR_3F_ARB
:
9914 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9915 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9917 case OPCODE_ATTR_4F_ARB
:
9918 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9919 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9922 case OPCODE_MATERIAL
:
9923 printf("MATERIAL %x %x: %f %f %f %f\n",
9924 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9927 printf("BEGIN %x\n", n
[1].i
);
9933 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9936 case OPCODE_EVAL_C1
:
9937 printf("EVAL_C1 %f\n", n
[1].f
);
9939 case OPCODE_EVAL_C2
:
9940 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9942 case OPCODE_EVAL_P1
:
9943 printf("EVAL_P1 %d\n", n
[1].i
);
9945 case OPCODE_EVAL_P2
:
9946 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9949 case OPCODE_PROVOKING_VERTEX
:
9950 printf("ProvokingVertex %s\n",
9951 _mesa_lookup_enum_by_nr(n
[1].ui
));
9955 * meta opcodes/commands
9958 printf("Error: %s %s\n", enum_string(n
[1].e
),
9959 (const char *) get_pointer(&n
[2]));
9961 case OPCODE_CONTINUE
:
9962 printf("DISPLAY-LIST-CONTINUE\n");
9963 n
= (Node
*) get_pointer(&n
[1]);
9965 case OPCODE_END_OF_LIST
:
9966 printf("END-LIST %u\n", list
);
9970 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9972 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9973 opcode
, (void *) n
);
9977 printf("command %d, %u operands\n", opcode
,
9981 /* increment n to point to next compiled command */
9982 if (opcode
!= OPCODE_CONTINUE
) {
9983 n
+= InstSize
[opcode
];
9992 * Clients may call this function to help debug display list problems.
9993 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9994 * changed, or break in the future without notice.
9997 mesa_print_display_list(GLuint list
)
9999 GET_CURRENT_CONTEXT(ctx
);
10000 print_list(ctx
, list
);
10004 /**********************************************************************/
10005 /***** Initialization *****/
10006 /**********************************************************************/
10009 save_vtxfmt_init(GLvertexformat
* vfmt
)
10011 vfmt
->ArrayElement
= _ae_ArrayElement
;
10013 vfmt
->Begin
= save_Begin
;
10015 vfmt
->CallList
= save_CallList
;
10016 vfmt
->CallLists
= save_CallLists
;
10018 vfmt
->Color3f
= save_Color3f
;
10019 vfmt
->Color3fv
= save_Color3fv
;
10020 vfmt
->Color4f
= save_Color4f
;
10021 vfmt
->Color4fv
= save_Color4fv
;
10022 vfmt
->EdgeFlag
= save_EdgeFlag
;
10023 vfmt
->End
= save_End
;
10025 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
10026 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
10027 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
10028 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
10029 vfmt
->EvalPoint1
= save_EvalPoint1
;
10030 vfmt
->EvalPoint2
= save_EvalPoint2
;
10032 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
10033 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
10034 vfmt
->Indexf
= save_Indexf
;
10035 vfmt
->Indexfv
= save_Indexfv
;
10036 vfmt
->Materialfv
= save_Materialfv
;
10037 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
10038 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
10039 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
10040 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
10041 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
10042 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
10043 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
10044 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
10045 vfmt
->Normal3f
= save_Normal3f
;
10046 vfmt
->Normal3fv
= save_Normal3fv
;
10047 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
10048 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
10049 vfmt
->TexCoord1f
= save_TexCoord1f
;
10050 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
10051 vfmt
->TexCoord2f
= save_TexCoord2f
;
10052 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
10053 vfmt
->TexCoord3f
= save_TexCoord3f
;
10054 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
10055 vfmt
->TexCoord4f
= save_TexCoord4f
;
10056 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
10057 vfmt
->Vertex2f
= save_Vertex2f
;
10058 vfmt
->Vertex2fv
= save_Vertex2fv
;
10059 vfmt
->Vertex3f
= save_Vertex3f
;
10060 vfmt
->Vertex3fv
= save_Vertex3fv
;
10061 vfmt
->Vertex4f
= save_Vertex4f
;
10062 vfmt
->Vertex4fv
= save_Vertex4fv
;
10063 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
10064 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
10065 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
10066 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
10067 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
10068 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
10069 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
10070 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
10075 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
10076 const GLvertexformat
*vfmt
)
10078 SET_CallList(disp
, vfmt
->CallList
);
10079 SET_CallLists(disp
, vfmt
->CallLists
);
10084 * Initialize display list state for given context.
10087 _mesa_init_display_list(struct gl_context
*ctx
)
10089 static GLboolean tableInitialized
= GL_FALSE
;
10091 /* zero-out the instruction size table, just once */
10092 if (!tableInitialized
) {
10093 memset(InstSize
, 0, sizeof(InstSize
));
10094 tableInitialized
= GL_TRUE
;
10097 /* extension info */
10098 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
10101 ctx
->ListState
.CallDepth
= 0;
10102 ctx
->ExecuteFlag
= GL_TRUE
;
10103 ctx
->CompileFlag
= GL_FALSE
;
10104 ctx
->ListState
.CurrentBlock
= NULL
;
10105 ctx
->ListState
.CurrentPos
= 0;
10107 /* Display List group */
10108 ctx
->List
.ListBase
= 0;
10110 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
10115 _mesa_free_display_list_data(struct gl_context
*ctx
)
10117 free(ctx
->ListExt
);
10118 ctx
->ListExt
= NULL
;