2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
30 * Display lists management functions.
35 #include "api_arrayelt.h"
37 #include "api_loopback.h"
38 #include "api_validate.h"
39 #include "atifragshader.h"
41 #include "bufferobj.h"
48 #include "framebuffer.h"
49 #include "glapi/glapi.h"
50 #include "glformats.h"
58 #include "samplerobj.h"
59 #include "shaderapi.h"
62 #include "texstorage.h"
65 #include "arbprogram.h"
66 #include "transformfeedback.h"
68 #include "math/m_matrix.h"
70 #include "main/dispatch.h"
75 * Other parts of Mesa (such as the VBO module) can plug into the display
76 * list system. This structure describes new display list instructions.
78 struct gl_list_instruction
81 void (*Execute
)( struct gl_context
*ctx
, void *data
);
82 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
83 void (*Print
)( struct gl_context
*ctx
, void *data
);
87 #define MAX_DLIST_EXT_OPCODES 16
90 * Used by device drivers to hook new commands into display lists.
92 struct gl_list_extensions
94 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
103 * \param ctx GL context.
105 * Checks if dd_function_table::SaveNeedFlush is marked to flush
106 * stored (save) vertices, and calls
107 * dd_function_table::SaveFlushVertices if so.
109 #define SAVE_FLUSH_VERTICES(ctx) \
111 if (ctx->Driver.SaveNeedFlush) \
112 ctx->Driver.SaveFlushVertices(ctx); \
117 * Macro to assert that the API call was made outside the
118 * glBegin()/glEnd() pair, with return value.
120 * \param ctx GL context.
121 * \param retval value to return value in case the assertion fails.
123 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
125 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
126 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
132 * Macro to assert that the API call was made outside the
133 * glBegin()/glEnd() pair.
135 * \param ctx GL context.
137 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
139 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
140 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
146 * Macro to assert that the API call was made outside the
147 * glBegin()/glEnd() pair and flush the vertices.
149 * \param ctx GL context.
151 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
153 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
154 SAVE_FLUSH_VERTICES(ctx); \
158 * Macro to assert that the API call was made outside the
159 * glBegin()/glEnd() pair and flush the vertices, with return value.
161 * \param ctx GL context.
162 * \param retval value to return value in case the assertion fails.
164 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
166 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
167 SAVE_FLUSH_VERTICES(ctx); \
173 * Display list opcodes.
175 * The fact that these identifiers are assigned consecutive
176 * integer values starting at 0 is very important, see InstSize array usage)
180 OPCODE_INVALID
= -1, /* Force signed enum */
186 OPCODE_BLEND_EQUATION
,
187 OPCODE_BLEND_EQUATION_SEPARATE
,
188 OPCODE_BLEND_FUNC_SEPARATE
,
190 OPCODE_BLEND_EQUATION_I
,
191 OPCODE_BLEND_EQUATION_SEPARATE_I
,
193 OPCODE_BLEND_FUNC_SEPARATE_I
,
196 OPCODE_CALL_LIST_OFFSET
,
202 OPCODE_CLEAR_STENCIL
,
203 OPCODE_CLEAR_BUFFER_IV
,
204 OPCODE_CLEAR_BUFFER_UIV
,
205 OPCODE_CLEAR_BUFFER_FV
,
206 OPCODE_CLEAR_BUFFER_FI
,
209 OPCODE_COLOR_MASK_INDEXED
,
210 OPCODE_COLOR_MATERIAL
,
212 OPCODE_COLOR_TABLE_PARAMETER_FV
,
213 OPCODE_COLOR_TABLE_PARAMETER_IV
,
214 OPCODE_COLOR_SUB_TABLE
,
215 OPCODE_CONVOLUTION_FILTER_1D
,
216 OPCODE_CONVOLUTION_FILTER_2D
,
217 OPCODE_CONVOLUTION_PARAMETER_I
,
218 OPCODE_CONVOLUTION_PARAMETER_IV
,
219 OPCODE_CONVOLUTION_PARAMETER_F
,
220 OPCODE_CONVOLUTION_PARAMETER_FV
,
221 OPCODE_COPY_COLOR_SUB_TABLE
,
222 OPCODE_COPY_COLOR_TABLE
,
224 OPCODE_COPY_TEX_IMAGE1D
,
225 OPCODE_COPY_TEX_IMAGE2D
,
226 OPCODE_COPY_TEX_SUB_IMAGE1D
,
227 OPCODE_COPY_TEX_SUB_IMAGE2D
,
228 OPCODE_COPY_TEX_SUB_IMAGE3D
,
234 OPCODE_DISABLE_INDEXED
,
238 OPCODE_ENABLE_INDEXED
,
253 OPCODE_LOAD_IDENTITY
,
267 OPCODE_PIXEL_TRANSFER
,
270 OPCODE_POINT_PARAMETERS
,
272 OPCODE_POLYGON_STIPPLE
,
273 OPCODE_POLYGON_OFFSET
,
277 OPCODE_PRIORITIZE_TEXTURE
,
283 OPCODE_RESET_HISTOGRAM
,
284 OPCODE_RESET_MIN_MAX
,
288 OPCODE_SELECT_TEXTURE_SGIS
,
289 OPCODE_SELECT_TEXTURE_COORD_SET
,
300 OPCODE_TEX_SUB_IMAGE1D
,
301 OPCODE_TEX_SUB_IMAGE2D
,
302 OPCODE_TEX_SUB_IMAGE3D
,
306 /* GL_ARB_multitexture */
307 OPCODE_ACTIVE_TEXTURE
,
308 /* GL_ARB_texture_compression */
309 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
310 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
311 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
312 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
313 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
314 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
315 /* GL_ARB_multisample */
316 OPCODE_SAMPLE_COVERAGE
,
317 /* GL_ARB_window_pos */
318 OPCODE_WINDOW_POS_ARB
,
319 /* GL_NV_fragment_program */
320 OPCODE_BIND_PROGRAM_NV
,
321 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
322 /* GL_EXT_stencil_two_side */
323 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
324 /* GL_EXT_depth_bounds_test */
325 OPCODE_DEPTH_BOUNDS_EXT
,
326 /* GL_ARB_vertex/fragment_program */
327 OPCODE_PROGRAM_STRING_ARB
,
328 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
329 /* GL_ARB_occlusion_query */
330 OPCODE_BEGIN_QUERY_ARB
,
331 OPCODE_END_QUERY_ARB
,
332 /* GL_ARB_draw_buffers */
333 OPCODE_DRAW_BUFFERS_ARB
,
334 /* GL_ATI_fragment_shader */
335 OPCODE_TEX_BUMP_PARAMETER_ATI
,
336 /* GL_ATI_fragment_shader */
337 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
338 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
340 OPCODE_STENCIL_FUNC_SEPARATE
,
341 OPCODE_STENCIL_OP_SEPARATE
,
342 OPCODE_STENCIL_MASK_SEPARATE
,
344 /* GL_ARB_shader_objects */
362 OPCODE_UNIFORM_MATRIX22
,
363 OPCODE_UNIFORM_MATRIX33
,
364 OPCODE_UNIFORM_MATRIX44
,
365 OPCODE_UNIFORM_MATRIX23
,
366 OPCODE_UNIFORM_MATRIX32
,
367 OPCODE_UNIFORM_MATRIX24
,
368 OPCODE_UNIFORM_MATRIX42
,
369 OPCODE_UNIFORM_MATRIX34
,
370 OPCODE_UNIFORM_MATRIX43
,
382 /* GL_ARB_color_buffer_float */
385 /* GL_EXT_framebuffer_blit */
386 OPCODE_BLIT_FRAMEBUFFER
,
388 /* Vertex attributes -- fallback for when optimized display
389 * list build isn't active.
408 /* GL_EXT_provoking_vertex */
409 OPCODE_PROVOKING_VERTEX
,
411 /* GL_EXT_transform_feedback */
412 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
413 OPCODE_END_TRANSFORM_FEEDBACK
,
414 OPCODE_BIND_TRANSFORM_FEEDBACK
,
415 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
416 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
417 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
419 /* GL_EXT_texture_integer */
421 OPCODE_CLEARCOLOR_UI
,
422 OPCODE_TEXPARAMETER_I
,
423 OPCODE_TEXPARAMETER_UI
,
425 /* GL_EXT_separate_shader_objects */
426 OPCODE_ACTIVE_PROGRAM_EXT
,
427 OPCODE_USE_SHADER_PROGRAM_EXT
,
429 /* GL_ARB_instanced_arrays */
430 OPCODE_VERTEX_ATTRIB_DIVISOR
,
432 /* GL_NV_texture_barrier */
433 OPCODE_TEXTURE_BARRIER_NV
,
435 /* GL_ARB_sampler_object */
437 OPCODE_SAMPLER_PARAMETERIV
,
438 OPCODE_SAMPLER_PARAMETERFV
,
439 OPCODE_SAMPLER_PARAMETERIIV
,
440 OPCODE_SAMPLER_PARAMETERUIV
,
442 /* GL_ARB_geometry_shader4 */
443 OPCODE_PROGRAM_PARAMETERI
,
444 OPCODE_FRAMEBUFFER_TEXTURE
,
445 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
450 /* GL_NV_conditional_render */
451 OPCODE_BEGIN_CONDITIONAL_RENDER
,
452 OPCODE_END_CONDITIONAL_RENDER
,
454 /* ARB_timer_query */
455 OPCODE_QUERY_COUNTER
,
457 /* ARB_transform_feedback3 */
458 OPCODE_BEGIN_QUERY_INDEXED
,
459 OPCODE_END_QUERY_INDEXED
,
460 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
462 /* ARB_transform_feedback_instanced */
463 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
464 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
466 /* ARB_uniform_buffer_object */
467 OPCODE_UNIFORM_BLOCK_BINDING
,
469 /* The following three are meta instructions */
470 OPCODE_ERROR
, /* raise compiled-in error */
481 * Display list instructions are stored as sequences of "nodes". Nodes
482 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
483 * are linked together with a pointer.
485 * Each instruction in the display list is stored as a sequence of
486 * contiguous nodes in memory.
487 * Each node is the union of a variety of data types.
503 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
507 typedef union gl_dlist_node Node
;
511 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
512 * environment. In 64-bit env, sizeof(Node)==8 anyway.
522 * How many nodes to allocate at a time.
524 * \note Reduced now that we hold vertices etc. elsewhere.
526 #define BLOCK_SIZE 256
531 * Number of nodes of storage needed for each instruction.
532 * Sizes for dynamically allocated opcodes are stored in the context struct.
534 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
537 void mesa_print_display_list(GLuint list
);
540 /**********************************************************************/
541 /***** Private *****/
542 /**********************************************************************/
546 * Make an empty display list. This is used by glGenLists() to
547 * reserve display list IDs.
549 static struct gl_display_list
*
550 make_list(GLuint name
, GLuint count
)
552 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
554 dlist
->Head
= malloc(sizeof(Node
) * count
);
555 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
561 * Lookup function to just encapsulate casting.
563 static inline struct gl_display_list
*
564 lookup_list(struct gl_context
*ctx
, GLuint list
)
566 return (struct gl_display_list
*)
567 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
571 /** Is the given opcode an extension code? */
572 static inline GLboolean
573 is_ext_opcode(OpCode opcode
)
575 return (opcode
>= OPCODE_EXT_0
);
579 /** Destroy an extended opcode instruction */
581 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
583 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
585 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
586 step
= ctx
->ListExt
->Opcode
[i
].Size
;
591 /** Execute an extended opcode instruction */
593 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
595 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
597 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
598 step
= ctx
->ListExt
->Opcode
[i
].Size
;
603 /** Print an extended opcode instruction */
605 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
607 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
609 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
610 step
= ctx
->ListExt
->Opcode
[i
].Size
;
616 * Delete the named display list, but don't remove from hash table.
617 * \param dlist - display list pointer
620 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
625 n
= block
= dlist
->Head
;
627 done
= block
? GL_FALSE
: GL_TRUE
;
629 const OpCode opcode
= n
[0].opcode
;
631 /* check for extension opcodes first */
632 if (is_ext_opcode(opcode
)) {
633 n
+= ext_opcode_destroy(ctx
, n
);
637 /* for some commands, we need to free malloc'd memory */
640 n
+= InstSize
[n
[0].opcode
];
644 n
+= InstSize
[n
[0].opcode
];
646 case OPCODE_DRAW_PIXELS
:
648 n
+= InstSize
[n
[0].opcode
];
652 n
+= InstSize
[n
[0].opcode
];
654 case OPCODE_COLOR_TABLE
:
656 n
+= InstSize
[n
[0].opcode
];
658 case OPCODE_COLOR_SUB_TABLE
:
660 n
+= InstSize
[n
[0].opcode
];
662 case OPCODE_CONVOLUTION_FILTER_1D
:
664 n
+= InstSize
[n
[0].opcode
];
666 case OPCODE_CONVOLUTION_FILTER_2D
:
668 n
+= InstSize
[n
[0].opcode
];
670 case OPCODE_POLYGON_STIPPLE
:
672 n
+= InstSize
[n
[0].opcode
];
674 case OPCODE_TEX_IMAGE1D
:
676 n
+= InstSize
[n
[0].opcode
];
678 case OPCODE_TEX_IMAGE2D
:
680 n
+= InstSize
[n
[0].opcode
];
682 case OPCODE_TEX_IMAGE3D
:
684 n
+= InstSize
[n
[0].opcode
];
686 case OPCODE_TEX_SUB_IMAGE1D
:
688 n
+= InstSize
[n
[0].opcode
];
690 case OPCODE_TEX_SUB_IMAGE2D
:
692 n
+= InstSize
[n
[0].opcode
];
694 case OPCODE_TEX_SUB_IMAGE3D
:
696 n
+= InstSize
[n
[0].opcode
];
698 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
700 n
+= InstSize
[n
[0].opcode
];
702 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
704 n
+= InstSize
[n
[0].opcode
];
706 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
708 n
+= InstSize
[n
[0].opcode
];
710 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
712 n
+= InstSize
[n
[0].opcode
];
714 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
716 n
+= InstSize
[n
[0].opcode
];
718 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
720 n
+= InstSize
[n
[0].opcode
];
722 case OPCODE_PROGRAM_STRING_ARB
:
723 free(n
[4].data
); /* program string */
724 n
+= InstSize
[n
[0].opcode
];
726 case OPCODE_UNIFORM_1FV
:
727 case OPCODE_UNIFORM_2FV
:
728 case OPCODE_UNIFORM_3FV
:
729 case OPCODE_UNIFORM_4FV
:
730 case OPCODE_UNIFORM_1IV
:
731 case OPCODE_UNIFORM_2IV
:
732 case OPCODE_UNIFORM_3IV
:
733 case OPCODE_UNIFORM_4IV
:
734 case OPCODE_UNIFORM_1UIV
:
735 case OPCODE_UNIFORM_2UIV
:
736 case OPCODE_UNIFORM_3UIV
:
737 case OPCODE_UNIFORM_4UIV
:
739 n
+= InstSize
[n
[0].opcode
];
741 case OPCODE_UNIFORM_MATRIX22
:
742 case OPCODE_UNIFORM_MATRIX33
:
743 case OPCODE_UNIFORM_MATRIX44
:
744 case OPCODE_UNIFORM_MATRIX24
:
745 case OPCODE_UNIFORM_MATRIX42
:
746 case OPCODE_UNIFORM_MATRIX23
:
747 case OPCODE_UNIFORM_MATRIX32
:
748 case OPCODE_UNIFORM_MATRIX34
:
749 case OPCODE_UNIFORM_MATRIX43
:
751 n
+= InstSize
[n
[0].opcode
];
754 case OPCODE_CONTINUE
:
755 n
= (Node
*) n
[1].next
;
759 case OPCODE_END_OF_LIST
:
764 /* Most frequent case */
765 n
+= InstSize
[n
[0].opcode
];
776 * Destroy a display list and remove from hash table.
777 * \param list - display list number
780 destroy_list(struct gl_context
*ctx
, GLuint list
)
782 struct gl_display_list
*dlist
;
787 dlist
= lookup_list(ctx
, list
);
791 _mesa_delete_list(ctx
, dlist
);
792 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
797 * Translate the nth element of list from <type> to GLint.
800 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
812 bptr
= (GLbyte
*) list
;
813 return (GLint
) bptr
[n
];
814 case GL_UNSIGNED_BYTE
:
815 ubptr
= (GLubyte
*) list
;
816 return (GLint
) ubptr
[n
];
818 sptr
= (GLshort
*) list
;
819 return (GLint
) sptr
[n
];
820 case GL_UNSIGNED_SHORT
:
821 usptr
= (GLushort
*) list
;
822 return (GLint
) usptr
[n
];
824 iptr
= (GLint
*) list
;
826 case GL_UNSIGNED_INT
:
827 uiptr
= (GLuint
*) list
;
828 return (GLint
) uiptr
[n
];
830 fptr
= (GLfloat
*) list
;
831 return (GLint
) FLOORF(fptr
[n
]);
833 ubptr
= ((GLubyte
*) list
) + 2 * n
;
834 return (GLint
) ubptr
[0] * 256
837 ubptr
= ((GLubyte
*) list
) + 3 * n
;
838 return (GLint
) ubptr
[0] * 65536
839 + (GLint
) ubptr
[1] * 256
842 ubptr
= ((GLubyte
*) list
) + 4 * n
;
843 return (GLint
) ubptr
[0] * 16777216
844 + (GLint
) ubptr
[1] * 65536
845 + (GLint
) ubptr
[2] * 256
855 /**********************************************************************/
857 /**********************************************************************/
860 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
861 * If width < 0 or height < 0 or format or type are invalid we'll just
862 * return NULL. We will not generate an error since OpenGL command
863 * arguments aren't error-checked until the command is actually executed
864 * (not when they're compiled).
865 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
868 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
869 GLsizei width
, GLsizei height
, GLsizei depth
,
870 GLenum format
, GLenum type
, const GLvoid
* pixels
,
871 const struct gl_pixelstore_attrib
*unpack
)
873 if (width
<= 0 || height
<= 0) {
877 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
878 /* bad format and/or type */
882 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
886 if (type
== GL_BITMAP
)
887 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
889 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
890 format
, type
, pixels
, unpack
);
891 if (pixels
&& !image
) {
892 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
896 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
897 depth
, format
, type
, INT_MAX
, pixels
)) {
898 const GLubyte
*map
, *src
;
902 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
903 GL_MAP_READ_BIT
, unpack
->BufferObj
);
905 /* unable to map src buffer! */
906 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
910 src
= ADD_POINTERS(map
, pixels
);
911 if (type
== GL_BITMAP
)
912 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
914 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
915 format
, type
, src
, unpack
);
917 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
920 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
926 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
931 * Allocate space for a display list instruction (opcode + payload space).
932 * \param opcode the instruction opcode (OPCODE_* value)
933 * \param bytes instruction payload size (not counting opcode)
934 * \return pointer to allocated memory (the opcode space)
937 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
939 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
942 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
943 if (InstSize
[opcode
] == 0) {
944 /* save instruction size now */
945 InstSize
[opcode
] = numNodes
;
948 /* make sure instruction size agrees */
949 ASSERT(numNodes
== InstSize
[opcode
]);
953 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
954 /* This block is full. Allocate a new block and chain to it */
956 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
957 n
[0].opcode
= OPCODE_CONTINUE
;
958 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
960 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
963 n
[1].next
= (Node
*) newblock
;
964 ctx
->ListState
.CurrentBlock
= newblock
;
965 ctx
->ListState
.CurrentPos
= 0;
968 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
969 ctx
->ListState
.CurrentPos
+= numNodes
;
971 n
[0].opcode
= opcode
;
979 * Allocate space for a display list instruction. Used by callers outside
980 * this file for things like VBO vertex data.
982 * \param opcode the instruction opcode (OPCODE_* value)
983 * \param bytes instruction size in bytes, not counting opcode.
984 * \return pointer to the usable data area (not including the internal
988 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
990 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
992 return n
+ 1; /* return pointer to payload area, after opcode */
999 * This function allows modules and drivers to get their own opcodes
1000 * for extending display list functionality.
1001 * \param ctx the rendering context
1002 * \param size number of bytes for storing the new display list command
1003 * \param execute function to execute the new display list command
1004 * \param destroy function to destroy the new display list command
1005 * \param print function to print the new display list command
1006 * \return the new opcode number or -1 if error
1009 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1011 void (*execute
) (struct gl_context
*, void *),
1012 void (*destroy
) (struct gl_context
*, void *),
1013 void (*print
) (struct gl_context
*, void *))
1015 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1016 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1017 ctx
->ListExt
->Opcode
[i
].Size
=
1018 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1019 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1020 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1021 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1022 return i
+ OPCODE_EXT_0
;
1029 * Allocate space for a display list instruction. The space is basically
1030 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1031 * function parameter, node[2] is the second parameter, etc.
1033 * \param opcode one of OPCODE_x
1034 * \param nparams number of function parameters
1035 * \return pointer to start of instruction space
1037 static inline Node
*
1038 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1040 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1046 * Display List compilation functions
1048 static void GLAPIENTRY
1049 save_Accum(GLenum op
, GLfloat value
)
1051 GET_CURRENT_CONTEXT(ctx
);
1053 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1054 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1059 if (ctx
->ExecuteFlag
) {
1060 CALL_Accum(ctx
->Exec
, (op
, value
));
1065 static void GLAPIENTRY
1066 save_AlphaFunc(GLenum func
, GLclampf ref
)
1068 GET_CURRENT_CONTEXT(ctx
);
1070 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1071 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1074 n
[2].f
= (GLfloat
) ref
;
1076 if (ctx
->ExecuteFlag
) {
1077 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1082 static void GLAPIENTRY
1083 save_BindTexture(GLenum target
, GLuint texture
)
1085 GET_CURRENT_CONTEXT(ctx
);
1087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1088 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1093 if (ctx
->ExecuteFlag
) {
1094 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1099 static void GLAPIENTRY
1100 save_Bitmap(GLsizei width
, GLsizei height
,
1101 GLfloat xorig
, GLfloat yorig
,
1102 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1104 GET_CURRENT_CONTEXT(ctx
);
1106 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1107 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1109 n
[1].i
= (GLint
) width
;
1110 n
[2].i
= (GLint
) height
;
1115 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1116 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1118 if (ctx
->ExecuteFlag
) {
1119 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1120 xorig
, yorig
, xmove
, ymove
, pixels
));
1125 static void GLAPIENTRY
1126 save_BlendEquation(GLenum mode
)
1128 GET_CURRENT_CONTEXT(ctx
);
1130 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1131 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1135 if (ctx
->ExecuteFlag
) {
1136 CALL_BlendEquation(ctx
->Exec
, (mode
));
1141 static void GLAPIENTRY
1142 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1144 GET_CURRENT_CONTEXT(ctx
);
1146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1147 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1152 if (ctx
->ExecuteFlag
) {
1153 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1158 static void GLAPIENTRY
1159 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1160 GLenum sfactorA
, GLenum dfactorA
)
1162 GET_CURRENT_CONTEXT(ctx
);
1164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1165 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1167 n
[1].e
= sfactorRGB
;
1168 n
[2].e
= dfactorRGB
;
1172 if (ctx
->ExecuteFlag
) {
1173 CALL_BlendFuncSeparate(ctx
->Exec
,
1174 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1179 static void GLAPIENTRY
1180 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1182 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1186 static void GLAPIENTRY
1187 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1189 GET_CURRENT_CONTEXT(ctx
);
1191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1192 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1199 if (ctx
->ExecuteFlag
) {
1200 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1204 /* GL_ARB_draw_buffers_blend */
1205 static void GLAPIENTRY
1206 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1207 GLenum sfactorA
, GLenum dfactorA
)
1209 GET_CURRENT_CONTEXT(ctx
);
1211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1212 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1215 n
[2].e
= sfactorRGB
;
1216 n
[3].e
= dfactorRGB
;
1220 if (ctx
->ExecuteFlag
) {
1221 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1222 sfactorA
, dfactorA
));
1226 /* GL_ARB_draw_buffers_blend */
1227 static void GLAPIENTRY
1228 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1230 GET_CURRENT_CONTEXT(ctx
);
1232 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1233 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1239 if (ctx
->ExecuteFlag
) {
1240 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1244 /* GL_ARB_draw_buffers_blend */
1245 static void GLAPIENTRY
1246 save_BlendEquationi(GLuint buf
, GLenum mode
)
1248 GET_CURRENT_CONTEXT(ctx
);
1250 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1251 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1256 if (ctx
->ExecuteFlag
) {
1257 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1261 /* GL_ARB_draw_buffers_blend */
1262 static void GLAPIENTRY
1263 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1265 GET_CURRENT_CONTEXT(ctx
);
1267 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1268 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1274 if (ctx
->ExecuteFlag
) {
1275 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1280 /* GL_ARB_draw_instanced. */
1281 static void GLAPIENTRY
1282 save_DrawArraysInstancedARB(GLenum mode
,
1287 GET_CURRENT_CONTEXT(ctx
);
1288 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1289 "glDrawArraysInstanced() during display list compile");
1292 static void GLAPIENTRY
1293 save_DrawElementsInstancedARB(GLenum mode
,
1296 const GLvoid
*indices
,
1299 GET_CURRENT_CONTEXT(ctx
);
1300 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1301 "glDrawElementsInstanced() during display list compile");
1304 static void GLAPIENTRY
1305 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1308 const GLvoid
*indices
,
1312 GET_CURRENT_CONTEXT(ctx
);
1313 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1314 "glDrawElementsInstancedBaseVertex() during display list compile");
1317 /* GL_ARB_base_instance. */
1318 static void GLAPIENTRY
1319 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1323 GLuint baseinstance
)
1325 GET_CURRENT_CONTEXT(ctx
);
1326 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1327 "glDrawArraysInstancedBaseInstance() during display list compile");
1330 static void APIENTRY
1331 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1334 const void *indices
,
1336 GLuint baseinstance
)
1338 GET_CURRENT_CONTEXT(ctx
);
1339 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1340 "glDrawElementsInstancedBaseInstance() during display list compile");
1343 static void APIENTRY
1344 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1347 const void *indices
,
1350 GLuint baseinstance
)
1352 GET_CURRENT_CONTEXT(ctx
);
1353 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1354 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1359 * While building a display list we cache some OpenGL state.
1360 * Under some circumstances we need to invalidate that state (immediately
1361 * when we start compiling a list, or after glCallList(s)).
1364 invalidate_saved_current_state(struct gl_context
*ctx
)
1368 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1369 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1371 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1372 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1374 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1376 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1380 static void GLAPIENTRY
1381 save_CallList(GLuint list
)
1383 GET_CURRENT_CONTEXT(ctx
);
1385 SAVE_FLUSH_VERTICES(ctx
);
1387 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1392 /* After this, we don't know what state we're in. Invalidate all
1393 * cached information previously gathered:
1395 invalidate_saved_current_state( ctx
);
1397 if (ctx
->ExecuteFlag
) {
1398 _mesa_CallList(list
);
1403 static void GLAPIENTRY
1404 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1406 GET_CURRENT_CONTEXT(ctx
);
1408 GLboolean typeErrorFlag
;
1410 SAVE_FLUSH_VERTICES(ctx
);
1414 case GL_UNSIGNED_BYTE
:
1416 case GL_UNSIGNED_SHORT
:
1418 case GL_UNSIGNED_INT
:
1423 typeErrorFlag
= GL_FALSE
;
1426 typeErrorFlag
= GL_TRUE
;
1429 for (i
= 0; i
< num
; i
++) {
1430 GLint list
= translate_id(i
, type
, lists
);
1431 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1434 n
[2].b
= typeErrorFlag
;
1438 /* After this, we don't know what state we're in. Invalidate all
1439 * cached information previously gathered:
1441 invalidate_saved_current_state( ctx
);
1443 if (ctx
->ExecuteFlag
) {
1444 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1449 static void GLAPIENTRY
1450 save_Clear(GLbitfield mask
)
1452 GET_CURRENT_CONTEXT(ctx
);
1454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1455 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1459 if (ctx
->ExecuteFlag
) {
1460 CALL_Clear(ctx
->Exec
, (mask
));
1465 static void GLAPIENTRY
1466 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1468 GET_CURRENT_CONTEXT(ctx
);
1470 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1471 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1474 n
[2].i
= drawbuffer
;
1476 if (buffer
== GL_COLOR
) {
1487 if (ctx
->ExecuteFlag
) {
1488 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1493 static void GLAPIENTRY
1494 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1496 GET_CURRENT_CONTEXT(ctx
);
1498 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1499 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1502 n
[2].i
= drawbuffer
;
1504 if (buffer
== GL_COLOR
) {
1515 if (ctx
->ExecuteFlag
) {
1516 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1521 static void GLAPIENTRY
1522 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1524 GET_CURRENT_CONTEXT(ctx
);
1526 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1527 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1530 n
[2].i
= drawbuffer
;
1532 if (buffer
== GL_COLOR
) {
1543 if (ctx
->ExecuteFlag
) {
1544 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1549 static void GLAPIENTRY
1550 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1551 GLfloat depth
, GLint stencil
)
1553 GET_CURRENT_CONTEXT(ctx
);
1555 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1556 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1559 n
[2].i
= drawbuffer
;
1563 if (ctx
->ExecuteFlag
) {
1564 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1569 static void GLAPIENTRY
1570 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1572 GET_CURRENT_CONTEXT(ctx
);
1574 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1575 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1582 if (ctx
->ExecuteFlag
) {
1583 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1588 static void GLAPIENTRY
1589 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1591 GET_CURRENT_CONTEXT(ctx
);
1593 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1594 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1601 if (ctx
->ExecuteFlag
) {
1602 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1607 static void GLAPIENTRY
1608 save_ClearDepth(GLclampd depth
)
1610 GET_CURRENT_CONTEXT(ctx
);
1612 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1613 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1615 n
[1].f
= (GLfloat
) depth
;
1617 if (ctx
->ExecuteFlag
) {
1618 CALL_ClearDepth(ctx
->Exec
, (depth
));
1623 static void GLAPIENTRY
1624 save_ClearIndex(GLfloat c
)
1626 GET_CURRENT_CONTEXT(ctx
);
1628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1629 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1633 if (ctx
->ExecuteFlag
) {
1634 CALL_ClearIndex(ctx
->Exec
, (c
));
1639 static void GLAPIENTRY
1640 save_ClearStencil(GLint s
)
1642 GET_CURRENT_CONTEXT(ctx
);
1644 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1645 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1649 if (ctx
->ExecuteFlag
) {
1650 CALL_ClearStencil(ctx
->Exec
, (s
));
1655 static void GLAPIENTRY
1656 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1658 GET_CURRENT_CONTEXT(ctx
);
1660 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1661 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1664 n
[2].f
= (GLfloat
) equ
[0];
1665 n
[3].f
= (GLfloat
) equ
[1];
1666 n
[4].f
= (GLfloat
) equ
[2];
1667 n
[5].f
= (GLfloat
) equ
[3];
1669 if (ctx
->ExecuteFlag
) {
1670 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1676 static void GLAPIENTRY
1677 save_ColorMask(GLboolean red
, GLboolean green
,
1678 GLboolean blue
, GLboolean alpha
)
1680 GET_CURRENT_CONTEXT(ctx
);
1682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1683 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1690 if (ctx
->ExecuteFlag
) {
1691 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1696 static void GLAPIENTRY
1697 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1698 GLboolean blue
, GLboolean alpha
)
1700 GET_CURRENT_CONTEXT(ctx
);
1702 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1703 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1711 if (ctx
->ExecuteFlag
) {
1712 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1717 static void GLAPIENTRY
1718 save_ColorMaterial(GLenum face
, GLenum mode
)
1720 GET_CURRENT_CONTEXT(ctx
);
1722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1724 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1729 if (ctx
->ExecuteFlag
) {
1730 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1735 static void GLAPIENTRY
1736 save_ColorTable(GLenum target
, GLenum internalFormat
,
1737 GLsizei width
, GLenum format
, GLenum type
,
1738 const GLvoid
* table
)
1740 GET_CURRENT_CONTEXT(ctx
);
1741 if (_mesa_is_proxy_texture(target
)) {
1742 /* execute immediately */
1743 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1744 format
, type
, table
));
1748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1749 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1752 n
[2].e
= internalFormat
;
1756 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1759 if (ctx
->ExecuteFlag
) {
1760 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1761 format
, type
, table
));
1768 static void GLAPIENTRY
1769 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1770 const GLfloat
*params
)
1772 GET_CURRENT_CONTEXT(ctx
);
1775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1777 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1782 if (pname
== GL_COLOR_TABLE_SGI
||
1783 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1784 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1791 if (ctx
->ExecuteFlag
) {
1792 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1797 static void GLAPIENTRY
1798 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1800 GET_CURRENT_CONTEXT(ctx
);
1803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1805 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1810 if (pname
== GL_COLOR_TABLE_SGI
||
1811 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1812 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1819 if (ctx
->ExecuteFlag
) {
1820 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1826 static void GLAPIENTRY
1827 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1828 GLenum format
, GLenum type
, const GLvoid
* table
)
1830 GET_CURRENT_CONTEXT(ctx
);
1832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1833 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1840 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1843 if (ctx
->ExecuteFlag
) {
1844 CALL_ColorSubTable(ctx
->Exec
,
1845 (target
, start
, count
, format
, type
, table
));
1850 static void GLAPIENTRY
1851 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1852 GLint x
, GLint y
, GLsizei width
)
1854 GET_CURRENT_CONTEXT(ctx
);
1857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1858 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1866 if (ctx
->ExecuteFlag
) {
1867 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1872 static void GLAPIENTRY
1873 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1874 GLint x
, GLint y
, GLsizei width
)
1876 GET_CURRENT_CONTEXT(ctx
);
1879 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1880 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1883 n
[2].e
= internalformat
;
1888 if (ctx
->ExecuteFlag
) {
1889 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1894 static void GLAPIENTRY
1895 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1896 GLenum format
, GLenum type
, const GLvoid
* filter
)
1898 GET_CURRENT_CONTEXT(ctx
);
1901 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1903 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1906 n
[2].e
= internalFormat
;
1910 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1913 if (ctx
->ExecuteFlag
) {
1914 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1915 format
, type
, filter
));
1920 static void GLAPIENTRY
1921 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1922 GLsizei width
, GLsizei height
, GLenum format
,
1923 GLenum type
, const GLvoid
* filter
)
1925 GET_CURRENT_CONTEXT(ctx
);
1928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1930 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1933 n
[2].e
= internalFormat
;
1938 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1941 if (ctx
->ExecuteFlag
) {
1942 CALL_ConvolutionFilter2D(ctx
->Exec
,
1943 (target
, internalFormat
, width
, height
, format
,
1949 static void GLAPIENTRY
1950 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1952 GET_CURRENT_CONTEXT(ctx
);
1954 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1955 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1961 if (ctx
->ExecuteFlag
) {
1962 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1967 static void GLAPIENTRY
1968 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1970 GET_CURRENT_CONTEXT(ctx
);
1972 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1973 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1978 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1979 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1980 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1986 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1989 if (ctx
->ExecuteFlag
) {
1990 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1995 static void GLAPIENTRY
1996 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1998 GET_CURRENT_CONTEXT(ctx
);
2000 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2001 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
2007 if (ctx
->ExecuteFlag
) {
2008 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
2013 static void GLAPIENTRY
2014 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
2015 const GLfloat
*params
)
2017 GET_CURRENT_CONTEXT(ctx
);
2019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2020 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
2025 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
2026 pname
== GL_CONVOLUTION_FILTER_SCALE
||
2027 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
2033 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
2036 if (ctx
->ExecuteFlag
) {
2037 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
2042 static void GLAPIENTRY
2043 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2045 GET_CURRENT_CONTEXT(ctx
);
2047 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2048 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2052 n
[3].i
= (GLint
) width
;
2053 n
[4].i
= (GLint
) height
;
2056 if (ctx
->ExecuteFlag
) {
2057 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2063 static void GLAPIENTRY
2064 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2065 GLint x
, GLint y
, GLsizei width
, GLint border
)
2067 GET_CURRENT_CONTEXT(ctx
);
2069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2070 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2074 n
[3].e
= internalformat
;
2080 if (ctx
->ExecuteFlag
) {
2081 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2082 x
, y
, width
, border
));
2087 static void GLAPIENTRY
2088 save_CopyTexImage2D(GLenum target
, GLint level
,
2089 GLenum internalformat
,
2090 GLint x
, GLint y
, GLsizei width
,
2091 GLsizei height
, GLint border
)
2093 GET_CURRENT_CONTEXT(ctx
);
2095 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2096 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2100 n
[3].e
= internalformat
;
2107 if (ctx
->ExecuteFlag
) {
2108 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2109 x
, y
, width
, height
, border
));
2115 static void GLAPIENTRY
2116 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2117 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2119 GET_CURRENT_CONTEXT(ctx
);
2121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2122 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2131 if (ctx
->ExecuteFlag
) {
2132 CALL_CopyTexSubImage1D(ctx
->Exec
,
2133 (target
, level
, xoffset
, x
, y
, width
));
2138 static void GLAPIENTRY
2139 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2140 GLint xoffset
, GLint yoffset
,
2141 GLint x
, GLint y
, GLsizei width
, GLint height
)
2143 GET_CURRENT_CONTEXT(ctx
);
2145 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2146 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2157 if (ctx
->ExecuteFlag
) {
2158 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2159 x
, y
, width
, height
));
2164 static void GLAPIENTRY
2165 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2166 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2167 GLint x
, GLint y
, GLsizei width
, GLint height
)
2169 GET_CURRENT_CONTEXT(ctx
);
2171 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2172 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2184 if (ctx
->ExecuteFlag
) {
2185 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2186 xoffset
, yoffset
, zoffset
,
2187 x
, y
, width
, height
));
2192 static void GLAPIENTRY
2193 save_CullFace(GLenum mode
)
2195 GET_CURRENT_CONTEXT(ctx
);
2197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2198 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2202 if (ctx
->ExecuteFlag
) {
2203 CALL_CullFace(ctx
->Exec
, (mode
));
2208 static void GLAPIENTRY
2209 save_DepthFunc(GLenum func
)
2211 GET_CURRENT_CONTEXT(ctx
);
2213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2214 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2218 if (ctx
->ExecuteFlag
) {
2219 CALL_DepthFunc(ctx
->Exec
, (func
));
2224 static void GLAPIENTRY
2225 save_DepthMask(GLboolean mask
)
2227 GET_CURRENT_CONTEXT(ctx
);
2229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2230 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2234 if (ctx
->ExecuteFlag
) {
2235 CALL_DepthMask(ctx
->Exec
, (mask
));
2240 static void GLAPIENTRY
2241 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2243 GET_CURRENT_CONTEXT(ctx
);
2245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2246 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2248 n
[1].f
= (GLfloat
) nearval
;
2249 n
[2].f
= (GLfloat
) farval
;
2251 if (ctx
->ExecuteFlag
) {
2252 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2257 static void GLAPIENTRY
2258 save_Disable(GLenum cap
)
2260 GET_CURRENT_CONTEXT(ctx
);
2262 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2263 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2267 if (ctx
->ExecuteFlag
) {
2268 CALL_Disable(ctx
->Exec
, (cap
));
2273 static void GLAPIENTRY
2274 save_DisableIndexed(GLuint index
, GLenum cap
)
2276 GET_CURRENT_CONTEXT(ctx
);
2278 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2279 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2284 if (ctx
->ExecuteFlag
) {
2285 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2290 static void GLAPIENTRY
2291 save_DrawBuffer(GLenum mode
)
2293 GET_CURRENT_CONTEXT(ctx
);
2295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2296 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2300 if (ctx
->ExecuteFlag
) {
2301 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2306 static void GLAPIENTRY
2307 save_DrawPixels(GLsizei width
, GLsizei height
,
2308 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2310 GET_CURRENT_CONTEXT(ctx
);
2313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2315 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
2321 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2322 pixels
, &ctx
->Unpack
);
2324 if (ctx
->ExecuteFlag
) {
2325 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2331 static void GLAPIENTRY
2332 save_Enable(GLenum cap
)
2334 GET_CURRENT_CONTEXT(ctx
);
2336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2337 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2341 if (ctx
->ExecuteFlag
) {
2342 CALL_Enable(ctx
->Exec
, (cap
));
2348 static void GLAPIENTRY
2349 save_EnableIndexed(GLuint index
, GLenum cap
)
2351 GET_CURRENT_CONTEXT(ctx
);
2353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2354 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2359 if (ctx
->ExecuteFlag
) {
2360 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2366 static void GLAPIENTRY
2367 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2369 GET_CURRENT_CONTEXT(ctx
);
2371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2372 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2378 if (ctx
->ExecuteFlag
) {
2379 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2384 static void GLAPIENTRY
2385 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2387 GET_CURRENT_CONTEXT(ctx
);
2389 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2390 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2398 if (ctx
->ExecuteFlag
) {
2399 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2406 static void GLAPIENTRY
2407 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2409 GET_CURRENT_CONTEXT(ctx
);
2411 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2412 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2420 if (ctx
->ExecuteFlag
) {
2421 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2426 static void GLAPIENTRY
2427 save_Fogf(GLenum pname
, GLfloat param
)
2431 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2432 save_Fogfv(pname
, parray
);
2436 static void GLAPIENTRY
2437 save_Fogiv(GLenum pname
, const GLint
*params
)
2442 case GL_FOG_DENSITY
:
2446 p
[0] = (GLfloat
) *params
;
2452 p
[0] = INT_TO_FLOAT(params
[0]);
2453 p
[1] = INT_TO_FLOAT(params
[1]);
2454 p
[2] = INT_TO_FLOAT(params
[2]);
2455 p
[3] = INT_TO_FLOAT(params
[3]);
2458 /* Error will be caught later in gl_Fogfv */
2459 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2461 save_Fogfv(pname
, p
);
2465 static void GLAPIENTRY
2466 save_Fogi(GLenum pname
, GLint param
)
2470 parray
[1] = parray
[2] = parray
[3] = 0;
2471 save_Fogiv(pname
, parray
);
2475 static void GLAPIENTRY
2476 save_FrontFace(GLenum mode
)
2478 GET_CURRENT_CONTEXT(ctx
);
2480 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2481 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2485 if (ctx
->ExecuteFlag
) {
2486 CALL_FrontFace(ctx
->Exec
, (mode
));
2491 static void GLAPIENTRY
2492 save_Frustum(GLdouble left
, GLdouble right
,
2493 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2495 GET_CURRENT_CONTEXT(ctx
);
2497 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2498 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2500 n
[1].f
= (GLfloat
) left
;
2501 n
[2].f
= (GLfloat
) right
;
2502 n
[3].f
= (GLfloat
) bottom
;
2503 n
[4].f
= (GLfloat
) top
;
2504 n
[5].f
= (GLfloat
) nearval
;
2505 n
[6].f
= (GLfloat
) farval
;
2507 if (ctx
->ExecuteFlag
) {
2508 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2513 static void GLAPIENTRY
2514 save_Hint(GLenum target
, GLenum mode
)
2516 GET_CURRENT_CONTEXT(ctx
);
2518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2519 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2524 if (ctx
->ExecuteFlag
) {
2525 CALL_Hint(ctx
->Exec
, (target
, mode
));
2530 static void GLAPIENTRY
2531 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2534 GET_CURRENT_CONTEXT(ctx
);
2537 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2538 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2542 n
[3].e
= internalFormat
;
2545 if (ctx
->ExecuteFlag
) {
2546 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2551 static void GLAPIENTRY
2552 save_IndexMask(GLuint mask
)
2554 GET_CURRENT_CONTEXT(ctx
);
2556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2557 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2561 if (ctx
->ExecuteFlag
) {
2562 CALL_IndexMask(ctx
->Exec
, (mask
));
2567 static void GLAPIENTRY
2568 save_InitNames(void)
2570 GET_CURRENT_CONTEXT(ctx
);
2571 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2572 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2573 if (ctx
->ExecuteFlag
) {
2574 CALL_InitNames(ctx
->Exec
, ());
2579 static void GLAPIENTRY
2580 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2582 GET_CURRENT_CONTEXT(ctx
);
2584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2585 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2603 case GL_SPOT_DIRECTION
:
2606 case GL_SPOT_EXPONENT
:
2609 case GL_SPOT_CUTOFF
:
2612 case GL_CONSTANT_ATTENUATION
:
2615 case GL_LINEAR_ATTENUATION
:
2618 case GL_QUADRATIC_ATTENUATION
:
2624 for (i
= 0; i
< nParams
; i
++) {
2625 n
[3 + i
].f
= params
[i
];
2628 if (ctx
->ExecuteFlag
) {
2629 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2634 static void GLAPIENTRY
2635 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2639 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2640 save_Lightfv(light
, pname
, parray
);
2644 static void GLAPIENTRY
2645 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2652 fparam
[0] = INT_TO_FLOAT(params
[0]);
2653 fparam
[1] = INT_TO_FLOAT(params
[1]);
2654 fparam
[2] = INT_TO_FLOAT(params
[2]);
2655 fparam
[3] = INT_TO_FLOAT(params
[3]);
2658 fparam
[0] = (GLfloat
) params
[0];
2659 fparam
[1] = (GLfloat
) params
[1];
2660 fparam
[2] = (GLfloat
) params
[2];
2661 fparam
[3] = (GLfloat
) params
[3];
2663 case GL_SPOT_DIRECTION
:
2664 fparam
[0] = (GLfloat
) params
[0];
2665 fparam
[1] = (GLfloat
) params
[1];
2666 fparam
[2] = (GLfloat
) params
[2];
2668 case GL_SPOT_EXPONENT
:
2669 case GL_SPOT_CUTOFF
:
2670 case GL_CONSTANT_ATTENUATION
:
2671 case GL_LINEAR_ATTENUATION
:
2672 case GL_QUADRATIC_ATTENUATION
:
2673 fparam
[0] = (GLfloat
) params
[0];
2676 /* error will be caught later in gl_Lightfv */
2679 save_Lightfv(light
, pname
, fparam
);
2683 static void GLAPIENTRY
2684 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2688 parray
[1] = parray
[2] = parray
[3] = 0;
2689 save_Lightiv(light
, pname
, parray
);
2693 static void GLAPIENTRY
2694 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2696 GET_CURRENT_CONTEXT(ctx
);
2698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2699 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2707 if (ctx
->ExecuteFlag
) {
2708 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2713 static void GLAPIENTRY
2714 save_LightModelf(GLenum pname
, GLfloat param
)
2718 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2719 save_LightModelfv(pname
, parray
);
2723 static void GLAPIENTRY
2724 save_LightModeliv(GLenum pname
, const GLint
*params
)
2728 case GL_LIGHT_MODEL_AMBIENT
:
2729 fparam
[0] = INT_TO_FLOAT(params
[0]);
2730 fparam
[1] = INT_TO_FLOAT(params
[1]);
2731 fparam
[2] = INT_TO_FLOAT(params
[2]);
2732 fparam
[3] = INT_TO_FLOAT(params
[3]);
2734 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2735 case GL_LIGHT_MODEL_TWO_SIDE
:
2736 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2737 fparam
[0] = (GLfloat
) params
[0];
2743 /* Error will be caught later in gl_LightModelfv */
2744 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2746 save_LightModelfv(pname
, fparam
);
2750 static void GLAPIENTRY
2751 save_LightModeli(GLenum pname
, GLint param
)
2755 parray
[1] = parray
[2] = parray
[3] = 0;
2756 save_LightModeliv(pname
, parray
);
2760 static void GLAPIENTRY
2761 save_LineStipple(GLint factor
, GLushort pattern
)
2763 GET_CURRENT_CONTEXT(ctx
);
2765 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2766 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2771 if (ctx
->ExecuteFlag
) {
2772 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2777 static void GLAPIENTRY
2778 save_LineWidth(GLfloat width
)
2780 GET_CURRENT_CONTEXT(ctx
);
2782 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2783 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2787 if (ctx
->ExecuteFlag
) {
2788 CALL_LineWidth(ctx
->Exec
, (width
));
2793 static void GLAPIENTRY
2794 save_ListBase(GLuint base
)
2796 GET_CURRENT_CONTEXT(ctx
);
2798 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2799 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2803 if (ctx
->ExecuteFlag
) {
2804 CALL_ListBase(ctx
->Exec
, (base
));
2809 static void GLAPIENTRY
2810 save_LoadIdentity(void)
2812 GET_CURRENT_CONTEXT(ctx
);
2813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2814 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2815 if (ctx
->ExecuteFlag
) {
2816 CALL_LoadIdentity(ctx
->Exec
, ());
2821 static void GLAPIENTRY
2822 save_LoadMatrixf(const GLfloat
* m
)
2824 GET_CURRENT_CONTEXT(ctx
);
2826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2827 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2830 for (i
= 0; i
< 16; i
++) {
2834 if (ctx
->ExecuteFlag
) {
2835 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2840 static void GLAPIENTRY
2841 save_LoadMatrixd(const GLdouble
* m
)
2845 for (i
= 0; i
< 16; i
++) {
2846 f
[i
] = (GLfloat
) m
[i
];
2848 save_LoadMatrixf(f
);
2852 static void GLAPIENTRY
2853 save_LoadName(GLuint name
)
2855 GET_CURRENT_CONTEXT(ctx
);
2857 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2858 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2862 if (ctx
->ExecuteFlag
) {
2863 CALL_LoadName(ctx
->Exec
, (name
));
2868 static void GLAPIENTRY
2869 save_LogicOp(GLenum opcode
)
2871 GET_CURRENT_CONTEXT(ctx
);
2873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2874 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2878 if (ctx
->ExecuteFlag
) {
2879 CALL_LogicOp(ctx
->Exec
, (opcode
));
2884 static void GLAPIENTRY
2885 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2886 GLint order
, const GLdouble
* points
)
2888 GET_CURRENT_CONTEXT(ctx
);
2890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2891 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2893 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2895 n
[2].f
= (GLfloat
) u1
;
2896 n
[3].f
= (GLfloat
) u2
;
2897 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2899 n
[6].data
= (void *) pnts
;
2901 if (ctx
->ExecuteFlag
) {
2902 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2906 static void GLAPIENTRY
2907 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2908 GLint order
, const GLfloat
* points
)
2910 GET_CURRENT_CONTEXT(ctx
);
2912 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2913 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2915 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2919 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2921 n
[6].data
= (void *) pnts
;
2923 if (ctx
->ExecuteFlag
) {
2924 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2929 static void GLAPIENTRY
2930 save_Map2d(GLenum target
,
2931 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2932 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2933 const GLdouble
* points
)
2935 GET_CURRENT_CONTEXT(ctx
);
2937 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2938 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2940 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2941 vstride
, vorder
, points
);
2943 n
[2].f
= (GLfloat
) u1
;
2944 n
[3].f
= (GLfloat
) u2
;
2945 n
[4].f
= (GLfloat
) v1
;
2946 n
[5].f
= (GLfloat
) v2
;
2947 /* XXX verify these strides are correct */
2948 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2949 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2952 n
[10].data
= (void *) pnts
;
2954 if (ctx
->ExecuteFlag
) {
2955 CALL_Map2d(ctx
->Exec
, (target
,
2956 u1
, u2
, ustride
, uorder
,
2957 v1
, v2
, vstride
, vorder
, points
));
2962 static void GLAPIENTRY
2963 save_Map2f(GLenum target
,
2964 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2965 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2966 const GLfloat
* points
)
2968 GET_CURRENT_CONTEXT(ctx
);
2970 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2971 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2973 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2974 vstride
, vorder
, points
);
2980 /* XXX verify these strides are correct */
2981 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2982 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2985 n
[10].data
= (void *) pnts
;
2987 if (ctx
->ExecuteFlag
) {
2988 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2989 v1
, v2
, vstride
, vorder
, points
));
2994 static void GLAPIENTRY
2995 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2997 GET_CURRENT_CONTEXT(ctx
);
2999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3000 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3006 if (ctx
->ExecuteFlag
) {
3007 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3012 static void GLAPIENTRY
3013 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3015 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3019 static void GLAPIENTRY
3020 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3021 GLint vn
, GLfloat v1
, GLfloat v2
)
3023 GET_CURRENT_CONTEXT(ctx
);
3025 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3026 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3035 if (ctx
->ExecuteFlag
) {
3036 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3042 static void GLAPIENTRY
3043 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3044 GLint vn
, GLdouble v1
, GLdouble v2
)
3046 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3047 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3051 static void GLAPIENTRY
3052 save_MatrixMode(GLenum mode
)
3054 GET_CURRENT_CONTEXT(ctx
);
3056 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3057 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3061 if (ctx
->ExecuteFlag
) {
3062 CALL_MatrixMode(ctx
->Exec
, (mode
));
3067 static void GLAPIENTRY
3068 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
3070 GET_CURRENT_CONTEXT(ctx
);
3073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3074 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
3077 n
[2].e
= internalFormat
;
3080 if (ctx
->ExecuteFlag
) {
3081 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
3086 static void GLAPIENTRY
3087 save_MultMatrixf(const GLfloat
* m
)
3089 GET_CURRENT_CONTEXT(ctx
);
3091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3092 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3095 for (i
= 0; i
< 16; i
++) {
3099 if (ctx
->ExecuteFlag
) {
3100 CALL_MultMatrixf(ctx
->Exec
, (m
));
3105 static void GLAPIENTRY
3106 save_MultMatrixd(const GLdouble
* m
)
3110 for (i
= 0; i
< 16; i
++) {
3111 f
[i
] = (GLfloat
) m
[i
];
3113 save_MultMatrixf(f
);
3117 static void GLAPIENTRY
3118 save_NewList(GLuint name
, GLenum mode
)
3120 GET_CURRENT_CONTEXT(ctx
);
3121 /* It's an error to call this function while building a display list */
3122 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3129 static void GLAPIENTRY
3130 save_Ortho(GLdouble left
, GLdouble right
,
3131 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3133 GET_CURRENT_CONTEXT(ctx
);
3135 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3136 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3138 n
[1].f
= (GLfloat
) left
;
3139 n
[2].f
= (GLfloat
) right
;
3140 n
[3].f
= (GLfloat
) bottom
;
3141 n
[4].f
= (GLfloat
) top
;
3142 n
[5].f
= (GLfloat
) nearval
;
3143 n
[6].f
= (GLfloat
) farval
;
3145 if (ctx
->ExecuteFlag
) {
3146 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3151 static void GLAPIENTRY
3152 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3154 GET_CURRENT_CONTEXT(ctx
);
3156 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3157 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
3161 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
3162 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
3164 if (ctx
->ExecuteFlag
) {
3165 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3170 static void GLAPIENTRY
3171 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3173 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3175 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3176 for (i
= 0; i
< mapsize
; i
++) {
3177 fvalues
[i
] = (GLfloat
) values
[i
];
3181 for (i
= 0; i
< mapsize
; i
++) {
3182 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3185 save_PixelMapfv(map
, mapsize
, fvalues
);
3189 static void GLAPIENTRY
3190 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3192 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3194 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3195 for (i
= 0; i
< mapsize
; i
++) {
3196 fvalues
[i
] = (GLfloat
) values
[i
];
3200 for (i
= 0; i
< mapsize
; i
++) {
3201 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3204 save_PixelMapfv(map
, mapsize
, fvalues
);
3208 static void GLAPIENTRY
3209 save_PixelTransferf(GLenum pname
, GLfloat param
)
3211 GET_CURRENT_CONTEXT(ctx
);
3213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3214 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3219 if (ctx
->ExecuteFlag
) {
3220 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3225 static void GLAPIENTRY
3226 save_PixelTransferi(GLenum pname
, GLint param
)
3228 save_PixelTransferf(pname
, (GLfloat
) param
);
3232 static void GLAPIENTRY
3233 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3235 GET_CURRENT_CONTEXT(ctx
);
3237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3238 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3243 if (ctx
->ExecuteFlag
) {
3244 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3249 static void GLAPIENTRY
3250 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3252 GET_CURRENT_CONTEXT(ctx
);
3254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3255 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3262 if (ctx
->ExecuteFlag
) {
3263 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3268 static void GLAPIENTRY
3269 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3273 parray
[1] = parray
[2] = 0.0F
;
3274 save_PointParameterfvEXT(pname
, parray
);
3277 static void GLAPIENTRY
3278 save_PointParameteriNV(GLenum pname
, GLint param
)
3281 parray
[0] = (GLfloat
) param
;
3282 parray
[1] = parray
[2] = 0.0F
;
3283 save_PointParameterfvEXT(pname
, parray
);
3286 static void GLAPIENTRY
3287 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3290 parray
[0] = (GLfloat
) param
[0];
3291 parray
[1] = parray
[2] = 0.0F
;
3292 save_PointParameterfvEXT(pname
, parray
);
3296 static void GLAPIENTRY
3297 save_PointSize(GLfloat size
)
3299 GET_CURRENT_CONTEXT(ctx
);
3301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3302 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3306 if (ctx
->ExecuteFlag
) {
3307 CALL_PointSize(ctx
->Exec
, (size
));
3312 static void GLAPIENTRY
3313 save_PolygonMode(GLenum face
, GLenum mode
)
3315 GET_CURRENT_CONTEXT(ctx
);
3317 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3318 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3323 if (ctx
->ExecuteFlag
) {
3324 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3329 static void GLAPIENTRY
3330 save_PolygonStipple(const GLubyte
* pattern
)
3332 GET_CURRENT_CONTEXT(ctx
);
3335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3337 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
3339 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3340 pattern
, &ctx
->Unpack
);
3342 if (ctx
->ExecuteFlag
) {
3343 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3348 static void GLAPIENTRY
3349 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3351 GET_CURRENT_CONTEXT(ctx
);
3353 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3354 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3359 if (ctx
->ExecuteFlag
) {
3360 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3365 static void GLAPIENTRY
3366 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3368 GET_CURRENT_CONTEXT(ctx
);
3369 /* XXX mult by DepthMaxF here??? */
3370 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3374 static void GLAPIENTRY
3375 save_PopAttrib(void)
3377 GET_CURRENT_CONTEXT(ctx
);
3378 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3379 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3380 if (ctx
->ExecuteFlag
) {
3381 CALL_PopAttrib(ctx
->Exec
, ());
3386 static void GLAPIENTRY
3387 save_PopMatrix(void)
3389 GET_CURRENT_CONTEXT(ctx
);
3390 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3391 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3392 if (ctx
->ExecuteFlag
) {
3393 CALL_PopMatrix(ctx
->Exec
, ());
3398 static void GLAPIENTRY
3401 GET_CURRENT_CONTEXT(ctx
);
3402 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3403 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3404 if (ctx
->ExecuteFlag
) {
3405 CALL_PopName(ctx
->Exec
, ());
3410 static void GLAPIENTRY
3411 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3412 const GLclampf
* priorities
)
3414 GET_CURRENT_CONTEXT(ctx
);
3416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3418 for (i
= 0; i
< num
; i
++) {
3420 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3422 n
[1].ui
= textures
[i
];
3423 n
[2].f
= priorities
[i
];
3426 if (ctx
->ExecuteFlag
) {
3427 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3432 static void GLAPIENTRY
3433 save_PushAttrib(GLbitfield mask
)
3435 GET_CURRENT_CONTEXT(ctx
);
3437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3438 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3442 if (ctx
->ExecuteFlag
) {
3443 CALL_PushAttrib(ctx
->Exec
, (mask
));
3448 static void GLAPIENTRY
3449 save_PushMatrix(void)
3451 GET_CURRENT_CONTEXT(ctx
);
3452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3453 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3454 if (ctx
->ExecuteFlag
) {
3455 CALL_PushMatrix(ctx
->Exec
, ());
3460 static void GLAPIENTRY
3461 save_PushName(GLuint name
)
3463 GET_CURRENT_CONTEXT(ctx
);
3465 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3466 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3470 if (ctx
->ExecuteFlag
) {
3471 CALL_PushName(ctx
->Exec
, (name
));
3476 static void GLAPIENTRY
3477 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3479 GET_CURRENT_CONTEXT(ctx
);
3481 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3482 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3489 if (ctx
->ExecuteFlag
) {
3490 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3494 static void GLAPIENTRY
3495 save_RasterPos2d(GLdouble x
, GLdouble y
)
3497 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3500 static void GLAPIENTRY
3501 save_RasterPos2f(GLfloat x
, GLfloat y
)
3503 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3506 static void GLAPIENTRY
3507 save_RasterPos2i(GLint x
, GLint y
)
3509 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3512 static void GLAPIENTRY
3513 save_RasterPos2s(GLshort x
, GLshort y
)
3515 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3518 static void GLAPIENTRY
3519 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3521 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3524 static void GLAPIENTRY
3525 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3527 save_RasterPos4f(x
, y
, z
, 1.0F
);
3530 static void GLAPIENTRY
3531 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3533 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3536 static void GLAPIENTRY
3537 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3539 save_RasterPos4f(x
, y
, z
, 1.0F
);
3542 static void GLAPIENTRY
3543 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3545 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3548 static void GLAPIENTRY
3549 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3551 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3554 static void GLAPIENTRY
3555 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3557 save_RasterPos4f(x
, y
, z
, w
);
3560 static void GLAPIENTRY
3561 save_RasterPos2dv(const GLdouble
* v
)
3563 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3566 static void GLAPIENTRY
3567 save_RasterPos2fv(const GLfloat
* v
)
3569 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3572 static void GLAPIENTRY
3573 save_RasterPos2iv(const GLint
* v
)
3575 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3578 static void GLAPIENTRY
3579 save_RasterPos2sv(const GLshort
* v
)
3581 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3584 static void GLAPIENTRY
3585 save_RasterPos3dv(const GLdouble
* v
)
3587 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3590 static void GLAPIENTRY
3591 save_RasterPos3fv(const GLfloat
* v
)
3593 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3596 static void GLAPIENTRY
3597 save_RasterPos3iv(const GLint
* v
)
3599 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3602 static void GLAPIENTRY
3603 save_RasterPos3sv(const GLshort
* v
)
3605 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3608 static void GLAPIENTRY
3609 save_RasterPos4dv(const GLdouble
* v
)
3611 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3612 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3615 static void GLAPIENTRY
3616 save_RasterPos4fv(const GLfloat
* v
)
3618 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3621 static void GLAPIENTRY
3622 save_RasterPos4iv(const GLint
* v
)
3624 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3625 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3628 static void GLAPIENTRY
3629 save_RasterPos4sv(const GLshort
* v
)
3631 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3635 static void GLAPIENTRY
3636 save_PassThrough(GLfloat token
)
3638 GET_CURRENT_CONTEXT(ctx
);
3640 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3641 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3645 if (ctx
->ExecuteFlag
) {
3646 CALL_PassThrough(ctx
->Exec
, (token
));
3651 static void GLAPIENTRY
3652 save_ReadBuffer(GLenum mode
)
3654 GET_CURRENT_CONTEXT(ctx
);
3656 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3657 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3661 if (ctx
->ExecuteFlag
) {
3662 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3667 static void GLAPIENTRY
3668 save_ResetHistogram(GLenum target
)
3670 GET_CURRENT_CONTEXT(ctx
);
3672 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3673 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3677 if (ctx
->ExecuteFlag
) {
3678 CALL_ResetHistogram(ctx
->Exec
, (target
));
3683 static void GLAPIENTRY
3684 save_ResetMinmax(GLenum target
)
3686 GET_CURRENT_CONTEXT(ctx
);
3688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3689 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3693 if (ctx
->ExecuteFlag
) {
3694 CALL_ResetMinmax(ctx
->Exec
, (target
));
3699 static void GLAPIENTRY
3700 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3702 GET_CURRENT_CONTEXT(ctx
);
3704 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3705 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3712 if (ctx
->ExecuteFlag
) {
3713 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3718 static void GLAPIENTRY
3719 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3721 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3725 static void GLAPIENTRY
3726 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3728 GET_CURRENT_CONTEXT(ctx
);
3730 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3731 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3737 if (ctx
->ExecuteFlag
) {
3738 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3743 static void GLAPIENTRY
3744 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3746 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3750 static void GLAPIENTRY
3751 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3753 GET_CURRENT_CONTEXT(ctx
);
3755 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3756 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3763 if (ctx
->ExecuteFlag
) {
3764 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3769 static void GLAPIENTRY
3770 save_ShadeModel(GLenum mode
)
3772 GET_CURRENT_CONTEXT(ctx
);
3774 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3776 if (ctx
->ExecuteFlag
) {
3777 CALL_ShadeModel(ctx
->Exec
, (mode
));
3780 /* Don't compile this call if it's a no-op.
3781 * By avoiding this state change we have a better chance of
3782 * coalescing subsequent drawing commands into one batch.
3784 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3787 SAVE_FLUSH_VERTICES(ctx
);
3789 ctx
->ListState
.Current
.ShadeModel
= mode
;
3791 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3798 static void GLAPIENTRY
3799 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3801 GET_CURRENT_CONTEXT(ctx
);
3803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3804 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3810 if (ctx
->ExecuteFlag
) {
3811 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3816 static void GLAPIENTRY
3817 save_StencilMask(GLuint mask
)
3819 GET_CURRENT_CONTEXT(ctx
);
3821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3822 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3826 if (ctx
->ExecuteFlag
) {
3827 CALL_StencilMask(ctx
->Exec
, (mask
));
3832 static void GLAPIENTRY
3833 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3835 GET_CURRENT_CONTEXT(ctx
);
3837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3838 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3844 if (ctx
->ExecuteFlag
) {
3845 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3850 static void GLAPIENTRY
3851 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3853 GET_CURRENT_CONTEXT(ctx
);
3855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3856 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3863 if (ctx
->ExecuteFlag
) {
3864 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3869 static void GLAPIENTRY
3870 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3873 GET_CURRENT_CONTEXT(ctx
);
3875 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3877 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3885 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3892 if (ctx
->ExecuteFlag
) {
3893 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3894 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3899 static void GLAPIENTRY
3900 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3902 GET_CURRENT_CONTEXT(ctx
);
3904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3905 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3910 if (ctx
->ExecuteFlag
) {
3911 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3916 static void GLAPIENTRY
3917 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3919 GET_CURRENT_CONTEXT(ctx
);
3921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3922 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3929 if (ctx
->ExecuteFlag
) {
3930 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3935 static void GLAPIENTRY
3936 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3938 GET_CURRENT_CONTEXT(ctx
);
3940 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3941 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3945 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3953 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3956 if (ctx
->ExecuteFlag
) {
3957 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3962 static void GLAPIENTRY
3963 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3966 parray
[0] = (GLfloat
) param
;
3967 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3968 save_TexEnvfv(target
, pname
, parray
);
3972 static void GLAPIENTRY
3973 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3976 p
[0] = (GLfloat
) param
;
3977 p
[1] = p
[2] = p
[3] = 0.0F
;
3978 save_TexEnvfv(target
, pname
, p
);
3982 static void GLAPIENTRY
3983 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3986 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3987 p
[0] = INT_TO_FLOAT(param
[0]);
3988 p
[1] = INT_TO_FLOAT(param
[1]);
3989 p
[2] = INT_TO_FLOAT(param
[2]);
3990 p
[3] = INT_TO_FLOAT(param
[3]);
3993 p
[0] = (GLfloat
) param
[0];
3994 p
[1] = p
[2] = p
[3] = 0.0F
;
3996 save_TexEnvfv(target
, pname
, p
);
4000 static void GLAPIENTRY
4001 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
4003 GET_CURRENT_CONTEXT(ctx
);
4005 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4006 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4015 if (ctx
->ExecuteFlag
) {
4016 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4021 static void GLAPIENTRY
4022 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4025 p
[0] = (GLfloat
) params
[0];
4026 p
[1] = (GLfloat
) params
[1];
4027 p
[2] = (GLfloat
) params
[2];
4028 p
[3] = (GLfloat
) params
[3];
4029 save_TexGenfv(coord
, pname
, p
);
4033 static void GLAPIENTRY
4034 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4037 parray
[0] = (GLfloat
) param
;
4038 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4039 save_TexGenfv(coord
, pname
, parray
);
4043 static void GLAPIENTRY
4044 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4047 p
[0] = (GLfloat
) params
[0];
4048 p
[1] = (GLfloat
) params
[1];
4049 p
[2] = (GLfloat
) params
[2];
4050 p
[3] = (GLfloat
) params
[3];
4051 save_TexGenfv(coord
, pname
, p
);
4055 static void GLAPIENTRY
4056 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4060 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4061 save_TexGenfv(coord
, pname
, parray
);
4065 static void GLAPIENTRY
4066 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4070 parray
[1] = parray
[2] = parray
[3] = 0;
4071 save_TexGeniv(coord
, pname
, parray
);
4075 static void GLAPIENTRY
4076 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4078 GET_CURRENT_CONTEXT(ctx
);
4080 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4081 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4090 if (ctx
->ExecuteFlag
) {
4091 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4096 static void GLAPIENTRY
4097 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4101 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4102 save_TexParameterfv(target
, pname
, parray
);
4106 static void GLAPIENTRY
4107 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4110 fparam
[0] = (GLfloat
) param
;
4111 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4112 save_TexParameterfv(target
, pname
, fparam
);
4116 static void GLAPIENTRY
4117 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4120 fparam
[0] = (GLfloat
) params
[0];
4121 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4122 save_TexParameterfv(target
, pname
, fparam
);
4126 static void GLAPIENTRY
4127 save_TexImage1D(GLenum target
,
4128 GLint level
, GLint components
,
4129 GLsizei width
, GLint border
,
4130 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4132 GET_CURRENT_CONTEXT(ctx
);
4133 if (target
== GL_PROXY_TEXTURE_1D
) {
4134 /* don't compile, execute immediately */
4135 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4136 border
, format
, type
, pixels
));
4140 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4141 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
4145 n
[3].i
= components
;
4146 n
[4].i
= (GLint
) width
;
4150 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4151 pixels
, &ctx
->Unpack
);
4153 if (ctx
->ExecuteFlag
) {
4154 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4155 border
, format
, type
, pixels
));
4161 static void GLAPIENTRY
4162 save_TexImage2D(GLenum target
,
4163 GLint level
, GLint components
,
4164 GLsizei width
, GLsizei height
, GLint border
,
4165 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4167 GET_CURRENT_CONTEXT(ctx
);
4168 if (target
== GL_PROXY_TEXTURE_2D
) {
4169 /* don't compile, execute immediately */
4170 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4171 height
, border
, format
, type
, pixels
));
4175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4176 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
4180 n
[3].i
= components
;
4181 n
[4].i
= (GLint
) width
;
4182 n
[5].i
= (GLint
) height
;
4186 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4187 pixels
, &ctx
->Unpack
);
4189 if (ctx
->ExecuteFlag
) {
4190 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4191 height
, border
, format
, type
, pixels
));
4197 static void GLAPIENTRY
4198 save_TexImage3D(GLenum target
,
4199 GLint level
, GLint internalFormat
,
4200 GLsizei width
, GLsizei height
, GLsizei depth
,
4202 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4204 GET_CURRENT_CONTEXT(ctx
);
4205 if (target
== GL_PROXY_TEXTURE_3D
) {
4206 /* don't compile, execute immediately */
4207 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4208 height
, depth
, border
, format
, type
,
4213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4214 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
4218 n
[3].i
= (GLint
) internalFormat
;
4219 n
[4].i
= (GLint
) width
;
4220 n
[5].i
= (GLint
) height
;
4221 n
[6].i
= (GLint
) depth
;
4225 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4226 pixels
, &ctx
->Unpack
);
4228 if (ctx
->ExecuteFlag
) {
4229 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4230 height
, depth
, border
, format
, type
,
4237 static void GLAPIENTRY
4238 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4239 GLsizei width
, GLenum format
, GLenum type
,
4240 const GLvoid
* pixels
)
4242 GET_CURRENT_CONTEXT(ctx
);
4245 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4247 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
4252 n
[4].i
= (GLint
) width
;
4255 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4256 pixels
, &ctx
->Unpack
);
4258 if (ctx
->ExecuteFlag
) {
4259 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4260 format
, type
, pixels
));
4265 static void GLAPIENTRY
4266 save_TexSubImage2D(GLenum target
, GLint level
,
4267 GLint xoffset
, GLint yoffset
,
4268 GLsizei width
, GLsizei height
,
4269 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4271 GET_CURRENT_CONTEXT(ctx
);
4274 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4276 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
4282 n
[5].i
= (GLint
) width
;
4283 n
[6].i
= (GLint
) height
;
4286 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4287 pixels
, &ctx
->Unpack
);
4289 if (ctx
->ExecuteFlag
) {
4290 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4291 width
, height
, format
, type
, pixels
));
4296 static void GLAPIENTRY
4297 save_TexSubImage3D(GLenum target
, GLint level
,
4298 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4299 GLsizei width
, GLsizei height
, GLsizei depth
,
4300 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4302 GET_CURRENT_CONTEXT(ctx
);
4305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4307 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
4314 n
[6].i
= (GLint
) width
;
4315 n
[7].i
= (GLint
) height
;
4316 n
[8].i
= (GLint
) depth
;
4319 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4320 pixels
, &ctx
->Unpack
);
4322 if (ctx
->ExecuteFlag
) {
4323 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4324 xoffset
, yoffset
, zoffset
,
4325 width
, height
, depth
, format
, type
,
4331 static void GLAPIENTRY
4332 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4334 GET_CURRENT_CONTEXT(ctx
);
4336 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4337 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4343 if (ctx
->ExecuteFlag
) {
4344 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4349 static void GLAPIENTRY
4350 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4352 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4357 static void GLAPIENTRY
4358 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4360 GET_CURRENT_CONTEXT(ctx
);
4362 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4363 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4367 n
[3].i
= (GLint
) width
;
4368 n
[4].i
= (GLint
) height
;
4370 if (ctx
->ExecuteFlag
) {
4371 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4376 static void GLAPIENTRY
4377 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4379 GET_CURRENT_CONTEXT(ctx
);
4381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4382 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4389 if (ctx
->ExecuteFlag
) {
4390 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4394 static void GLAPIENTRY
4395 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4397 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4400 static void GLAPIENTRY
4401 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4403 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4406 static void GLAPIENTRY
4407 save_WindowPos2iMESA(GLint x
, GLint y
)
4409 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4412 static void GLAPIENTRY
4413 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4415 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4418 static void GLAPIENTRY
4419 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4421 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4424 static void GLAPIENTRY
4425 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4427 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4430 static void GLAPIENTRY
4431 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4433 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4436 static void GLAPIENTRY
4437 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4439 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4442 static void GLAPIENTRY
4443 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4445 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4448 static void GLAPIENTRY
4449 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4451 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4454 static void GLAPIENTRY
4455 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4457 save_WindowPos4fMESA(x
, y
, z
, w
);
4460 static void GLAPIENTRY
4461 save_WindowPos2dvMESA(const GLdouble
* v
)
4463 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4466 static void GLAPIENTRY
4467 save_WindowPos2fvMESA(const GLfloat
* v
)
4469 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4472 static void GLAPIENTRY
4473 save_WindowPos2ivMESA(const GLint
* v
)
4475 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4478 static void GLAPIENTRY
4479 save_WindowPos2svMESA(const GLshort
* v
)
4481 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4484 static void GLAPIENTRY
4485 save_WindowPos3dvMESA(const GLdouble
* v
)
4487 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4490 static void GLAPIENTRY
4491 save_WindowPos3fvMESA(const GLfloat
* v
)
4493 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4496 static void GLAPIENTRY
4497 save_WindowPos3ivMESA(const GLint
* v
)
4499 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4502 static void GLAPIENTRY
4503 save_WindowPos3svMESA(const GLshort
* v
)
4505 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4508 static void GLAPIENTRY
4509 save_WindowPos4dvMESA(const GLdouble
* v
)
4511 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4512 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4515 static void GLAPIENTRY
4516 save_WindowPos4fvMESA(const GLfloat
* v
)
4518 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4521 static void GLAPIENTRY
4522 save_WindowPos4ivMESA(const GLint
* v
)
4524 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4525 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4528 static void GLAPIENTRY
4529 save_WindowPos4svMESA(const GLshort
* v
)
4531 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4536 /* GL_ARB_multitexture */
4537 static void GLAPIENTRY
4538 save_ActiveTextureARB(GLenum target
)
4540 GET_CURRENT_CONTEXT(ctx
);
4542 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4543 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4547 if (ctx
->ExecuteFlag
) {
4548 CALL_ActiveTexture(ctx
->Exec
, (target
));
4553 /* GL_ARB_transpose_matrix */
4555 static void GLAPIENTRY
4556 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4559 _math_transposefd(tm
, m
);
4560 save_LoadMatrixf(tm
);
4564 static void GLAPIENTRY
4565 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4568 _math_transposef(tm
, m
);
4569 save_LoadMatrixf(tm
);
4573 static void GLAPIENTRY
4574 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4577 _math_transposefd(tm
, m
);
4578 save_MultMatrixf(tm
);
4582 static void GLAPIENTRY
4583 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4586 _math_transposef(tm
, m
);
4587 save_MultMatrixf(tm
);
4590 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4592 GET_CURRENT_CONTEXT(ctx
);
4598 image
= malloc(size
);
4600 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4603 memcpy(image
, data
, size
);
4609 /* GL_ARB_texture_compression */
4610 static void GLAPIENTRY
4611 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4612 GLenum internalFormat
, GLsizei width
,
4613 GLint border
, GLsizei imageSize
,
4614 const GLvoid
* data
)
4616 GET_CURRENT_CONTEXT(ctx
);
4617 if (target
== GL_PROXY_TEXTURE_1D
) {
4618 /* don't compile, execute immediately */
4619 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4620 width
, border
, imageSize
,
4625 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4627 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4631 n
[3].e
= internalFormat
;
4632 n
[4].i
= (GLint
) width
;
4635 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4637 if (ctx
->ExecuteFlag
) {
4638 CALL_CompressedTexImage1D(ctx
->Exec
,
4639 (target
, level
, internalFormat
, width
,
4640 border
, imageSize
, data
));
4646 static void GLAPIENTRY
4647 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4648 GLenum internalFormat
, GLsizei width
,
4649 GLsizei height
, GLint border
, GLsizei imageSize
,
4650 const GLvoid
* data
)
4652 GET_CURRENT_CONTEXT(ctx
);
4653 if (target
== GL_PROXY_TEXTURE_2D
) {
4654 /* don't compile, execute immediately */
4655 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4656 width
, height
, border
,
4661 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4663 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4667 n
[3].e
= internalFormat
;
4668 n
[4].i
= (GLint
) width
;
4669 n
[5].i
= (GLint
) height
;
4672 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4674 if (ctx
->ExecuteFlag
) {
4675 CALL_CompressedTexImage2D(ctx
->Exec
,
4676 (target
, level
, internalFormat
, width
,
4677 height
, border
, imageSize
, data
));
4683 static void GLAPIENTRY
4684 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4685 GLenum internalFormat
, GLsizei width
,
4686 GLsizei height
, GLsizei depth
, GLint border
,
4687 GLsizei imageSize
, const GLvoid
* data
)
4689 GET_CURRENT_CONTEXT(ctx
);
4690 if (target
== GL_PROXY_TEXTURE_3D
) {
4691 /* don't compile, execute immediately */
4692 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4693 width
, height
, depth
, border
,
4698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4700 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4704 n
[3].e
= internalFormat
;
4705 n
[4].i
= (GLint
) width
;
4706 n
[5].i
= (GLint
) height
;
4707 n
[6].i
= (GLint
) depth
;
4710 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4712 if (ctx
->ExecuteFlag
) {
4713 CALL_CompressedTexImage3D(ctx
->Exec
,
4714 (target
, level
, internalFormat
, width
,
4715 height
, depth
, border
, imageSize
,
4722 static void GLAPIENTRY
4723 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4724 GLsizei width
, GLenum format
,
4725 GLsizei imageSize
, const GLvoid
* data
)
4728 GET_CURRENT_CONTEXT(ctx
);
4729 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4731 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4736 n
[4].i
= (GLint
) width
;
4739 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4741 if (ctx
->ExecuteFlag
) {
4742 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4743 width
, format
, imageSize
,
4749 static void GLAPIENTRY
4750 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4751 GLint yoffset
, GLsizei width
, GLsizei height
,
4752 GLenum format
, GLsizei imageSize
,
4753 const GLvoid
* data
)
4756 GET_CURRENT_CONTEXT(ctx
);
4757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4759 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4765 n
[5].i
= (GLint
) width
;
4766 n
[6].i
= (GLint
) height
;
4769 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4771 if (ctx
->ExecuteFlag
) {
4772 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4773 (target
, level
, xoffset
, yoffset
, width
,
4774 height
, format
, imageSize
, data
));
4779 static void GLAPIENTRY
4780 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4781 GLint yoffset
, GLint zoffset
, GLsizei width
,
4782 GLsizei height
, GLsizei depth
, GLenum format
,
4783 GLsizei imageSize
, const GLvoid
* data
)
4786 GET_CURRENT_CONTEXT(ctx
);
4787 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4789 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4796 n
[6].i
= (GLint
) width
;
4797 n
[7].i
= (GLint
) height
;
4798 n
[8].i
= (GLint
) depth
;
4800 n
[10].i
= imageSize
;
4801 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4803 if (ctx
->ExecuteFlag
) {
4804 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4805 (target
, level
, xoffset
, yoffset
,
4806 zoffset
, width
, height
, depth
, format
,
4812 /* GL_ARB_multisample */
4813 static void GLAPIENTRY
4814 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4816 GET_CURRENT_CONTEXT(ctx
);
4818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4819 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4824 if (ctx
->ExecuteFlag
) {
4825 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4831 * GL_NV_fragment_program
4833 static void GLAPIENTRY
4834 save_BindProgramNV(GLenum target
, GLuint id
)
4836 GET_CURRENT_CONTEXT(ctx
);
4838 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4839 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4844 if (ctx
->ExecuteFlag
) {
4845 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4849 static void GLAPIENTRY
4850 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4851 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4853 GET_CURRENT_CONTEXT(ctx
);
4855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4856 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4865 if (ctx
->ExecuteFlag
) {
4866 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4871 static void GLAPIENTRY
4872 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4873 const GLfloat
*params
)
4875 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4876 params
[2], params
[3]);
4880 static void GLAPIENTRY
4881 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4882 const GLfloat
* params
)
4884 GET_CURRENT_CONTEXT(ctx
);
4886 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4890 const GLfloat
* p
= params
;
4892 for (i
= 0 ; i
< count
; i
++) {
4893 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4906 if (ctx
->ExecuteFlag
) {
4907 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4912 static void GLAPIENTRY
4913 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4914 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4916 save_ProgramEnvParameter4fARB(target
, index
,
4918 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4922 static void GLAPIENTRY
4923 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4924 const GLdouble
*params
)
4926 save_ProgramEnvParameter4fARB(target
, index
,
4927 (GLfloat
) params
[0],
4928 (GLfloat
) params
[1],
4929 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4933 static void GLAPIENTRY
4934 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4935 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4937 GET_CURRENT_CONTEXT(ctx
);
4939 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4940 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4949 if (ctx
->ExecuteFlag
) {
4950 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4955 static void GLAPIENTRY
4956 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4957 const GLfloat
*params
)
4959 GET_CURRENT_CONTEXT(ctx
);
4961 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4962 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4971 if (ctx
->ExecuteFlag
) {
4972 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4977 static void GLAPIENTRY
4978 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4979 const GLfloat
*params
)
4981 GET_CURRENT_CONTEXT(ctx
);
4983 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4987 const GLfloat
* p
= params
;
4989 for (i
= 0 ; i
< count
; i
++) {
4990 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5003 if (ctx
->ExecuteFlag
) {
5004 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5009 static void GLAPIENTRY
5010 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5011 GLdouble x
, GLdouble y
,
5012 GLdouble z
, GLdouble w
)
5014 GET_CURRENT_CONTEXT(ctx
);
5016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5017 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5021 n
[3].f
= (GLfloat
) x
;
5022 n
[4].f
= (GLfloat
) y
;
5023 n
[5].f
= (GLfloat
) z
;
5024 n
[6].f
= (GLfloat
) w
;
5026 if (ctx
->ExecuteFlag
) {
5027 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5032 static void GLAPIENTRY
5033 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5034 const GLdouble
*params
)
5036 GET_CURRENT_CONTEXT(ctx
);
5038 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5039 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5043 n
[3].f
= (GLfloat
) params
[0];
5044 n
[4].f
= (GLfloat
) params
[1];
5045 n
[5].f
= (GLfloat
) params
[2];
5046 n
[6].f
= (GLfloat
) params
[3];
5048 if (ctx
->ExecuteFlag
) {
5049 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5054 /* GL_EXT_stencil_two_side */
5055 static void GLAPIENTRY
5056 save_ActiveStencilFaceEXT(GLenum face
)
5058 GET_CURRENT_CONTEXT(ctx
);
5060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5061 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5065 if (ctx
->ExecuteFlag
) {
5066 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5071 /* GL_EXT_depth_bounds_test */
5072 static void GLAPIENTRY
5073 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5075 GET_CURRENT_CONTEXT(ctx
);
5077 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5078 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5080 n
[1].f
= (GLfloat
) zmin
;
5081 n
[2].f
= (GLfloat
) zmax
;
5083 if (ctx
->ExecuteFlag
) {
5084 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5090 static void GLAPIENTRY
5091 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5092 const GLvoid
* string
)
5094 GET_CURRENT_CONTEXT(ctx
);
5097 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5099 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
5101 GLubyte
*programCopy
= malloc(len
);
5103 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5106 memcpy(programCopy
, string
, len
);
5110 n
[4].data
= programCopy
;
5112 if (ctx
->ExecuteFlag
) {
5113 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5118 static void GLAPIENTRY
5119 save_BeginQueryARB(GLenum target
, GLuint id
)
5121 GET_CURRENT_CONTEXT(ctx
);
5123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5124 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5129 if (ctx
->ExecuteFlag
) {
5130 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5134 static void GLAPIENTRY
5135 save_EndQueryARB(GLenum target
)
5137 GET_CURRENT_CONTEXT(ctx
);
5139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5140 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5144 if (ctx
->ExecuteFlag
) {
5145 CALL_EndQuery(ctx
->Exec
, (target
));
5149 static void GLAPIENTRY
5150 save_QueryCounter(GLuint id
, GLenum target
)
5152 GET_CURRENT_CONTEXT(ctx
);
5154 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5155 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5160 if (ctx
->ExecuteFlag
) {
5161 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5165 static void GLAPIENTRY
5166 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5168 GET_CURRENT_CONTEXT(ctx
);
5170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5171 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5177 if (ctx
->ExecuteFlag
) {
5178 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5182 static void GLAPIENTRY
5183 save_EndQueryIndexed(GLenum target
, GLuint index
)
5185 GET_CURRENT_CONTEXT(ctx
);
5187 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5188 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5193 if (ctx
->ExecuteFlag
) {
5194 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5199 static void GLAPIENTRY
5200 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5202 GET_CURRENT_CONTEXT(ctx
);
5204 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5205 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5209 if (count
> MAX_DRAW_BUFFERS
)
5210 count
= MAX_DRAW_BUFFERS
;
5211 for (i
= 0; i
< count
; i
++) {
5212 n
[2 + i
].e
= buffers
[i
];
5215 if (ctx
->ExecuteFlag
) {
5216 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5220 static void GLAPIENTRY
5221 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5223 GET_CURRENT_CONTEXT(ctx
);
5226 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5234 if (ctx
->ExecuteFlag
) {
5235 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5239 static void GLAPIENTRY
5240 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5243 p
[0] = INT_TO_FLOAT(param
[0]);
5244 p
[1] = INT_TO_FLOAT(param
[1]);
5245 p
[2] = INT_TO_FLOAT(param
[2]);
5246 p
[3] = INT_TO_FLOAT(param
[3]);
5247 save_TexBumpParameterfvATI(pname
, p
);
5250 static void GLAPIENTRY
5251 save_BindFragmentShaderATI(GLuint id
)
5253 GET_CURRENT_CONTEXT(ctx
);
5256 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5260 if (ctx
->ExecuteFlag
) {
5261 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5265 static void GLAPIENTRY
5266 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5268 GET_CURRENT_CONTEXT(ctx
);
5271 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5279 if (ctx
->ExecuteFlag
) {
5280 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5284 static void GLAPIENTRY
5285 save_Attr1fNV(GLenum attr
, GLfloat x
)
5287 GET_CURRENT_CONTEXT(ctx
);
5289 SAVE_FLUSH_VERTICES(ctx
);
5290 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5296 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5297 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5298 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5300 if (ctx
->ExecuteFlag
) {
5301 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5305 static void GLAPIENTRY
5306 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5308 GET_CURRENT_CONTEXT(ctx
);
5310 SAVE_FLUSH_VERTICES(ctx
);
5311 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5318 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5319 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5320 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5322 if (ctx
->ExecuteFlag
) {
5323 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5327 static void GLAPIENTRY
5328 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5330 GET_CURRENT_CONTEXT(ctx
);
5332 SAVE_FLUSH_VERTICES(ctx
);
5333 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5341 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5342 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5343 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5345 if (ctx
->ExecuteFlag
) {
5346 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5350 static void GLAPIENTRY
5351 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5353 GET_CURRENT_CONTEXT(ctx
);
5355 SAVE_FLUSH_VERTICES(ctx
);
5356 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5365 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5366 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5367 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5369 if (ctx
->ExecuteFlag
) {
5370 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5375 static void GLAPIENTRY
5376 save_Attr1fARB(GLenum attr
, GLfloat x
)
5378 GET_CURRENT_CONTEXT(ctx
);
5380 SAVE_FLUSH_VERTICES(ctx
);
5381 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5387 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5388 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5389 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5391 if (ctx
->ExecuteFlag
) {
5392 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5396 static void GLAPIENTRY
5397 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5399 GET_CURRENT_CONTEXT(ctx
);
5401 SAVE_FLUSH_VERTICES(ctx
);
5402 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5409 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5410 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5411 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5413 if (ctx
->ExecuteFlag
) {
5414 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5418 static void GLAPIENTRY
5419 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5421 GET_CURRENT_CONTEXT(ctx
);
5423 SAVE_FLUSH_VERTICES(ctx
);
5424 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5432 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5433 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5434 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5436 if (ctx
->ExecuteFlag
) {
5437 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5441 static void GLAPIENTRY
5442 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5444 GET_CURRENT_CONTEXT(ctx
);
5446 SAVE_FLUSH_VERTICES(ctx
);
5447 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5456 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5457 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5458 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5460 if (ctx
->ExecuteFlag
) {
5461 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5466 static void GLAPIENTRY
5467 save_EvalCoord1f(GLfloat x
)
5469 GET_CURRENT_CONTEXT(ctx
);
5471 SAVE_FLUSH_VERTICES(ctx
);
5472 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5476 if (ctx
->ExecuteFlag
) {
5477 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5481 static void GLAPIENTRY
5482 save_EvalCoord1fv(const GLfloat
* v
)
5484 save_EvalCoord1f(v
[0]);
5487 static void GLAPIENTRY
5488 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5490 GET_CURRENT_CONTEXT(ctx
);
5492 SAVE_FLUSH_VERTICES(ctx
);
5493 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5498 if (ctx
->ExecuteFlag
) {
5499 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5503 static void GLAPIENTRY
5504 save_EvalCoord2fv(const GLfloat
* v
)
5506 save_EvalCoord2f(v
[0], v
[1]);
5510 static void GLAPIENTRY
5511 save_EvalPoint1(GLint x
)
5513 GET_CURRENT_CONTEXT(ctx
);
5515 SAVE_FLUSH_VERTICES(ctx
);
5516 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5520 if (ctx
->ExecuteFlag
) {
5521 CALL_EvalPoint1(ctx
->Exec
, (x
));
5525 static void GLAPIENTRY
5526 save_EvalPoint2(GLint x
, GLint y
)
5528 GET_CURRENT_CONTEXT(ctx
);
5530 SAVE_FLUSH_VERTICES(ctx
);
5531 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5536 if (ctx
->ExecuteFlag
) {
5537 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5541 static void GLAPIENTRY
5542 save_Indexf(GLfloat x
)
5544 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5547 static void GLAPIENTRY
5548 save_Indexfv(const GLfloat
* v
)
5550 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5553 static void GLAPIENTRY
5554 save_EdgeFlag(GLboolean x
)
5556 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5561 * Compare 'count' elements of vectors 'a' and 'b'.
5562 * \return GL_TRUE if equal, GL_FALSE if different.
5564 static inline GLboolean
5565 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5567 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5572 * This glMaterial function is used for glMaterial calls that are outside
5573 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5575 static void GLAPIENTRY
5576 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5578 GET_CURRENT_CONTEXT(ctx
);
5586 case GL_FRONT_AND_BACK
:
5589 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5598 case GL_AMBIENT_AND_DIFFUSE
:
5604 case GL_COLOR_INDEXES
:
5608 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5612 if (ctx
->ExecuteFlag
) {
5613 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5616 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5618 /* Try to eliminate redundant statechanges. Because it is legal to
5619 * call glMaterial even inside begin/end calls, don't need to worry
5620 * about ctx->Driver.CurrentSavePrimitive here.
5622 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5623 if (bitmask
& (1 << i
)) {
5624 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5625 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5626 /* no change in material value */
5627 bitmask
&= ~(1 << i
);
5630 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5631 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5636 /* If this call has no effect, return early */
5640 SAVE_FLUSH_VERTICES(ctx
);
5642 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5646 for (i
= 0; i
< args
; i
++)
5647 n
[3 + i
].f
= param
[i
];
5651 static void GLAPIENTRY
5652 save_Begin(GLenum mode
)
5654 GET_CURRENT_CONTEXT(ctx
);
5656 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5657 /* compile this error into the display list */
5658 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5660 else if (_mesa_inside_dlist_begin_end(ctx
)) {
5661 /* compile this error into the display list */
5662 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5667 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5669 /* Give the driver an opportunity to hook in an optimized
5670 * display list compiler.
5672 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5675 SAVE_FLUSH_VERTICES(ctx
);
5676 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5681 if (ctx
->ExecuteFlag
) {
5682 CALL_Begin(ctx
->Exec
, (mode
));
5687 static void GLAPIENTRY
5690 GET_CURRENT_CONTEXT(ctx
);
5691 SAVE_FLUSH_VERTICES(ctx
);
5692 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5693 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5694 if (ctx
->ExecuteFlag
) {
5695 CALL_End(ctx
->Exec
, ());
5699 static void GLAPIENTRY
5700 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5702 GET_CURRENT_CONTEXT(ctx
);
5704 SAVE_FLUSH_VERTICES(ctx
);
5705 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5712 if (ctx
->ExecuteFlag
) {
5713 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5718 static void GLAPIENTRY
5719 save_Vertex2f(GLfloat x
, GLfloat y
)
5721 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5724 static void GLAPIENTRY
5725 save_Vertex2fv(const GLfloat
* v
)
5727 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5730 static void GLAPIENTRY
5731 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5733 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5736 static void GLAPIENTRY
5737 save_Vertex3fv(const GLfloat
* v
)
5739 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5742 static void GLAPIENTRY
5743 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5745 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5748 static void GLAPIENTRY
5749 save_Vertex4fv(const GLfloat
* v
)
5751 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5754 static void GLAPIENTRY
5755 save_TexCoord1f(GLfloat x
)
5757 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5760 static void GLAPIENTRY
5761 save_TexCoord1fv(const GLfloat
* v
)
5763 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5766 static void GLAPIENTRY
5767 save_TexCoord2f(GLfloat x
, GLfloat y
)
5769 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5772 static void GLAPIENTRY
5773 save_TexCoord2fv(const GLfloat
* v
)
5775 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5778 static void GLAPIENTRY
5779 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5781 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5784 static void GLAPIENTRY
5785 save_TexCoord3fv(const GLfloat
* v
)
5787 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5790 static void GLAPIENTRY
5791 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5793 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5796 static void GLAPIENTRY
5797 save_TexCoord4fv(const GLfloat
* v
)
5799 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5802 static void GLAPIENTRY
5803 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5805 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5808 static void GLAPIENTRY
5809 save_Normal3fv(const GLfloat
* v
)
5811 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5814 static void GLAPIENTRY
5815 save_FogCoordfEXT(GLfloat x
)
5817 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5820 static void GLAPIENTRY
5821 save_FogCoordfvEXT(const GLfloat
* v
)
5823 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5826 static void GLAPIENTRY
5827 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5829 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5832 static void GLAPIENTRY
5833 save_Color3fv(const GLfloat
* v
)
5835 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5838 static void GLAPIENTRY
5839 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5841 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5844 static void GLAPIENTRY
5845 save_Color4fv(const GLfloat
* v
)
5847 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5850 static void GLAPIENTRY
5851 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5853 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5856 static void GLAPIENTRY
5857 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5859 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5863 /* Just call the respective ATTR for texcoord
5865 static void GLAPIENTRY
5866 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5868 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5869 save_Attr1fNV(attr
, x
);
5872 static void GLAPIENTRY
5873 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5875 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5876 save_Attr1fNV(attr
, v
[0]);
5879 static void GLAPIENTRY
5880 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5882 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5883 save_Attr2fNV(attr
, x
, y
);
5886 static void GLAPIENTRY
5887 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5889 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5890 save_Attr2fNV(attr
, v
[0], v
[1]);
5893 static void GLAPIENTRY
5894 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5896 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5897 save_Attr3fNV(attr
, x
, y
, z
);
5900 static void GLAPIENTRY
5901 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5903 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5904 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5907 static void GLAPIENTRY
5908 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5909 GLfloat z
, GLfloat w
)
5911 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5912 save_Attr4fNV(attr
, x
, y
, z
, w
);
5915 static void GLAPIENTRY
5916 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5918 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5919 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5924 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5930 GET_CURRENT_CONTEXT(ctx
);
5931 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5936 static void GLAPIENTRY
5937 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5939 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5940 save_Attr1fARB(index
, x
);
5945 static void GLAPIENTRY
5946 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5948 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5949 save_Attr1fARB(index
, v
[0]);
5954 static void GLAPIENTRY
5955 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5957 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5958 save_Attr2fARB(index
, x
, y
);
5963 static void GLAPIENTRY
5964 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5966 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5967 save_Attr2fARB(index
, v
[0], v
[1]);
5972 static void GLAPIENTRY
5973 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5975 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5976 save_Attr3fARB(index
, x
, y
, z
);
5981 static void GLAPIENTRY
5982 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5984 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5985 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5990 static void GLAPIENTRY
5991 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5994 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5995 save_Attr4fARB(index
, x
, y
, z
, w
);
6000 static void GLAPIENTRY
6001 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6003 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6004 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6009 static void GLAPIENTRY
6010 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6011 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6012 GLbitfield mask
, GLenum filter
)
6014 GET_CURRENT_CONTEXT(ctx
);
6016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6017 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6030 if (ctx
->ExecuteFlag
) {
6031 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6032 dstX0
, dstY0
, dstX1
, dstY1
,
6038 /** GL_EXT_provoking_vertex */
6039 static void GLAPIENTRY
6040 save_ProvokingVertexEXT(GLenum mode
)
6042 GET_CURRENT_CONTEXT(ctx
);
6044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6045 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6049 if (ctx
->ExecuteFlag
) {
6050 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6051 _mesa_ProvokingVertex(mode
);
6056 /** GL_EXT_transform_feedback */
6057 static void GLAPIENTRY
6058 save_BeginTransformFeedback(GLenum mode
)
6060 GET_CURRENT_CONTEXT(ctx
);
6062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6063 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6067 if (ctx
->ExecuteFlag
) {
6068 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6073 /** GL_EXT_transform_feedback */
6074 static void GLAPIENTRY
6075 save_EndTransformFeedback(void)
6077 GET_CURRENT_CONTEXT(ctx
);
6078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6079 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6080 if (ctx
->ExecuteFlag
) {
6081 CALL_EndTransformFeedback(ctx
->Exec
, ());
6085 static void GLAPIENTRY
6086 save_BindTransformFeedback(GLenum target
, GLuint name
)
6088 GET_CURRENT_CONTEXT(ctx
);
6090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6091 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6096 if (ctx
->ExecuteFlag
) {
6097 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6101 static void GLAPIENTRY
6102 save_PauseTransformFeedback(void)
6104 GET_CURRENT_CONTEXT(ctx
);
6105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6106 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6107 if (ctx
->ExecuteFlag
) {
6108 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6112 static void GLAPIENTRY
6113 save_ResumeTransformFeedback(void)
6115 GET_CURRENT_CONTEXT(ctx
);
6116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6117 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6118 if (ctx
->ExecuteFlag
) {
6119 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6123 static void GLAPIENTRY
6124 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6126 GET_CURRENT_CONTEXT(ctx
);
6128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6129 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6134 if (ctx
->ExecuteFlag
) {
6135 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6139 static void GLAPIENTRY
6140 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6142 GET_CURRENT_CONTEXT(ctx
);
6144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6145 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6151 if (ctx
->ExecuteFlag
) {
6152 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6156 static void GLAPIENTRY
6157 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6160 GET_CURRENT_CONTEXT(ctx
);
6162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6163 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6167 n
[3].si
= primcount
;
6169 if (ctx
->ExecuteFlag
) {
6170 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6174 static void GLAPIENTRY
6175 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6176 GLuint stream
, GLsizei primcount
)
6178 GET_CURRENT_CONTEXT(ctx
);
6180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6181 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6186 n
[4].si
= primcount
;
6188 if (ctx
->ExecuteFlag
) {
6189 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6194 /* aka UseProgram() */
6195 static void GLAPIENTRY
6196 save_UseProgramObjectARB(GLhandleARB program
)
6198 GET_CURRENT_CONTEXT(ctx
);
6200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6201 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6205 if (ctx
->ExecuteFlag
) {
6206 CALL_UseProgram(ctx
->Exec
, (program
));
6211 static void GLAPIENTRY
6212 save_Uniform1fARB(GLint location
, GLfloat x
)
6214 GET_CURRENT_CONTEXT(ctx
);
6216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6217 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6222 if (ctx
->ExecuteFlag
) {
6223 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6228 static void GLAPIENTRY
6229 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6231 GET_CURRENT_CONTEXT(ctx
);
6233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6234 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6240 if (ctx
->ExecuteFlag
) {
6241 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6246 static void GLAPIENTRY
6247 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6249 GET_CURRENT_CONTEXT(ctx
);
6251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6252 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6259 if (ctx
->ExecuteFlag
) {
6260 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6265 static void GLAPIENTRY
6266 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6268 GET_CURRENT_CONTEXT(ctx
);
6270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6271 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6279 if (ctx
->ExecuteFlag
) {
6280 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6285 /** Return copy of memory */
6287 memdup(const void *src
, GLsizei bytes
)
6289 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
6291 memcpy(b
, src
, bytes
);
6296 static void GLAPIENTRY
6297 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6299 GET_CURRENT_CONTEXT(ctx
);
6301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6302 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6306 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6308 if (ctx
->ExecuteFlag
) {
6309 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6313 static void GLAPIENTRY
6314 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6316 GET_CURRENT_CONTEXT(ctx
);
6318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6319 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6323 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6325 if (ctx
->ExecuteFlag
) {
6326 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6330 static void GLAPIENTRY
6331 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6333 GET_CURRENT_CONTEXT(ctx
);
6335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6336 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6340 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6342 if (ctx
->ExecuteFlag
) {
6343 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6347 static void GLAPIENTRY
6348 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6350 GET_CURRENT_CONTEXT(ctx
);
6352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6353 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6357 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6359 if (ctx
->ExecuteFlag
) {
6360 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6365 static void GLAPIENTRY
6366 save_Uniform1iARB(GLint location
, GLint x
)
6368 GET_CURRENT_CONTEXT(ctx
);
6370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6371 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6376 if (ctx
->ExecuteFlag
) {
6377 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6381 static void GLAPIENTRY
6382 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6384 GET_CURRENT_CONTEXT(ctx
);
6386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6387 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6393 if (ctx
->ExecuteFlag
) {
6394 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6398 static void GLAPIENTRY
6399 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6401 GET_CURRENT_CONTEXT(ctx
);
6403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6404 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6411 if (ctx
->ExecuteFlag
) {
6412 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6416 static void GLAPIENTRY
6417 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6419 GET_CURRENT_CONTEXT(ctx
);
6421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6422 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6430 if (ctx
->ExecuteFlag
) {
6431 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6437 static void GLAPIENTRY
6438 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6440 GET_CURRENT_CONTEXT(ctx
);
6442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6443 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6447 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6454 static void GLAPIENTRY
6455 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6457 GET_CURRENT_CONTEXT(ctx
);
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6460 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6464 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6466 if (ctx
->ExecuteFlag
) {
6467 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6471 static void GLAPIENTRY
6472 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6474 GET_CURRENT_CONTEXT(ctx
);
6476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6477 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6481 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6483 if (ctx
->ExecuteFlag
) {
6484 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6488 static void GLAPIENTRY
6489 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6491 GET_CURRENT_CONTEXT(ctx
);
6493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6494 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6498 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6500 if (ctx
->ExecuteFlag
) {
6501 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6507 static void GLAPIENTRY
6508 save_Uniform1ui(GLint location
, GLuint x
)
6510 GET_CURRENT_CONTEXT(ctx
);
6512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6513 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6518 if (ctx
->ExecuteFlag
) {
6519 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6523 static void GLAPIENTRY
6524 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6526 GET_CURRENT_CONTEXT(ctx
);
6528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6529 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6535 if (ctx
->ExecuteFlag
) {
6536 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6540 static void GLAPIENTRY
6541 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6543 GET_CURRENT_CONTEXT(ctx
);
6545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6546 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6553 if (ctx
->ExecuteFlag
) {
6554 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6558 static void GLAPIENTRY
6559 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6561 GET_CURRENT_CONTEXT(ctx
);
6563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6564 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6572 if (ctx
->ExecuteFlag
) {
6573 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6579 static void GLAPIENTRY
6580 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6582 GET_CURRENT_CONTEXT(ctx
);
6584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6585 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6589 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6591 if (ctx
->ExecuteFlag
) {
6592 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6596 static void GLAPIENTRY
6597 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6599 GET_CURRENT_CONTEXT(ctx
);
6601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6602 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6606 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6608 if (ctx
->ExecuteFlag
) {
6609 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6613 static void GLAPIENTRY
6614 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6616 GET_CURRENT_CONTEXT(ctx
);
6618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6619 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6623 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6625 if (ctx
->ExecuteFlag
) {
6626 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6630 static void GLAPIENTRY
6631 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6633 GET_CURRENT_CONTEXT(ctx
);
6635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6636 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6640 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6642 if (ctx
->ExecuteFlag
) {
6643 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6649 static void GLAPIENTRY
6650 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6653 GET_CURRENT_CONTEXT(ctx
);
6655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6656 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6661 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6663 if (ctx
->ExecuteFlag
) {
6664 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6668 static void GLAPIENTRY
6669 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6672 GET_CURRENT_CONTEXT(ctx
);
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6675 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6680 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6682 if (ctx
->ExecuteFlag
) {
6683 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6687 static void GLAPIENTRY
6688 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6691 GET_CURRENT_CONTEXT(ctx
);
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6694 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6699 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6701 if (ctx
->ExecuteFlag
) {
6702 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6707 static void GLAPIENTRY
6708 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6711 GET_CURRENT_CONTEXT(ctx
);
6713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6714 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6719 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6721 if (ctx
->ExecuteFlag
) {
6722 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6726 static void GLAPIENTRY
6727 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6730 GET_CURRENT_CONTEXT(ctx
);
6732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6733 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6738 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6740 if (ctx
->ExecuteFlag
) {
6741 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6746 static void GLAPIENTRY
6747 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6750 GET_CURRENT_CONTEXT(ctx
);
6752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6753 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6758 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6760 if (ctx
->ExecuteFlag
) {
6761 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6765 static void GLAPIENTRY
6766 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6769 GET_CURRENT_CONTEXT(ctx
);
6771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6772 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6777 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6779 if (ctx
->ExecuteFlag
) {
6780 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6785 static void GLAPIENTRY
6786 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6789 GET_CURRENT_CONTEXT(ctx
);
6791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6792 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6797 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6799 if (ctx
->ExecuteFlag
) {
6800 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6804 static void GLAPIENTRY
6805 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6808 GET_CURRENT_CONTEXT(ctx
);
6810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6811 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6816 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6818 if (ctx
->ExecuteFlag
) {
6819 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6823 static void GLAPIENTRY
6824 save_ClampColorARB(GLenum target
, GLenum clamp
)
6826 GET_CURRENT_CONTEXT(ctx
);
6828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6829 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6834 if (ctx
->ExecuteFlag
) {
6835 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6839 static void GLAPIENTRY
6840 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6842 GET_CURRENT_CONTEXT(ctx
);
6844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6845 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6850 if (ctx
->ExecuteFlag
) {
6851 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6855 static void GLAPIENTRY
6856 save_ActiveProgramEXT(GLuint program
)
6858 GET_CURRENT_CONTEXT(ctx
);
6860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6861 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6865 if (ctx
->ExecuteFlag
) {
6866 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6870 /** GL_EXT_texture_integer */
6871 static void GLAPIENTRY
6872 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6874 GET_CURRENT_CONTEXT(ctx
);
6876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6877 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6884 if (ctx
->ExecuteFlag
) {
6885 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6889 /** GL_EXT_texture_integer */
6890 static void GLAPIENTRY
6891 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6893 GET_CURRENT_CONTEXT(ctx
);
6895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6896 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6903 if (ctx
->ExecuteFlag
) {
6904 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6908 /** GL_EXT_texture_integer */
6909 static void GLAPIENTRY
6910 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6912 GET_CURRENT_CONTEXT(ctx
);
6914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6915 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6924 if (ctx
->ExecuteFlag
) {
6925 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6929 /** GL_EXT_texture_integer */
6930 static void GLAPIENTRY
6931 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6933 GET_CURRENT_CONTEXT(ctx
);
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6936 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6940 n
[3].ui
= params
[0];
6941 n
[4].ui
= params
[1];
6942 n
[5].ui
= params
[2];
6943 n
[6].ui
= params
[3];
6945 if (ctx
->ExecuteFlag
) {
6946 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6950 /* GL_ARB_instanced_arrays */
6951 static void GLAPIENTRY
6952 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6954 GET_CURRENT_CONTEXT(ctx
);
6956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6957 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6962 if (ctx
->ExecuteFlag
) {
6963 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6968 /* GL_NV_texture_barrier */
6969 static void GLAPIENTRY
6970 save_TextureBarrierNV(void)
6972 GET_CURRENT_CONTEXT(ctx
);
6973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6974 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6975 if (ctx
->ExecuteFlag
) {
6976 CALL_TextureBarrierNV(ctx
->Exec
, ());
6981 /* GL_ARB_sampler_objects */
6982 static void GLAPIENTRY
6983 save_BindSampler(GLuint unit
, GLuint sampler
)
6986 GET_CURRENT_CONTEXT(ctx
);
6987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6988 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6993 if (ctx
->ExecuteFlag
) {
6994 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6998 static void GLAPIENTRY
6999 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7002 GET_CURRENT_CONTEXT(ctx
);
7003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7004 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7009 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7015 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7018 if (ctx
->ExecuteFlag
) {
7019 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7023 static void GLAPIENTRY
7024 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7026 save_SamplerParameteriv(sampler
, pname
, ¶m
);
7029 static void GLAPIENTRY
7030 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7033 GET_CURRENT_CONTEXT(ctx
);
7034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7035 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7040 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7046 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7049 if (ctx
->ExecuteFlag
) {
7050 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7054 static void GLAPIENTRY
7055 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7057 save_SamplerParameterfv(sampler
, pname
, ¶m
);
7060 static void GLAPIENTRY
7061 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7064 GET_CURRENT_CONTEXT(ctx
);
7065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7066 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7071 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7077 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7080 if (ctx
->ExecuteFlag
) {
7081 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7085 static void GLAPIENTRY
7086 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7089 GET_CURRENT_CONTEXT(ctx
);
7090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7091 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7095 n
[3].ui
= params
[0];
7096 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7097 n
[4].ui
= params
[1];
7098 n
[5].ui
= params
[2];
7099 n
[6].ui
= params
[3];
7102 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7105 if (ctx
->ExecuteFlag
) {
7106 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7110 /* GL_ARB_geometry_shader4 */
7111 static void GLAPIENTRY
7112 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7115 GET_CURRENT_CONTEXT(ctx
);
7116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7117 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7123 if (ctx
->ExecuteFlag
) {
7124 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7128 static void GLAPIENTRY
7129 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7130 GLuint texture
, GLint level
)
7133 GET_CURRENT_CONTEXT(ctx
);
7134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7135 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7138 n
[2].e
= attachment
;
7142 if (ctx
->ExecuteFlag
) {
7143 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7147 static void GLAPIENTRY
7148 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7149 GLuint texture
, GLint level
, GLenum face
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7154 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7157 n
[2].e
= attachment
;
7162 if (ctx
->ExecuteFlag
) {
7163 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7170 static void GLAPIENTRY
7171 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7174 GET_CURRENT_CONTEXT(ctx
);
7175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7176 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7178 union uint64_pair p
;
7182 n
[3].ui
= p
.uint32
[0];
7183 n
[4].ui
= p
.uint32
[1];
7185 if (ctx
->ExecuteFlag
) {
7186 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7191 /** GL_NV_conditional_render */
7192 static void GLAPIENTRY
7193 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7195 GET_CURRENT_CONTEXT(ctx
);
7197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7198 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7203 if (ctx
->ExecuteFlag
) {
7204 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7208 static void GLAPIENTRY
7209 save_EndConditionalRender(void)
7211 GET_CURRENT_CONTEXT(ctx
);
7212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7213 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7214 if (ctx
->ExecuteFlag
) {
7215 CALL_EndConditionalRender(ctx
->Exec
, ());
7219 static void GLAPIENTRY
7220 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7222 GET_CURRENT_CONTEXT(ctx
);
7224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7225 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7231 if (ctx
->ExecuteFlag
) {
7232 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7238 * Save an error-generating command into display list.
7240 * KW: Will appear in the list before the vertex buffer containing the
7241 * command that provoked the error. I don't see this as a problem.
7244 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7247 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
7250 n
[2].data
= (void *) s
;
7256 * Compile an error into current display list.
7259 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7261 if (ctx
->CompileFlag
)
7262 save_error(ctx
, error
, s
);
7263 if (ctx
->ExecuteFlag
)
7264 _mesa_error(ctx
, error
, "%s", s
);
7269 * Test if ID names a display list.
7272 islist(struct gl_context
*ctx
, GLuint list
)
7274 if (list
> 0 && lookup_list(ctx
, list
)) {
7284 /**********************************************************************/
7285 /* Display list execution */
7286 /**********************************************************************/
7290 * Execute a display list. Note that the ListBase offset must have already
7291 * been added before calling this function. I.e. the list argument is
7292 * the absolute list number, not relative to ListBase.
7293 * \param list - display list number
7296 execute_list(struct gl_context
*ctx
, GLuint list
)
7298 struct gl_display_list
*dlist
;
7302 if (list
== 0 || !islist(ctx
, list
))
7305 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7306 /* raise an error? */
7310 dlist
= lookup_list(ctx
, list
);
7314 ctx
->ListState
.CallDepth
++;
7316 if (ctx
->Driver
.BeginCallList
)
7317 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7323 const OpCode opcode
= n
[0].opcode
;
7325 if (is_ext_opcode(opcode
)) {
7326 n
+= ext_opcode_execute(ctx
, n
);
7331 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
7334 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7336 case OPCODE_ALPHA_FUNC
:
7337 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7339 case OPCODE_BIND_TEXTURE
:
7340 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7344 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7345 ctx
->Unpack
= ctx
->DefaultPacking
;
7346 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7347 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7348 (const GLubyte
*) n
[7].data
));
7349 ctx
->Unpack
= save
; /* restore */
7352 case OPCODE_BLEND_COLOR
:
7353 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7355 case OPCODE_BLEND_EQUATION
:
7356 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7358 case OPCODE_BLEND_EQUATION_SEPARATE
:
7359 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7361 case OPCODE_BLEND_FUNC_SEPARATE
:
7362 CALL_BlendFuncSeparate(ctx
->Exec
,
7363 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7366 case OPCODE_BLEND_FUNC_I
:
7367 /* GL_ARB_draw_buffers_blend */
7368 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7370 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7371 /* GL_ARB_draw_buffers_blend */
7372 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7375 case OPCODE_BLEND_EQUATION_I
:
7376 /* GL_ARB_draw_buffers_blend */
7377 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7379 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7380 /* GL_ARB_draw_buffers_blend */
7381 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7382 (n
[1].ui
, n
[2].e
, n
[3].e
));
7385 case OPCODE_CALL_LIST
:
7386 /* Generated by glCallList(), don't add ListBase */
7387 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7388 execute_list(ctx
, n
[1].ui
);
7391 case OPCODE_CALL_LIST_OFFSET
:
7392 /* Generated by glCallLists() so we must add ListBase */
7394 /* user specified a bad data type at compile time */
7395 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7397 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7398 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7399 execute_list(ctx
, list
);
7403 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7405 case OPCODE_CLEAR_BUFFER_IV
:
7412 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7415 case OPCODE_CLEAR_BUFFER_UIV
:
7422 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7425 case OPCODE_CLEAR_BUFFER_FV
:
7432 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7435 case OPCODE_CLEAR_BUFFER_FI
:
7436 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7438 case OPCODE_CLEAR_COLOR
:
7439 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7441 case OPCODE_CLEAR_ACCUM
:
7442 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7444 case OPCODE_CLEAR_DEPTH
:
7445 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7447 case OPCODE_CLEAR_INDEX
:
7448 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7450 case OPCODE_CLEAR_STENCIL
:
7451 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7453 case OPCODE_CLIP_PLANE
:
7460 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7463 case OPCODE_COLOR_MASK
:
7464 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7466 case OPCODE_COLOR_MASK_INDEXED
:
7467 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7470 case OPCODE_COLOR_MATERIAL
:
7471 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7473 case OPCODE_COLOR_TABLE
:
7475 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7476 ctx
->Unpack
= ctx
->DefaultPacking
;
7477 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
7478 n
[5].e
, n
[6].data
));
7479 ctx
->Unpack
= save
; /* restore */
7482 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7489 CALL_ColorTableParameterfv(ctx
->Exec
,
7490 (n
[1].e
, n
[2].e
, params
));
7493 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7500 CALL_ColorTableParameteriv(ctx
->Exec
,
7501 (n
[1].e
, n
[2].e
, params
));
7504 case OPCODE_COLOR_SUB_TABLE
:
7506 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7507 ctx
->Unpack
= ctx
->DefaultPacking
;
7508 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7509 n
[4].e
, n
[5].e
, n
[6].data
));
7510 ctx
->Unpack
= save
; /* restore */
7513 case OPCODE_CONVOLUTION_FILTER_1D
:
7515 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7516 ctx
->Unpack
= ctx
->DefaultPacking
;
7517 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7520 ctx
->Unpack
= save
; /* restore */
7523 case OPCODE_CONVOLUTION_FILTER_2D
:
7525 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7526 ctx
->Unpack
= ctx
->DefaultPacking
;
7527 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7528 n
[4].i
, n
[5].e
, n
[6].e
,
7530 ctx
->Unpack
= save
; /* restore */
7533 case OPCODE_CONVOLUTION_PARAMETER_I
:
7534 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
7536 case OPCODE_CONVOLUTION_PARAMETER_IV
:
7543 CALL_ConvolutionParameteriv(ctx
->Exec
,
7544 (n
[1].e
, n
[2].e
, params
));
7547 case OPCODE_CONVOLUTION_PARAMETER_F
:
7548 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
7550 case OPCODE_CONVOLUTION_PARAMETER_FV
:
7557 CALL_ConvolutionParameterfv(ctx
->Exec
,
7558 (n
[1].e
, n
[2].e
, params
));
7561 case OPCODE_COPY_COLOR_SUB_TABLE
:
7562 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7563 n
[3].i
, n
[4].i
, n
[5].i
));
7565 case OPCODE_COPY_COLOR_TABLE
:
7566 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7567 n
[3].i
, n
[4].i
, n
[5].i
));
7569 case OPCODE_COPY_PIXELS
:
7570 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7571 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7574 case OPCODE_COPY_TEX_IMAGE1D
:
7575 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7576 n
[5].i
, n
[6].i
, n
[7].i
));
7578 case OPCODE_COPY_TEX_IMAGE2D
:
7579 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7580 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7582 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7583 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7584 n
[4].i
, n
[5].i
, n
[6].i
));
7586 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7587 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7588 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7591 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7592 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7593 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7596 case OPCODE_CULL_FACE
:
7597 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7599 case OPCODE_DEPTH_FUNC
:
7600 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7602 case OPCODE_DEPTH_MASK
:
7603 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7605 case OPCODE_DEPTH_RANGE
:
7606 CALL_DepthRange(ctx
->Exec
,
7607 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7609 case OPCODE_DISABLE
:
7610 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7612 case OPCODE_DISABLE_INDEXED
:
7613 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7615 case OPCODE_DRAW_BUFFER
:
7616 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7618 case OPCODE_DRAW_PIXELS
:
7620 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7621 ctx
->Unpack
= ctx
->DefaultPacking
;
7622 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7624 ctx
->Unpack
= save
; /* restore */
7628 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7630 case OPCODE_ENABLE_INDEXED
:
7631 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7633 case OPCODE_EVALMESH1
:
7634 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7636 case OPCODE_EVALMESH2
:
7637 CALL_EvalMesh2(ctx
->Exec
,
7638 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7647 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7650 case OPCODE_FRONT_FACE
:
7651 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7653 case OPCODE_FRUSTUM
:
7654 CALL_Frustum(ctx
->Exec
,
7655 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7658 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7660 case OPCODE_HISTOGRAM
:
7661 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
7663 case OPCODE_INDEX_MASK
:
7664 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7666 case OPCODE_INIT_NAMES
:
7667 CALL_InitNames(ctx
->Exec
, ());
7676 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7679 case OPCODE_LIGHT_MODEL
:
7686 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7689 case OPCODE_LINE_STIPPLE
:
7690 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7692 case OPCODE_LINE_WIDTH
:
7693 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7695 case OPCODE_LIST_BASE
:
7696 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7698 case OPCODE_LOAD_IDENTITY
:
7699 CALL_LoadIdentity(ctx
->Exec
, ());
7701 case OPCODE_LOAD_MATRIX
:
7702 if (sizeof(Node
) == sizeof(GLfloat
)) {
7703 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7708 for (i
= 0; i
< 16; i
++) {
7711 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7714 case OPCODE_LOAD_NAME
:
7715 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7717 case OPCODE_LOGIC_OP
:
7718 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7722 GLenum target
= n
[1].e
;
7723 GLint ustride
= _mesa_evaluator_components(target
);
7724 GLint uorder
= n
[5].i
;
7725 GLfloat u1
= n
[2].f
;
7726 GLfloat u2
= n
[3].f
;
7727 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7728 (GLfloat
*) n
[6].data
));
7733 GLenum target
= n
[1].e
;
7734 GLfloat u1
= n
[2].f
;
7735 GLfloat u2
= n
[3].f
;
7736 GLfloat v1
= n
[4].f
;
7737 GLfloat v2
= n
[5].f
;
7738 GLint ustride
= n
[6].i
;
7739 GLint vstride
= n
[7].i
;
7740 GLint uorder
= n
[8].i
;
7741 GLint vorder
= n
[9].i
;
7742 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7743 v1
, v2
, vstride
, vorder
,
7744 (GLfloat
*) n
[10].data
));
7747 case OPCODE_MAPGRID1
:
7748 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7750 case OPCODE_MAPGRID2
:
7751 CALL_MapGrid2f(ctx
->Exec
,
7752 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7754 case OPCODE_MATRIX_MODE
:
7755 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7757 case OPCODE_MIN_MAX
:
7758 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
7760 case OPCODE_MULT_MATRIX
:
7761 if (sizeof(Node
) == sizeof(GLfloat
)) {
7762 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7767 for (i
= 0; i
< 16; i
++) {
7770 CALL_MultMatrixf(ctx
->Exec
, (m
));
7774 CALL_Ortho(ctx
->Exec
,
7775 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7777 case OPCODE_PASSTHROUGH
:
7778 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7780 case OPCODE_PIXEL_MAP
:
7781 CALL_PixelMapfv(ctx
->Exec
,
7782 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7784 case OPCODE_PIXEL_TRANSFER
:
7785 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7787 case OPCODE_PIXEL_ZOOM
:
7788 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7790 case OPCODE_POINT_SIZE
:
7791 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7793 case OPCODE_POINT_PARAMETERS
:
7799 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7802 case OPCODE_POLYGON_MODE
:
7803 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7805 case OPCODE_POLYGON_STIPPLE
:
7807 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7808 ctx
->Unpack
= ctx
->DefaultPacking
;
7809 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7810 ctx
->Unpack
= save
; /* restore */
7813 case OPCODE_POLYGON_OFFSET
:
7814 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7816 case OPCODE_POP_ATTRIB
:
7817 CALL_PopAttrib(ctx
->Exec
, ());
7819 case OPCODE_POP_MATRIX
:
7820 CALL_PopMatrix(ctx
->Exec
, ());
7822 case OPCODE_POP_NAME
:
7823 CALL_PopName(ctx
->Exec
, ());
7825 case OPCODE_PRIORITIZE_TEXTURE
:
7826 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7828 case OPCODE_PUSH_ATTRIB
:
7829 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7831 case OPCODE_PUSH_MATRIX
:
7832 CALL_PushMatrix(ctx
->Exec
, ());
7834 case OPCODE_PUSH_NAME
:
7835 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7837 case OPCODE_RASTER_POS
:
7838 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7840 case OPCODE_READ_BUFFER
:
7841 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7843 case OPCODE_RESET_HISTOGRAM
:
7844 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
7846 case OPCODE_RESET_MIN_MAX
:
7847 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7850 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7853 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7855 case OPCODE_SCISSOR
:
7856 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7858 case OPCODE_SHADE_MODEL
:
7859 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7861 case OPCODE_PROVOKING_VERTEX
:
7862 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7864 case OPCODE_STENCIL_FUNC
:
7865 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7867 case OPCODE_STENCIL_MASK
:
7868 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7870 case OPCODE_STENCIL_OP
:
7871 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7873 case OPCODE_STENCIL_FUNC_SEPARATE
:
7874 CALL_StencilFuncSeparate(ctx
->Exec
,
7875 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7877 case OPCODE_STENCIL_MASK_SEPARATE
:
7878 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7880 case OPCODE_STENCIL_OP_SEPARATE
:
7881 CALL_StencilOpSeparate(ctx
->Exec
,
7882 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7891 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7901 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7904 case OPCODE_TEXPARAMETER
:
7911 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7914 case OPCODE_TEX_IMAGE1D
:
7916 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7917 ctx
->Unpack
= ctx
->DefaultPacking
;
7918 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7920 n
[3].i
, /* components */
7922 n
[5].e
, /* border */
7923 n
[6].e
, /* format */
7926 ctx
->Unpack
= save
; /* restore */
7929 case OPCODE_TEX_IMAGE2D
:
7931 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7932 ctx
->Unpack
= ctx
->DefaultPacking
;
7933 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7935 n
[3].i
, /* components */
7937 n
[5].i
, /* height */
7938 n
[6].e
, /* border */
7939 n
[7].e
, /* format */
7942 ctx
->Unpack
= save
; /* restore */
7945 case OPCODE_TEX_IMAGE3D
:
7947 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7948 ctx
->Unpack
= ctx
->DefaultPacking
;
7949 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7951 n
[3].i
, /* components */
7953 n
[5].i
, /* height */
7955 n
[7].e
, /* border */
7956 n
[8].e
, /* format */
7959 ctx
->Unpack
= save
; /* restore */
7962 case OPCODE_TEX_SUB_IMAGE1D
:
7964 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7965 ctx
->Unpack
= ctx
->DefaultPacking
;
7966 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7968 n
[6].e
, n
[7].data
));
7969 ctx
->Unpack
= save
; /* restore */
7972 case OPCODE_TEX_SUB_IMAGE2D
:
7974 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7975 ctx
->Unpack
= ctx
->DefaultPacking
;
7976 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7978 n
[6].i
, n
[7].e
, n
[8].e
,
7980 ctx
->Unpack
= save
; /* restore */
7983 case OPCODE_TEX_SUB_IMAGE3D
:
7985 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7986 ctx
->Unpack
= ctx
->DefaultPacking
;
7987 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7988 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7989 n
[8].i
, n
[9].e
, n
[10].e
,
7991 ctx
->Unpack
= save
; /* restore */
7994 case OPCODE_TRANSLATE
:
7995 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7997 case OPCODE_VIEWPORT
:
7998 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7999 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8001 case OPCODE_WINDOW_POS
:
8002 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8004 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8005 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8007 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8008 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8009 n
[4].i
, n
[5].i
, n
[6].i
,
8012 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8013 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8014 n
[4].i
, n
[5].i
, n
[6].i
,
8015 n
[7].i
, n
[8].data
));
8017 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8018 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8019 n
[4].i
, n
[5].i
, n
[6].i
,
8023 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8024 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8025 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8026 n
[5].e
, n
[6].i
, n
[7].data
));
8028 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8029 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8030 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8031 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8034 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8035 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8036 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8037 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8038 n
[9].e
, n
[10].i
, n
[11].data
));
8040 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8041 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8043 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8044 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8046 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8047 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8049 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8050 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8051 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8054 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8055 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8057 case OPCODE_DEPTH_BOUNDS_EXT
:
8058 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8060 case OPCODE_PROGRAM_STRING_ARB
:
8061 CALL_ProgramStringARB(ctx
->Exec
,
8062 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
8064 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8065 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8069 case OPCODE_BEGIN_QUERY_ARB
:
8070 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8072 case OPCODE_END_QUERY_ARB
:
8073 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8075 case OPCODE_QUERY_COUNTER
:
8076 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8078 case OPCODE_BEGIN_QUERY_INDEXED
:
8079 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8081 case OPCODE_END_QUERY_INDEXED
:
8082 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8084 case OPCODE_DRAW_BUFFERS_ARB
:
8086 GLenum buffers
[MAX_DRAW_BUFFERS
];
8087 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8088 for (i
= 0; i
< count
; i
++)
8089 buffers
[i
] = n
[2 + i
].e
;
8090 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8093 case OPCODE_BLIT_FRAMEBUFFER
:
8094 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8095 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8098 case OPCODE_USE_PROGRAM
:
8099 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8101 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8102 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8104 case OPCODE_ACTIVE_PROGRAM_EXT
:
8105 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8107 case OPCODE_UNIFORM_1F
:
8108 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8110 case OPCODE_UNIFORM_2F
:
8111 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8113 case OPCODE_UNIFORM_3F
:
8114 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8116 case OPCODE_UNIFORM_4F
:
8117 CALL_Uniform4f(ctx
->Exec
,
8118 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8120 case OPCODE_UNIFORM_1FV
:
8121 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8123 case OPCODE_UNIFORM_2FV
:
8124 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8126 case OPCODE_UNIFORM_3FV
:
8127 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8129 case OPCODE_UNIFORM_4FV
:
8130 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8132 case OPCODE_UNIFORM_1I
:
8133 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8135 case OPCODE_UNIFORM_2I
:
8136 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8138 case OPCODE_UNIFORM_3I
:
8139 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8141 case OPCODE_UNIFORM_4I
:
8142 CALL_Uniform4i(ctx
->Exec
,
8143 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8145 case OPCODE_UNIFORM_1IV
:
8146 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8148 case OPCODE_UNIFORM_2IV
:
8149 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8151 case OPCODE_UNIFORM_3IV
:
8152 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8154 case OPCODE_UNIFORM_4IV
:
8155 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8157 case OPCODE_UNIFORM_1UI
:
8158 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8160 case OPCODE_UNIFORM_2UI
:
8161 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8163 case OPCODE_UNIFORM_3UI
:
8164 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8166 case OPCODE_UNIFORM_4UI
:
8167 /*CALL_Uniform4uiARB(ctx->Exec,
8168 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8171 case OPCODE_UNIFORM_1UIV
:
8172 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8174 case OPCODE_UNIFORM_2UIV
:
8175 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8177 case OPCODE_UNIFORM_3UIV
:
8178 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8180 case OPCODE_UNIFORM_4UIV
:
8181 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8183 case OPCODE_UNIFORM_MATRIX22
:
8184 CALL_UniformMatrix2fv(ctx
->Exec
,
8185 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8187 case OPCODE_UNIFORM_MATRIX33
:
8188 CALL_UniformMatrix3fv(ctx
->Exec
,
8189 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8191 case OPCODE_UNIFORM_MATRIX44
:
8192 CALL_UniformMatrix4fv(ctx
->Exec
,
8193 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8195 case OPCODE_UNIFORM_MATRIX23
:
8196 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8197 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8199 case OPCODE_UNIFORM_MATRIX32
:
8200 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8201 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8203 case OPCODE_UNIFORM_MATRIX24
:
8204 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8205 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8207 case OPCODE_UNIFORM_MATRIX42
:
8208 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8209 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8211 case OPCODE_UNIFORM_MATRIX34
:
8212 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8213 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8215 case OPCODE_UNIFORM_MATRIX43
:
8216 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8217 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8220 case OPCODE_CLAMP_COLOR
:
8221 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8224 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8227 GLuint i
, pname
= n
[1].ui
;
8229 for (i
= 0; i
< 4; i
++)
8230 values
[i
] = n
[1 + i
].f
;
8231 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8234 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8235 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8237 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8240 GLuint i
, dst
= n
[1].ui
;
8242 for (i
= 0; i
< 4; i
++)
8243 values
[i
] = n
[1 + i
].f
;
8244 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8247 case OPCODE_ATTR_1F_NV
:
8248 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8250 case OPCODE_ATTR_2F_NV
:
8251 /* Really shouldn't have to do this - the Node structure
8252 * is convenient, but it would be better to store the data
8253 * packed appropriately so that it can be sent directly
8254 * on. With x86_64 becoming common, this will start to
8257 if (sizeof(Node
) == sizeof(GLfloat
))
8258 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8260 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8262 case OPCODE_ATTR_3F_NV
:
8263 if (sizeof(Node
) == sizeof(GLfloat
))
8264 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8266 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8269 case OPCODE_ATTR_4F_NV
:
8270 if (sizeof(Node
) == sizeof(GLfloat
))
8271 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8273 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8276 case OPCODE_ATTR_1F_ARB
:
8277 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8279 case OPCODE_ATTR_2F_ARB
:
8280 /* Really shouldn't have to do this - the Node structure
8281 * is convenient, but it would be better to store the data
8282 * packed appropriately so that it can be sent directly
8283 * on. With x86_64 becoming common, this will start to
8286 if (sizeof(Node
) == sizeof(GLfloat
))
8287 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8289 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8291 case OPCODE_ATTR_3F_ARB
:
8292 if (sizeof(Node
) == sizeof(GLfloat
))
8293 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8295 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8298 case OPCODE_ATTR_4F_ARB
:
8299 if (sizeof(Node
) == sizeof(GLfloat
))
8300 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8302 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8305 case OPCODE_MATERIAL
:
8306 if (sizeof(Node
) == sizeof(GLfloat
))
8307 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8314 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8318 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8321 CALL_End(ctx
->Exec
, ());
8324 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8326 case OPCODE_EVAL_C1
:
8327 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8329 case OPCODE_EVAL_C2
:
8330 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8332 case OPCODE_EVAL_P1
:
8333 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8335 case OPCODE_EVAL_P2
:
8336 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8339 /* GL_EXT_texture_integer */
8340 case OPCODE_CLEARCOLOR_I
:
8341 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8343 case OPCODE_CLEARCOLOR_UI
:
8344 CALL_ClearColorIuiEXT(ctx
->Exec
,
8345 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8347 case OPCODE_TEXPARAMETER_I
:
8354 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8357 case OPCODE_TEXPARAMETER_UI
:
8360 params
[0] = n
[3].ui
;
8361 params
[1] = n
[4].ui
;
8362 params
[2] = n
[5].ui
;
8363 params
[3] = n
[6].ui
;
8364 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8368 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8369 /* GL_ARB_instanced_arrays */
8370 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8373 case OPCODE_TEXTURE_BARRIER_NV
:
8374 CALL_TextureBarrierNV(ctx
->Exec
, ());
8377 /* GL_EXT/ARB_transform_feedback */
8378 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8379 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8381 case OPCODE_END_TRANSFORM_FEEDBACK
:
8382 CALL_EndTransformFeedback(ctx
->Exec
, ());
8384 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8385 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8387 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8388 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8390 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8391 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8393 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8394 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8396 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8397 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8398 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8400 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8401 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8402 (n
[1].e
, n
[2].ui
, n
[3].si
));
8404 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8405 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8406 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8410 case OPCODE_BIND_SAMPLER
:
8411 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8413 case OPCODE_SAMPLER_PARAMETERIV
:
8420 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8423 case OPCODE_SAMPLER_PARAMETERFV
:
8430 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8433 case OPCODE_SAMPLER_PARAMETERIIV
:
8440 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8443 case OPCODE_SAMPLER_PARAMETERUIV
:
8446 params
[0] = n
[3].ui
;
8447 params
[1] = n
[4].ui
;
8448 params
[2] = n
[5].ui
;
8449 params
[3] = n
[6].ui
;
8450 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8454 /* GL_ARB_geometry_shader4 */
8455 case OPCODE_PROGRAM_PARAMETERI
:
8456 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8458 case OPCODE_FRAMEBUFFER_TEXTURE
:
8459 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8462 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8463 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8464 n
[3].ui
, n
[4].i
, n
[5].e
));
8468 case OPCODE_WAIT_SYNC
:
8470 union uint64_pair p
;
8471 p
.uint32
[0] = n
[3].ui
;
8472 p
.uint32
[1] = n
[4].ui
;
8473 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
8477 /* GL_NV_conditional_render */
8478 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8479 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8481 case OPCODE_END_CONDITIONAL_RENDER
:
8482 CALL_EndConditionalRender(ctx
->Exec
, ());
8485 case OPCODE_UNIFORM_BLOCK_BINDING
:
8486 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8489 case OPCODE_CONTINUE
:
8490 n
= (Node
*) n
[1].next
;
8492 case OPCODE_END_OF_LIST
:
8498 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8500 _mesa_problem(ctx
, "%s", msg
);
8505 /* increment n to point to next compiled command */
8506 if (opcode
!= OPCODE_CONTINUE
) {
8507 n
+= InstSize
[opcode
];
8512 if (ctx
->Driver
.EndCallList
)
8513 ctx
->Driver
.EndCallList(ctx
);
8515 ctx
->ListState
.CallDepth
--;
8520 /**********************************************************************/
8522 /**********************************************************************/
8525 * Test if a display list number is valid.
8527 GLboolean GLAPIENTRY
8528 _mesa_IsList(GLuint list
)
8530 GET_CURRENT_CONTEXT(ctx
);
8531 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8532 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8533 return islist(ctx
, list
);
8538 * Delete a sequence of consecutive display lists.
8541 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8543 GET_CURRENT_CONTEXT(ctx
);
8545 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8546 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8549 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8552 for (i
= list
; i
< list
+ range
; i
++) {
8553 destroy_list(ctx
, i
);
8559 * Return a display list number, n, such that lists n through n+range-1
8563 _mesa_GenLists(GLsizei range
)
8565 GET_CURRENT_CONTEXT(ctx
);
8567 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8568 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8571 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8579 * Make this an atomic operation
8581 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8583 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8585 /* reserve the list IDs by with empty/dummy lists */
8587 for (i
= 0; i
< range
; i
++) {
8588 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8589 make_list(base
+ i
, 1));
8593 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8600 * Begin a new display list.
8603 _mesa_NewList(GLuint name
, GLenum mode
)
8605 GET_CURRENT_CONTEXT(ctx
);
8607 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8608 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8610 if (MESA_VERBOSE
& VERBOSE_API
)
8611 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8612 _mesa_lookup_enum_by_nr(mode
));
8615 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8619 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8620 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8624 if (ctx
->ListState
.CurrentList
) {
8625 /* already compiling a display list */
8626 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8630 ctx
->CompileFlag
= GL_TRUE
;
8631 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8633 /* Reset accumulated list state */
8634 invalidate_saved_current_state( ctx
);
8636 /* Allocate new display list */
8637 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8638 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8639 ctx
->ListState
.CurrentPos
= 0;
8641 ctx
->Driver
.NewList(ctx
, name
, mode
);
8643 ctx
->CurrentDispatch
= ctx
->Save
;
8644 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8649 * End definition of current display list.
8654 GET_CURRENT_CONTEXT(ctx
);
8655 SAVE_FLUSH_VERTICES(ctx
);
8656 FLUSH_VERTICES(ctx
, 0);
8658 if (MESA_VERBOSE
& VERBOSE_API
)
8659 _mesa_debug(ctx
, "glEndList\n");
8661 if (ctx
->ExecuteFlag
&& _mesa_inside_dlist_begin_end(ctx
)) {
8662 _mesa_error(ctx
, GL_INVALID_OPERATION
,
8663 "glEndList() called inside glBegin/End");
8666 /* Check that a list is under construction */
8667 if (!ctx
->ListState
.CurrentList
) {
8668 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8672 /* Call before emitting END_OF_LIST, in case the driver wants to
8673 * emit opcodes itself.
8675 ctx
->Driver
.EndList(ctx
);
8677 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8679 /* Destroy old list, if any */
8680 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8682 /* Install the new list */
8683 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8684 ctx
->ListState
.CurrentList
->Name
,
8685 ctx
->ListState
.CurrentList
);
8688 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8689 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8691 ctx
->ListState
.CurrentList
= NULL
;
8692 ctx
->ExecuteFlag
= GL_TRUE
;
8693 ctx
->CompileFlag
= GL_FALSE
;
8695 ctx
->CurrentDispatch
= ctx
->Exec
;
8696 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8701 _mesa_CallList(GLuint list
)
8703 GLboolean save_compile_flag
;
8704 GET_CURRENT_CONTEXT(ctx
);
8705 FLUSH_CURRENT(ctx
, 0);
8707 if (MESA_VERBOSE
& VERBOSE_API
)
8708 _mesa_debug(ctx
, "glCallList %d\n", list
);
8711 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8716 mesa_print_display_list( list
);
8718 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8719 * execute the display list, and restore the CompileFlag.
8721 save_compile_flag
= ctx
->CompileFlag
;
8722 if (save_compile_flag
) {
8723 ctx
->CompileFlag
= GL_FALSE
;
8726 execute_list(ctx
, list
);
8727 ctx
->CompileFlag
= save_compile_flag
;
8729 /* also restore API function pointers to point to "save" versions */
8730 if (save_compile_flag
) {
8731 ctx
->CurrentDispatch
= ctx
->Save
;
8732 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8738 * Execute glCallLists: call multiple display lists.
8741 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8743 GET_CURRENT_CONTEXT(ctx
);
8745 GLboolean save_compile_flag
;
8747 if (MESA_VERBOSE
& VERBOSE_API
)
8748 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8752 case GL_UNSIGNED_BYTE
:
8754 case GL_UNSIGNED_SHORT
:
8756 case GL_UNSIGNED_INT
:
8764 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8768 /* Save the CompileFlag status, turn it off, execute display list,
8769 * and restore the CompileFlag.
8771 save_compile_flag
= ctx
->CompileFlag
;
8772 ctx
->CompileFlag
= GL_FALSE
;
8774 for (i
= 0; i
< n
; i
++) {
8775 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8776 execute_list(ctx
, list
);
8779 ctx
->CompileFlag
= save_compile_flag
;
8781 /* also restore API function pointers to point to "save" versions */
8782 if (save_compile_flag
) {
8783 ctx
->CurrentDispatch
= ctx
->Save
;
8784 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8790 * Set the offset added to list numbers in glCallLists.
8793 _mesa_ListBase(GLuint base
)
8795 GET_CURRENT_CONTEXT(ctx
);
8796 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8797 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8798 ctx
->List
.ListBase
= base
;
8802 * Setup the given dispatch table to point to Mesa's display list
8803 * building functions.
8805 * This does not include any of the tnl functions - they are
8806 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8810 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8812 struct _glapi_table
*table
= ctx
->Save
;
8813 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8815 /* Initially populate the dispatch table with the contents of the
8816 * normal-execution dispatch table. This lets us skip populating functions
8817 * that should be called directly instead of compiled into display lists.
8819 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8821 _mesa_loopback_init_api_table(ctx
, table
);
8824 SET_Accum(table
, save_Accum
);
8825 SET_AlphaFunc(table
, save_AlphaFunc
);
8826 SET_Bitmap(table
, save_Bitmap
);
8827 SET_BlendFunc(table
, save_BlendFunc
);
8828 SET_CallList(table
, save_CallList
);
8829 SET_CallLists(table
, save_CallLists
);
8830 SET_Clear(table
, save_Clear
);
8831 SET_ClearAccum(table
, save_ClearAccum
);
8832 SET_ClearColor(table
, save_ClearColor
);
8833 SET_ClearDepth(table
, save_ClearDepth
);
8834 SET_ClearIndex(table
, save_ClearIndex
);
8835 SET_ClearStencil(table
, save_ClearStencil
);
8836 SET_ClipPlane(table
, save_ClipPlane
);
8837 SET_ColorMask(table
, save_ColorMask
);
8838 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8839 SET_ColorMaterial(table
, save_ColorMaterial
);
8840 SET_CopyPixels(table
, save_CopyPixels
);
8841 SET_CullFace(table
, save_CullFace
);
8842 SET_DepthFunc(table
, save_DepthFunc
);
8843 SET_DepthMask(table
, save_DepthMask
);
8844 SET_DepthRange(table
, save_DepthRange
);
8845 SET_Disable(table
, save_Disable
);
8846 SET_Disablei(table
, save_DisableIndexed
);
8847 SET_DrawBuffer(table
, save_DrawBuffer
);
8848 SET_DrawPixels(table
, save_DrawPixels
);
8849 SET_Enable(table
, save_Enable
);
8850 SET_Enablei(table
, save_EnableIndexed
);
8851 SET_EvalMesh1(table
, save_EvalMesh1
);
8852 SET_EvalMesh2(table
, save_EvalMesh2
);
8853 SET_Fogf(table
, save_Fogf
);
8854 SET_Fogfv(table
, save_Fogfv
);
8855 SET_Fogi(table
, save_Fogi
);
8856 SET_Fogiv(table
, save_Fogiv
);
8857 SET_FrontFace(table
, save_FrontFace
);
8858 SET_Frustum(table
, save_Frustum
);
8859 SET_Hint(table
, save_Hint
);
8860 SET_IndexMask(table
, save_IndexMask
);
8861 SET_InitNames(table
, save_InitNames
);
8862 SET_LightModelf(table
, save_LightModelf
);
8863 SET_LightModelfv(table
, save_LightModelfv
);
8864 SET_LightModeli(table
, save_LightModeli
);
8865 SET_LightModeliv(table
, save_LightModeliv
);
8866 SET_Lightf(table
, save_Lightf
);
8867 SET_Lightfv(table
, save_Lightfv
);
8868 SET_Lighti(table
, save_Lighti
);
8869 SET_Lightiv(table
, save_Lightiv
);
8870 SET_LineStipple(table
, save_LineStipple
);
8871 SET_LineWidth(table
, save_LineWidth
);
8872 SET_ListBase(table
, save_ListBase
);
8873 SET_LoadIdentity(table
, save_LoadIdentity
);
8874 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8875 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8876 SET_LoadName(table
, save_LoadName
);
8877 SET_LogicOp(table
, save_LogicOp
);
8878 SET_Map1d(table
, save_Map1d
);
8879 SET_Map1f(table
, save_Map1f
);
8880 SET_Map2d(table
, save_Map2d
);
8881 SET_Map2f(table
, save_Map2f
);
8882 SET_MapGrid1d(table
, save_MapGrid1d
);
8883 SET_MapGrid1f(table
, save_MapGrid1f
);
8884 SET_MapGrid2d(table
, save_MapGrid2d
);
8885 SET_MapGrid2f(table
, save_MapGrid2f
);
8886 SET_MatrixMode(table
, save_MatrixMode
);
8887 SET_MultMatrixd(table
, save_MultMatrixd
);
8888 SET_MultMatrixf(table
, save_MultMatrixf
);
8889 SET_NewList(table
, save_NewList
);
8890 SET_Ortho(table
, save_Ortho
);
8891 SET_PassThrough(table
, save_PassThrough
);
8892 SET_PixelMapfv(table
, save_PixelMapfv
);
8893 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8894 SET_PixelMapusv(table
, save_PixelMapusv
);
8895 SET_PixelTransferf(table
, save_PixelTransferf
);
8896 SET_PixelTransferi(table
, save_PixelTransferi
);
8897 SET_PixelZoom(table
, save_PixelZoom
);
8898 SET_PointSize(table
, save_PointSize
);
8899 SET_PolygonMode(table
, save_PolygonMode
);
8900 SET_PolygonOffset(table
, save_PolygonOffset
);
8901 SET_PolygonStipple(table
, save_PolygonStipple
);
8902 SET_PopAttrib(table
, save_PopAttrib
);
8903 SET_PopMatrix(table
, save_PopMatrix
);
8904 SET_PopName(table
, save_PopName
);
8905 SET_PushAttrib(table
, save_PushAttrib
);
8906 SET_PushMatrix(table
, save_PushMatrix
);
8907 SET_PushName(table
, save_PushName
);
8908 SET_RasterPos2d(table
, save_RasterPos2d
);
8909 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8910 SET_RasterPos2f(table
, save_RasterPos2f
);
8911 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8912 SET_RasterPos2i(table
, save_RasterPos2i
);
8913 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8914 SET_RasterPos2s(table
, save_RasterPos2s
);
8915 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8916 SET_RasterPos3d(table
, save_RasterPos3d
);
8917 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8918 SET_RasterPos3f(table
, save_RasterPos3f
);
8919 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8920 SET_RasterPos3i(table
, save_RasterPos3i
);
8921 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8922 SET_RasterPos3s(table
, save_RasterPos3s
);
8923 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8924 SET_RasterPos4d(table
, save_RasterPos4d
);
8925 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8926 SET_RasterPos4f(table
, save_RasterPos4f
);
8927 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8928 SET_RasterPos4i(table
, save_RasterPos4i
);
8929 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8930 SET_RasterPos4s(table
, save_RasterPos4s
);
8931 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8932 SET_ReadBuffer(table
, save_ReadBuffer
);
8933 SET_Rotated(table
, save_Rotated
);
8934 SET_Rotatef(table
, save_Rotatef
);
8935 SET_Scaled(table
, save_Scaled
);
8936 SET_Scalef(table
, save_Scalef
);
8937 SET_Scissor(table
, save_Scissor
);
8938 SET_ShadeModel(table
, save_ShadeModel
);
8939 SET_StencilFunc(table
, save_StencilFunc
);
8940 SET_StencilMask(table
, save_StencilMask
);
8941 SET_StencilOp(table
, save_StencilOp
);
8942 SET_TexEnvf(table
, save_TexEnvf
);
8943 SET_TexEnvfv(table
, save_TexEnvfv
);
8944 SET_TexEnvi(table
, save_TexEnvi
);
8945 SET_TexEnviv(table
, save_TexEnviv
);
8946 SET_TexGend(table
, save_TexGend
);
8947 SET_TexGendv(table
, save_TexGendv
);
8948 SET_TexGenf(table
, save_TexGenf
);
8949 SET_TexGenfv(table
, save_TexGenfv
);
8950 SET_TexGeni(table
, save_TexGeni
);
8951 SET_TexGeniv(table
, save_TexGeniv
);
8952 SET_TexImage1D(table
, save_TexImage1D
);
8953 SET_TexImage2D(table
, save_TexImage2D
);
8954 SET_TexParameterf(table
, save_TexParameterf
);
8955 SET_TexParameterfv(table
, save_TexParameterfv
);
8956 SET_TexParameteri(table
, save_TexParameteri
);
8957 SET_TexParameteriv(table
, save_TexParameteriv
);
8958 SET_Translated(table
, save_Translated
);
8959 SET_Translatef(table
, save_Translatef
);
8960 SET_Viewport(table
, save_Viewport
);
8963 SET_BindTexture(table
, save_BindTexture
);
8964 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8965 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8966 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8967 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8968 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8969 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8970 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8973 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8974 SET_TexImage3D(table
, save_TexImage3D
);
8975 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8978 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8979 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8980 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8982 /* ATI_separate_stencil */
8983 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8985 /* GL_ARB_imaging */
8986 /* Not all are supported */
8987 SET_BlendColor(table
, save_BlendColor
);
8988 SET_BlendEquation(table
, save_BlendEquation
);
8989 SET_ColorSubTable(table
, save_ColorSubTable
);
8990 SET_ColorTable(table
, save_ColorTable
);
8991 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
8992 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
8993 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
8994 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
8995 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
8996 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
8997 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
8998 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
8999 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
9000 SET_CopyColorTable(table
, save_CopyColorTable
);
9001 SET_Histogram(table
, save_Histogram
);
9002 SET_Minmax(table
, save_Minmax
);
9003 SET_ResetHistogram(table
, save_ResetHistogram
);
9004 SET_ResetMinmax(table
, save_ResetMinmax
);
9006 /* 2. GL_EXT_blend_color */
9008 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9011 /* 3. GL_EXT_polygon_offset */
9012 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9014 /* 6. GL_EXT_texture3d */
9016 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9017 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9018 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9021 /* 14. GL_SGI_color_table */
9023 SET_ColorTableSGI(table
, save_ColorTable
);
9024 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
9027 /* 37. GL_EXT_blend_minmax */
9029 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9032 /* 54. GL_EXT_point_parameters */
9033 SET_PointParameterf(table
, save_PointParameterfEXT
);
9034 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9036 /* 173. GL_EXT_blend_func_separate */
9037 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9039 /* 197. GL_MESA_window_pos */
9040 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9041 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9042 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9043 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9044 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9045 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9046 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9047 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9048 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9049 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9050 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9051 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9052 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9053 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9054 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9055 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9056 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9057 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9058 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9059 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9060 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9061 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9062 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9063 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9065 /* 233. GL_NV_vertex_program */
9066 /* The following commands DO NOT go into display lists:
9067 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9068 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9070 SET_BindProgramARB(table
, save_BindProgramNV
);
9072 /* 244. GL_ATI_envmap_bumpmap */
9073 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9074 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9076 /* 245. GL_ATI_fragment_shader */
9077 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9078 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9080 /* 262. GL_NV_point_sprite */
9081 SET_PointParameteri(table
, save_PointParameteriNV
);
9082 SET_PointParameteriv(table
, save_PointParameterivNV
);
9084 /* 268. GL_EXT_stencil_two_side */
9085 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9087 /* ???. GL_EXT_depth_bounds_test */
9088 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9090 /* ARB 1. GL_ARB_multitexture */
9091 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9093 /* ARB 3. GL_ARB_transpose_matrix */
9094 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9095 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9096 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9097 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9099 /* ARB 5. GL_ARB_multisample */
9100 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9102 /* ARB 12. GL_ARB_texture_compression */
9103 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9104 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9105 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9106 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9107 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9108 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9110 /* ARB 14. GL_ARB_point_parameters */
9111 /* aliased with EXT_point_parameters functions */
9113 /* ARB 25. GL_ARB_window_pos */
9114 /* aliased with MESA_window_pos functions */
9116 /* ARB 26. GL_ARB_vertex_program */
9117 /* ARB 27. GL_ARB_fragment_program */
9118 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9119 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9120 SET_BindProgramARB(table
, save_BindProgramNV
);
9121 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9122 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9123 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9124 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9125 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9126 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9127 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9128 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9130 SET_BeginQuery(table
, save_BeginQueryARB
);
9131 SET_EndQuery(table
, save_EndQueryARB
);
9132 SET_QueryCounter(table
, save_QueryCounter
);
9134 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9136 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9138 SET_UseProgram(table
, save_UseProgramObjectARB
);
9139 SET_Uniform1f(table
, save_Uniform1fARB
);
9140 SET_Uniform2f(table
, save_Uniform2fARB
);
9141 SET_Uniform3f(table
, save_Uniform3fARB
);
9142 SET_Uniform4f(table
, save_Uniform4fARB
);
9143 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9144 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9145 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9146 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9147 SET_Uniform1i(table
, save_Uniform1iARB
);
9148 SET_Uniform2i(table
, save_Uniform2iARB
);
9149 SET_Uniform3i(table
, save_Uniform3iARB
);
9150 SET_Uniform4i(table
, save_Uniform4iARB
);
9151 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9152 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9153 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9154 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9155 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9156 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9157 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9158 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9159 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9160 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9161 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9162 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9163 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9165 /* 299. GL_EXT_blend_equation_separate */
9166 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9168 /* GL_EXT_gpu_program_parameters */
9169 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9170 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9172 /* 364. GL_EXT_provoking_vertex */
9173 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9175 /* GL_EXT_texture_integer */
9176 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9177 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9178 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9179 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9181 /* 377. GL_EXT_separate_shader_objects */
9182 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9183 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9185 /* GL_ARB_color_buffer_float */
9186 SET_ClampColor(table
, save_ClampColorARB
);
9189 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9190 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9191 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9192 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9194 SET_Uniform1ui(table
, save_Uniform1ui
);
9195 SET_Uniform2ui(table
, save_Uniform2ui
);
9196 SET_Uniform3ui(table
, save_Uniform3ui
);
9197 SET_Uniform4ui(table
, save_Uniform4ui
);
9198 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9199 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9200 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9201 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9203 (void) save_Uniform1ui
;
9204 (void) save_Uniform2ui
;
9205 (void) save_Uniform3ui
;
9206 (void) save_Uniform4ui
;
9207 (void) save_Uniform1uiv
;
9208 (void) save_Uniform2uiv
;
9209 (void) save_Uniform3uiv
;
9210 (void) save_Uniform4uiv
;
9214 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9215 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9216 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9217 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9218 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9219 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9220 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9221 SET_DrawTransformFeedbackInstanced(table
,
9222 save_DrawTransformFeedbackInstanced
);
9223 SET_DrawTransformFeedbackStreamInstanced(table
,
9224 save_DrawTransformFeedbackStreamInstanced
);
9225 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9226 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9228 /* GL_ARB_instanced_arrays */
9229 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9231 /* GL_NV_texture_barrier */
9232 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9234 SET_BindSampler(table
, save_BindSampler
);
9235 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9236 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9237 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9238 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9239 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9240 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9242 /* GL_ARB_draw_buffer_blend */
9243 SET_BlendFunciARB(table
, save_BlendFunci
);
9244 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9245 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9246 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9248 /* GL_ARB_geometry_shader4 */
9249 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9250 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9251 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9253 /* GL_NV_conditional_render */
9254 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9255 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9258 SET_WaitSync(table
, save_WaitSync
);
9260 /* GL_ARB_uniform_buffer_object */
9261 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9267 enum_string(GLenum k
)
9269 return _mesa_lookup_enum_by_nr(k
);
9274 * Print the commands in a display list. For debugging only.
9275 * TODO: many commands aren't handled yet.
9277 static void GLAPIENTRY
9278 print_list(struct gl_context
*ctx
, GLuint list
)
9280 struct gl_display_list
*dlist
;
9284 if (!islist(ctx
, list
)) {
9285 printf("%u is not a display list ID\n", list
);
9289 dlist
= lookup_list(ctx
, list
);
9295 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9297 done
= n
? GL_FALSE
: GL_TRUE
;
9299 const OpCode opcode
= n
[0].opcode
;
9301 if (is_ext_opcode(opcode
)) {
9302 n
+= ext_opcode_print(ctx
, n
);
9307 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9310 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9311 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9313 case OPCODE_CALL_LIST
:
9314 printf("CallList %d\n", (int) n
[1].ui
);
9316 case OPCODE_CALL_LIST_OFFSET
:
9317 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9318 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9320 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9321 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9322 enum_string(n
[1].e
), enum_string(n
[2].e
),
9323 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9325 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9326 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9327 enum_string(n
[1].e
), enum_string(n
[2].e
),
9328 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9330 case OPCODE_DISABLE
:
9331 printf("Disable %s\n", enum_string(n
[1].e
));
9334 printf("Enable %s\n", enum_string(n
[1].e
));
9336 case OPCODE_FRUSTUM
:
9337 printf("Frustum %g %g %g %g %g %g\n",
9338 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9340 case OPCODE_LINE_STIPPLE
:
9341 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9343 case OPCODE_LOAD_IDENTITY
:
9344 printf("LoadIdentity\n");
9346 case OPCODE_LOAD_MATRIX
:
9347 printf("LoadMatrix\n");
9348 printf(" %8f %8f %8f %8f\n",
9349 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9350 printf(" %8f %8f %8f %8f\n",
9351 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9352 printf(" %8f %8f %8f %8f\n",
9353 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9354 printf(" %8f %8f %8f %8f\n",
9355 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9357 case OPCODE_MULT_MATRIX
:
9358 printf("MultMatrix (or Rotate)\n");
9359 printf(" %8f %8f %8f %8f\n",
9360 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9361 printf(" %8f %8f %8f %8f\n",
9362 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9363 printf(" %8f %8f %8f %8f\n",
9364 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9365 printf(" %8f %8f %8f %8f\n",
9366 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9369 printf("Ortho %g %g %g %g %g %g\n",
9370 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9372 case OPCODE_POP_ATTRIB
:
9373 printf("PopAttrib\n");
9375 case OPCODE_POP_MATRIX
:
9376 printf("PopMatrix\n");
9378 case OPCODE_POP_NAME
:
9379 printf("PopName\n");
9381 case OPCODE_PUSH_ATTRIB
:
9382 printf("PushAttrib %x\n", n
[1].bf
);
9384 case OPCODE_PUSH_MATRIX
:
9385 printf("PushMatrix\n");
9387 case OPCODE_PUSH_NAME
:
9388 printf("PushName %d\n", (int) n
[1].ui
);
9390 case OPCODE_RASTER_POS
:
9391 printf("RasterPos %g %g %g %g\n",
9392 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9395 printf("Rotate %g %g %g %g\n",
9396 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9399 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9401 case OPCODE_TRANSLATE
:
9402 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9404 case OPCODE_BIND_TEXTURE
:
9405 printf("BindTexture %s %d\n",
9406 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9408 case OPCODE_SHADE_MODEL
:
9409 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9412 printf("Map1 %s %.3f %.3f %d %d\n",
9413 _mesa_lookup_enum_by_nr(n
[1].ui
),
9414 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9417 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9418 _mesa_lookup_enum_by_nr(n
[1].ui
),
9419 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9420 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9422 case OPCODE_MAPGRID1
:
9423 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9425 case OPCODE_MAPGRID2
:
9426 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9427 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9429 case OPCODE_EVALMESH1
:
9430 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9432 case OPCODE_EVALMESH2
:
9433 printf("EvalMesh2 %d %d %d %d\n",
9434 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9437 case OPCODE_ATTR_1F_NV
:
9438 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9440 case OPCODE_ATTR_2F_NV
:
9441 printf("ATTR_2F_NV attr %d: %f %f\n",
9442 n
[1].i
, n
[2].f
, n
[3].f
);
9444 case OPCODE_ATTR_3F_NV
:
9445 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9446 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9448 case OPCODE_ATTR_4F_NV
:
9449 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9450 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9452 case OPCODE_ATTR_1F_ARB
:
9453 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9455 case OPCODE_ATTR_2F_ARB
:
9456 printf("ATTR_2F_ARB attr %d: %f %f\n",
9457 n
[1].i
, n
[2].f
, n
[3].f
);
9459 case OPCODE_ATTR_3F_ARB
:
9460 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9461 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9463 case OPCODE_ATTR_4F_ARB
:
9464 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9465 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9468 case OPCODE_MATERIAL
:
9469 printf("MATERIAL %x %x: %f %f %f %f\n",
9470 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9473 printf("BEGIN %x\n", n
[1].i
);
9479 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9482 case OPCODE_EVAL_C1
:
9483 printf("EVAL_C1 %f\n", n
[1].f
);
9485 case OPCODE_EVAL_C2
:
9486 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9488 case OPCODE_EVAL_P1
:
9489 printf("EVAL_P1 %d\n", n
[1].i
);
9491 case OPCODE_EVAL_P2
:
9492 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9495 case OPCODE_PROVOKING_VERTEX
:
9496 printf("ProvokingVertex %s\n",
9497 _mesa_lookup_enum_by_nr(n
[1].ui
));
9501 * meta opcodes/commands
9504 printf("Error: %s %s\n",
9505 enum_string(n
[1].e
), (const char *) n
[2].data
);
9507 case OPCODE_CONTINUE
:
9508 printf("DISPLAY-LIST-CONTINUE\n");
9509 n
= (Node
*) n
[1].next
;
9511 case OPCODE_END_OF_LIST
:
9512 printf("END-LIST %u\n", list
);
9516 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9518 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9519 opcode
, (void *) n
);
9523 printf("command %d, %u operands\n", opcode
,
9527 /* increment n to point to next compiled command */
9528 if (opcode
!= OPCODE_CONTINUE
) {
9529 n
+= InstSize
[opcode
];
9538 * Clients may call this function to help debug display list problems.
9539 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9540 * changed, or break in the future without notice.
9543 mesa_print_display_list(GLuint list
)
9545 GET_CURRENT_CONTEXT(ctx
);
9546 print_list(ctx
, list
);
9550 /**********************************************************************/
9551 /***** Initialization *****/
9552 /**********************************************************************/
9555 save_vtxfmt_init(GLvertexformat
* vfmt
)
9557 vfmt
->ArrayElement
= _ae_ArrayElement
;
9559 vfmt
->Begin
= save_Begin
;
9561 vfmt
->CallList
= save_CallList
;
9562 vfmt
->CallLists
= save_CallLists
;
9564 vfmt
->Color3f
= save_Color3f
;
9565 vfmt
->Color3fv
= save_Color3fv
;
9566 vfmt
->Color4f
= save_Color4f
;
9567 vfmt
->Color4fv
= save_Color4fv
;
9568 vfmt
->EdgeFlag
= save_EdgeFlag
;
9569 vfmt
->End
= save_End
;
9571 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
9573 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9574 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9575 vfmt
->Indexf
= save_Indexf
;
9576 vfmt
->Indexfv
= save_Indexfv
;
9577 vfmt
->Materialfv
= save_Materialfv
;
9578 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9579 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9580 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9581 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9582 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9583 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9584 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9585 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9586 vfmt
->Normal3f
= save_Normal3f
;
9587 vfmt
->Normal3fv
= save_Normal3fv
;
9588 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9589 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9590 vfmt
->TexCoord1f
= save_TexCoord1f
;
9591 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9592 vfmt
->TexCoord2f
= save_TexCoord2f
;
9593 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9594 vfmt
->TexCoord3f
= save_TexCoord3f
;
9595 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9596 vfmt
->TexCoord4f
= save_TexCoord4f
;
9597 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9598 vfmt
->Vertex2f
= save_Vertex2f
;
9599 vfmt
->Vertex2fv
= save_Vertex2fv
;
9600 vfmt
->Vertex3f
= save_Vertex3f
;
9601 vfmt
->Vertex3fv
= save_Vertex3fv
;
9602 vfmt
->Vertex4f
= save_Vertex4f
;
9603 vfmt
->Vertex4fv
= save_Vertex4fv
;
9604 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9605 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9606 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9607 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9608 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9609 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9610 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9611 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9613 vfmt
->Rectf
= save_Rectf
;
9615 /* GL_ARB_draw_instanced */
9616 vfmt
->DrawArraysInstanced
= save_DrawArraysInstancedARB
;
9617 vfmt
->DrawElementsInstanced
= save_DrawElementsInstancedARB
;
9619 /* GL_ARB_draw_elements_base_vertex */
9620 vfmt
->DrawElementsInstancedBaseVertex
= save_DrawElementsInstancedBaseVertexARB
;
9622 /* GL_ARB_base_instance */
9623 vfmt
->DrawArraysInstancedBaseInstance
= save_DrawArraysInstancedBaseInstance
;
9624 vfmt
->DrawElementsInstancedBaseInstance
= save_DrawElementsInstancedBaseInstance
;
9625 vfmt
->DrawElementsInstancedBaseVertexBaseInstance
= save_DrawElementsInstancedBaseVertexBaseInstance
;
9627 /* The driver is required to implement these as
9628 * 1) They can probably do a better job.
9629 * 2) A lot of new mechanisms would have to be added to this module
9630 * to support it. That code would probably never get used,
9634 vfmt
->DrawArrays
= 0;
9635 vfmt
->DrawElements
= 0;
9636 vfmt
->DrawRangeElements
= 0;
9637 vfmt
->MultiDrawElemementsEXT
= 0;
9638 vfmt
->DrawElementsBaseVertex
= 0;
9639 vfmt
->DrawRangeElementsBaseVertex
= 0;
9640 vfmt
->MultiDrawElemementsBaseVertex
= 0;
9646 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9647 const GLvertexformat
*vfmt
)
9649 SET_CallList(disp
, vfmt
->CallList
);
9650 SET_CallLists(disp
, vfmt
->CallLists
);
9655 * Initialize display list state for given context.
9658 _mesa_init_display_list(struct gl_context
*ctx
)
9660 static GLboolean tableInitialized
= GL_FALSE
;
9662 /* zero-out the instruction size table, just once */
9663 if (!tableInitialized
) {
9664 memset(InstSize
, 0, sizeof(InstSize
));
9665 tableInitialized
= GL_TRUE
;
9668 /* extension info */
9669 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9672 ctx
->ListState
.CallDepth
= 0;
9673 ctx
->ExecuteFlag
= GL_TRUE
;
9674 ctx
->CompileFlag
= GL_FALSE
;
9675 ctx
->ListState
.CurrentBlock
= NULL
;
9676 ctx
->ListState
.CurrentPos
= 0;
9678 /* Display List group */
9679 ctx
->List
.ListBase
= 0;
9681 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9686 _mesa_free_display_list_data(struct gl_context
*ctx
)
9689 ctx
->ListExt
= NULL
;