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_COLOR_TABLE_PARAMETER_FV
,
214 OPCODE_COLOR_TABLE_PARAMETER_IV
,
215 OPCODE_COLOR_SUB_TABLE
,
216 OPCODE_CONVOLUTION_FILTER_1D
,
217 OPCODE_CONVOLUTION_FILTER_2D
,
218 OPCODE_CONVOLUTION_PARAMETER_I
,
219 OPCODE_CONVOLUTION_PARAMETER_IV
,
220 OPCODE_CONVOLUTION_PARAMETER_F
,
221 OPCODE_CONVOLUTION_PARAMETER_FV
,
222 OPCODE_COPY_COLOR_SUB_TABLE
,
223 OPCODE_COPY_COLOR_TABLE
,
225 OPCODE_COPY_TEX_IMAGE1D
,
226 OPCODE_COPY_TEX_IMAGE2D
,
227 OPCODE_COPY_TEX_SUB_IMAGE1D
,
228 OPCODE_COPY_TEX_SUB_IMAGE2D
,
229 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_DISABLE_INDEXED
,
239 OPCODE_ENABLE_INDEXED
,
254 OPCODE_LOAD_IDENTITY
,
268 OPCODE_PIXEL_TRANSFER
,
271 OPCODE_POINT_PARAMETERS
,
273 OPCODE_POLYGON_STIPPLE
,
274 OPCODE_POLYGON_OFFSET
,
278 OPCODE_PRIORITIZE_TEXTURE
,
284 OPCODE_RESET_HISTOGRAM
,
285 OPCODE_RESET_MIN_MAX
,
289 OPCODE_SELECT_TEXTURE_SGIS
,
290 OPCODE_SELECT_TEXTURE_COORD_SET
,
301 OPCODE_TEX_SUB_IMAGE1D
,
302 OPCODE_TEX_SUB_IMAGE2D
,
303 OPCODE_TEX_SUB_IMAGE3D
,
307 /* GL_ARB_multitexture */
308 OPCODE_ACTIVE_TEXTURE
,
309 /* GL_ARB_texture_compression */
310 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
311 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
312 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
313 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
314 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
315 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
316 /* GL_ARB_multisample */
317 OPCODE_SAMPLE_COVERAGE
,
318 /* GL_ARB_window_pos */
319 OPCODE_WINDOW_POS_ARB
,
320 /* GL_NV_fragment_program */
321 OPCODE_BIND_PROGRAM_NV
,
322 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
323 /* GL_EXT_stencil_two_side */
324 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
325 /* GL_EXT_depth_bounds_test */
326 OPCODE_DEPTH_BOUNDS_EXT
,
327 /* GL_ARB_vertex/fragment_program */
328 OPCODE_PROGRAM_STRING_ARB
,
329 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
330 /* GL_ARB_occlusion_query */
331 OPCODE_BEGIN_QUERY_ARB
,
332 OPCODE_END_QUERY_ARB
,
333 /* GL_ARB_draw_buffers */
334 OPCODE_DRAW_BUFFERS_ARB
,
335 /* GL_ATI_fragment_shader */
336 OPCODE_TEX_BUMP_PARAMETER_ATI
,
337 /* GL_ATI_fragment_shader */
338 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
339 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
341 OPCODE_STENCIL_FUNC_SEPARATE
,
342 OPCODE_STENCIL_OP_SEPARATE
,
343 OPCODE_STENCIL_MASK_SEPARATE
,
345 /* GL_ARB_shader_objects */
363 OPCODE_UNIFORM_MATRIX22
,
364 OPCODE_UNIFORM_MATRIX33
,
365 OPCODE_UNIFORM_MATRIX44
,
366 OPCODE_UNIFORM_MATRIX23
,
367 OPCODE_UNIFORM_MATRIX32
,
368 OPCODE_UNIFORM_MATRIX24
,
369 OPCODE_UNIFORM_MATRIX42
,
370 OPCODE_UNIFORM_MATRIX34
,
371 OPCODE_UNIFORM_MATRIX43
,
383 /* GL_ARB_color_buffer_float */
386 /* GL_EXT_framebuffer_blit */
387 OPCODE_BLIT_FRAMEBUFFER
,
389 /* Vertex attributes -- fallback for when optimized display
390 * list build isn't active.
409 /* GL_EXT_provoking_vertex */
410 OPCODE_PROVOKING_VERTEX
,
412 /* GL_EXT_transform_feedback */
413 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
414 OPCODE_END_TRANSFORM_FEEDBACK
,
415 OPCODE_BIND_TRANSFORM_FEEDBACK
,
416 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
417 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
418 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
420 /* GL_EXT_texture_integer */
422 OPCODE_CLEARCOLOR_UI
,
423 OPCODE_TEXPARAMETER_I
,
424 OPCODE_TEXPARAMETER_UI
,
426 /* GL_EXT_separate_shader_objects */
427 OPCODE_ACTIVE_PROGRAM_EXT
,
428 OPCODE_USE_SHADER_PROGRAM_EXT
,
430 /* GL_ARB_instanced_arrays */
431 OPCODE_VERTEX_ATTRIB_DIVISOR
,
433 /* GL_NV_texture_barrier */
434 OPCODE_TEXTURE_BARRIER_NV
,
436 /* GL_ARB_sampler_object */
438 OPCODE_SAMPLER_PARAMETERIV
,
439 OPCODE_SAMPLER_PARAMETERFV
,
440 OPCODE_SAMPLER_PARAMETERIIV
,
441 OPCODE_SAMPLER_PARAMETERUIV
,
443 /* GL_ARB_geometry_shader4 */
444 OPCODE_PROGRAM_PARAMETERI
,
445 OPCODE_FRAMEBUFFER_TEXTURE
,
446 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
451 /* GL_NV_conditional_render */
452 OPCODE_BEGIN_CONDITIONAL_RENDER
,
453 OPCODE_END_CONDITIONAL_RENDER
,
455 /* ARB_timer_query */
456 OPCODE_QUERY_COUNTER
,
458 /* ARB_transform_feedback3 */
459 OPCODE_BEGIN_QUERY_INDEXED
,
460 OPCODE_END_QUERY_INDEXED
,
461 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
463 /* ARB_transform_feedback_instanced */
464 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
465 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
467 /* ARB_uniform_buffer_object */
468 OPCODE_UNIFORM_BLOCK_BINDING
,
470 /* The following three are meta instructions */
471 OPCODE_ERROR
, /* raise compiled-in error */
482 * Display list instructions are stored as sequences of "nodes". Nodes
483 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
484 * are linked together with a pointer.
486 * Each instruction in the display list is stored as a sequence of
487 * contiguous nodes in memory.
488 * Each node is the union of a variety of data types.
504 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
508 typedef union gl_dlist_node Node
;
512 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
513 * environment. In 64-bit env, sizeof(Node)==8 anyway.
523 * How many nodes to allocate at a time.
525 * \note Reduced now that we hold vertices etc. elsewhere.
527 #define BLOCK_SIZE 256
532 * Number of nodes of storage needed for each instruction.
533 * Sizes for dynamically allocated opcodes are stored in the context struct.
535 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
538 void mesa_print_display_list(GLuint list
);
541 /**********************************************************************/
542 /***** Private *****/
543 /**********************************************************************/
547 * Make an empty display list. This is used by glGenLists() to
548 * reserve display list IDs.
550 static struct gl_display_list
*
551 make_list(GLuint name
, GLuint count
)
553 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
555 dlist
->Head
= malloc(sizeof(Node
) * count
);
556 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
562 * Lookup function to just encapsulate casting.
564 static inline struct gl_display_list
*
565 lookup_list(struct gl_context
*ctx
, GLuint list
)
567 return (struct gl_display_list
*)
568 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
572 /** Is the given opcode an extension code? */
573 static inline GLboolean
574 is_ext_opcode(OpCode opcode
)
576 return (opcode
>= OPCODE_EXT_0
);
580 /** Destroy an extended opcode instruction */
582 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
584 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
586 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
587 step
= ctx
->ListExt
->Opcode
[i
].Size
;
592 /** Execute an extended opcode instruction */
594 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
596 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
598 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
599 step
= ctx
->ListExt
->Opcode
[i
].Size
;
604 /** Print an extended opcode instruction */
606 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
608 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
610 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
611 step
= ctx
->ListExt
->Opcode
[i
].Size
;
617 * Delete the named display list, but don't remove from hash table.
618 * \param dlist - display list pointer
621 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
626 n
= block
= dlist
->Head
;
628 done
= block
? GL_FALSE
: GL_TRUE
;
630 const OpCode opcode
= n
[0].opcode
;
632 /* check for extension opcodes first */
633 if (is_ext_opcode(opcode
)) {
634 n
+= ext_opcode_destroy(ctx
, n
);
638 /* for some commands, we need to free malloc'd memory */
641 n
+= InstSize
[n
[0].opcode
];
645 n
+= InstSize
[n
[0].opcode
];
647 case OPCODE_DRAW_PIXELS
:
649 n
+= InstSize
[n
[0].opcode
];
653 n
+= InstSize
[n
[0].opcode
];
655 case OPCODE_COLOR_TABLE
:
657 n
+= InstSize
[n
[0].opcode
];
659 case OPCODE_COLOR_SUB_TABLE
:
661 n
+= InstSize
[n
[0].opcode
];
663 case OPCODE_CONVOLUTION_FILTER_1D
:
665 n
+= InstSize
[n
[0].opcode
];
667 case OPCODE_CONVOLUTION_FILTER_2D
:
669 n
+= InstSize
[n
[0].opcode
];
671 case OPCODE_POLYGON_STIPPLE
:
673 n
+= InstSize
[n
[0].opcode
];
675 case OPCODE_TEX_IMAGE1D
:
677 n
+= InstSize
[n
[0].opcode
];
679 case OPCODE_TEX_IMAGE2D
:
681 n
+= InstSize
[n
[0].opcode
];
683 case OPCODE_TEX_IMAGE3D
:
685 n
+= InstSize
[n
[0].opcode
];
687 case OPCODE_TEX_SUB_IMAGE1D
:
689 n
+= InstSize
[n
[0].opcode
];
691 case OPCODE_TEX_SUB_IMAGE2D
:
693 n
+= InstSize
[n
[0].opcode
];
695 case OPCODE_TEX_SUB_IMAGE3D
:
697 n
+= InstSize
[n
[0].opcode
];
699 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
701 n
+= InstSize
[n
[0].opcode
];
703 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
705 n
+= InstSize
[n
[0].opcode
];
707 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
709 n
+= InstSize
[n
[0].opcode
];
711 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
713 n
+= InstSize
[n
[0].opcode
];
715 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
717 n
+= InstSize
[n
[0].opcode
];
719 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
721 n
+= InstSize
[n
[0].opcode
];
723 case OPCODE_PROGRAM_STRING_ARB
:
724 free(n
[4].data
); /* program string */
725 n
+= InstSize
[n
[0].opcode
];
727 case OPCODE_UNIFORM_1FV
:
728 case OPCODE_UNIFORM_2FV
:
729 case OPCODE_UNIFORM_3FV
:
730 case OPCODE_UNIFORM_4FV
:
731 case OPCODE_UNIFORM_1IV
:
732 case OPCODE_UNIFORM_2IV
:
733 case OPCODE_UNIFORM_3IV
:
734 case OPCODE_UNIFORM_4IV
:
735 case OPCODE_UNIFORM_1UIV
:
736 case OPCODE_UNIFORM_2UIV
:
737 case OPCODE_UNIFORM_3UIV
:
738 case OPCODE_UNIFORM_4UIV
:
740 n
+= InstSize
[n
[0].opcode
];
742 case OPCODE_UNIFORM_MATRIX22
:
743 case OPCODE_UNIFORM_MATRIX33
:
744 case OPCODE_UNIFORM_MATRIX44
:
745 case OPCODE_UNIFORM_MATRIX24
:
746 case OPCODE_UNIFORM_MATRIX42
:
747 case OPCODE_UNIFORM_MATRIX23
:
748 case OPCODE_UNIFORM_MATRIX32
:
749 case OPCODE_UNIFORM_MATRIX34
:
750 case OPCODE_UNIFORM_MATRIX43
:
752 n
+= InstSize
[n
[0].opcode
];
755 case OPCODE_CONTINUE
:
756 n
= (Node
*) n
[1].next
;
760 case OPCODE_END_OF_LIST
:
765 /* Most frequent case */
766 n
+= InstSize
[n
[0].opcode
];
777 * Destroy a display list and remove from hash table.
778 * \param list - display list number
781 destroy_list(struct gl_context
*ctx
, GLuint list
)
783 struct gl_display_list
*dlist
;
788 dlist
= lookup_list(ctx
, list
);
792 _mesa_delete_list(ctx
, dlist
);
793 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
798 * Translate the nth element of list from <type> to GLint.
801 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
813 bptr
= (GLbyte
*) list
;
814 return (GLint
) bptr
[n
];
815 case GL_UNSIGNED_BYTE
:
816 ubptr
= (GLubyte
*) list
;
817 return (GLint
) ubptr
[n
];
819 sptr
= (GLshort
*) list
;
820 return (GLint
) sptr
[n
];
821 case GL_UNSIGNED_SHORT
:
822 usptr
= (GLushort
*) list
;
823 return (GLint
) usptr
[n
];
825 iptr
= (GLint
*) list
;
827 case GL_UNSIGNED_INT
:
828 uiptr
= (GLuint
*) list
;
829 return (GLint
) uiptr
[n
];
831 fptr
= (GLfloat
*) list
;
832 return (GLint
) FLOORF(fptr
[n
]);
834 ubptr
= ((GLubyte
*) list
) + 2 * n
;
835 return (GLint
) ubptr
[0] * 256
838 ubptr
= ((GLubyte
*) list
) + 3 * n
;
839 return (GLint
) ubptr
[0] * 65536
840 + (GLint
) ubptr
[1] * 256
843 ubptr
= ((GLubyte
*) list
) + 4 * n
;
844 return (GLint
) ubptr
[0] * 16777216
845 + (GLint
) ubptr
[1] * 65536
846 + (GLint
) ubptr
[2] * 256
856 /**********************************************************************/
858 /**********************************************************************/
861 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
862 * If width < 0 or height < 0 or format or type are invalid we'll just
863 * return NULL. We will not generate an error since OpenGL command
864 * arguments aren't error-checked until the command is actually executed
865 * (not when they're compiled).
866 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
869 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
870 GLsizei width
, GLsizei height
, GLsizei depth
,
871 GLenum format
, GLenum type
, const GLvoid
* pixels
,
872 const struct gl_pixelstore_attrib
*unpack
)
874 if (width
<= 0 || height
<= 0) {
878 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
879 /* bad format and/or type */
883 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
887 if (type
== GL_BITMAP
)
888 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
890 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
891 format
, type
, pixels
, unpack
);
892 if (pixels
&& !image
) {
893 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
897 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
898 depth
, format
, type
, INT_MAX
, pixels
)) {
899 const GLubyte
*map
, *src
;
903 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
904 GL_MAP_READ_BIT
, unpack
->BufferObj
);
906 /* unable to map src buffer! */
907 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
911 src
= ADD_POINTERS(map
, pixels
);
912 if (type
== GL_BITMAP
)
913 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
915 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
916 format
, type
, src
, unpack
);
918 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
921 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
927 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
932 * Allocate space for a display list instruction (opcode + payload space).
933 * \param opcode the instruction opcode (OPCODE_* value)
934 * \param bytes instruction payload size (not counting opcode)
935 * \return pointer to allocated memory (the opcode space)
938 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
940 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
943 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
944 if (InstSize
[opcode
] == 0) {
945 /* save instruction size now */
946 InstSize
[opcode
] = numNodes
;
949 /* make sure instruction size agrees */
950 ASSERT(numNodes
== InstSize
[opcode
]);
954 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
955 /* This block is full. Allocate a new block and chain to it */
957 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
958 n
[0].opcode
= OPCODE_CONTINUE
;
959 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
961 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
964 n
[1].next
= (Node
*) newblock
;
965 ctx
->ListState
.CurrentBlock
= newblock
;
966 ctx
->ListState
.CurrentPos
= 0;
969 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
970 ctx
->ListState
.CurrentPos
+= numNodes
;
972 n
[0].opcode
= opcode
;
980 * Allocate space for a display list instruction. Used by callers outside
981 * this file for things like VBO vertex data.
983 * \param opcode the instruction opcode (OPCODE_* value)
984 * \param bytes instruction size in bytes, not counting opcode.
985 * \return pointer to the usable data area (not including the internal
989 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
991 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
993 return n
+ 1; /* return pointer to payload area, after opcode */
1000 * This function allows modules and drivers to get their own opcodes
1001 * for extending display list functionality.
1002 * \param ctx the rendering context
1003 * \param size number of bytes for storing the new display list command
1004 * \param execute function to execute the new display list command
1005 * \param destroy function to destroy the new display list command
1006 * \param print function to print the new display list command
1007 * \return the new opcode number or -1 if error
1010 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1012 void (*execute
) (struct gl_context
*, void *),
1013 void (*destroy
) (struct gl_context
*, void *),
1014 void (*print
) (struct gl_context
*, void *))
1016 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1017 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1018 ctx
->ListExt
->Opcode
[i
].Size
=
1019 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1020 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1021 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1022 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1023 return i
+ OPCODE_EXT_0
;
1030 * Allocate space for a display list instruction. The space is basically
1031 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1032 * function parameter, node[2] is the second parameter, etc.
1034 * \param opcode one of OPCODE_x
1035 * \param nparams number of function parameters
1036 * \return pointer to start of instruction space
1038 static inline Node
*
1039 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1041 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1047 * Display List compilation functions
1049 static void GLAPIENTRY
1050 save_Accum(GLenum op
, GLfloat value
)
1052 GET_CURRENT_CONTEXT(ctx
);
1054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1055 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1060 if (ctx
->ExecuteFlag
) {
1061 CALL_Accum(ctx
->Exec
, (op
, value
));
1066 static void GLAPIENTRY
1067 save_AlphaFunc(GLenum func
, GLclampf ref
)
1069 GET_CURRENT_CONTEXT(ctx
);
1071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1072 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1075 n
[2].f
= (GLfloat
) ref
;
1077 if (ctx
->ExecuteFlag
) {
1078 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1083 static void GLAPIENTRY
1084 save_BindTexture(GLenum target
, GLuint texture
)
1086 GET_CURRENT_CONTEXT(ctx
);
1088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1089 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1094 if (ctx
->ExecuteFlag
) {
1095 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1100 static void GLAPIENTRY
1101 save_Bitmap(GLsizei width
, GLsizei height
,
1102 GLfloat xorig
, GLfloat yorig
,
1103 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1105 GET_CURRENT_CONTEXT(ctx
);
1107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1108 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1110 n
[1].i
= (GLint
) width
;
1111 n
[2].i
= (GLint
) height
;
1116 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1117 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1119 if (ctx
->ExecuteFlag
) {
1120 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1121 xorig
, yorig
, xmove
, ymove
, pixels
));
1126 static void GLAPIENTRY
1127 save_BlendEquation(GLenum mode
)
1129 GET_CURRENT_CONTEXT(ctx
);
1131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1132 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1136 if (ctx
->ExecuteFlag
) {
1137 CALL_BlendEquation(ctx
->Exec
, (mode
));
1142 static void GLAPIENTRY
1143 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1145 GET_CURRENT_CONTEXT(ctx
);
1147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1148 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1153 if (ctx
->ExecuteFlag
) {
1154 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1159 static void GLAPIENTRY
1160 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1161 GLenum sfactorA
, GLenum dfactorA
)
1163 GET_CURRENT_CONTEXT(ctx
);
1165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1166 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1168 n
[1].e
= sfactorRGB
;
1169 n
[2].e
= dfactorRGB
;
1173 if (ctx
->ExecuteFlag
) {
1174 CALL_BlendFuncSeparate(ctx
->Exec
,
1175 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1180 static void GLAPIENTRY
1181 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1183 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1187 static void GLAPIENTRY
1188 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1190 GET_CURRENT_CONTEXT(ctx
);
1192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1193 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1200 if (ctx
->ExecuteFlag
) {
1201 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1205 /* GL_ARB_draw_buffers_blend */
1206 static void GLAPIENTRY
1207 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1208 GLenum sfactorA
, GLenum dfactorA
)
1210 GET_CURRENT_CONTEXT(ctx
);
1212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1213 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1216 n
[2].e
= sfactorRGB
;
1217 n
[3].e
= dfactorRGB
;
1221 if (ctx
->ExecuteFlag
) {
1222 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1223 sfactorA
, dfactorA
));
1227 /* GL_ARB_draw_buffers_blend */
1228 static void GLAPIENTRY
1229 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1231 GET_CURRENT_CONTEXT(ctx
);
1233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1234 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1240 if (ctx
->ExecuteFlag
) {
1241 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1245 /* GL_ARB_draw_buffers_blend */
1246 static void GLAPIENTRY
1247 save_BlendEquationi(GLuint buf
, GLenum mode
)
1249 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1252 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1257 if (ctx
->ExecuteFlag
) {
1258 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1262 /* GL_ARB_draw_buffers_blend */
1263 static void GLAPIENTRY
1264 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1266 GET_CURRENT_CONTEXT(ctx
);
1268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1269 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1275 if (ctx
->ExecuteFlag
) {
1276 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1281 /* GL_ARB_draw_instanced. */
1282 static void GLAPIENTRY
1283 save_DrawArraysInstancedARB(GLenum mode
,
1288 GET_CURRENT_CONTEXT(ctx
);
1289 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1290 "glDrawArraysInstanced() during display list compile");
1293 static void GLAPIENTRY
1294 save_DrawElementsInstancedARB(GLenum mode
,
1297 const GLvoid
*indices
,
1300 GET_CURRENT_CONTEXT(ctx
);
1301 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1302 "glDrawElementsInstanced() during display list compile");
1305 static void GLAPIENTRY
1306 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1309 const GLvoid
*indices
,
1313 GET_CURRENT_CONTEXT(ctx
);
1314 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1315 "glDrawElementsInstancedBaseVertex() during display list compile");
1318 /* GL_ARB_base_instance. */
1319 static void GLAPIENTRY
1320 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1324 GLuint baseinstance
)
1326 GET_CURRENT_CONTEXT(ctx
);
1327 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1328 "glDrawArraysInstancedBaseInstance() during display list compile");
1331 static void APIENTRY
1332 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1335 const void *indices
,
1337 GLuint baseinstance
)
1339 GET_CURRENT_CONTEXT(ctx
);
1340 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1341 "glDrawElementsInstancedBaseInstance() during display list compile");
1344 static void APIENTRY
1345 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1348 const void *indices
,
1351 GLuint baseinstance
)
1353 GET_CURRENT_CONTEXT(ctx
);
1354 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1355 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1360 * While building a display list we cache some OpenGL state.
1361 * Under some circumstances we need to invalidate that state (immediately
1362 * when we start compiling a list, or after glCallList(s)).
1365 invalidate_saved_current_state(struct gl_context
*ctx
)
1369 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1370 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1372 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1373 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1375 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1377 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1381 static void GLAPIENTRY
1382 save_CallList(GLuint list
)
1384 GET_CURRENT_CONTEXT(ctx
);
1386 SAVE_FLUSH_VERTICES(ctx
);
1388 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1393 /* After this, we don't know what state we're in. Invalidate all
1394 * cached information previously gathered:
1396 invalidate_saved_current_state( ctx
);
1398 if (ctx
->ExecuteFlag
) {
1399 _mesa_CallList(list
);
1404 static void GLAPIENTRY
1405 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1407 GET_CURRENT_CONTEXT(ctx
);
1409 GLboolean typeErrorFlag
;
1411 SAVE_FLUSH_VERTICES(ctx
);
1415 case GL_UNSIGNED_BYTE
:
1417 case GL_UNSIGNED_SHORT
:
1419 case GL_UNSIGNED_INT
:
1424 typeErrorFlag
= GL_FALSE
;
1427 typeErrorFlag
= GL_TRUE
;
1430 for (i
= 0; i
< num
; i
++) {
1431 GLint list
= translate_id(i
, type
, lists
);
1432 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1435 n
[2].b
= typeErrorFlag
;
1439 /* After this, we don't know what state we're in. Invalidate all
1440 * cached information previously gathered:
1442 invalidate_saved_current_state( ctx
);
1444 if (ctx
->ExecuteFlag
) {
1445 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1450 static void GLAPIENTRY
1451 save_Clear(GLbitfield mask
)
1453 GET_CURRENT_CONTEXT(ctx
);
1455 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1456 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1460 if (ctx
->ExecuteFlag
) {
1461 CALL_Clear(ctx
->Exec
, (mask
));
1466 static void GLAPIENTRY
1467 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1469 GET_CURRENT_CONTEXT(ctx
);
1471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1472 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1475 n
[2].i
= drawbuffer
;
1477 if (buffer
== GL_COLOR
) {
1488 if (ctx
->ExecuteFlag
) {
1489 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1494 static void GLAPIENTRY
1495 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1497 GET_CURRENT_CONTEXT(ctx
);
1499 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1500 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1503 n
[2].i
= drawbuffer
;
1505 if (buffer
== GL_COLOR
) {
1516 if (ctx
->ExecuteFlag
) {
1517 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1522 static void GLAPIENTRY
1523 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1525 GET_CURRENT_CONTEXT(ctx
);
1527 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1528 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1531 n
[2].i
= drawbuffer
;
1533 if (buffer
== GL_COLOR
) {
1544 if (ctx
->ExecuteFlag
) {
1545 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1550 static void GLAPIENTRY
1551 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1552 GLfloat depth
, GLint stencil
)
1554 GET_CURRENT_CONTEXT(ctx
);
1556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1557 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1560 n
[2].i
= drawbuffer
;
1564 if (ctx
->ExecuteFlag
) {
1565 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1570 static void GLAPIENTRY
1571 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1573 GET_CURRENT_CONTEXT(ctx
);
1575 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1576 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1583 if (ctx
->ExecuteFlag
) {
1584 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1589 static void GLAPIENTRY
1590 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1592 GET_CURRENT_CONTEXT(ctx
);
1594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1595 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1602 if (ctx
->ExecuteFlag
) {
1603 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1608 static void GLAPIENTRY
1609 save_ClearDepth(GLclampd depth
)
1611 GET_CURRENT_CONTEXT(ctx
);
1613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1614 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1616 n
[1].f
= (GLfloat
) depth
;
1618 if (ctx
->ExecuteFlag
) {
1619 CALL_ClearDepth(ctx
->Exec
, (depth
));
1624 static void GLAPIENTRY
1625 save_ClearIndex(GLfloat c
)
1627 GET_CURRENT_CONTEXT(ctx
);
1629 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1630 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1634 if (ctx
->ExecuteFlag
) {
1635 CALL_ClearIndex(ctx
->Exec
, (c
));
1640 static void GLAPIENTRY
1641 save_ClearStencil(GLint s
)
1643 GET_CURRENT_CONTEXT(ctx
);
1645 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1646 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1650 if (ctx
->ExecuteFlag
) {
1651 CALL_ClearStencil(ctx
->Exec
, (s
));
1656 static void GLAPIENTRY
1657 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1659 GET_CURRENT_CONTEXT(ctx
);
1661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1662 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1665 n
[2].f
= (GLfloat
) equ
[0];
1666 n
[3].f
= (GLfloat
) equ
[1];
1667 n
[4].f
= (GLfloat
) equ
[2];
1668 n
[5].f
= (GLfloat
) equ
[3];
1670 if (ctx
->ExecuteFlag
) {
1671 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1677 static void GLAPIENTRY
1678 save_ColorMask(GLboolean red
, GLboolean green
,
1679 GLboolean blue
, GLboolean alpha
)
1681 GET_CURRENT_CONTEXT(ctx
);
1683 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1684 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1691 if (ctx
->ExecuteFlag
) {
1692 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1697 static void GLAPIENTRY
1698 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1699 GLboolean blue
, GLboolean alpha
)
1701 GET_CURRENT_CONTEXT(ctx
);
1703 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1704 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1712 if (ctx
->ExecuteFlag
) {
1713 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1718 static void GLAPIENTRY
1719 save_ColorMaterial(GLenum face
, GLenum mode
)
1721 GET_CURRENT_CONTEXT(ctx
);
1723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1725 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1730 if (ctx
->ExecuteFlag
) {
1731 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1736 static void GLAPIENTRY
1737 save_ColorTable(GLenum target
, GLenum internalFormat
,
1738 GLsizei width
, GLenum format
, GLenum type
,
1739 const GLvoid
* table
)
1741 GET_CURRENT_CONTEXT(ctx
);
1742 if (_mesa_is_proxy_texture(target
)) {
1743 /* execute immediately */
1744 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1745 format
, type
, table
));
1749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1750 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1753 n
[2].e
= internalFormat
;
1757 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1760 if (ctx
->ExecuteFlag
) {
1761 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1762 format
, type
, table
));
1769 static void GLAPIENTRY
1770 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1771 const GLfloat
*params
)
1773 GET_CURRENT_CONTEXT(ctx
);
1776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1778 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1783 if (pname
== GL_COLOR_TABLE_SGI
||
1784 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1785 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1792 if (ctx
->ExecuteFlag
) {
1793 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1798 static void GLAPIENTRY
1799 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1801 GET_CURRENT_CONTEXT(ctx
);
1804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1806 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1811 if (pname
== GL_COLOR_TABLE_SGI
||
1812 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1813 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1820 if (ctx
->ExecuteFlag
) {
1821 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1827 static void GLAPIENTRY
1828 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1829 GLenum format
, GLenum type
, const GLvoid
* table
)
1831 GET_CURRENT_CONTEXT(ctx
);
1833 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1834 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1841 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1844 if (ctx
->ExecuteFlag
) {
1845 CALL_ColorSubTable(ctx
->Exec
,
1846 (target
, start
, count
, format
, type
, table
));
1851 static void GLAPIENTRY
1852 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1853 GLint x
, GLint y
, GLsizei width
)
1855 GET_CURRENT_CONTEXT(ctx
);
1858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1859 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1867 if (ctx
->ExecuteFlag
) {
1868 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1873 static void GLAPIENTRY
1874 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1875 GLint x
, GLint y
, GLsizei width
)
1877 GET_CURRENT_CONTEXT(ctx
);
1880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1881 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1884 n
[2].e
= internalformat
;
1889 if (ctx
->ExecuteFlag
) {
1890 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1895 static void GLAPIENTRY
1896 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1897 GLenum format
, GLenum type
, const GLvoid
* filter
)
1899 GET_CURRENT_CONTEXT(ctx
);
1902 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1904 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1907 n
[2].e
= internalFormat
;
1911 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1914 if (ctx
->ExecuteFlag
) {
1915 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1916 format
, type
, filter
));
1921 static void GLAPIENTRY
1922 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1923 GLsizei width
, GLsizei height
, GLenum format
,
1924 GLenum type
, const GLvoid
* filter
)
1926 GET_CURRENT_CONTEXT(ctx
);
1929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1931 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1934 n
[2].e
= internalFormat
;
1939 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1942 if (ctx
->ExecuteFlag
) {
1943 CALL_ConvolutionFilter2D(ctx
->Exec
,
1944 (target
, internalFormat
, width
, height
, format
,
1950 static void GLAPIENTRY
1951 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1953 GET_CURRENT_CONTEXT(ctx
);
1955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1956 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1962 if (ctx
->ExecuteFlag
) {
1963 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1968 static void GLAPIENTRY
1969 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1971 GET_CURRENT_CONTEXT(ctx
);
1973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1974 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1979 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1980 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1981 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1987 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1990 if (ctx
->ExecuteFlag
) {
1991 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1996 static void GLAPIENTRY
1997 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1999 GET_CURRENT_CONTEXT(ctx
);
2001 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2002 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
2008 if (ctx
->ExecuteFlag
) {
2009 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
2014 static void GLAPIENTRY
2015 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
2016 const GLfloat
*params
)
2018 GET_CURRENT_CONTEXT(ctx
);
2020 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2021 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
2026 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
2027 pname
== GL_CONVOLUTION_FILTER_SCALE
||
2028 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
2034 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
2037 if (ctx
->ExecuteFlag
) {
2038 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
2043 static void GLAPIENTRY
2044 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2046 GET_CURRENT_CONTEXT(ctx
);
2048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2049 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2053 n
[3].i
= (GLint
) width
;
2054 n
[4].i
= (GLint
) height
;
2057 if (ctx
->ExecuteFlag
) {
2058 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2064 static void GLAPIENTRY
2065 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2066 GLint x
, GLint y
, GLsizei width
, GLint border
)
2068 GET_CURRENT_CONTEXT(ctx
);
2070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2071 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2075 n
[3].e
= internalformat
;
2081 if (ctx
->ExecuteFlag
) {
2082 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2083 x
, y
, width
, border
));
2088 static void GLAPIENTRY
2089 save_CopyTexImage2D(GLenum target
, GLint level
,
2090 GLenum internalformat
,
2091 GLint x
, GLint y
, GLsizei width
,
2092 GLsizei height
, GLint border
)
2094 GET_CURRENT_CONTEXT(ctx
);
2096 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2097 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2101 n
[3].e
= internalformat
;
2108 if (ctx
->ExecuteFlag
) {
2109 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2110 x
, y
, width
, height
, border
));
2116 static void GLAPIENTRY
2117 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2118 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2120 GET_CURRENT_CONTEXT(ctx
);
2122 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2123 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2132 if (ctx
->ExecuteFlag
) {
2133 CALL_CopyTexSubImage1D(ctx
->Exec
,
2134 (target
, level
, xoffset
, x
, y
, width
));
2139 static void GLAPIENTRY
2140 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2141 GLint xoffset
, GLint yoffset
,
2142 GLint x
, GLint y
, GLsizei width
, GLint height
)
2144 GET_CURRENT_CONTEXT(ctx
);
2146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2147 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2158 if (ctx
->ExecuteFlag
) {
2159 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2160 x
, y
, width
, height
));
2165 static void GLAPIENTRY
2166 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2167 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2168 GLint x
, GLint y
, GLsizei width
, GLint height
)
2170 GET_CURRENT_CONTEXT(ctx
);
2172 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2173 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2185 if (ctx
->ExecuteFlag
) {
2186 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2187 xoffset
, yoffset
, zoffset
,
2188 x
, y
, width
, height
));
2193 static void GLAPIENTRY
2194 save_CullFace(GLenum mode
)
2196 GET_CURRENT_CONTEXT(ctx
);
2198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2199 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2203 if (ctx
->ExecuteFlag
) {
2204 CALL_CullFace(ctx
->Exec
, (mode
));
2209 static void GLAPIENTRY
2210 save_DepthFunc(GLenum func
)
2212 GET_CURRENT_CONTEXT(ctx
);
2214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2215 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2219 if (ctx
->ExecuteFlag
) {
2220 CALL_DepthFunc(ctx
->Exec
, (func
));
2225 static void GLAPIENTRY
2226 save_DepthMask(GLboolean mask
)
2228 GET_CURRENT_CONTEXT(ctx
);
2230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2231 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2235 if (ctx
->ExecuteFlag
) {
2236 CALL_DepthMask(ctx
->Exec
, (mask
));
2241 static void GLAPIENTRY
2242 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2244 GET_CURRENT_CONTEXT(ctx
);
2246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2247 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2249 n
[1].f
= (GLfloat
) nearval
;
2250 n
[2].f
= (GLfloat
) farval
;
2252 if (ctx
->ExecuteFlag
) {
2253 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2258 static void GLAPIENTRY
2259 save_Disable(GLenum cap
)
2261 GET_CURRENT_CONTEXT(ctx
);
2263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2264 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2268 if (ctx
->ExecuteFlag
) {
2269 CALL_Disable(ctx
->Exec
, (cap
));
2274 static void GLAPIENTRY
2275 save_DisableIndexed(GLuint index
, GLenum cap
)
2277 GET_CURRENT_CONTEXT(ctx
);
2279 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2280 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2285 if (ctx
->ExecuteFlag
) {
2286 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2291 static void GLAPIENTRY
2292 save_DrawBuffer(GLenum mode
)
2294 GET_CURRENT_CONTEXT(ctx
);
2296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2297 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2301 if (ctx
->ExecuteFlag
) {
2302 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2307 static void GLAPIENTRY
2308 save_DrawPixels(GLsizei width
, GLsizei height
,
2309 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2311 GET_CURRENT_CONTEXT(ctx
);
2314 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2316 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
2322 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2323 pixels
, &ctx
->Unpack
);
2325 if (ctx
->ExecuteFlag
) {
2326 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2332 static void GLAPIENTRY
2333 save_Enable(GLenum cap
)
2335 GET_CURRENT_CONTEXT(ctx
);
2337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2338 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2342 if (ctx
->ExecuteFlag
) {
2343 CALL_Enable(ctx
->Exec
, (cap
));
2349 static void GLAPIENTRY
2350 save_EnableIndexed(GLuint index
, GLenum cap
)
2352 GET_CURRENT_CONTEXT(ctx
);
2354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2355 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2360 if (ctx
->ExecuteFlag
) {
2361 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2367 static void GLAPIENTRY
2368 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2370 GET_CURRENT_CONTEXT(ctx
);
2372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2373 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2379 if (ctx
->ExecuteFlag
) {
2380 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2385 static void GLAPIENTRY
2386 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2388 GET_CURRENT_CONTEXT(ctx
);
2390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2391 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2399 if (ctx
->ExecuteFlag
) {
2400 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2407 static void GLAPIENTRY
2408 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2410 GET_CURRENT_CONTEXT(ctx
);
2412 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2413 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2421 if (ctx
->ExecuteFlag
) {
2422 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2427 static void GLAPIENTRY
2428 save_Fogf(GLenum pname
, GLfloat param
)
2432 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2433 save_Fogfv(pname
, parray
);
2437 static void GLAPIENTRY
2438 save_Fogiv(GLenum pname
, const GLint
*params
)
2443 case GL_FOG_DENSITY
:
2447 p
[0] = (GLfloat
) *params
;
2453 p
[0] = INT_TO_FLOAT(params
[0]);
2454 p
[1] = INT_TO_FLOAT(params
[1]);
2455 p
[2] = INT_TO_FLOAT(params
[2]);
2456 p
[3] = INT_TO_FLOAT(params
[3]);
2459 /* Error will be caught later in gl_Fogfv */
2460 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2462 save_Fogfv(pname
, p
);
2466 static void GLAPIENTRY
2467 save_Fogi(GLenum pname
, GLint param
)
2471 parray
[1] = parray
[2] = parray
[3] = 0;
2472 save_Fogiv(pname
, parray
);
2476 static void GLAPIENTRY
2477 save_FrontFace(GLenum mode
)
2479 GET_CURRENT_CONTEXT(ctx
);
2481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2482 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2486 if (ctx
->ExecuteFlag
) {
2487 CALL_FrontFace(ctx
->Exec
, (mode
));
2492 static void GLAPIENTRY
2493 save_Frustum(GLdouble left
, GLdouble right
,
2494 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2496 GET_CURRENT_CONTEXT(ctx
);
2498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2499 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2501 n
[1].f
= (GLfloat
) left
;
2502 n
[2].f
= (GLfloat
) right
;
2503 n
[3].f
= (GLfloat
) bottom
;
2504 n
[4].f
= (GLfloat
) top
;
2505 n
[5].f
= (GLfloat
) nearval
;
2506 n
[6].f
= (GLfloat
) farval
;
2508 if (ctx
->ExecuteFlag
) {
2509 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2514 static void GLAPIENTRY
2515 save_Hint(GLenum target
, GLenum mode
)
2517 GET_CURRENT_CONTEXT(ctx
);
2519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2520 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2525 if (ctx
->ExecuteFlag
) {
2526 CALL_Hint(ctx
->Exec
, (target
, mode
));
2531 static void GLAPIENTRY
2532 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2535 GET_CURRENT_CONTEXT(ctx
);
2538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2539 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2543 n
[3].e
= internalFormat
;
2546 if (ctx
->ExecuteFlag
) {
2547 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2552 static void GLAPIENTRY
2553 save_IndexMask(GLuint mask
)
2555 GET_CURRENT_CONTEXT(ctx
);
2557 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2558 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2562 if (ctx
->ExecuteFlag
) {
2563 CALL_IndexMask(ctx
->Exec
, (mask
));
2568 static void GLAPIENTRY
2569 save_InitNames(void)
2571 GET_CURRENT_CONTEXT(ctx
);
2572 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2573 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2574 if (ctx
->ExecuteFlag
) {
2575 CALL_InitNames(ctx
->Exec
, ());
2580 static void GLAPIENTRY
2581 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2583 GET_CURRENT_CONTEXT(ctx
);
2585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2586 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2604 case GL_SPOT_DIRECTION
:
2607 case GL_SPOT_EXPONENT
:
2610 case GL_SPOT_CUTOFF
:
2613 case GL_CONSTANT_ATTENUATION
:
2616 case GL_LINEAR_ATTENUATION
:
2619 case GL_QUADRATIC_ATTENUATION
:
2625 for (i
= 0; i
< nParams
; i
++) {
2626 n
[3 + i
].f
= params
[i
];
2629 if (ctx
->ExecuteFlag
) {
2630 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2635 static void GLAPIENTRY
2636 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2640 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2641 save_Lightfv(light
, pname
, parray
);
2645 static void GLAPIENTRY
2646 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2653 fparam
[0] = INT_TO_FLOAT(params
[0]);
2654 fparam
[1] = INT_TO_FLOAT(params
[1]);
2655 fparam
[2] = INT_TO_FLOAT(params
[2]);
2656 fparam
[3] = INT_TO_FLOAT(params
[3]);
2659 fparam
[0] = (GLfloat
) params
[0];
2660 fparam
[1] = (GLfloat
) params
[1];
2661 fparam
[2] = (GLfloat
) params
[2];
2662 fparam
[3] = (GLfloat
) params
[3];
2664 case GL_SPOT_DIRECTION
:
2665 fparam
[0] = (GLfloat
) params
[0];
2666 fparam
[1] = (GLfloat
) params
[1];
2667 fparam
[2] = (GLfloat
) params
[2];
2669 case GL_SPOT_EXPONENT
:
2670 case GL_SPOT_CUTOFF
:
2671 case GL_CONSTANT_ATTENUATION
:
2672 case GL_LINEAR_ATTENUATION
:
2673 case GL_QUADRATIC_ATTENUATION
:
2674 fparam
[0] = (GLfloat
) params
[0];
2677 /* error will be caught later in gl_Lightfv */
2680 save_Lightfv(light
, pname
, fparam
);
2684 static void GLAPIENTRY
2685 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2689 parray
[1] = parray
[2] = parray
[3] = 0;
2690 save_Lightiv(light
, pname
, parray
);
2694 static void GLAPIENTRY
2695 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2697 GET_CURRENT_CONTEXT(ctx
);
2699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2700 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2708 if (ctx
->ExecuteFlag
) {
2709 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2714 static void GLAPIENTRY
2715 save_LightModelf(GLenum pname
, GLfloat param
)
2719 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2720 save_LightModelfv(pname
, parray
);
2724 static void GLAPIENTRY
2725 save_LightModeliv(GLenum pname
, const GLint
*params
)
2729 case GL_LIGHT_MODEL_AMBIENT
:
2730 fparam
[0] = INT_TO_FLOAT(params
[0]);
2731 fparam
[1] = INT_TO_FLOAT(params
[1]);
2732 fparam
[2] = INT_TO_FLOAT(params
[2]);
2733 fparam
[3] = INT_TO_FLOAT(params
[3]);
2735 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2736 case GL_LIGHT_MODEL_TWO_SIDE
:
2737 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2738 fparam
[0] = (GLfloat
) params
[0];
2744 /* Error will be caught later in gl_LightModelfv */
2745 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2747 save_LightModelfv(pname
, fparam
);
2751 static void GLAPIENTRY
2752 save_LightModeli(GLenum pname
, GLint param
)
2756 parray
[1] = parray
[2] = parray
[3] = 0;
2757 save_LightModeliv(pname
, parray
);
2761 static void GLAPIENTRY
2762 save_LineStipple(GLint factor
, GLushort pattern
)
2764 GET_CURRENT_CONTEXT(ctx
);
2766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2767 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2772 if (ctx
->ExecuteFlag
) {
2773 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2778 static void GLAPIENTRY
2779 save_LineWidth(GLfloat width
)
2781 GET_CURRENT_CONTEXT(ctx
);
2783 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2784 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2788 if (ctx
->ExecuteFlag
) {
2789 CALL_LineWidth(ctx
->Exec
, (width
));
2794 static void GLAPIENTRY
2795 save_ListBase(GLuint base
)
2797 GET_CURRENT_CONTEXT(ctx
);
2799 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2800 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2804 if (ctx
->ExecuteFlag
) {
2805 CALL_ListBase(ctx
->Exec
, (base
));
2810 static void GLAPIENTRY
2811 save_LoadIdentity(void)
2813 GET_CURRENT_CONTEXT(ctx
);
2814 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2815 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2816 if (ctx
->ExecuteFlag
) {
2817 CALL_LoadIdentity(ctx
->Exec
, ());
2822 static void GLAPIENTRY
2823 save_LoadMatrixf(const GLfloat
* m
)
2825 GET_CURRENT_CONTEXT(ctx
);
2827 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2828 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2831 for (i
= 0; i
< 16; i
++) {
2835 if (ctx
->ExecuteFlag
) {
2836 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2841 static void GLAPIENTRY
2842 save_LoadMatrixd(const GLdouble
* m
)
2846 for (i
= 0; i
< 16; i
++) {
2847 f
[i
] = (GLfloat
) m
[i
];
2849 save_LoadMatrixf(f
);
2853 static void GLAPIENTRY
2854 save_LoadName(GLuint name
)
2856 GET_CURRENT_CONTEXT(ctx
);
2858 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2859 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2863 if (ctx
->ExecuteFlag
) {
2864 CALL_LoadName(ctx
->Exec
, (name
));
2869 static void GLAPIENTRY
2870 save_LogicOp(GLenum opcode
)
2872 GET_CURRENT_CONTEXT(ctx
);
2874 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2875 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2879 if (ctx
->ExecuteFlag
) {
2880 CALL_LogicOp(ctx
->Exec
, (opcode
));
2885 static void GLAPIENTRY
2886 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2887 GLint order
, const GLdouble
* points
)
2889 GET_CURRENT_CONTEXT(ctx
);
2891 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2892 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2894 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2896 n
[2].f
= (GLfloat
) u1
;
2897 n
[3].f
= (GLfloat
) u2
;
2898 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2900 n
[6].data
= (void *) pnts
;
2902 if (ctx
->ExecuteFlag
) {
2903 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2907 static void GLAPIENTRY
2908 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2909 GLint order
, const GLfloat
* points
)
2911 GET_CURRENT_CONTEXT(ctx
);
2913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2914 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2916 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2920 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2922 n
[6].data
= (void *) pnts
;
2924 if (ctx
->ExecuteFlag
) {
2925 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2930 static void GLAPIENTRY
2931 save_Map2d(GLenum target
,
2932 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2933 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2934 const GLdouble
* points
)
2936 GET_CURRENT_CONTEXT(ctx
);
2938 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2939 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2941 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2942 vstride
, vorder
, points
);
2944 n
[2].f
= (GLfloat
) u1
;
2945 n
[3].f
= (GLfloat
) u2
;
2946 n
[4].f
= (GLfloat
) v1
;
2947 n
[5].f
= (GLfloat
) v2
;
2948 /* XXX verify these strides are correct */
2949 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2950 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2953 n
[10].data
= (void *) pnts
;
2955 if (ctx
->ExecuteFlag
) {
2956 CALL_Map2d(ctx
->Exec
, (target
,
2957 u1
, u2
, ustride
, uorder
,
2958 v1
, v2
, vstride
, vorder
, points
));
2963 static void GLAPIENTRY
2964 save_Map2f(GLenum target
,
2965 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2966 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2967 const GLfloat
* points
)
2969 GET_CURRENT_CONTEXT(ctx
);
2971 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2972 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2974 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2975 vstride
, vorder
, points
);
2981 /* XXX verify these strides are correct */
2982 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2983 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2986 n
[10].data
= (void *) pnts
;
2988 if (ctx
->ExecuteFlag
) {
2989 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2990 v1
, v2
, vstride
, vorder
, points
));
2995 static void GLAPIENTRY
2996 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2998 GET_CURRENT_CONTEXT(ctx
);
3000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3001 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3007 if (ctx
->ExecuteFlag
) {
3008 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3013 static void GLAPIENTRY
3014 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3016 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3020 static void GLAPIENTRY
3021 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3022 GLint vn
, GLfloat v1
, GLfloat v2
)
3024 GET_CURRENT_CONTEXT(ctx
);
3026 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3027 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3036 if (ctx
->ExecuteFlag
) {
3037 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3043 static void GLAPIENTRY
3044 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3045 GLint vn
, GLdouble v1
, GLdouble v2
)
3047 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3048 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3052 static void GLAPIENTRY
3053 save_MatrixMode(GLenum mode
)
3055 GET_CURRENT_CONTEXT(ctx
);
3057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3058 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3062 if (ctx
->ExecuteFlag
) {
3063 CALL_MatrixMode(ctx
->Exec
, (mode
));
3068 static void GLAPIENTRY
3069 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
3071 GET_CURRENT_CONTEXT(ctx
);
3074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3075 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
3078 n
[2].e
= internalFormat
;
3081 if (ctx
->ExecuteFlag
) {
3082 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
3087 static void GLAPIENTRY
3088 save_MultMatrixf(const GLfloat
* m
)
3090 GET_CURRENT_CONTEXT(ctx
);
3092 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3093 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3096 for (i
= 0; i
< 16; i
++) {
3100 if (ctx
->ExecuteFlag
) {
3101 CALL_MultMatrixf(ctx
->Exec
, (m
));
3106 static void GLAPIENTRY
3107 save_MultMatrixd(const GLdouble
* m
)
3111 for (i
= 0; i
< 16; i
++) {
3112 f
[i
] = (GLfloat
) m
[i
];
3114 save_MultMatrixf(f
);
3118 static void GLAPIENTRY
3119 save_NewList(GLuint name
, GLenum mode
)
3121 GET_CURRENT_CONTEXT(ctx
);
3122 /* It's an error to call this function while building a display list */
3123 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3130 static void GLAPIENTRY
3131 save_Ortho(GLdouble left
, GLdouble right
,
3132 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3134 GET_CURRENT_CONTEXT(ctx
);
3136 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3137 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3139 n
[1].f
= (GLfloat
) left
;
3140 n
[2].f
= (GLfloat
) right
;
3141 n
[3].f
= (GLfloat
) bottom
;
3142 n
[4].f
= (GLfloat
) top
;
3143 n
[5].f
= (GLfloat
) nearval
;
3144 n
[6].f
= (GLfloat
) farval
;
3146 if (ctx
->ExecuteFlag
) {
3147 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3152 static void GLAPIENTRY
3153 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3155 GET_CURRENT_CONTEXT(ctx
);
3157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3158 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
3162 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
3163 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
3165 if (ctx
->ExecuteFlag
) {
3166 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3171 static void GLAPIENTRY
3172 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3174 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3176 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3177 for (i
= 0; i
< mapsize
; i
++) {
3178 fvalues
[i
] = (GLfloat
) values
[i
];
3182 for (i
= 0; i
< mapsize
; i
++) {
3183 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3186 save_PixelMapfv(map
, mapsize
, fvalues
);
3190 static void GLAPIENTRY
3191 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3193 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3195 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3196 for (i
= 0; i
< mapsize
; i
++) {
3197 fvalues
[i
] = (GLfloat
) values
[i
];
3201 for (i
= 0; i
< mapsize
; i
++) {
3202 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3205 save_PixelMapfv(map
, mapsize
, fvalues
);
3209 static void GLAPIENTRY
3210 save_PixelTransferf(GLenum pname
, GLfloat param
)
3212 GET_CURRENT_CONTEXT(ctx
);
3214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3215 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3220 if (ctx
->ExecuteFlag
) {
3221 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3226 static void GLAPIENTRY
3227 save_PixelTransferi(GLenum pname
, GLint param
)
3229 save_PixelTransferf(pname
, (GLfloat
) param
);
3233 static void GLAPIENTRY
3234 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3236 GET_CURRENT_CONTEXT(ctx
);
3238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3239 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3244 if (ctx
->ExecuteFlag
) {
3245 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3250 static void GLAPIENTRY
3251 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3253 GET_CURRENT_CONTEXT(ctx
);
3255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3256 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3263 if (ctx
->ExecuteFlag
) {
3264 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3269 static void GLAPIENTRY
3270 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3274 parray
[1] = parray
[2] = 0.0F
;
3275 save_PointParameterfvEXT(pname
, parray
);
3278 static void GLAPIENTRY
3279 save_PointParameteriNV(GLenum pname
, GLint param
)
3282 parray
[0] = (GLfloat
) param
;
3283 parray
[1] = parray
[2] = 0.0F
;
3284 save_PointParameterfvEXT(pname
, parray
);
3287 static void GLAPIENTRY
3288 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3291 parray
[0] = (GLfloat
) param
[0];
3292 parray
[1] = parray
[2] = 0.0F
;
3293 save_PointParameterfvEXT(pname
, parray
);
3297 static void GLAPIENTRY
3298 save_PointSize(GLfloat size
)
3300 GET_CURRENT_CONTEXT(ctx
);
3302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3303 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3307 if (ctx
->ExecuteFlag
) {
3308 CALL_PointSize(ctx
->Exec
, (size
));
3313 static void GLAPIENTRY
3314 save_PolygonMode(GLenum face
, GLenum mode
)
3316 GET_CURRENT_CONTEXT(ctx
);
3318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3319 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3324 if (ctx
->ExecuteFlag
) {
3325 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3330 static void GLAPIENTRY
3331 save_PolygonStipple(const GLubyte
* pattern
)
3333 GET_CURRENT_CONTEXT(ctx
);
3336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3338 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
3340 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3341 pattern
, &ctx
->Unpack
);
3343 if (ctx
->ExecuteFlag
) {
3344 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3349 static void GLAPIENTRY
3350 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3352 GET_CURRENT_CONTEXT(ctx
);
3354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3355 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3360 if (ctx
->ExecuteFlag
) {
3361 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3366 static void GLAPIENTRY
3367 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3369 GET_CURRENT_CONTEXT(ctx
);
3370 /* XXX mult by DepthMaxF here??? */
3371 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3375 static void GLAPIENTRY
3376 save_PopAttrib(void)
3378 GET_CURRENT_CONTEXT(ctx
);
3379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3380 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3381 if (ctx
->ExecuteFlag
) {
3382 CALL_PopAttrib(ctx
->Exec
, ());
3387 static void GLAPIENTRY
3388 save_PopMatrix(void)
3390 GET_CURRENT_CONTEXT(ctx
);
3391 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3392 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3393 if (ctx
->ExecuteFlag
) {
3394 CALL_PopMatrix(ctx
->Exec
, ());
3399 static void GLAPIENTRY
3402 GET_CURRENT_CONTEXT(ctx
);
3403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3404 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3405 if (ctx
->ExecuteFlag
) {
3406 CALL_PopName(ctx
->Exec
, ());
3411 static void GLAPIENTRY
3412 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3413 const GLclampf
* priorities
)
3415 GET_CURRENT_CONTEXT(ctx
);
3417 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3419 for (i
= 0; i
< num
; i
++) {
3421 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3423 n
[1].ui
= textures
[i
];
3424 n
[2].f
= priorities
[i
];
3427 if (ctx
->ExecuteFlag
) {
3428 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3433 static void GLAPIENTRY
3434 save_PushAttrib(GLbitfield mask
)
3436 GET_CURRENT_CONTEXT(ctx
);
3438 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3439 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3443 if (ctx
->ExecuteFlag
) {
3444 CALL_PushAttrib(ctx
->Exec
, (mask
));
3449 static void GLAPIENTRY
3450 save_PushMatrix(void)
3452 GET_CURRENT_CONTEXT(ctx
);
3453 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3454 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3455 if (ctx
->ExecuteFlag
) {
3456 CALL_PushMatrix(ctx
->Exec
, ());
3461 static void GLAPIENTRY
3462 save_PushName(GLuint name
)
3464 GET_CURRENT_CONTEXT(ctx
);
3466 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3467 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3471 if (ctx
->ExecuteFlag
) {
3472 CALL_PushName(ctx
->Exec
, (name
));
3477 static void GLAPIENTRY
3478 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3480 GET_CURRENT_CONTEXT(ctx
);
3482 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3483 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3490 if (ctx
->ExecuteFlag
) {
3491 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3495 static void GLAPIENTRY
3496 save_RasterPos2d(GLdouble x
, GLdouble y
)
3498 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3501 static void GLAPIENTRY
3502 save_RasterPos2f(GLfloat x
, GLfloat y
)
3504 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3507 static void GLAPIENTRY
3508 save_RasterPos2i(GLint x
, GLint y
)
3510 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3513 static void GLAPIENTRY
3514 save_RasterPos2s(GLshort x
, GLshort y
)
3516 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3519 static void GLAPIENTRY
3520 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3522 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3525 static void GLAPIENTRY
3526 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3528 save_RasterPos4f(x
, y
, z
, 1.0F
);
3531 static void GLAPIENTRY
3532 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3534 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3537 static void GLAPIENTRY
3538 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3540 save_RasterPos4f(x
, y
, z
, 1.0F
);
3543 static void GLAPIENTRY
3544 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3546 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3549 static void GLAPIENTRY
3550 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3552 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3555 static void GLAPIENTRY
3556 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3558 save_RasterPos4f(x
, y
, z
, w
);
3561 static void GLAPIENTRY
3562 save_RasterPos2dv(const GLdouble
* v
)
3564 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3567 static void GLAPIENTRY
3568 save_RasterPos2fv(const GLfloat
* v
)
3570 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3573 static void GLAPIENTRY
3574 save_RasterPos2iv(const GLint
* v
)
3576 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3579 static void GLAPIENTRY
3580 save_RasterPos2sv(const GLshort
* v
)
3582 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3585 static void GLAPIENTRY
3586 save_RasterPos3dv(const GLdouble
* v
)
3588 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3591 static void GLAPIENTRY
3592 save_RasterPos3fv(const GLfloat
* v
)
3594 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3597 static void GLAPIENTRY
3598 save_RasterPos3iv(const GLint
* v
)
3600 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3603 static void GLAPIENTRY
3604 save_RasterPos3sv(const GLshort
* v
)
3606 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3609 static void GLAPIENTRY
3610 save_RasterPos4dv(const GLdouble
* v
)
3612 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3613 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3616 static void GLAPIENTRY
3617 save_RasterPos4fv(const GLfloat
* v
)
3619 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3622 static void GLAPIENTRY
3623 save_RasterPos4iv(const GLint
* v
)
3625 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3626 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3629 static void GLAPIENTRY
3630 save_RasterPos4sv(const GLshort
* v
)
3632 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3636 static void GLAPIENTRY
3637 save_PassThrough(GLfloat token
)
3639 GET_CURRENT_CONTEXT(ctx
);
3641 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3642 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3646 if (ctx
->ExecuteFlag
) {
3647 CALL_PassThrough(ctx
->Exec
, (token
));
3652 static void GLAPIENTRY
3653 save_ReadBuffer(GLenum mode
)
3655 GET_CURRENT_CONTEXT(ctx
);
3657 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3658 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3662 if (ctx
->ExecuteFlag
) {
3663 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3668 static void GLAPIENTRY
3669 save_ResetHistogram(GLenum target
)
3671 GET_CURRENT_CONTEXT(ctx
);
3673 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3674 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3678 if (ctx
->ExecuteFlag
) {
3679 CALL_ResetHistogram(ctx
->Exec
, (target
));
3684 static void GLAPIENTRY
3685 save_ResetMinmax(GLenum target
)
3687 GET_CURRENT_CONTEXT(ctx
);
3689 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3690 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3694 if (ctx
->ExecuteFlag
) {
3695 CALL_ResetMinmax(ctx
->Exec
, (target
));
3700 static void GLAPIENTRY
3701 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3703 GET_CURRENT_CONTEXT(ctx
);
3705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3706 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3713 if (ctx
->ExecuteFlag
) {
3714 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3719 static void GLAPIENTRY
3720 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3722 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3726 static void GLAPIENTRY
3727 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3729 GET_CURRENT_CONTEXT(ctx
);
3731 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3732 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3738 if (ctx
->ExecuteFlag
) {
3739 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3744 static void GLAPIENTRY
3745 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3747 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3751 static void GLAPIENTRY
3752 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3754 GET_CURRENT_CONTEXT(ctx
);
3756 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3757 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3764 if (ctx
->ExecuteFlag
) {
3765 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3770 static void GLAPIENTRY
3771 save_ShadeModel(GLenum mode
)
3773 GET_CURRENT_CONTEXT(ctx
);
3775 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3777 if (ctx
->ExecuteFlag
) {
3778 CALL_ShadeModel(ctx
->Exec
, (mode
));
3781 /* Don't compile this call if it's a no-op.
3782 * By avoiding this state change we have a better chance of
3783 * coalescing subsequent drawing commands into one batch.
3785 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3788 SAVE_FLUSH_VERTICES(ctx
);
3790 ctx
->ListState
.Current
.ShadeModel
= mode
;
3792 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3799 static void GLAPIENTRY
3800 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3802 GET_CURRENT_CONTEXT(ctx
);
3804 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3805 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3811 if (ctx
->ExecuteFlag
) {
3812 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3817 static void GLAPIENTRY
3818 save_StencilMask(GLuint mask
)
3820 GET_CURRENT_CONTEXT(ctx
);
3822 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3823 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3827 if (ctx
->ExecuteFlag
) {
3828 CALL_StencilMask(ctx
->Exec
, (mask
));
3833 static void GLAPIENTRY
3834 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3836 GET_CURRENT_CONTEXT(ctx
);
3838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3839 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3845 if (ctx
->ExecuteFlag
) {
3846 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3851 static void GLAPIENTRY
3852 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3854 GET_CURRENT_CONTEXT(ctx
);
3856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3857 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3864 if (ctx
->ExecuteFlag
) {
3865 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3870 static void GLAPIENTRY
3871 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3874 GET_CURRENT_CONTEXT(ctx
);
3876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3878 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3886 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3893 if (ctx
->ExecuteFlag
) {
3894 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3895 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3900 static void GLAPIENTRY
3901 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3903 GET_CURRENT_CONTEXT(ctx
);
3905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3906 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3911 if (ctx
->ExecuteFlag
) {
3912 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3917 static void GLAPIENTRY
3918 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3920 GET_CURRENT_CONTEXT(ctx
);
3922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3923 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3930 if (ctx
->ExecuteFlag
) {
3931 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3936 static void GLAPIENTRY
3937 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3939 GET_CURRENT_CONTEXT(ctx
);
3941 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3942 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3946 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3954 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3957 if (ctx
->ExecuteFlag
) {
3958 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3963 static void GLAPIENTRY
3964 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3967 parray
[0] = (GLfloat
) param
;
3968 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3969 save_TexEnvfv(target
, pname
, parray
);
3973 static void GLAPIENTRY
3974 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3977 p
[0] = (GLfloat
) param
;
3978 p
[1] = p
[2] = p
[3] = 0.0F
;
3979 save_TexEnvfv(target
, pname
, p
);
3983 static void GLAPIENTRY
3984 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3987 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3988 p
[0] = INT_TO_FLOAT(param
[0]);
3989 p
[1] = INT_TO_FLOAT(param
[1]);
3990 p
[2] = INT_TO_FLOAT(param
[2]);
3991 p
[3] = INT_TO_FLOAT(param
[3]);
3994 p
[0] = (GLfloat
) param
[0];
3995 p
[1] = p
[2] = p
[3] = 0.0F
;
3997 save_TexEnvfv(target
, pname
, p
);
4001 static void GLAPIENTRY
4002 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4004 GET_CURRENT_CONTEXT(ctx
);
4006 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4007 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4016 if (ctx
->ExecuteFlag
) {
4017 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4022 static void GLAPIENTRY
4023 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4026 p
[0] = (GLfloat
) params
[0];
4027 p
[1] = (GLfloat
) params
[1];
4028 p
[2] = (GLfloat
) params
[2];
4029 p
[3] = (GLfloat
) params
[3];
4030 save_TexGenfv(coord
, pname
, p
);
4034 static void GLAPIENTRY
4035 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4038 parray
[0] = (GLfloat
) param
;
4039 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4040 save_TexGenfv(coord
, pname
, parray
);
4044 static void GLAPIENTRY
4045 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4048 p
[0] = (GLfloat
) params
[0];
4049 p
[1] = (GLfloat
) params
[1];
4050 p
[2] = (GLfloat
) params
[2];
4051 p
[3] = (GLfloat
) params
[3];
4052 save_TexGenfv(coord
, pname
, p
);
4056 static void GLAPIENTRY
4057 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4061 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4062 save_TexGenfv(coord
, pname
, parray
);
4066 static void GLAPIENTRY
4067 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4071 parray
[1] = parray
[2] = parray
[3] = 0;
4072 save_TexGeniv(coord
, pname
, parray
);
4076 static void GLAPIENTRY
4077 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4079 GET_CURRENT_CONTEXT(ctx
);
4081 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4082 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4091 if (ctx
->ExecuteFlag
) {
4092 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4097 static void GLAPIENTRY
4098 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4102 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4103 save_TexParameterfv(target
, pname
, parray
);
4107 static void GLAPIENTRY
4108 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4111 fparam
[0] = (GLfloat
) param
;
4112 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4113 save_TexParameterfv(target
, pname
, fparam
);
4117 static void GLAPIENTRY
4118 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4121 fparam
[0] = (GLfloat
) params
[0];
4122 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4123 save_TexParameterfv(target
, pname
, fparam
);
4127 static void GLAPIENTRY
4128 save_TexImage1D(GLenum target
,
4129 GLint level
, GLint components
,
4130 GLsizei width
, GLint border
,
4131 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4133 GET_CURRENT_CONTEXT(ctx
);
4134 if (target
== GL_PROXY_TEXTURE_1D
) {
4135 /* don't compile, execute immediately */
4136 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4137 border
, format
, type
, pixels
));
4141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4142 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
4146 n
[3].i
= components
;
4147 n
[4].i
= (GLint
) width
;
4151 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4152 pixels
, &ctx
->Unpack
);
4154 if (ctx
->ExecuteFlag
) {
4155 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4156 border
, format
, type
, pixels
));
4162 static void GLAPIENTRY
4163 save_TexImage2D(GLenum target
,
4164 GLint level
, GLint components
,
4165 GLsizei width
, GLsizei height
, GLint border
,
4166 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4168 GET_CURRENT_CONTEXT(ctx
);
4169 if (target
== GL_PROXY_TEXTURE_2D
) {
4170 /* don't compile, execute immediately */
4171 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4172 height
, border
, format
, type
, pixels
));
4176 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4177 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
4181 n
[3].i
= components
;
4182 n
[4].i
= (GLint
) width
;
4183 n
[5].i
= (GLint
) height
;
4187 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4188 pixels
, &ctx
->Unpack
);
4190 if (ctx
->ExecuteFlag
) {
4191 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4192 height
, border
, format
, type
, pixels
));
4198 static void GLAPIENTRY
4199 save_TexImage3D(GLenum target
,
4200 GLint level
, GLint internalFormat
,
4201 GLsizei width
, GLsizei height
, GLsizei depth
,
4203 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4205 GET_CURRENT_CONTEXT(ctx
);
4206 if (target
== GL_PROXY_TEXTURE_3D
) {
4207 /* don't compile, execute immediately */
4208 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4209 height
, depth
, border
, format
, type
,
4214 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4215 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
4219 n
[3].i
= (GLint
) internalFormat
;
4220 n
[4].i
= (GLint
) width
;
4221 n
[5].i
= (GLint
) height
;
4222 n
[6].i
= (GLint
) depth
;
4226 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4227 pixels
, &ctx
->Unpack
);
4229 if (ctx
->ExecuteFlag
) {
4230 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4231 height
, depth
, border
, format
, type
,
4238 static void GLAPIENTRY
4239 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4240 GLsizei width
, GLenum format
, GLenum type
,
4241 const GLvoid
* pixels
)
4243 GET_CURRENT_CONTEXT(ctx
);
4246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4248 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
4253 n
[4].i
= (GLint
) width
;
4256 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4257 pixels
, &ctx
->Unpack
);
4259 if (ctx
->ExecuteFlag
) {
4260 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4261 format
, type
, pixels
));
4266 static void GLAPIENTRY
4267 save_TexSubImage2D(GLenum target
, GLint level
,
4268 GLint xoffset
, GLint yoffset
,
4269 GLsizei width
, GLsizei height
,
4270 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4272 GET_CURRENT_CONTEXT(ctx
);
4275 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4277 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
4283 n
[5].i
= (GLint
) width
;
4284 n
[6].i
= (GLint
) height
;
4287 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4288 pixels
, &ctx
->Unpack
);
4290 if (ctx
->ExecuteFlag
) {
4291 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4292 width
, height
, format
, type
, pixels
));
4297 static void GLAPIENTRY
4298 save_TexSubImage3D(GLenum target
, GLint level
,
4299 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4300 GLsizei width
, GLsizei height
, GLsizei depth
,
4301 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4303 GET_CURRENT_CONTEXT(ctx
);
4306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4308 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
4315 n
[6].i
= (GLint
) width
;
4316 n
[7].i
= (GLint
) height
;
4317 n
[8].i
= (GLint
) depth
;
4320 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4321 pixels
, &ctx
->Unpack
);
4323 if (ctx
->ExecuteFlag
) {
4324 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4325 xoffset
, yoffset
, zoffset
,
4326 width
, height
, depth
, format
, type
,
4332 static void GLAPIENTRY
4333 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4335 GET_CURRENT_CONTEXT(ctx
);
4337 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4338 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4344 if (ctx
->ExecuteFlag
) {
4345 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4350 static void GLAPIENTRY
4351 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4353 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4358 static void GLAPIENTRY
4359 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4361 GET_CURRENT_CONTEXT(ctx
);
4363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4364 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4368 n
[3].i
= (GLint
) width
;
4369 n
[4].i
= (GLint
) height
;
4371 if (ctx
->ExecuteFlag
) {
4372 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4377 static void GLAPIENTRY
4378 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4380 GET_CURRENT_CONTEXT(ctx
);
4382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4383 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4390 if (ctx
->ExecuteFlag
) {
4391 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4395 static void GLAPIENTRY
4396 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4398 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4401 static void GLAPIENTRY
4402 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4404 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4407 static void GLAPIENTRY
4408 save_WindowPos2iMESA(GLint x
, GLint y
)
4410 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4413 static void GLAPIENTRY
4414 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4416 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4419 static void GLAPIENTRY
4420 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4422 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4425 static void GLAPIENTRY
4426 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4428 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4431 static void GLAPIENTRY
4432 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4434 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4437 static void GLAPIENTRY
4438 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4440 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4443 static void GLAPIENTRY
4444 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4446 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4449 static void GLAPIENTRY
4450 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4452 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4455 static void GLAPIENTRY
4456 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4458 save_WindowPos4fMESA(x
, y
, z
, w
);
4461 static void GLAPIENTRY
4462 save_WindowPos2dvMESA(const GLdouble
* v
)
4464 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4467 static void GLAPIENTRY
4468 save_WindowPos2fvMESA(const GLfloat
* v
)
4470 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4473 static void GLAPIENTRY
4474 save_WindowPos2ivMESA(const GLint
* v
)
4476 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4479 static void GLAPIENTRY
4480 save_WindowPos2svMESA(const GLshort
* v
)
4482 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4485 static void GLAPIENTRY
4486 save_WindowPos3dvMESA(const GLdouble
* v
)
4488 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4491 static void GLAPIENTRY
4492 save_WindowPos3fvMESA(const GLfloat
* v
)
4494 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4497 static void GLAPIENTRY
4498 save_WindowPos3ivMESA(const GLint
* v
)
4500 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4503 static void GLAPIENTRY
4504 save_WindowPos3svMESA(const GLshort
* v
)
4506 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4509 static void GLAPIENTRY
4510 save_WindowPos4dvMESA(const GLdouble
* v
)
4512 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4513 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4516 static void GLAPIENTRY
4517 save_WindowPos4fvMESA(const GLfloat
* v
)
4519 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4522 static void GLAPIENTRY
4523 save_WindowPos4ivMESA(const GLint
* v
)
4525 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4526 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4529 static void GLAPIENTRY
4530 save_WindowPos4svMESA(const GLshort
* v
)
4532 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4537 /* GL_ARB_multitexture */
4538 static void GLAPIENTRY
4539 save_ActiveTextureARB(GLenum target
)
4541 GET_CURRENT_CONTEXT(ctx
);
4543 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4544 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4548 if (ctx
->ExecuteFlag
) {
4549 CALL_ActiveTexture(ctx
->Exec
, (target
));
4554 /* GL_ARB_transpose_matrix */
4556 static void GLAPIENTRY
4557 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4560 _math_transposefd(tm
, m
);
4561 save_LoadMatrixf(tm
);
4565 static void GLAPIENTRY
4566 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4569 _math_transposef(tm
, m
);
4570 save_LoadMatrixf(tm
);
4574 static void GLAPIENTRY
4575 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4578 _math_transposefd(tm
, m
);
4579 save_MultMatrixf(tm
);
4583 static void GLAPIENTRY
4584 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4587 _math_transposef(tm
, m
);
4588 save_MultMatrixf(tm
);
4591 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4593 GET_CURRENT_CONTEXT(ctx
);
4599 image
= malloc(size
);
4601 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4604 memcpy(image
, data
, size
);
4610 /* GL_ARB_texture_compression */
4611 static void GLAPIENTRY
4612 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4613 GLenum internalFormat
, GLsizei width
,
4614 GLint border
, GLsizei imageSize
,
4615 const GLvoid
* data
)
4617 GET_CURRENT_CONTEXT(ctx
);
4618 if (target
== GL_PROXY_TEXTURE_1D
) {
4619 /* don't compile, execute immediately */
4620 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4621 width
, border
, imageSize
,
4626 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4628 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4632 n
[3].e
= internalFormat
;
4633 n
[4].i
= (GLint
) width
;
4636 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4638 if (ctx
->ExecuteFlag
) {
4639 CALL_CompressedTexImage1D(ctx
->Exec
,
4640 (target
, level
, internalFormat
, width
,
4641 border
, imageSize
, data
));
4647 static void GLAPIENTRY
4648 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4649 GLenum internalFormat
, GLsizei width
,
4650 GLsizei height
, GLint border
, GLsizei imageSize
,
4651 const GLvoid
* data
)
4653 GET_CURRENT_CONTEXT(ctx
);
4654 if (target
== GL_PROXY_TEXTURE_2D
) {
4655 /* don't compile, execute immediately */
4656 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4657 width
, height
, border
,
4662 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4664 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4668 n
[3].e
= internalFormat
;
4669 n
[4].i
= (GLint
) width
;
4670 n
[5].i
= (GLint
) height
;
4673 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4675 if (ctx
->ExecuteFlag
) {
4676 CALL_CompressedTexImage2D(ctx
->Exec
,
4677 (target
, level
, internalFormat
, width
,
4678 height
, border
, imageSize
, data
));
4684 static void GLAPIENTRY
4685 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4686 GLenum internalFormat
, GLsizei width
,
4687 GLsizei height
, GLsizei depth
, GLint border
,
4688 GLsizei imageSize
, const GLvoid
* data
)
4690 GET_CURRENT_CONTEXT(ctx
);
4691 if (target
== GL_PROXY_TEXTURE_3D
) {
4692 /* don't compile, execute immediately */
4693 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4694 width
, height
, depth
, border
,
4699 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4701 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4705 n
[3].e
= internalFormat
;
4706 n
[4].i
= (GLint
) width
;
4707 n
[5].i
= (GLint
) height
;
4708 n
[6].i
= (GLint
) depth
;
4711 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4713 if (ctx
->ExecuteFlag
) {
4714 CALL_CompressedTexImage3D(ctx
->Exec
,
4715 (target
, level
, internalFormat
, width
,
4716 height
, depth
, border
, imageSize
,
4723 static void GLAPIENTRY
4724 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4725 GLsizei width
, GLenum format
,
4726 GLsizei imageSize
, const GLvoid
* data
)
4729 GET_CURRENT_CONTEXT(ctx
);
4730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4732 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4737 n
[4].i
= (GLint
) width
;
4740 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4742 if (ctx
->ExecuteFlag
) {
4743 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4744 width
, format
, imageSize
,
4750 static void GLAPIENTRY
4751 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4752 GLint yoffset
, GLsizei width
, GLsizei height
,
4753 GLenum format
, GLsizei imageSize
,
4754 const GLvoid
* data
)
4757 GET_CURRENT_CONTEXT(ctx
);
4758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4760 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4766 n
[5].i
= (GLint
) width
;
4767 n
[6].i
= (GLint
) height
;
4770 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4772 if (ctx
->ExecuteFlag
) {
4773 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4774 (target
, level
, xoffset
, yoffset
, width
,
4775 height
, format
, imageSize
, data
));
4780 static void GLAPIENTRY
4781 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4782 GLint yoffset
, GLint zoffset
, GLsizei width
,
4783 GLsizei height
, GLsizei depth
, GLenum format
,
4784 GLsizei imageSize
, const GLvoid
* data
)
4787 GET_CURRENT_CONTEXT(ctx
);
4788 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4790 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4797 n
[6].i
= (GLint
) width
;
4798 n
[7].i
= (GLint
) height
;
4799 n
[8].i
= (GLint
) depth
;
4801 n
[10].i
= imageSize
;
4802 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4804 if (ctx
->ExecuteFlag
) {
4805 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4806 (target
, level
, xoffset
, yoffset
,
4807 zoffset
, width
, height
, depth
, format
,
4813 /* GL_ARB_multisample */
4814 static void GLAPIENTRY
4815 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4817 GET_CURRENT_CONTEXT(ctx
);
4819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4820 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4825 if (ctx
->ExecuteFlag
) {
4826 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4832 * GL_NV_fragment_program
4834 static void GLAPIENTRY
4835 save_BindProgramNV(GLenum target
, GLuint id
)
4837 GET_CURRENT_CONTEXT(ctx
);
4839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4840 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4845 if (ctx
->ExecuteFlag
) {
4846 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4850 static void GLAPIENTRY
4851 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4852 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4854 GET_CURRENT_CONTEXT(ctx
);
4856 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4857 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4866 if (ctx
->ExecuteFlag
) {
4867 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4872 static void GLAPIENTRY
4873 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4874 const GLfloat
*params
)
4876 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4877 params
[2], params
[3]);
4881 static void GLAPIENTRY
4882 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4883 const GLfloat
* params
)
4885 GET_CURRENT_CONTEXT(ctx
);
4887 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4891 const GLfloat
* p
= params
;
4893 for (i
= 0 ; i
< count
; i
++) {
4894 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4907 if (ctx
->ExecuteFlag
) {
4908 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4913 static void GLAPIENTRY
4914 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4915 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4917 save_ProgramEnvParameter4fARB(target
, index
,
4919 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4923 static void GLAPIENTRY
4924 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4925 const GLdouble
*params
)
4927 save_ProgramEnvParameter4fARB(target
, index
,
4928 (GLfloat
) params
[0],
4929 (GLfloat
) params
[1],
4930 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4934 static void GLAPIENTRY
4935 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4936 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4938 GET_CURRENT_CONTEXT(ctx
);
4940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4941 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4950 if (ctx
->ExecuteFlag
) {
4951 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4956 static void GLAPIENTRY
4957 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4958 const GLfloat
*params
)
4960 GET_CURRENT_CONTEXT(ctx
);
4962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4963 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4972 if (ctx
->ExecuteFlag
) {
4973 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4978 static void GLAPIENTRY
4979 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4980 const GLfloat
*params
)
4982 GET_CURRENT_CONTEXT(ctx
);
4984 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4988 const GLfloat
* p
= params
;
4990 for (i
= 0 ; i
< count
; i
++) {
4991 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5004 if (ctx
->ExecuteFlag
) {
5005 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5010 static void GLAPIENTRY
5011 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5012 GLdouble x
, GLdouble y
,
5013 GLdouble z
, GLdouble w
)
5015 GET_CURRENT_CONTEXT(ctx
);
5017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5018 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5022 n
[3].f
= (GLfloat
) x
;
5023 n
[4].f
= (GLfloat
) y
;
5024 n
[5].f
= (GLfloat
) z
;
5025 n
[6].f
= (GLfloat
) w
;
5027 if (ctx
->ExecuteFlag
) {
5028 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5033 static void GLAPIENTRY
5034 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5035 const GLdouble
*params
)
5037 GET_CURRENT_CONTEXT(ctx
);
5039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5040 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5044 n
[3].f
= (GLfloat
) params
[0];
5045 n
[4].f
= (GLfloat
) params
[1];
5046 n
[5].f
= (GLfloat
) params
[2];
5047 n
[6].f
= (GLfloat
) params
[3];
5049 if (ctx
->ExecuteFlag
) {
5050 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5055 /* GL_EXT_stencil_two_side */
5056 static void GLAPIENTRY
5057 save_ActiveStencilFaceEXT(GLenum face
)
5059 GET_CURRENT_CONTEXT(ctx
);
5061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5062 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5066 if (ctx
->ExecuteFlag
) {
5067 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5072 /* GL_EXT_depth_bounds_test */
5073 static void GLAPIENTRY
5074 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5076 GET_CURRENT_CONTEXT(ctx
);
5078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5079 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5081 n
[1].f
= (GLfloat
) zmin
;
5082 n
[2].f
= (GLfloat
) zmax
;
5084 if (ctx
->ExecuteFlag
) {
5085 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5091 static void GLAPIENTRY
5092 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5093 const GLvoid
* string
)
5095 GET_CURRENT_CONTEXT(ctx
);
5098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5100 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
5102 GLubyte
*programCopy
= malloc(len
);
5104 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5107 memcpy(programCopy
, string
, len
);
5111 n
[4].data
= programCopy
;
5113 if (ctx
->ExecuteFlag
) {
5114 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5119 static void GLAPIENTRY
5120 save_BeginQueryARB(GLenum target
, GLuint id
)
5122 GET_CURRENT_CONTEXT(ctx
);
5124 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5125 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5130 if (ctx
->ExecuteFlag
) {
5131 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5135 static void GLAPIENTRY
5136 save_EndQueryARB(GLenum target
)
5138 GET_CURRENT_CONTEXT(ctx
);
5140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5141 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5145 if (ctx
->ExecuteFlag
) {
5146 CALL_EndQuery(ctx
->Exec
, (target
));
5150 static void GLAPIENTRY
5151 save_QueryCounter(GLuint id
, GLenum target
)
5153 GET_CURRENT_CONTEXT(ctx
);
5155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5156 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5161 if (ctx
->ExecuteFlag
) {
5162 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5166 static void GLAPIENTRY
5167 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5169 GET_CURRENT_CONTEXT(ctx
);
5171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5172 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5178 if (ctx
->ExecuteFlag
) {
5179 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5183 static void GLAPIENTRY
5184 save_EndQueryIndexed(GLenum target
, GLuint index
)
5186 GET_CURRENT_CONTEXT(ctx
);
5188 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5189 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5194 if (ctx
->ExecuteFlag
) {
5195 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5200 static void GLAPIENTRY
5201 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5203 GET_CURRENT_CONTEXT(ctx
);
5205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5206 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5210 if (count
> MAX_DRAW_BUFFERS
)
5211 count
= MAX_DRAW_BUFFERS
;
5212 for (i
= 0; i
< count
; i
++) {
5213 n
[2 + i
].e
= buffers
[i
];
5216 if (ctx
->ExecuteFlag
) {
5217 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5221 static void GLAPIENTRY
5222 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5224 GET_CURRENT_CONTEXT(ctx
);
5227 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5235 if (ctx
->ExecuteFlag
) {
5236 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5240 static void GLAPIENTRY
5241 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5244 p
[0] = INT_TO_FLOAT(param
[0]);
5245 p
[1] = INT_TO_FLOAT(param
[1]);
5246 p
[2] = INT_TO_FLOAT(param
[2]);
5247 p
[3] = INT_TO_FLOAT(param
[3]);
5248 save_TexBumpParameterfvATI(pname
, p
);
5251 static void GLAPIENTRY
5252 save_BindFragmentShaderATI(GLuint id
)
5254 GET_CURRENT_CONTEXT(ctx
);
5257 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5261 if (ctx
->ExecuteFlag
) {
5262 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5266 static void GLAPIENTRY
5267 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5269 GET_CURRENT_CONTEXT(ctx
);
5272 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5280 if (ctx
->ExecuteFlag
) {
5281 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5285 static void GLAPIENTRY
5286 save_Attr1fNV(GLenum attr
, GLfloat x
)
5288 GET_CURRENT_CONTEXT(ctx
);
5290 SAVE_FLUSH_VERTICES(ctx
);
5291 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5297 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5298 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5299 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5301 if (ctx
->ExecuteFlag
) {
5302 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5306 static void GLAPIENTRY
5307 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5309 GET_CURRENT_CONTEXT(ctx
);
5311 SAVE_FLUSH_VERTICES(ctx
);
5312 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5319 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5320 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5321 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5323 if (ctx
->ExecuteFlag
) {
5324 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5328 static void GLAPIENTRY
5329 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5331 GET_CURRENT_CONTEXT(ctx
);
5333 SAVE_FLUSH_VERTICES(ctx
);
5334 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5342 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5343 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5344 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5346 if (ctx
->ExecuteFlag
) {
5347 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5351 static void GLAPIENTRY
5352 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5354 GET_CURRENT_CONTEXT(ctx
);
5356 SAVE_FLUSH_VERTICES(ctx
);
5357 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5366 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5367 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5368 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5370 if (ctx
->ExecuteFlag
) {
5371 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5376 static void GLAPIENTRY
5377 save_Attr1fARB(GLenum attr
, GLfloat x
)
5379 GET_CURRENT_CONTEXT(ctx
);
5381 SAVE_FLUSH_VERTICES(ctx
);
5382 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5388 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5389 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5390 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5392 if (ctx
->ExecuteFlag
) {
5393 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5397 static void GLAPIENTRY
5398 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5400 GET_CURRENT_CONTEXT(ctx
);
5402 SAVE_FLUSH_VERTICES(ctx
);
5403 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5410 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5411 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5412 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5414 if (ctx
->ExecuteFlag
) {
5415 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5419 static void GLAPIENTRY
5420 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5422 GET_CURRENT_CONTEXT(ctx
);
5424 SAVE_FLUSH_VERTICES(ctx
);
5425 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5433 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5434 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5435 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5437 if (ctx
->ExecuteFlag
) {
5438 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5442 static void GLAPIENTRY
5443 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5445 GET_CURRENT_CONTEXT(ctx
);
5447 SAVE_FLUSH_VERTICES(ctx
);
5448 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5457 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5458 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5459 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5461 if (ctx
->ExecuteFlag
) {
5462 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5467 static void GLAPIENTRY
5468 save_EvalCoord1f(GLfloat x
)
5470 GET_CURRENT_CONTEXT(ctx
);
5472 SAVE_FLUSH_VERTICES(ctx
);
5473 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5477 if (ctx
->ExecuteFlag
) {
5478 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5482 static void GLAPIENTRY
5483 save_EvalCoord1fv(const GLfloat
* v
)
5485 save_EvalCoord1f(v
[0]);
5488 static void GLAPIENTRY
5489 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5491 GET_CURRENT_CONTEXT(ctx
);
5493 SAVE_FLUSH_VERTICES(ctx
);
5494 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5499 if (ctx
->ExecuteFlag
) {
5500 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5504 static void GLAPIENTRY
5505 save_EvalCoord2fv(const GLfloat
* v
)
5507 save_EvalCoord2f(v
[0], v
[1]);
5511 static void GLAPIENTRY
5512 save_EvalPoint1(GLint x
)
5514 GET_CURRENT_CONTEXT(ctx
);
5516 SAVE_FLUSH_VERTICES(ctx
);
5517 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5521 if (ctx
->ExecuteFlag
) {
5522 CALL_EvalPoint1(ctx
->Exec
, (x
));
5526 static void GLAPIENTRY
5527 save_EvalPoint2(GLint x
, GLint y
)
5529 GET_CURRENT_CONTEXT(ctx
);
5531 SAVE_FLUSH_VERTICES(ctx
);
5532 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5537 if (ctx
->ExecuteFlag
) {
5538 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5542 static void GLAPIENTRY
5543 save_Indexf(GLfloat x
)
5545 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5548 static void GLAPIENTRY
5549 save_Indexfv(const GLfloat
* v
)
5551 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5554 static void GLAPIENTRY
5555 save_EdgeFlag(GLboolean x
)
5557 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5562 * Compare 'count' elements of vectors 'a' and 'b'.
5563 * \return GL_TRUE if equal, GL_FALSE if different.
5565 static inline GLboolean
5566 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5568 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5573 * This glMaterial function is used for glMaterial calls that are outside
5574 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5576 static void GLAPIENTRY
5577 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5579 GET_CURRENT_CONTEXT(ctx
);
5587 case GL_FRONT_AND_BACK
:
5590 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5599 case GL_AMBIENT_AND_DIFFUSE
:
5605 case GL_COLOR_INDEXES
:
5609 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5613 if (ctx
->ExecuteFlag
) {
5614 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5617 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5619 /* Try to eliminate redundant statechanges. Because it is legal to
5620 * call glMaterial even inside begin/end calls, don't need to worry
5621 * about ctx->Driver.CurrentSavePrimitive here.
5623 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5624 if (bitmask
& (1 << i
)) {
5625 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5626 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5627 /* no change in material value */
5628 bitmask
&= ~(1 << i
);
5631 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5632 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5637 /* If this call has no effect, return early */
5641 SAVE_FLUSH_VERTICES(ctx
);
5643 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5647 for (i
= 0; i
< args
; i
++)
5648 n
[3 + i
].f
= param
[i
];
5652 static void GLAPIENTRY
5653 save_Begin(GLenum mode
)
5655 GET_CURRENT_CONTEXT(ctx
);
5657 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5658 /* compile this error into the display list */
5659 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5661 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5662 /* compile this error into the display list */
5663 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5668 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5670 /* Give the driver an opportunity to hook in an optimized
5671 * display list compiler.
5673 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5676 SAVE_FLUSH_VERTICES(ctx
);
5677 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5682 if (ctx
->ExecuteFlag
) {
5683 CALL_Begin(ctx
->Exec
, (mode
));
5688 static void GLAPIENTRY
5691 GET_CURRENT_CONTEXT(ctx
);
5692 SAVE_FLUSH_VERTICES(ctx
);
5693 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5694 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5695 if (ctx
->ExecuteFlag
) {
5696 CALL_End(ctx
->Exec
, ());
5700 static void GLAPIENTRY
5701 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5703 GET_CURRENT_CONTEXT(ctx
);
5705 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5706 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5713 if (ctx
->ExecuteFlag
) {
5714 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5719 static void GLAPIENTRY
5720 save_Vertex2f(GLfloat x
, GLfloat y
)
5722 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5725 static void GLAPIENTRY
5726 save_Vertex2fv(const GLfloat
* v
)
5728 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5731 static void GLAPIENTRY
5732 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5734 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5737 static void GLAPIENTRY
5738 save_Vertex3fv(const GLfloat
* v
)
5740 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5743 static void GLAPIENTRY
5744 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5746 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5749 static void GLAPIENTRY
5750 save_Vertex4fv(const GLfloat
* v
)
5752 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5755 static void GLAPIENTRY
5756 save_TexCoord1f(GLfloat x
)
5758 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5761 static void GLAPIENTRY
5762 save_TexCoord1fv(const GLfloat
* v
)
5764 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5767 static void GLAPIENTRY
5768 save_TexCoord2f(GLfloat x
, GLfloat y
)
5770 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5773 static void GLAPIENTRY
5774 save_TexCoord2fv(const GLfloat
* v
)
5776 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5779 static void GLAPIENTRY
5780 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5782 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5785 static void GLAPIENTRY
5786 save_TexCoord3fv(const GLfloat
* v
)
5788 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5791 static void GLAPIENTRY
5792 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5794 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5797 static void GLAPIENTRY
5798 save_TexCoord4fv(const GLfloat
* v
)
5800 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5803 static void GLAPIENTRY
5804 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5806 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5809 static void GLAPIENTRY
5810 save_Normal3fv(const GLfloat
* v
)
5812 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5815 static void GLAPIENTRY
5816 save_FogCoordfEXT(GLfloat x
)
5818 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5821 static void GLAPIENTRY
5822 save_FogCoordfvEXT(const GLfloat
* v
)
5824 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5827 static void GLAPIENTRY
5828 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5830 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5833 static void GLAPIENTRY
5834 save_Color3fv(const GLfloat
* v
)
5836 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5839 static void GLAPIENTRY
5840 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5842 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5845 static void GLAPIENTRY
5846 save_Color4fv(const GLfloat
* v
)
5848 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5851 static void GLAPIENTRY
5852 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5854 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5857 static void GLAPIENTRY
5858 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5860 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5864 /* Just call the respective ATTR for texcoord
5866 static void GLAPIENTRY
5867 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5869 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5870 save_Attr1fNV(attr
, x
);
5873 static void GLAPIENTRY
5874 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5876 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5877 save_Attr1fNV(attr
, v
[0]);
5880 static void GLAPIENTRY
5881 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5883 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5884 save_Attr2fNV(attr
, x
, y
);
5887 static void GLAPIENTRY
5888 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5890 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5891 save_Attr2fNV(attr
, v
[0], v
[1]);
5894 static void GLAPIENTRY
5895 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5897 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5898 save_Attr3fNV(attr
, x
, y
, z
);
5901 static void GLAPIENTRY
5902 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5904 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5905 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5908 static void GLAPIENTRY
5909 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5910 GLfloat z
, GLfloat w
)
5912 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5913 save_Attr4fNV(attr
, x
, y
, z
, w
);
5916 static void GLAPIENTRY
5917 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5919 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5920 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5925 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5931 GET_CURRENT_CONTEXT(ctx
);
5932 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5937 static void GLAPIENTRY
5938 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5940 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5941 save_Attr1fARB(index
, x
);
5946 static void GLAPIENTRY
5947 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5949 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5950 save_Attr1fARB(index
, v
[0]);
5955 static void GLAPIENTRY
5956 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5958 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5959 save_Attr2fARB(index
, x
, y
);
5964 static void GLAPIENTRY
5965 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5967 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5968 save_Attr2fARB(index
, v
[0], v
[1]);
5973 static void GLAPIENTRY
5974 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5976 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5977 save_Attr3fARB(index
, x
, y
, z
);
5982 static void GLAPIENTRY
5983 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5985 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5986 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5991 static void GLAPIENTRY
5992 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5995 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5996 save_Attr4fARB(index
, x
, y
, z
, w
);
6001 static void GLAPIENTRY
6002 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6004 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6005 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6010 static void GLAPIENTRY
6011 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6012 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6013 GLbitfield mask
, GLenum filter
)
6015 GET_CURRENT_CONTEXT(ctx
);
6017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6018 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6031 if (ctx
->ExecuteFlag
) {
6032 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6033 dstX0
, dstY0
, dstX1
, dstY1
,
6039 /** GL_EXT_provoking_vertex */
6040 static void GLAPIENTRY
6041 save_ProvokingVertexEXT(GLenum mode
)
6043 GET_CURRENT_CONTEXT(ctx
);
6045 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6046 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6050 if (ctx
->ExecuteFlag
) {
6051 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6052 _mesa_ProvokingVertex(mode
);
6057 /** GL_EXT_transform_feedback */
6058 static void GLAPIENTRY
6059 save_BeginTransformFeedback(GLenum mode
)
6061 GET_CURRENT_CONTEXT(ctx
);
6063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6064 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6068 if (ctx
->ExecuteFlag
) {
6069 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6074 /** GL_EXT_transform_feedback */
6075 static void GLAPIENTRY
6076 save_EndTransformFeedback(void)
6078 GET_CURRENT_CONTEXT(ctx
);
6079 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6080 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6081 if (ctx
->ExecuteFlag
) {
6082 CALL_EndTransformFeedback(ctx
->Exec
, ());
6086 static void GLAPIENTRY
6087 save_BindTransformFeedback(GLenum target
, GLuint name
)
6089 GET_CURRENT_CONTEXT(ctx
);
6091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6092 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6097 if (ctx
->ExecuteFlag
) {
6098 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6102 static void GLAPIENTRY
6103 save_PauseTransformFeedback(void)
6105 GET_CURRENT_CONTEXT(ctx
);
6106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6107 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6108 if (ctx
->ExecuteFlag
) {
6109 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6113 static void GLAPIENTRY
6114 save_ResumeTransformFeedback(void)
6116 GET_CURRENT_CONTEXT(ctx
);
6117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6118 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6119 if (ctx
->ExecuteFlag
) {
6120 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6124 static void GLAPIENTRY
6125 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6127 GET_CURRENT_CONTEXT(ctx
);
6129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6130 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6135 if (ctx
->ExecuteFlag
) {
6136 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6140 static void GLAPIENTRY
6141 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6143 GET_CURRENT_CONTEXT(ctx
);
6145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6146 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6152 if (ctx
->ExecuteFlag
) {
6153 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6157 static void GLAPIENTRY
6158 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6161 GET_CURRENT_CONTEXT(ctx
);
6163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6164 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6168 n
[3].si
= primcount
;
6170 if (ctx
->ExecuteFlag
) {
6171 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6175 static void GLAPIENTRY
6176 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6177 GLuint stream
, GLsizei primcount
)
6179 GET_CURRENT_CONTEXT(ctx
);
6181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6182 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6187 n
[4].si
= primcount
;
6189 if (ctx
->ExecuteFlag
) {
6190 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6195 /* aka UseProgram() */
6196 static void GLAPIENTRY
6197 save_UseProgramObjectARB(GLhandleARB program
)
6199 GET_CURRENT_CONTEXT(ctx
);
6201 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6202 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6206 if (ctx
->ExecuteFlag
) {
6207 CALL_UseProgram(ctx
->Exec
, (program
));
6212 static void GLAPIENTRY
6213 save_Uniform1fARB(GLint location
, GLfloat x
)
6215 GET_CURRENT_CONTEXT(ctx
);
6217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6218 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6223 if (ctx
->ExecuteFlag
) {
6224 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6229 static void GLAPIENTRY
6230 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6232 GET_CURRENT_CONTEXT(ctx
);
6234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6235 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6241 if (ctx
->ExecuteFlag
) {
6242 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6247 static void GLAPIENTRY
6248 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6250 GET_CURRENT_CONTEXT(ctx
);
6252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6253 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6260 if (ctx
->ExecuteFlag
) {
6261 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6266 static void GLAPIENTRY
6267 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6269 GET_CURRENT_CONTEXT(ctx
);
6271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6272 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6280 if (ctx
->ExecuteFlag
) {
6281 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6286 /** Return copy of memory */
6288 memdup(const void *src
, GLsizei bytes
)
6290 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
6292 memcpy(b
, src
, bytes
);
6297 static void GLAPIENTRY
6298 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6300 GET_CURRENT_CONTEXT(ctx
);
6302 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6303 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6307 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6309 if (ctx
->ExecuteFlag
) {
6310 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6314 static void GLAPIENTRY
6315 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6317 GET_CURRENT_CONTEXT(ctx
);
6319 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6320 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6324 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6326 if (ctx
->ExecuteFlag
) {
6327 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6331 static void GLAPIENTRY
6332 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6334 GET_CURRENT_CONTEXT(ctx
);
6336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6337 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6341 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6343 if (ctx
->ExecuteFlag
) {
6344 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6348 static void GLAPIENTRY
6349 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6351 GET_CURRENT_CONTEXT(ctx
);
6353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6354 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6358 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6360 if (ctx
->ExecuteFlag
) {
6361 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6366 static void GLAPIENTRY
6367 save_Uniform1iARB(GLint location
, GLint x
)
6369 GET_CURRENT_CONTEXT(ctx
);
6371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6372 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6377 if (ctx
->ExecuteFlag
) {
6378 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6382 static void GLAPIENTRY
6383 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6385 GET_CURRENT_CONTEXT(ctx
);
6387 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6388 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6394 if (ctx
->ExecuteFlag
) {
6395 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6399 static void GLAPIENTRY
6400 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6402 GET_CURRENT_CONTEXT(ctx
);
6404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6405 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6412 if (ctx
->ExecuteFlag
) {
6413 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6417 static void GLAPIENTRY
6418 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6420 GET_CURRENT_CONTEXT(ctx
);
6422 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6423 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6431 if (ctx
->ExecuteFlag
) {
6432 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6438 static void GLAPIENTRY
6439 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6441 GET_CURRENT_CONTEXT(ctx
);
6443 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6444 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6448 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6450 if (ctx
->ExecuteFlag
) {
6451 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6455 static void GLAPIENTRY
6456 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6458 GET_CURRENT_CONTEXT(ctx
);
6460 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6461 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6465 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6467 if (ctx
->ExecuteFlag
) {
6468 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6472 static void GLAPIENTRY
6473 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6475 GET_CURRENT_CONTEXT(ctx
);
6477 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6478 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6482 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6484 if (ctx
->ExecuteFlag
) {
6485 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6489 static void GLAPIENTRY
6490 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6492 GET_CURRENT_CONTEXT(ctx
);
6494 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6495 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6499 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6501 if (ctx
->ExecuteFlag
) {
6502 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6508 static void GLAPIENTRY
6509 save_Uniform1ui(GLint location
, GLuint x
)
6511 GET_CURRENT_CONTEXT(ctx
);
6513 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6514 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6519 if (ctx
->ExecuteFlag
) {
6520 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6524 static void GLAPIENTRY
6525 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6527 GET_CURRENT_CONTEXT(ctx
);
6529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6530 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6536 if (ctx
->ExecuteFlag
) {
6537 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6541 static void GLAPIENTRY
6542 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6544 GET_CURRENT_CONTEXT(ctx
);
6546 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6547 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6554 if (ctx
->ExecuteFlag
) {
6555 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6559 static void GLAPIENTRY
6560 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6562 GET_CURRENT_CONTEXT(ctx
);
6564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6565 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6573 if (ctx
->ExecuteFlag
) {
6574 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6580 static void GLAPIENTRY
6581 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6583 GET_CURRENT_CONTEXT(ctx
);
6585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6586 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6590 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6592 if (ctx
->ExecuteFlag
) {
6593 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6597 static void GLAPIENTRY
6598 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6600 GET_CURRENT_CONTEXT(ctx
);
6602 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6603 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6607 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6609 if (ctx
->ExecuteFlag
) {
6610 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6614 static void GLAPIENTRY
6615 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6617 GET_CURRENT_CONTEXT(ctx
);
6619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6620 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6624 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6626 if (ctx
->ExecuteFlag
) {
6627 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6631 static void GLAPIENTRY
6632 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6634 GET_CURRENT_CONTEXT(ctx
);
6636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6637 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6641 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6643 if (ctx
->ExecuteFlag
) {
6644 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6650 static void GLAPIENTRY
6651 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6654 GET_CURRENT_CONTEXT(ctx
);
6656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6657 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6662 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6664 if (ctx
->ExecuteFlag
) {
6665 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6669 static void GLAPIENTRY
6670 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6673 GET_CURRENT_CONTEXT(ctx
);
6675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6676 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6681 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6683 if (ctx
->ExecuteFlag
) {
6684 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6688 static void GLAPIENTRY
6689 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6692 GET_CURRENT_CONTEXT(ctx
);
6694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6695 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6700 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6702 if (ctx
->ExecuteFlag
) {
6703 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6708 static void GLAPIENTRY
6709 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6712 GET_CURRENT_CONTEXT(ctx
);
6714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6715 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6720 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6722 if (ctx
->ExecuteFlag
) {
6723 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6727 static void GLAPIENTRY
6728 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6731 GET_CURRENT_CONTEXT(ctx
);
6733 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6734 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6739 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6741 if (ctx
->ExecuteFlag
) {
6742 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6747 static void GLAPIENTRY
6748 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6751 GET_CURRENT_CONTEXT(ctx
);
6753 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6754 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6759 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6761 if (ctx
->ExecuteFlag
) {
6762 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6766 static void GLAPIENTRY
6767 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6770 GET_CURRENT_CONTEXT(ctx
);
6772 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6773 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6778 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6780 if (ctx
->ExecuteFlag
) {
6781 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6786 static void GLAPIENTRY
6787 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6790 GET_CURRENT_CONTEXT(ctx
);
6792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6793 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6798 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6800 if (ctx
->ExecuteFlag
) {
6801 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6805 static void GLAPIENTRY
6806 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6809 GET_CURRENT_CONTEXT(ctx
);
6811 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6812 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6817 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6819 if (ctx
->ExecuteFlag
) {
6820 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6824 static void GLAPIENTRY
6825 save_ClampColorARB(GLenum target
, GLenum clamp
)
6827 GET_CURRENT_CONTEXT(ctx
);
6829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6830 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6835 if (ctx
->ExecuteFlag
) {
6836 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6840 static void GLAPIENTRY
6841 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6843 GET_CURRENT_CONTEXT(ctx
);
6845 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6846 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6851 if (ctx
->ExecuteFlag
) {
6852 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6856 static void GLAPIENTRY
6857 save_ActiveProgramEXT(GLuint program
)
6859 GET_CURRENT_CONTEXT(ctx
);
6861 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6862 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6866 if (ctx
->ExecuteFlag
) {
6867 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6871 /** GL_EXT_texture_integer */
6872 static void GLAPIENTRY
6873 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6875 GET_CURRENT_CONTEXT(ctx
);
6877 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6878 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6885 if (ctx
->ExecuteFlag
) {
6886 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6890 /** GL_EXT_texture_integer */
6891 static void GLAPIENTRY
6892 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6894 GET_CURRENT_CONTEXT(ctx
);
6896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6897 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6904 if (ctx
->ExecuteFlag
) {
6905 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6909 /** GL_EXT_texture_integer */
6910 static void GLAPIENTRY
6911 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6913 GET_CURRENT_CONTEXT(ctx
);
6915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6916 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6925 if (ctx
->ExecuteFlag
) {
6926 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6930 /** GL_EXT_texture_integer */
6931 static void GLAPIENTRY
6932 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6934 GET_CURRENT_CONTEXT(ctx
);
6936 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6937 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6941 n
[3].ui
= params
[0];
6942 n
[4].ui
= params
[1];
6943 n
[5].ui
= params
[2];
6944 n
[6].ui
= params
[3];
6946 if (ctx
->ExecuteFlag
) {
6947 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6951 /* GL_ARB_instanced_arrays */
6952 static void GLAPIENTRY
6953 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6955 GET_CURRENT_CONTEXT(ctx
);
6957 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6958 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6963 if (ctx
->ExecuteFlag
) {
6964 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6969 /* GL_NV_texture_barrier */
6970 static void GLAPIENTRY
6971 save_TextureBarrierNV(void)
6973 GET_CURRENT_CONTEXT(ctx
);
6974 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6975 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6976 if (ctx
->ExecuteFlag
) {
6977 CALL_TextureBarrierNV(ctx
->Exec
, ());
6982 /* GL_ARB_sampler_objects */
6983 static void GLAPIENTRY
6984 save_BindSampler(GLuint unit
, GLuint sampler
)
6987 GET_CURRENT_CONTEXT(ctx
);
6988 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6989 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6994 if (ctx
->ExecuteFlag
) {
6995 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6999 static void GLAPIENTRY
7000 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7003 GET_CURRENT_CONTEXT(ctx
);
7004 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7005 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7010 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7016 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7019 if (ctx
->ExecuteFlag
) {
7020 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7024 static void GLAPIENTRY
7025 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7029 parray
[1] = parray
[2] = parray
[3] = 0;
7030 save_SamplerParameteriv(sampler
, pname
, parray
);
7033 static void GLAPIENTRY
7034 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7037 GET_CURRENT_CONTEXT(ctx
);
7038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7039 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7044 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7050 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7053 if (ctx
->ExecuteFlag
) {
7054 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7058 static void GLAPIENTRY
7059 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7063 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
7064 save_SamplerParameterfv(sampler
, pname
, parray
);
7067 static void GLAPIENTRY
7068 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7071 GET_CURRENT_CONTEXT(ctx
);
7072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7073 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7078 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7084 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7087 if (ctx
->ExecuteFlag
) {
7088 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7092 static void GLAPIENTRY
7093 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7096 GET_CURRENT_CONTEXT(ctx
);
7097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7098 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7102 n
[3].ui
= params
[0];
7103 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7104 n
[4].ui
= params
[1];
7105 n
[5].ui
= params
[2];
7106 n
[6].ui
= params
[3];
7109 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7112 if (ctx
->ExecuteFlag
) {
7113 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7117 /* GL_ARB_geometry_shader4 */
7118 static void GLAPIENTRY
7119 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7122 GET_CURRENT_CONTEXT(ctx
);
7123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7124 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7130 if (ctx
->ExecuteFlag
) {
7131 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7135 static void GLAPIENTRY
7136 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7137 GLuint texture
, GLint level
)
7140 GET_CURRENT_CONTEXT(ctx
);
7141 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7142 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7145 n
[2].e
= attachment
;
7149 if (ctx
->ExecuteFlag
) {
7150 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7154 static void GLAPIENTRY
7155 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7156 GLuint texture
, GLint level
, GLenum face
)
7159 GET_CURRENT_CONTEXT(ctx
);
7160 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7161 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7164 n
[2].e
= attachment
;
7169 if (ctx
->ExecuteFlag
) {
7170 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7177 static void GLAPIENTRY
7178 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7181 GET_CURRENT_CONTEXT(ctx
);
7182 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7183 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7185 union uint64_pair p
;
7189 n
[3].ui
= p
.uint32
[0];
7190 n
[4].ui
= p
.uint32
[1];
7192 if (ctx
->ExecuteFlag
) {
7193 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7198 /** GL_NV_conditional_render */
7199 static void GLAPIENTRY
7200 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7202 GET_CURRENT_CONTEXT(ctx
);
7204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7205 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7210 if (ctx
->ExecuteFlag
) {
7211 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7215 static void GLAPIENTRY
7216 save_EndConditionalRender(void)
7218 GET_CURRENT_CONTEXT(ctx
);
7219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7220 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7221 if (ctx
->ExecuteFlag
) {
7222 CALL_EndConditionalRender(ctx
->Exec
, ());
7226 static void GLAPIENTRY
7227 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7229 GET_CURRENT_CONTEXT(ctx
);
7231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7232 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7238 if (ctx
->ExecuteFlag
) {
7239 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7245 * Save an error-generating command into display list.
7247 * KW: Will appear in the list before the vertex buffer containing the
7248 * command that provoked the error. I don't see this as a problem.
7251 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7254 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
7257 n
[2].data
= (void *) s
;
7263 * Compile an error into current display list.
7266 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7268 if (ctx
->CompileFlag
)
7269 save_error(ctx
, error
, s
);
7270 if (ctx
->ExecuteFlag
)
7271 _mesa_error(ctx
, error
, "%s", s
);
7276 * Test if ID names a display list.
7279 islist(struct gl_context
*ctx
, GLuint list
)
7281 if (list
> 0 && lookup_list(ctx
, list
)) {
7291 /**********************************************************************/
7292 /* Display list execution */
7293 /**********************************************************************/
7297 * Execute a display list. Note that the ListBase offset must have already
7298 * been added before calling this function. I.e. the list argument is
7299 * the absolute list number, not relative to ListBase.
7300 * \param list - display list number
7303 execute_list(struct gl_context
*ctx
, GLuint list
)
7305 struct gl_display_list
*dlist
;
7309 if (list
== 0 || !islist(ctx
, list
))
7312 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7313 /* raise an error? */
7317 dlist
= lookup_list(ctx
, list
);
7321 ctx
->ListState
.CallDepth
++;
7323 if (ctx
->Driver
.BeginCallList
)
7324 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7330 const OpCode opcode
= n
[0].opcode
;
7332 if (is_ext_opcode(opcode
)) {
7333 n
+= ext_opcode_execute(ctx
, n
);
7338 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
7341 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7343 case OPCODE_ALPHA_FUNC
:
7344 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7346 case OPCODE_BIND_TEXTURE
:
7347 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7351 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7352 ctx
->Unpack
= ctx
->DefaultPacking
;
7353 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7354 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7355 (const GLubyte
*) n
[7].data
));
7356 ctx
->Unpack
= save
; /* restore */
7359 case OPCODE_BLEND_COLOR
:
7360 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7362 case OPCODE_BLEND_EQUATION
:
7363 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7365 case OPCODE_BLEND_EQUATION_SEPARATE
:
7366 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7368 case OPCODE_BLEND_FUNC_SEPARATE
:
7369 CALL_BlendFuncSeparate(ctx
->Exec
,
7370 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7373 case OPCODE_BLEND_FUNC_I
:
7374 /* GL_ARB_draw_buffers_blend */
7375 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7377 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7378 /* GL_ARB_draw_buffers_blend */
7379 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7382 case OPCODE_BLEND_EQUATION_I
:
7383 /* GL_ARB_draw_buffers_blend */
7384 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7386 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7387 /* GL_ARB_draw_buffers_blend */
7388 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7389 (n
[1].ui
, n
[2].e
, n
[3].e
));
7392 case OPCODE_CALL_LIST
:
7393 /* Generated by glCallList(), don't add ListBase */
7394 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7395 execute_list(ctx
, n
[1].ui
);
7398 case OPCODE_CALL_LIST_OFFSET
:
7399 /* Generated by glCallLists() so we must add ListBase */
7401 /* user specified a bad data type at compile time */
7402 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7404 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7405 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7406 execute_list(ctx
, list
);
7410 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7412 case OPCODE_CLEAR_BUFFER_IV
:
7419 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7422 case OPCODE_CLEAR_BUFFER_UIV
:
7429 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7432 case OPCODE_CLEAR_BUFFER_FV
:
7439 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7442 case OPCODE_CLEAR_BUFFER_FI
:
7443 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7445 case OPCODE_CLEAR_COLOR
:
7446 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7448 case OPCODE_CLEAR_ACCUM
:
7449 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7451 case OPCODE_CLEAR_DEPTH
:
7452 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7454 case OPCODE_CLEAR_INDEX
:
7455 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7457 case OPCODE_CLEAR_STENCIL
:
7458 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7460 case OPCODE_CLIP_PLANE
:
7467 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7470 case OPCODE_COLOR_MASK
:
7471 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7473 case OPCODE_COLOR_MASK_INDEXED
:
7474 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7477 case OPCODE_COLOR_MATERIAL
:
7478 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7480 case OPCODE_COLOR_TABLE
:
7482 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7483 ctx
->Unpack
= ctx
->DefaultPacking
;
7484 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
7485 n
[5].e
, n
[6].data
));
7486 ctx
->Unpack
= save
; /* restore */
7489 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7496 CALL_ColorTableParameterfv(ctx
->Exec
,
7497 (n
[1].e
, n
[2].e
, params
));
7500 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7507 CALL_ColorTableParameteriv(ctx
->Exec
,
7508 (n
[1].e
, n
[2].e
, params
));
7511 case OPCODE_COLOR_SUB_TABLE
:
7513 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7514 ctx
->Unpack
= ctx
->DefaultPacking
;
7515 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7516 n
[4].e
, n
[5].e
, n
[6].data
));
7517 ctx
->Unpack
= save
; /* restore */
7520 case OPCODE_CONVOLUTION_FILTER_1D
:
7522 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7523 ctx
->Unpack
= ctx
->DefaultPacking
;
7524 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7527 ctx
->Unpack
= save
; /* restore */
7530 case OPCODE_CONVOLUTION_FILTER_2D
:
7532 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7533 ctx
->Unpack
= ctx
->DefaultPacking
;
7534 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7535 n
[4].i
, n
[5].e
, n
[6].e
,
7537 ctx
->Unpack
= save
; /* restore */
7540 case OPCODE_CONVOLUTION_PARAMETER_I
:
7541 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
7543 case OPCODE_CONVOLUTION_PARAMETER_IV
:
7550 CALL_ConvolutionParameteriv(ctx
->Exec
,
7551 (n
[1].e
, n
[2].e
, params
));
7554 case OPCODE_CONVOLUTION_PARAMETER_F
:
7555 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
7557 case OPCODE_CONVOLUTION_PARAMETER_FV
:
7564 CALL_ConvolutionParameterfv(ctx
->Exec
,
7565 (n
[1].e
, n
[2].e
, params
));
7568 case OPCODE_COPY_COLOR_SUB_TABLE
:
7569 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7570 n
[3].i
, n
[4].i
, n
[5].i
));
7572 case OPCODE_COPY_COLOR_TABLE
:
7573 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7574 n
[3].i
, n
[4].i
, n
[5].i
));
7576 case OPCODE_COPY_PIXELS
:
7577 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7578 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7581 case OPCODE_COPY_TEX_IMAGE1D
:
7582 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7583 n
[5].i
, n
[6].i
, n
[7].i
));
7585 case OPCODE_COPY_TEX_IMAGE2D
:
7586 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7587 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7589 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7590 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7591 n
[4].i
, n
[5].i
, n
[6].i
));
7593 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7594 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7595 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7598 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7599 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7600 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7603 case OPCODE_CULL_FACE
:
7604 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7606 case OPCODE_DEPTH_FUNC
:
7607 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7609 case OPCODE_DEPTH_MASK
:
7610 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7612 case OPCODE_DEPTH_RANGE
:
7613 CALL_DepthRange(ctx
->Exec
,
7614 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7616 case OPCODE_DISABLE
:
7617 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7619 case OPCODE_DISABLE_INDEXED
:
7620 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7622 case OPCODE_DRAW_BUFFER
:
7623 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7625 case OPCODE_DRAW_PIXELS
:
7627 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7628 ctx
->Unpack
= ctx
->DefaultPacking
;
7629 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7631 ctx
->Unpack
= save
; /* restore */
7635 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7637 case OPCODE_ENABLE_INDEXED
:
7638 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7640 case OPCODE_EVALMESH1
:
7641 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7643 case OPCODE_EVALMESH2
:
7644 CALL_EvalMesh2(ctx
->Exec
,
7645 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7654 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7657 case OPCODE_FRONT_FACE
:
7658 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7660 case OPCODE_FRUSTUM
:
7661 CALL_Frustum(ctx
->Exec
,
7662 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7665 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7667 case OPCODE_HISTOGRAM
:
7668 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
7670 case OPCODE_INDEX_MASK
:
7671 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7673 case OPCODE_INIT_NAMES
:
7674 CALL_InitNames(ctx
->Exec
, ());
7683 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7686 case OPCODE_LIGHT_MODEL
:
7693 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7696 case OPCODE_LINE_STIPPLE
:
7697 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7699 case OPCODE_LINE_WIDTH
:
7700 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7702 case OPCODE_LIST_BASE
:
7703 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7705 case OPCODE_LOAD_IDENTITY
:
7706 CALL_LoadIdentity(ctx
->Exec
, ());
7708 case OPCODE_LOAD_MATRIX
:
7709 if (sizeof(Node
) == sizeof(GLfloat
)) {
7710 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7715 for (i
= 0; i
< 16; i
++) {
7718 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7721 case OPCODE_LOAD_NAME
:
7722 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7724 case OPCODE_LOGIC_OP
:
7725 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7729 GLenum target
= n
[1].e
;
7730 GLint ustride
= _mesa_evaluator_components(target
);
7731 GLint uorder
= n
[5].i
;
7732 GLfloat u1
= n
[2].f
;
7733 GLfloat u2
= n
[3].f
;
7734 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7735 (GLfloat
*) n
[6].data
));
7740 GLenum target
= n
[1].e
;
7741 GLfloat u1
= n
[2].f
;
7742 GLfloat u2
= n
[3].f
;
7743 GLfloat v1
= n
[4].f
;
7744 GLfloat v2
= n
[5].f
;
7745 GLint ustride
= n
[6].i
;
7746 GLint vstride
= n
[7].i
;
7747 GLint uorder
= n
[8].i
;
7748 GLint vorder
= n
[9].i
;
7749 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7750 v1
, v2
, vstride
, vorder
,
7751 (GLfloat
*) n
[10].data
));
7754 case OPCODE_MAPGRID1
:
7755 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7757 case OPCODE_MAPGRID2
:
7758 CALL_MapGrid2f(ctx
->Exec
,
7759 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7761 case OPCODE_MATRIX_MODE
:
7762 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7764 case OPCODE_MIN_MAX
:
7765 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
7767 case OPCODE_MULT_MATRIX
:
7768 if (sizeof(Node
) == sizeof(GLfloat
)) {
7769 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7774 for (i
= 0; i
< 16; i
++) {
7777 CALL_MultMatrixf(ctx
->Exec
, (m
));
7781 CALL_Ortho(ctx
->Exec
,
7782 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7784 case OPCODE_PASSTHROUGH
:
7785 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7787 case OPCODE_PIXEL_MAP
:
7788 CALL_PixelMapfv(ctx
->Exec
,
7789 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7791 case OPCODE_PIXEL_TRANSFER
:
7792 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7794 case OPCODE_PIXEL_ZOOM
:
7795 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7797 case OPCODE_POINT_SIZE
:
7798 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7800 case OPCODE_POINT_PARAMETERS
:
7806 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7809 case OPCODE_POLYGON_MODE
:
7810 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7812 case OPCODE_POLYGON_STIPPLE
:
7814 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7815 ctx
->Unpack
= ctx
->DefaultPacking
;
7816 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7817 ctx
->Unpack
= save
; /* restore */
7820 case OPCODE_POLYGON_OFFSET
:
7821 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7823 case OPCODE_POP_ATTRIB
:
7824 CALL_PopAttrib(ctx
->Exec
, ());
7826 case OPCODE_POP_MATRIX
:
7827 CALL_PopMatrix(ctx
->Exec
, ());
7829 case OPCODE_POP_NAME
:
7830 CALL_PopName(ctx
->Exec
, ());
7832 case OPCODE_PRIORITIZE_TEXTURE
:
7833 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7835 case OPCODE_PUSH_ATTRIB
:
7836 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7838 case OPCODE_PUSH_MATRIX
:
7839 CALL_PushMatrix(ctx
->Exec
, ());
7841 case OPCODE_PUSH_NAME
:
7842 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7844 case OPCODE_RASTER_POS
:
7845 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7847 case OPCODE_READ_BUFFER
:
7848 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7850 case OPCODE_RESET_HISTOGRAM
:
7851 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
7853 case OPCODE_RESET_MIN_MAX
:
7854 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7857 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7860 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7862 case OPCODE_SCISSOR
:
7863 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7865 case OPCODE_SHADE_MODEL
:
7866 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7868 case OPCODE_PROVOKING_VERTEX
:
7869 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7871 case OPCODE_STENCIL_FUNC
:
7872 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7874 case OPCODE_STENCIL_MASK
:
7875 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7877 case OPCODE_STENCIL_OP
:
7878 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7880 case OPCODE_STENCIL_FUNC_SEPARATE
:
7881 CALL_StencilFuncSeparate(ctx
->Exec
,
7882 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7884 case OPCODE_STENCIL_MASK_SEPARATE
:
7885 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7887 case OPCODE_STENCIL_OP_SEPARATE
:
7888 CALL_StencilOpSeparate(ctx
->Exec
,
7889 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7898 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7908 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7911 case OPCODE_TEXPARAMETER
:
7918 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7921 case OPCODE_TEX_IMAGE1D
:
7923 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7924 ctx
->Unpack
= ctx
->DefaultPacking
;
7925 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7927 n
[3].i
, /* components */
7929 n
[5].e
, /* border */
7930 n
[6].e
, /* format */
7933 ctx
->Unpack
= save
; /* restore */
7936 case OPCODE_TEX_IMAGE2D
:
7938 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7939 ctx
->Unpack
= ctx
->DefaultPacking
;
7940 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7942 n
[3].i
, /* components */
7944 n
[5].i
, /* height */
7945 n
[6].e
, /* border */
7946 n
[7].e
, /* format */
7949 ctx
->Unpack
= save
; /* restore */
7952 case OPCODE_TEX_IMAGE3D
:
7954 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7955 ctx
->Unpack
= ctx
->DefaultPacking
;
7956 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7958 n
[3].i
, /* components */
7960 n
[5].i
, /* height */
7962 n
[7].e
, /* border */
7963 n
[8].e
, /* format */
7966 ctx
->Unpack
= save
; /* restore */
7969 case OPCODE_TEX_SUB_IMAGE1D
:
7971 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7972 ctx
->Unpack
= ctx
->DefaultPacking
;
7973 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7975 n
[6].e
, n
[7].data
));
7976 ctx
->Unpack
= save
; /* restore */
7979 case OPCODE_TEX_SUB_IMAGE2D
:
7981 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7982 ctx
->Unpack
= ctx
->DefaultPacking
;
7983 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7985 n
[6].i
, n
[7].e
, n
[8].e
,
7987 ctx
->Unpack
= save
; /* restore */
7990 case OPCODE_TEX_SUB_IMAGE3D
:
7992 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7993 ctx
->Unpack
= ctx
->DefaultPacking
;
7994 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7995 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7996 n
[8].i
, n
[9].e
, n
[10].e
,
7998 ctx
->Unpack
= save
; /* restore */
8001 case OPCODE_TRANSLATE
:
8002 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8004 case OPCODE_VIEWPORT
:
8005 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
8006 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8008 case OPCODE_WINDOW_POS
:
8009 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8011 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8012 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8014 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8015 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8016 n
[4].i
, n
[5].i
, n
[6].i
,
8019 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8020 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8021 n
[4].i
, n
[5].i
, n
[6].i
,
8022 n
[7].i
, n
[8].data
));
8024 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8025 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8026 n
[4].i
, n
[5].i
, n
[6].i
,
8030 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8031 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8032 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8033 n
[5].e
, n
[6].i
, n
[7].data
));
8035 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8036 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8037 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8038 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8041 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8042 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8043 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8044 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8045 n
[9].e
, n
[10].i
, n
[11].data
));
8047 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8048 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8050 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8051 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8053 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8054 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8056 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8057 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8058 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8061 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8062 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8064 case OPCODE_DEPTH_BOUNDS_EXT
:
8065 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8067 case OPCODE_PROGRAM_STRING_ARB
:
8068 CALL_ProgramStringARB(ctx
->Exec
,
8069 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
8071 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8072 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8076 case OPCODE_BEGIN_QUERY_ARB
:
8077 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8079 case OPCODE_END_QUERY_ARB
:
8080 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8082 case OPCODE_QUERY_COUNTER
:
8083 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8085 case OPCODE_BEGIN_QUERY_INDEXED
:
8086 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8088 case OPCODE_END_QUERY_INDEXED
:
8089 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8091 case OPCODE_DRAW_BUFFERS_ARB
:
8093 GLenum buffers
[MAX_DRAW_BUFFERS
];
8094 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8095 for (i
= 0; i
< count
; i
++)
8096 buffers
[i
] = n
[2 + i
].e
;
8097 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8100 case OPCODE_BLIT_FRAMEBUFFER
:
8101 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8102 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8105 case OPCODE_USE_PROGRAM
:
8106 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8108 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8109 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8111 case OPCODE_ACTIVE_PROGRAM_EXT
:
8112 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8114 case OPCODE_UNIFORM_1F
:
8115 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8117 case OPCODE_UNIFORM_2F
:
8118 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8120 case OPCODE_UNIFORM_3F
:
8121 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8123 case OPCODE_UNIFORM_4F
:
8124 CALL_Uniform4f(ctx
->Exec
,
8125 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8127 case OPCODE_UNIFORM_1FV
:
8128 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8130 case OPCODE_UNIFORM_2FV
:
8131 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8133 case OPCODE_UNIFORM_3FV
:
8134 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8136 case OPCODE_UNIFORM_4FV
:
8137 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8139 case OPCODE_UNIFORM_1I
:
8140 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8142 case OPCODE_UNIFORM_2I
:
8143 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8145 case OPCODE_UNIFORM_3I
:
8146 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8148 case OPCODE_UNIFORM_4I
:
8149 CALL_Uniform4i(ctx
->Exec
,
8150 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8152 case OPCODE_UNIFORM_1IV
:
8153 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8155 case OPCODE_UNIFORM_2IV
:
8156 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8158 case OPCODE_UNIFORM_3IV
:
8159 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8161 case OPCODE_UNIFORM_4IV
:
8162 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8164 case OPCODE_UNIFORM_1UI
:
8165 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8167 case OPCODE_UNIFORM_2UI
:
8168 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8170 case OPCODE_UNIFORM_3UI
:
8171 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8173 case OPCODE_UNIFORM_4UI
:
8174 /*CALL_Uniform4uiARB(ctx->Exec,
8175 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8178 case OPCODE_UNIFORM_1UIV
:
8179 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8181 case OPCODE_UNIFORM_2UIV
:
8182 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8184 case OPCODE_UNIFORM_3UIV
:
8185 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8187 case OPCODE_UNIFORM_4UIV
:
8188 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8190 case OPCODE_UNIFORM_MATRIX22
:
8191 CALL_UniformMatrix2fv(ctx
->Exec
,
8192 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8194 case OPCODE_UNIFORM_MATRIX33
:
8195 CALL_UniformMatrix3fv(ctx
->Exec
,
8196 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8198 case OPCODE_UNIFORM_MATRIX44
:
8199 CALL_UniformMatrix4fv(ctx
->Exec
,
8200 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8202 case OPCODE_UNIFORM_MATRIX23
:
8203 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8204 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8206 case OPCODE_UNIFORM_MATRIX32
:
8207 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8208 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8210 case OPCODE_UNIFORM_MATRIX24
:
8211 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8212 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8214 case OPCODE_UNIFORM_MATRIX42
:
8215 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8216 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8218 case OPCODE_UNIFORM_MATRIX34
:
8219 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8220 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8222 case OPCODE_UNIFORM_MATRIX43
:
8223 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8224 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8227 case OPCODE_CLAMP_COLOR
:
8228 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8231 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8234 GLuint i
, pname
= n
[1].ui
;
8236 for (i
= 0; i
< 4; i
++)
8237 values
[i
] = n
[1 + i
].f
;
8238 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8241 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8242 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8244 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8247 GLuint i
, dst
= n
[1].ui
;
8249 for (i
= 0; i
< 4; i
++)
8250 values
[i
] = n
[1 + i
].f
;
8251 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8254 case OPCODE_ATTR_1F_NV
:
8255 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8257 case OPCODE_ATTR_2F_NV
:
8258 /* Really shouldn't have to do this - the Node structure
8259 * is convenient, but it would be better to store the data
8260 * packed appropriately so that it can be sent directly
8261 * on. With x86_64 becoming common, this will start to
8264 if (sizeof(Node
) == sizeof(GLfloat
))
8265 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8267 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8269 case OPCODE_ATTR_3F_NV
:
8270 if (sizeof(Node
) == sizeof(GLfloat
))
8271 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8273 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8276 case OPCODE_ATTR_4F_NV
:
8277 if (sizeof(Node
) == sizeof(GLfloat
))
8278 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8280 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8283 case OPCODE_ATTR_1F_ARB
:
8284 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8286 case OPCODE_ATTR_2F_ARB
:
8287 /* Really shouldn't have to do this - the Node structure
8288 * is convenient, but it would be better to store the data
8289 * packed appropriately so that it can be sent directly
8290 * on. With x86_64 becoming common, this will start to
8293 if (sizeof(Node
) == sizeof(GLfloat
))
8294 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8296 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8298 case OPCODE_ATTR_3F_ARB
:
8299 if (sizeof(Node
) == sizeof(GLfloat
))
8300 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8302 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8305 case OPCODE_ATTR_4F_ARB
:
8306 if (sizeof(Node
) == sizeof(GLfloat
))
8307 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8309 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8312 case OPCODE_MATERIAL
:
8313 if (sizeof(Node
) == sizeof(GLfloat
))
8314 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8321 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8325 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8328 CALL_End(ctx
->Exec
, ());
8331 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8333 case OPCODE_EVAL_C1
:
8334 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8336 case OPCODE_EVAL_C2
:
8337 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8339 case OPCODE_EVAL_P1
:
8340 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8342 case OPCODE_EVAL_P2
:
8343 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8346 /* GL_EXT_texture_integer */
8347 case OPCODE_CLEARCOLOR_I
:
8348 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8350 case OPCODE_CLEARCOLOR_UI
:
8351 CALL_ClearColorIuiEXT(ctx
->Exec
,
8352 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8354 case OPCODE_TEXPARAMETER_I
:
8361 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8364 case OPCODE_TEXPARAMETER_UI
:
8367 params
[0] = n
[3].ui
;
8368 params
[1] = n
[4].ui
;
8369 params
[2] = n
[5].ui
;
8370 params
[3] = n
[6].ui
;
8371 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8375 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8376 /* GL_ARB_instanced_arrays */
8377 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8380 case OPCODE_TEXTURE_BARRIER_NV
:
8381 CALL_TextureBarrierNV(ctx
->Exec
, ());
8384 /* GL_EXT/ARB_transform_feedback */
8385 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8386 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8388 case OPCODE_END_TRANSFORM_FEEDBACK
:
8389 CALL_EndTransformFeedback(ctx
->Exec
, ());
8391 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8392 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8394 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8395 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8397 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8398 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8400 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8401 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8403 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8404 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8405 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8407 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8408 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8409 (n
[1].e
, n
[2].ui
, n
[3].si
));
8411 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8412 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8413 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8417 case OPCODE_BIND_SAMPLER
:
8418 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8420 case OPCODE_SAMPLER_PARAMETERIV
:
8427 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8430 case OPCODE_SAMPLER_PARAMETERFV
:
8437 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8440 case OPCODE_SAMPLER_PARAMETERIIV
:
8447 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8450 case OPCODE_SAMPLER_PARAMETERUIV
:
8453 params
[0] = n
[3].ui
;
8454 params
[1] = n
[4].ui
;
8455 params
[2] = n
[5].ui
;
8456 params
[3] = n
[6].ui
;
8457 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8461 /* GL_ARB_geometry_shader4 */
8462 case OPCODE_PROGRAM_PARAMETERI
:
8463 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8465 case OPCODE_FRAMEBUFFER_TEXTURE
:
8466 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8469 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8470 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8471 n
[3].ui
, n
[4].i
, n
[5].e
));
8475 case OPCODE_WAIT_SYNC
:
8477 union uint64_pair p
;
8478 p
.uint32
[0] = n
[3].ui
;
8479 p
.uint32
[1] = n
[4].ui
;
8480 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
8484 /* GL_NV_conditional_render */
8485 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8486 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8488 case OPCODE_END_CONDITIONAL_RENDER
:
8489 CALL_EndConditionalRender(ctx
->Exec
, ());
8492 case OPCODE_UNIFORM_BLOCK_BINDING
:
8493 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8496 case OPCODE_CONTINUE
:
8497 n
= (Node
*) n
[1].next
;
8499 case OPCODE_END_OF_LIST
:
8505 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8507 _mesa_problem(ctx
, "%s", msg
);
8512 /* increment n to point to next compiled command */
8513 if (opcode
!= OPCODE_CONTINUE
) {
8514 n
+= InstSize
[opcode
];
8519 if (ctx
->Driver
.EndCallList
)
8520 ctx
->Driver
.EndCallList(ctx
);
8522 ctx
->ListState
.CallDepth
--;
8527 /**********************************************************************/
8529 /**********************************************************************/
8532 * Test if a display list number is valid.
8534 GLboolean GLAPIENTRY
8535 _mesa_IsList(GLuint list
)
8537 GET_CURRENT_CONTEXT(ctx
);
8538 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8539 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8540 return islist(ctx
, list
);
8545 * Delete a sequence of consecutive display lists.
8548 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8550 GET_CURRENT_CONTEXT(ctx
);
8552 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8553 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8556 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8559 for (i
= list
; i
< list
+ range
; i
++) {
8560 destroy_list(ctx
, i
);
8566 * Return a display list number, n, such that lists n through n+range-1
8570 _mesa_GenLists(GLsizei range
)
8572 GET_CURRENT_CONTEXT(ctx
);
8574 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8575 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8578 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8586 * Make this an atomic operation
8588 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8590 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8592 /* reserve the list IDs by with empty/dummy lists */
8594 for (i
= 0; i
< range
; i
++) {
8595 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8596 make_list(base
+ i
, 1));
8600 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8607 * Begin a new display list.
8610 _mesa_NewList(GLuint name
, GLenum mode
)
8612 GET_CURRENT_CONTEXT(ctx
);
8614 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8615 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8617 if (MESA_VERBOSE
& VERBOSE_API
)
8618 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8619 _mesa_lookup_enum_by_nr(mode
));
8622 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8626 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8627 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8631 if (ctx
->ListState
.CurrentList
) {
8632 /* already compiling a display list */
8633 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8637 ctx
->CompileFlag
= GL_TRUE
;
8638 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8640 /* Reset accumulated list state */
8641 invalidate_saved_current_state( ctx
);
8643 /* Allocate new display list */
8644 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8645 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8646 ctx
->ListState
.CurrentPos
= 0;
8648 ctx
->Driver
.NewList(ctx
, name
, mode
);
8650 ctx
->CurrentDispatch
= ctx
->Save
;
8651 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8656 * End definition of current display list.
8661 GET_CURRENT_CONTEXT(ctx
);
8662 SAVE_FLUSH_VERTICES(ctx
);
8663 FLUSH_VERTICES(ctx
, 0);
8665 if (MESA_VERBOSE
& VERBOSE_API
)
8666 _mesa_debug(ctx
, "glEndList\n");
8668 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8669 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8670 "glEndList() called inside glBegin/End");
8673 /* Check that a list is under construction */
8674 if (!ctx
->ListState
.CurrentList
) {
8675 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8679 /* Call before emitting END_OF_LIST, in case the driver wants to
8680 * emit opcodes itself.
8682 ctx
->Driver
.EndList(ctx
);
8684 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8686 /* Destroy old list, if any */
8687 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8689 /* Install the new list */
8690 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8691 ctx
->ListState
.CurrentList
->Name
,
8692 ctx
->ListState
.CurrentList
);
8695 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8696 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8698 ctx
->ListState
.CurrentList
= NULL
;
8699 ctx
->ExecuteFlag
= GL_TRUE
;
8700 ctx
->CompileFlag
= GL_FALSE
;
8702 ctx
->CurrentDispatch
= ctx
->Exec
;
8703 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8708 _mesa_CallList(GLuint list
)
8710 GLboolean save_compile_flag
;
8711 GET_CURRENT_CONTEXT(ctx
);
8712 FLUSH_CURRENT(ctx
, 0);
8714 if (MESA_VERBOSE
& VERBOSE_API
)
8715 _mesa_debug(ctx
, "glCallList %d\n", list
);
8718 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8723 mesa_print_display_list( list
);
8725 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8726 * execute the display list, and restore the CompileFlag.
8728 save_compile_flag
= ctx
->CompileFlag
;
8729 if (save_compile_flag
) {
8730 ctx
->CompileFlag
= GL_FALSE
;
8733 execute_list(ctx
, list
);
8734 ctx
->CompileFlag
= save_compile_flag
;
8736 /* also restore API function pointers to point to "save" versions */
8737 if (save_compile_flag
) {
8738 ctx
->CurrentDispatch
= ctx
->Save
;
8739 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8745 * Execute glCallLists: call multiple display lists.
8748 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8750 GET_CURRENT_CONTEXT(ctx
);
8752 GLboolean save_compile_flag
;
8754 if (MESA_VERBOSE
& VERBOSE_API
)
8755 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8759 case GL_UNSIGNED_BYTE
:
8761 case GL_UNSIGNED_SHORT
:
8763 case GL_UNSIGNED_INT
:
8771 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8775 /* Save the CompileFlag status, turn it off, execute display list,
8776 * and restore the CompileFlag.
8778 save_compile_flag
= ctx
->CompileFlag
;
8779 ctx
->CompileFlag
= GL_FALSE
;
8781 for (i
= 0; i
< n
; i
++) {
8782 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8783 execute_list(ctx
, list
);
8786 ctx
->CompileFlag
= save_compile_flag
;
8788 /* also restore API function pointers to point to "save" versions */
8789 if (save_compile_flag
) {
8790 ctx
->CurrentDispatch
= ctx
->Save
;
8791 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8797 * Set the offset added to list numbers in glCallLists.
8800 _mesa_ListBase(GLuint base
)
8802 GET_CURRENT_CONTEXT(ctx
);
8803 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8804 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8805 ctx
->List
.ListBase
= base
;
8809 * Setup the given dispatch table to point to Mesa's display list
8810 * building functions.
8812 * This does not include any of the tnl functions - they are
8813 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8817 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8819 struct _glapi_table
*table
= ctx
->Save
;
8820 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8822 /* Initially populate the dispatch table with the contents of the
8823 * normal-execution dispatch table. This lets us skip populating functions
8824 * that should be called directly instead of compiled into display lists.
8826 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8828 _mesa_loopback_init_api_table(ctx
, table
);
8831 vbo_initialize_save_dispatch(ctx
, table
);
8834 SET_Accum(table
, save_Accum
);
8835 SET_AlphaFunc(table
, save_AlphaFunc
);
8836 SET_Bitmap(table
, save_Bitmap
);
8837 SET_BlendFunc(table
, save_BlendFunc
);
8838 SET_CallList(table
, save_CallList
);
8839 SET_CallLists(table
, save_CallLists
);
8840 SET_Clear(table
, save_Clear
);
8841 SET_ClearAccum(table
, save_ClearAccum
);
8842 SET_ClearColor(table
, save_ClearColor
);
8843 SET_ClearDepth(table
, save_ClearDepth
);
8844 SET_ClearIndex(table
, save_ClearIndex
);
8845 SET_ClearStencil(table
, save_ClearStencil
);
8846 SET_ClipPlane(table
, save_ClipPlane
);
8847 SET_ColorMask(table
, save_ColorMask
);
8848 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8849 SET_ColorMaterial(table
, save_ColorMaterial
);
8850 SET_CopyPixels(table
, save_CopyPixels
);
8851 SET_CullFace(table
, save_CullFace
);
8852 SET_DepthFunc(table
, save_DepthFunc
);
8853 SET_DepthMask(table
, save_DepthMask
);
8854 SET_DepthRange(table
, save_DepthRange
);
8855 SET_Disable(table
, save_Disable
);
8856 SET_Disablei(table
, save_DisableIndexed
);
8857 SET_DrawBuffer(table
, save_DrawBuffer
);
8858 SET_DrawPixels(table
, save_DrawPixels
);
8859 SET_Enable(table
, save_Enable
);
8860 SET_Enablei(table
, save_EnableIndexed
);
8861 SET_EvalMesh1(table
, save_EvalMesh1
);
8862 SET_EvalMesh2(table
, save_EvalMesh2
);
8863 SET_Fogf(table
, save_Fogf
);
8864 SET_Fogfv(table
, save_Fogfv
);
8865 SET_Fogi(table
, save_Fogi
);
8866 SET_Fogiv(table
, save_Fogiv
);
8867 SET_FrontFace(table
, save_FrontFace
);
8868 SET_Frustum(table
, save_Frustum
);
8869 SET_Hint(table
, save_Hint
);
8870 SET_IndexMask(table
, save_IndexMask
);
8871 SET_InitNames(table
, save_InitNames
);
8872 SET_LightModelf(table
, save_LightModelf
);
8873 SET_LightModelfv(table
, save_LightModelfv
);
8874 SET_LightModeli(table
, save_LightModeli
);
8875 SET_LightModeliv(table
, save_LightModeliv
);
8876 SET_Lightf(table
, save_Lightf
);
8877 SET_Lightfv(table
, save_Lightfv
);
8878 SET_Lighti(table
, save_Lighti
);
8879 SET_Lightiv(table
, save_Lightiv
);
8880 SET_LineStipple(table
, save_LineStipple
);
8881 SET_LineWidth(table
, save_LineWidth
);
8882 SET_ListBase(table
, save_ListBase
);
8883 SET_LoadIdentity(table
, save_LoadIdentity
);
8884 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8885 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8886 SET_LoadName(table
, save_LoadName
);
8887 SET_LogicOp(table
, save_LogicOp
);
8888 SET_Map1d(table
, save_Map1d
);
8889 SET_Map1f(table
, save_Map1f
);
8890 SET_Map2d(table
, save_Map2d
);
8891 SET_Map2f(table
, save_Map2f
);
8892 SET_MapGrid1d(table
, save_MapGrid1d
);
8893 SET_MapGrid1f(table
, save_MapGrid1f
);
8894 SET_MapGrid2d(table
, save_MapGrid2d
);
8895 SET_MapGrid2f(table
, save_MapGrid2f
);
8896 SET_MatrixMode(table
, save_MatrixMode
);
8897 SET_MultMatrixd(table
, save_MultMatrixd
);
8898 SET_MultMatrixf(table
, save_MultMatrixf
);
8899 SET_NewList(table
, save_NewList
);
8900 SET_Ortho(table
, save_Ortho
);
8901 SET_PassThrough(table
, save_PassThrough
);
8902 SET_PixelMapfv(table
, save_PixelMapfv
);
8903 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8904 SET_PixelMapusv(table
, save_PixelMapusv
);
8905 SET_PixelTransferf(table
, save_PixelTransferf
);
8906 SET_PixelTransferi(table
, save_PixelTransferi
);
8907 SET_PixelZoom(table
, save_PixelZoom
);
8908 SET_PointSize(table
, save_PointSize
);
8909 SET_PolygonMode(table
, save_PolygonMode
);
8910 SET_PolygonOffset(table
, save_PolygonOffset
);
8911 SET_PolygonStipple(table
, save_PolygonStipple
);
8912 SET_PopAttrib(table
, save_PopAttrib
);
8913 SET_PopMatrix(table
, save_PopMatrix
);
8914 SET_PopName(table
, save_PopName
);
8915 SET_PushAttrib(table
, save_PushAttrib
);
8916 SET_PushMatrix(table
, save_PushMatrix
);
8917 SET_PushName(table
, save_PushName
);
8918 SET_RasterPos2d(table
, save_RasterPos2d
);
8919 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8920 SET_RasterPos2f(table
, save_RasterPos2f
);
8921 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8922 SET_RasterPos2i(table
, save_RasterPos2i
);
8923 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8924 SET_RasterPos2s(table
, save_RasterPos2s
);
8925 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8926 SET_RasterPos3d(table
, save_RasterPos3d
);
8927 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8928 SET_RasterPos3f(table
, save_RasterPos3f
);
8929 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8930 SET_RasterPos3i(table
, save_RasterPos3i
);
8931 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8932 SET_RasterPos3s(table
, save_RasterPos3s
);
8933 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8934 SET_RasterPos4d(table
, save_RasterPos4d
);
8935 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8936 SET_RasterPos4f(table
, save_RasterPos4f
);
8937 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8938 SET_RasterPos4i(table
, save_RasterPos4i
);
8939 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8940 SET_RasterPos4s(table
, save_RasterPos4s
);
8941 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8942 SET_ReadBuffer(table
, save_ReadBuffer
);
8943 SET_Rectf(table
, save_Rectf
);
8944 SET_Rotated(table
, save_Rotated
);
8945 SET_Rotatef(table
, save_Rotatef
);
8946 SET_Scaled(table
, save_Scaled
);
8947 SET_Scalef(table
, save_Scalef
);
8948 SET_Scissor(table
, save_Scissor
);
8949 SET_ShadeModel(table
, save_ShadeModel
);
8950 SET_StencilFunc(table
, save_StencilFunc
);
8951 SET_StencilMask(table
, save_StencilMask
);
8952 SET_StencilOp(table
, save_StencilOp
);
8953 SET_TexEnvf(table
, save_TexEnvf
);
8954 SET_TexEnvfv(table
, save_TexEnvfv
);
8955 SET_TexEnvi(table
, save_TexEnvi
);
8956 SET_TexEnviv(table
, save_TexEnviv
);
8957 SET_TexGend(table
, save_TexGend
);
8958 SET_TexGendv(table
, save_TexGendv
);
8959 SET_TexGenf(table
, save_TexGenf
);
8960 SET_TexGenfv(table
, save_TexGenfv
);
8961 SET_TexGeni(table
, save_TexGeni
);
8962 SET_TexGeniv(table
, save_TexGeniv
);
8963 SET_TexImage1D(table
, save_TexImage1D
);
8964 SET_TexImage2D(table
, save_TexImage2D
);
8965 SET_TexParameterf(table
, save_TexParameterf
);
8966 SET_TexParameterfv(table
, save_TexParameterfv
);
8967 SET_TexParameteri(table
, save_TexParameteri
);
8968 SET_TexParameteriv(table
, save_TexParameteriv
);
8969 SET_Translated(table
, save_Translated
);
8970 SET_Translatef(table
, save_Translatef
);
8971 SET_Viewport(table
, save_Viewport
);
8974 SET_BindTexture(table
, save_BindTexture
);
8975 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8976 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8977 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8978 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8979 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8980 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8981 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8984 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8985 SET_TexImage3D(table
, save_TexImage3D
);
8986 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8989 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8990 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8991 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8993 /* ATI_separate_stencil */
8994 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8996 /* GL_ARB_imaging */
8997 /* Not all are supported */
8998 SET_BlendColor(table
, save_BlendColor
);
8999 SET_BlendEquation(table
, save_BlendEquation
);
9000 SET_ColorSubTable(table
, save_ColorSubTable
);
9001 SET_ColorTable(table
, save_ColorTable
);
9002 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
9003 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
9004 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
9005 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
9006 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
9007 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
9008 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
9009 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
9010 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
9011 SET_CopyColorTable(table
, save_CopyColorTable
);
9012 SET_Histogram(table
, save_Histogram
);
9013 SET_Minmax(table
, save_Minmax
);
9014 SET_ResetHistogram(table
, save_ResetHistogram
);
9015 SET_ResetMinmax(table
, save_ResetMinmax
);
9017 /* 2. GL_EXT_blend_color */
9019 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9022 /* 3. GL_EXT_polygon_offset */
9023 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9025 /* 6. GL_EXT_texture3d */
9027 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9028 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9029 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9032 /* 14. GL_SGI_color_table */
9034 SET_ColorTableSGI(table
, save_ColorTable
);
9035 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
9038 /* 37. GL_EXT_blend_minmax */
9040 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9043 /* 54. GL_EXT_point_parameters */
9044 SET_PointParameterf(table
, save_PointParameterfEXT
);
9045 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9047 /* 173. GL_EXT_blend_func_separate */
9048 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9050 /* 197. GL_MESA_window_pos */
9051 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9052 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9053 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9054 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9055 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9056 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9057 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9058 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9059 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9060 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9061 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9062 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9063 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9064 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9065 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9066 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9067 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9068 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9069 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9070 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9071 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9072 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9073 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9074 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9076 /* 233. GL_NV_vertex_program */
9077 /* The following commands DO NOT go into display lists:
9078 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9079 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9081 SET_BindProgramARB(table
, save_BindProgramNV
);
9083 /* 244. GL_ATI_envmap_bumpmap */
9084 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9085 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9087 /* 245. GL_ATI_fragment_shader */
9088 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9089 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9091 /* 262. GL_NV_point_sprite */
9092 SET_PointParameteri(table
, save_PointParameteriNV
);
9093 SET_PointParameteriv(table
, save_PointParameterivNV
);
9095 /* 268. GL_EXT_stencil_two_side */
9096 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9098 /* ???. GL_EXT_depth_bounds_test */
9099 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9101 /* ARB 1. GL_ARB_multitexture */
9102 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9104 /* ARB 3. GL_ARB_transpose_matrix */
9105 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9106 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9107 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9108 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9110 /* ARB 5. GL_ARB_multisample */
9111 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9113 /* ARB 12. GL_ARB_texture_compression */
9114 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9115 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9116 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9117 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9118 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9119 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9121 /* ARB 14. GL_ARB_point_parameters */
9122 /* aliased with EXT_point_parameters functions */
9124 /* ARB 25. GL_ARB_window_pos */
9125 /* aliased with MESA_window_pos functions */
9127 /* ARB 26. GL_ARB_vertex_program */
9128 /* ARB 27. GL_ARB_fragment_program */
9129 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9130 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9131 SET_BindProgramARB(table
, save_BindProgramNV
);
9132 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9133 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9134 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9135 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9136 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9137 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9138 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9139 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9141 SET_BeginQuery(table
, save_BeginQueryARB
);
9142 SET_EndQuery(table
, save_EndQueryARB
);
9143 SET_QueryCounter(table
, save_QueryCounter
);
9145 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9147 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9149 SET_UseProgram(table
, save_UseProgramObjectARB
);
9150 SET_Uniform1f(table
, save_Uniform1fARB
);
9151 SET_Uniform2f(table
, save_Uniform2fARB
);
9152 SET_Uniform3f(table
, save_Uniform3fARB
);
9153 SET_Uniform4f(table
, save_Uniform4fARB
);
9154 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9155 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9156 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9157 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9158 SET_Uniform1i(table
, save_Uniform1iARB
);
9159 SET_Uniform2i(table
, save_Uniform2iARB
);
9160 SET_Uniform3i(table
, save_Uniform3iARB
);
9161 SET_Uniform4i(table
, save_Uniform4iARB
);
9162 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9163 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9164 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9165 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9166 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9167 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9168 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9169 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9170 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9171 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9172 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9173 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9174 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9176 /* 299. GL_EXT_blend_equation_separate */
9177 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9179 /* GL_EXT_gpu_program_parameters */
9180 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9181 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9183 /* 364. GL_EXT_provoking_vertex */
9184 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9186 /* GL_EXT_texture_integer */
9187 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9188 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9189 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9190 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9192 /* 377. GL_EXT_separate_shader_objects */
9193 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9194 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9196 /* GL_ARB_color_buffer_float */
9197 SET_ClampColor(table
, save_ClampColorARB
);
9200 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9201 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9202 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9203 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9205 SET_Uniform1ui(table
, save_Uniform1ui
);
9206 SET_Uniform2ui(table
, save_Uniform2ui
);
9207 SET_Uniform3ui(table
, save_Uniform3ui
);
9208 SET_Uniform4ui(table
, save_Uniform4ui
);
9209 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9210 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9211 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9212 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9214 (void) save_Uniform1ui
;
9215 (void) save_Uniform2ui
;
9216 (void) save_Uniform3ui
;
9217 (void) save_Uniform4ui
;
9218 (void) save_Uniform1uiv
;
9219 (void) save_Uniform2uiv
;
9220 (void) save_Uniform3uiv
;
9221 (void) save_Uniform4uiv
;
9225 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9226 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9227 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9228 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9229 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9230 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9231 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9232 SET_DrawTransformFeedbackInstanced(table
,
9233 save_DrawTransformFeedbackInstanced
);
9234 SET_DrawTransformFeedbackStreamInstanced(table
,
9235 save_DrawTransformFeedbackStreamInstanced
);
9236 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9237 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9239 /* GL_ARB_instanced_arrays */
9240 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9242 /* GL_NV_texture_barrier */
9243 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9245 SET_BindSampler(table
, save_BindSampler
);
9246 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9247 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9248 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9249 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9250 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9251 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9253 /* GL_ARB_draw_buffer_blend */
9254 SET_BlendFunciARB(table
, save_BlendFunci
);
9255 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9256 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9257 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9259 /* GL_ARB_geometry_shader4 */
9260 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9261 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9262 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9264 /* GL_NV_conditional_render */
9265 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9266 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9269 SET_WaitSync(table
, save_WaitSync
);
9271 /* GL_ARB_uniform_buffer_object */
9272 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9274 /* GL_ARB_draw_instanced */
9275 SET_DrawArraysInstancedARB(table
, save_DrawArraysInstancedARB
);
9276 SET_DrawElementsInstancedARB(table
, save_DrawElementsInstancedARB
);
9278 /* GL_ARB_draw_elements_base_vertex */
9279 SET_DrawElementsInstancedBaseVertex(table
, save_DrawElementsInstancedBaseVertexARB
);
9281 /* GL_ARB_base_instance */
9282 SET_DrawArraysInstancedBaseInstance(table
, save_DrawArraysInstancedBaseInstance
);
9283 SET_DrawElementsInstancedBaseInstance(table
, save_DrawElementsInstancedBaseInstance
);
9284 SET_DrawElementsInstancedBaseVertexBaseInstance(table
, save_DrawElementsInstancedBaseVertexBaseInstance
);
9290 enum_string(GLenum k
)
9292 return _mesa_lookup_enum_by_nr(k
);
9297 * Print the commands in a display list. For debugging only.
9298 * TODO: many commands aren't handled yet.
9300 static void GLAPIENTRY
9301 print_list(struct gl_context
*ctx
, GLuint list
)
9303 struct gl_display_list
*dlist
;
9307 if (!islist(ctx
, list
)) {
9308 printf("%u is not a display list ID\n", list
);
9312 dlist
= lookup_list(ctx
, list
);
9318 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9320 done
= n
? GL_FALSE
: GL_TRUE
;
9322 const OpCode opcode
= n
[0].opcode
;
9324 if (is_ext_opcode(opcode
)) {
9325 n
+= ext_opcode_print(ctx
, n
);
9330 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9333 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9334 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9336 case OPCODE_CALL_LIST
:
9337 printf("CallList %d\n", (int) n
[1].ui
);
9339 case OPCODE_CALL_LIST_OFFSET
:
9340 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9341 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9343 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9344 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9345 enum_string(n
[1].e
), enum_string(n
[2].e
),
9346 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9348 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9349 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9350 enum_string(n
[1].e
), enum_string(n
[2].e
),
9351 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9353 case OPCODE_DISABLE
:
9354 printf("Disable %s\n", enum_string(n
[1].e
));
9357 printf("Enable %s\n", enum_string(n
[1].e
));
9359 case OPCODE_FRUSTUM
:
9360 printf("Frustum %g %g %g %g %g %g\n",
9361 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9363 case OPCODE_LINE_STIPPLE
:
9364 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9366 case OPCODE_LOAD_IDENTITY
:
9367 printf("LoadIdentity\n");
9369 case OPCODE_LOAD_MATRIX
:
9370 printf("LoadMatrix\n");
9371 printf(" %8f %8f %8f %8f\n",
9372 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9373 printf(" %8f %8f %8f %8f\n",
9374 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9375 printf(" %8f %8f %8f %8f\n",
9376 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9377 printf(" %8f %8f %8f %8f\n",
9378 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9380 case OPCODE_MULT_MATRIX
:
9381 printf("MultMatrix (or Rotate)\n");
9382 printf(" %8f %8f %8f %8f\n",
9383 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9384 printf(" %8f %8f %8f %8f\n",
9385 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9386 printf(" %8f %8f %8f %8f\n",
9387 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9388 printf(" %8f %8f %8f %8f\n",
9389 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9392 printf("Ortho %g %g %g %g %g %g\n",
9393 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9395 case OPCODE_POP_ATTRIB
:
9396 printf("PopAttrib\n");
9398 case OPCODE_POP_MATRIX
:
9399 printf("PopMatrix\n");
9401 case OPCODE_POP_NAME
:
9402 printf("PopName\n");
9404 case OPCODE_PUSH_ATTRIB
:
9405 printf("PushAttrib %x\n", n
[1].bf
);
9407 case OPCODE_PUSH_MATRIX
:
9408 printf("PushMatrix\n");
9410 case OPCODE_PUSH_NAME
:
9411 printf("PushName %d\n", (int) n
[1].ui
);
9413 case OPCODE_RASTER_POS
:
9414 printf("RasterPos %g %g %g %g\n",
9415 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9418 printf("Rotate %g %g %g %g\n",
9419 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9422 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9424 case OPCODE_TRANSLATE
:
9425 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9427 case OPCODE_BIND_TEXTURE
:
9428 printf("BindTexture %s %d\n",
9429 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9431 case OPCODE_SHADE_MODEL
:
9432 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9435 printf("Map1 %s %.3f %.3f %d %d\n",
9436 _mesa_lookup_enum_by_nr(n
[1].ui
),
9437 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9440 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9441 _mesa_lookup_enum_by_nr(n
[1].ui
),
9442 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9443 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9445 case OPCODE_MAPGRID1
:
9446 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9448 case OPCODE_MAPGRID2
:
9449 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9450 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9452 case OPCODE_EVALMESH1
:
9453 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9455 case OPCODE_EVALMESH2
:
9456 printf("EvalMesh2 %d %d %d %d\n",
9457 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9460 case OPCODE_ATTR_1F_NV
:
9461 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9463 case OPCODE_ATTR_2F_NV
:
9464 printf("ATTR_2F_NV attr %d: %f %f\n",
9465 n
[1].i
, n
[2].f
, n
[3].f
);
9467 case OPCODE_ATTR_3F_NV
:
9468 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9469 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9471 case OPCODE_ATTR_4F_NV
:
9472 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9473 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9475 case OPCODE_ATTR_1F_ARB
:
9476 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9478 case OPCODE_ATTR_2F_ARB
:
9479 printf("ATTR_2F_ARB attr %d: %f %f\n",
9480 n
[1].i
, n
[2].f
, n
[3].f
);
9482 case OPCODE_ATTR_3F_ARB
:
9483 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9484 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9486 case OPCODE_ATTR_4F_ARB
:
9487 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9488 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9491 case OPCODE_MATERIAL
:
9492 printf("MATERIAL %x %x: %f %f %f %f\n",
9493 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9496 printf("BEGIN %x\n", n
[1].i
);
9502 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9505 case OPCODE_EVAL_C1
:
9506 printf("EVAL_C1 %f\n", n
[1].f
);
9508 case OPCODE_EVAL_C2
:
9509 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9511 case OPCODE_EVAL_P1
:
9512 printf("EVAL_P1 %d\n", n
[1].i
);
9514 case OPCODE_EVAL_P2
:
9515 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9518 case OPCODE_PROVOKING_VERTEX
:
9519 printf("ProvokingVertex %s\n",
9520 _mesa_lookup_enum_by_nr(n
[1].ui
));
9524 * meta opcodes/commands
9527 printf("Error: %s %s\n",
9528 enum_string(n
[1].e
), (const char *) n
[2].data
);
9530 case OPCODE_CONTINUE
:
9531 printf("DISPLAY-LIST-CONTINUE\n");
9532 n
= (Node
*) n
[1].next
;
9534 case OPCODE_END_OF_LIST
:
9535 printf("END-LIST %u\n", list
);
9539 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9541 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9542 opcode
, (void *) n
);
9546 printf("command %d, %u operands\n", opcode
,
9550 /* increment n to point to next compiled command */
9551 if (opcode
!= OPCODE_CONTINUE
) {
9552 n
+= InstSize
[opcode
];
9561 * Clients may call this function to help debug display list problems.
9562 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9563 * changed, or break in the future without notice.
9566 mesa_print_display_list(GLuint list
)
9568 GET_CURRENT_CONTEXT(ctx
);
9569 print_list(ctx
, list
);
9573 /**********************************************************************/
9574 /***** Initialization *****/
9575 /**********************************************************************/
9578 save_vtxfmt_init(GLvertexformat
* vfmt
)
9580 vfmt
->ArrayElement
= _ae_ArrayElement
;
9582 vfmt
->Begin
= save_Begin
;
9584 vfmt
->CallList
= save_CallList
;
9585 vfmt
->CallLists
= save_CallLists
;
9587 vfmt
->Color3f
= save_Color3f
;
9588 vfmt
->Color3fv
= save_Color3fv
;
9589 vfmt
->Color4f
= save_Color4f
;
9590 vfmt
->Color4fv
= save_Color4fv
;
9591 vfmt
->EdgeFlag
= save_EdgeFlag
;
9592 vfmt
->End
= save_End
;
9594 vfmt
->EvalCoord1f
= save_EvalCoord1f
;
9595 vfmt
->EvalCoord1fv
= save_EvalCoord1fv
;
9596 vfmt
->EvalCoord2f
= save_EvalCoord2f
;
9597 vfmt
->EvalCoord2fv
= save_EvalCoord2fv
;
9598 vfmt
->EvalPoint1
= save_EvalPoint1
;
9599 vfmt
->EvalPoint2
= save_EvalPoint2
;
9601 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9602 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9603 vfmt
->Indexf
= save_Indexf
;
9604 vfmt
->Indexfv
= save_Indexfv
;
9605 vfmt
->Materialfv
= save_Materialfv
;
9606 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9607 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9608 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9609 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9610 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9611 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9612 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9613 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9614 vfmt
->Normal3f
= save_Normal3f
;
9615 vfmt
->Normal3fv
= save_Normal3fv
;
9616 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9617 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9618 vfmt
->TexCoord1f
= save_TexCoord1f
;
9619 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9620 vfmt
->TexCoord2f
= save_TexCoord2f
;
9621 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9622 vfmt
->TexCoord3f
= save_TexCoord3f
;
9623 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9624 vfmt
->TexCoord4f
= save_TexCoord4f
;
9625 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9626 vfmt
->Vertex2f
= save_Vertex2f
;
9627 vfmt
->Vertex2fv
= save_Vertex2fv
;
9628 vfmt
->Vertex3f
= save_Vertex3f
;
9629 vfmt
->Vertex3fv
= save_Vertex3fv
;
9630 vfmt
->Vertex4f
= save_Vertex4f
;
9631 vfmt
->Vertex4fv
= save_Vertex4fv
;
9632 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9633 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9634 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9635 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9636 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9637 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9638 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9639 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9644 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9645 const GLvertexformat
*vfmt
)
9647 SET_CallList(disp
, vfmt
->CallList
);
9648 SET_CallLists(disp
, vfmt
->CallLists
);
9653 * Initialize display list state for given context.
9656 _mesa_init_display_list(struct gl_context
*ctx
)
9658 static GLboolean tableInitialized
= GL_FALSE
;
9660 /* zero-out the instruction size table, just once */
9661 if (!tableInitialized
) {
9662 memset(InstSize
, 0, sizeof(InstSize
));
9663 tableInitialized
= GL_TRUE
;
9666 /* extension info */
9667 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9670 ctx
->ListState
.CallDepth
= 0;
9671 ctx
->ExecuteFlag
= GL_TRUE
;
9672 ctx
->CompileFlag
= GL_FALSE
;
9673 ctx
->ListState
.CurrentBlock
= NULL
;
9674 ctx
->ListState
.CurrentPos
= 0;
9676 /* Display List group */
9677 ctx
->List
.ListBase
= 0;
9679 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9684 _mesa_free_display_list_data(struct gl_context
*ctx
)
9687 ctx
->ListExt
= NULL
;