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");
1357 static void invalidate_saved_current_state( struct gl_context
*ctx
)
1361 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1362 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1364 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1365 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1367 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1369 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1372 static void GLAPIENTRY
1373 save_CallList(GLuint list
)
1375 GET_CURRENT_CONTEXT(ctx
);
1377 SAVE_FLUSH_VERTICES(ctx
);
1379 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1384 /* After this, we don't know what state we're in. Invalidate all
1385 * cached information previously gathered:
1387 invalidate_saved_current_state( ctx
);
1389 if (ctx
->ExecuteFlag
) {
1390 _mesa_CallList(list
);
1395 static void GLAPIENTRY
1396 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1398 GET_CURRENT_CONTEXT(ctx
);
1400 GLboolean typeErrorFlag
;
1402 SAVE_FLUSH_VERTICES(ctx
);
1406 case GL_UNSIGNED_BYTE
:
1408 case GL_UNSIGNED_SHORT
:
1410 case GL_UNSIGNED_INT
:
1415 typeErrorFlag
= GL_FALSE
;
1418 typeErrorFlag
= GL_TRUE
;
1421 for (i
= 0; i
< num
; i
++) {
1422 GLint list
= translate_id(i
, type
, lists
);
1423 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1426 n
[2].b
= typeErrorFlag
;
1430 /* After this, we don't know what state we're in. Invalidate all
1431 * cached information previously gathered:
1433 invalidate_saved_current_state( ctx
);
1435 if (ctx
->ExecuteFlag
) {
1436 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1441 static void GLAPIENTRY
1442 save_Clear(GLbitfield mask
)
1444 GET_CURRENT_CONTEXT(ctx
);
1446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1447 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1451 if (ctx
->ExecuteFlag
) {
1452 CALL_Clear(ctx
->Exec
, (mask
));
1457 static void GLAPIENTRY
1458 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1460 GET_CURRENT_CONTEXT(ctx
);
1462 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1463 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1466 n
[2].i
= drawbuffer
;
1468 if (buffer
== GL_COLOR
) {
1479 if (ctx
->ExecuteFlag
) {
1480 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1485 static void GLAPIENTRY
1486 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1488 GET_CURRENT_CONTEXT(ctx
);
1490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1491 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1494 n
[2].i
= drawbuffer
;
1496 if (buffer
== GL_COLOR
) {
1507 if (ctx
->ExecuteFlag
) {
1508 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1513 static void GLAPIENTRY
1514 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1516 GET_CURRENT_CONTEXT(ctx
);
1518 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1519 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1522 n
[2].i
= drawbuffer
;
1524 if (buffer
== GL_COLOR
) {
1535 if (ctx
->ExecuteFlag
) {
1536 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1541 static void GLAPIENTRY
1542 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1543 GLfloat depth
, GLint stencil
)
1545 GET_CURRENT_CONTEXT(ctx
);
1547 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1548 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1551 n
[2].i
= drawbuffer
;
1555 if (ctx
->ExecuteFlag
) {
1556 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1561 static void GLAPIENTRY
1562 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1564 GET_CURRENT_CONTEXT(ctx
);
1566 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1567 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1574 if (ctx
->ExecuteFlag
) {
1575 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1580 static void GLAPIENTRY
1581 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1583 GET_CURRENT_CONTEXT(ctx
);
1585 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1586 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1593 if (ctx
->ExecuteFlag
) {
1594 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1599 static void GLAPIENTRY
1600 save_ClearDepth(GLclampd depth
)
1602 GET_CURRENT_CONTEXT(ctx
);
1604 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1605 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1607 n
[1].f
= (GLfloat
) depth
;
1609 if (ctx
->ExecuteFlag
) {
1610 CALL_ClearDepth(ctx
->Exec
, (depth
));
1615 static void GLAPIENTRY
1616 save_ClearIndex(GLfloat c
)
1618 GET_CURRENT_CONTEXT(ctx
);
1620 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1621 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1625 if (ctx
->ExecuteFlag
) {
1626 CALL_ClearIndex(ctx
->Exec
, (c
));
1631 static void GLAPIENTRY
1632 save_ClearStencil(GLint s
)
1634 GET_CURRENT_CONTEXT(ctx
);
1636 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1637 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1641 if (ctx
->ExecuteFlag
) {
1642 CALL_ClearStencil(ctx
->Exec
, (s
));
1647 static void GLAPIENTRY
1648 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1650 GET_CURRENT_CONTEXT(ctx
);
1652 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1653 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1656 n
[2].f
= (GLfloat
) equ
[0];
1657 n
[3].f
= (GLfloat
) equ
[1];
1658 n
[4].f
= (GLfloat
) equ
[2];
1659 n
[5].f
= (GLfloat
) equ
[3];
1661 if (ctx
->ExecuteFlag
) {
1662 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1668 static void GLAPIENTRY
1669 save_ColorMask(GLboolean red
, GLboolean green
,
1670 GLboolean blue
, GLboolean alpha
)
1672 GET_CURRENT_CONTEXT(ctx
);
1674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1675 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1682 if (ctx
->ExecuteFlag
) {
1683 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1688 static void GLAPIENTRY
1689 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1690 GLboolean blue
, GLboolean alpha
)
1692 GET_CURRENT_CONTEXT(ctx
);
1694 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1695 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1703 if (ctx
->ExecuteFlag
) {
1704 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1709 static void GLAPIENTRY
1710 save_ColorMaterial(GLenum face
, GLenum mode
)
1712 GET_CURRENT_CONTEXT(ctx
);
1714 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1716 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1721 if (ctx
->ExecuteFlag
) {
1722 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1727 static void GLAPIENTRY
1728 save_ColorTable(GLenum target
, GLenum internalFormat
,
1729 GLsizei width
, GLenum format
, GLenum type
,
1730 const GLvoid
* table
)
1732 GET_CURRENT_CONTEXT(ctx
);
1733 if (_mesa_is_proxy_texture(target
)) {
1734 /* execute immediately */
1735 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1736 format
, type
, table
));
1740 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1741 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1744 n
[2].e
= internalFormat
;
1748 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1751 if (ctx
->ExecuteFlag
) {
1752 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1753 format
, type
, table
));
1760 static void GLAPIENTRY
1761 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1762 const GLfloat
*params
)
1764 GET_CURRENT_CONTEXT(ctx
);
1767 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1769 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1774 if (pname
== GL_COLOR_TABLE_SGI
||
1775 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1776 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1783 if (ctx
->ExecuteFlag
) {
1784 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1789 static void GLAPIENTRY
1790 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1792 GET_CURRENT_CONTEXT(ctx
);
1795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1797 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1802 if (pname
== GL_COLOR_TABLE_SGI
||
1803 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1804 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1811 if (ctx
->ExecuteFlag
) {
1812 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1818 static void GLAPIENTRY
1819 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1820 GLenum format
, GLenum type
, const GLvoid
* table
)
1822 GET_CURRENT_CONTEXT(ctx
);
1824 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1825 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1832 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1835 if (ctx
->ExecuteFlag
) {
1836 CALL_ColorSubTable(ctx
->Exec
,
1837 (target
, start
, count
, format
, type
, table
));
1842 static void GLAPIENTRY
1843 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1844 GLint x
, GLint y
, GLsizei width
)
1846 GET_CURRENT_CONTEXT(ctx
);
1849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1850 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1858 if (ctx
->ExecuteFlag
) {
1859 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1864 static void GLAPIENTRY
1865 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1866 GLint x
, GLint y
, GLsizei width
)
1868 GET_CURRENT_CONTEXT(ctx
);
1871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1872 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1875 n
[2].e
= internalformat
;
1880 if (ctx
->ExecuteFlag
) {
1881 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1886 static void GLAPIENTRY
1887 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1888 GLenum format
, GLenum type
, const GLvoid
* filter
)
1890 GET_CURRENT_CONTEXT(ctx
);
1893 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1895 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1898 n
[2].e
= internalFormat
;
1902 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1905 if (ctx
->ExecuteFlag
) {
1906 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1907 format
, type
, filter
));
1912 static void GLAPIENTRY
1913 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1914 GLsizei width
, GLsizei height
, GLenum format
,
1915 GLenum type
, const GLvoid
* filter
)
1917 GET_CURRENT_CONTEXT(ctx
);
1920 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1922 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1925 n
[2].e
= internalFormat
;
1930 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1933 if (ctx
->ExecuteFlag
) {
1934 CALL_ConvolutionFilter2D(ctx
->Exec
,
1935 (target
, internalFormat
, width
, height
, format
,
1941 static void GLAPIENTRY
1942 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1944 GET_CURRENT_CONTEXT(ctx
);
1946 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1947 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1953 if (ctx
->ExecuteFlag
) {
1954 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1959 static void GLAPIENTRY
1960 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1962 GET_CURRENT_CONTEXT(ctx
);
1964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1965 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1970 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1971 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1972 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1978 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1981 if (ctx
->ExecuteFlag
) {
1982 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1987 static void GLAPIENTRY
1988 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1990 GET_CURRENT_CONTEXT(ctx
);
1992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1993 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
1999 if (ctx
->ExecuteFlag
) {
2000 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
2005 static void GLAPIENTRY
2006 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
2007 const GLfloat
*params
)
2009 GET_CURRENT_CONTEXT(ctx
);
2011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2012 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
2017 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
2018 pname
== GL_CONVOLUTION_FILTER_SCALE
||
2019 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
2025 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
2028 if (ctx
->ExecuteFlag
) {
2029 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
2034 static void GLAPIENTRY
2035 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2037 GET_CURRENT_CONTEXT(ctx
);
2039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2040 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2044 n
[3].i
= (GLint
) width
;
2045 n
[4].i
= (GLint
) height
;
2048 if (ctx
->ExecuteFlag
) {
2049 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2055 static void GLAPIENTRY
2056 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2057 GLint x
, GLint y
, GLsizei width
, GLint border
)
2059 GET_CURRENT_CONTEXT(ctx
);
2061 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2062 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2066 n
[3].e
= internalformat
;
2072 if (ctx
->ExecuteFlag
) {
2073 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2074 x
, y
, width
, border
));
2079 static void GLAPIENTRY
2080 save_CopyTexImage2D(GLenum target
, GLint level
,
2081 GLenum internalformat
,
2082 GLint x
, GLint y
, GLsizei width
,
2083 GLsizei height
, GLint border
)
2085 GET_CURRENT_CONTEXT(ctx
);
2087 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2088 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2092 n
[3].e
= internalformat
;
2099 if (ctx
->ExecuteFlag
) {
2100 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2101 x
, y
, width
, height
, border
));
2107 static void GLAPIENTRY
2108 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2109 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2111 GET_CURRENT_CONTEXT(ctx
);
2113 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2114 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2123 if (ctx
->ExecuteFlag
) {
2124 CALL_CopyTexSubImage1D(ctx
->Exec
,
2125 (target
, level
, xoffset
, x
, y
, width
));
2130 static void GLAPIENTRY
2131 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2132 GLint xoffset
, GLint yoffset
,
2133 GLint x
, GLint y
, GLsizei width
, GLint height
)
2135 GET_CURRENT_CONTEXT(ctx
);
2137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2138 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2149 if (ctx
->ExecuteFlag
) {
2150 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2151 x
, y
, width
, height
));
2156 static void GLAPIENTRY
2157 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2158 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2159 GLint x
, GLint y
, GLsizei width
, GLint height
)
2161 GET_CURRENT_CONTEXT(ctx
);
2163 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2164 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2176 if (ctx
->ExecuteFlag
) {
2177 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2178 xoffset
, yoffset
, zoffset
,
2179 x
, y
, width
, height
));
2184 static void GLAPIENTRY
2185 save_CullFace(GLenum mode
)
2187 GET_CURRENT_CONTEXT(ctx
);
2189 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2190 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2194 if (ctx
->ExecuteFlag
) {
2195 CALL_CullFace(ctx
->Exec
, (mode
));
2200 static void GLAPIENTRY
2201 save_DepthFunc(GLenum func
)
2203 GET_CURRENT_CONTEXT(ctx
);
2205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2206 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2210 if (ctx
->ExecuteFlag
) {
2211 CALL_DepthFunc(ctx
->Exec
, (func
));
2216 static void GLAPIENTRY
2217 save_DepthMask(GLboolean mask
)
2219 GET_CURRENT_CONTEXT(ctx
);
2221 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2222 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2226 if (ctx
->ExecuteFlag
) {
2227 CALL_DepthMask(ctx
->Exec
, (mask
));
2232 static void GLAPIENTRY
2233 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2235 GET_CURRENT_CONTEXT(ctx
);
2237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2238 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2240 n
[1].f
= (GLfloat
) nearval
;
2241 n
[2].f
= (GLfloat
) farval
;
2243 if (ctx
->ExecuteFlag
) {
2244 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2249 static void GLAPIENTRY
2250 save_Disable(GLenum cap
)
2252 GET_CURRENT_CONTEXT(ctx
);
2254 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2255 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2259 if (ctx
->ExecuteFlag
) {
2260 CALL_Disable(ctx
->Exec
, (cap
));
2265 static void GLAPIENTRY
2266 save_DisableIndexed(GLuint index
, GLenum cap
)
2268 GET_CURRENT_CONTEXT(ctx
);
2270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2271 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2276 if (ctx
->ExecuteFlag
) {
2277 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2282 static void GLAPIENTRY
2283 save_DrawBuffer(GLenum mode
)
2285 GET_CURRENT_CONTEXT(ctx
);
2287 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2288 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2292 if (ctx
->ExecuteFlag
) {
2293 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2298 static void GLAPIENTRY
2299 save_DrawPixels(GLsizei width
, GLsizei height
,
2300 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2302 GET_CURRENT_CONTEXT(ctx
);
2305 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2307 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
2313 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2314 pixels
, &ctx
->Unpack
);
2316 if (ctx
->ExecuteFlag
) {
2317 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2323 static void GLAPIENTRY
2324 save_Enable(GLenum cap
)
2326 GET_CURRENT_CONTEXT(ctx
);
2328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2329 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2333 if (ctx
->ExecuteFlag
) {
2334 CALL_Enable(ctx
->Exec
, (cap
));
2340 static void GLAPIENTRY
2341 save_EnableIndexed(GLuint index
, GLenum cap
)
2343 GET_CURRENT_CONTEXT(ctx
);
2345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2346 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2351 if (ctx
->ExecuteFlag
) {
2352 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2358 static void GLAPIENTRY
2359 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2361 GET_CURRENT_CONTEXT(ctx
);
2363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2364 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2370 if (ctx
->ExecuteFlag
) {
2371 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2376 static void GLAPIENTRY
2377 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2379 GET_CURRENT_CONTEXT(ctx
);
2381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2382 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2390 if (ctx
->ExecuteFlag
) {
2391 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2398 static void GLAPIENTRY
2399 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2401 GET_CURRENT_CONTEXT(ctx
);
2403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2404 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2412 if (ctx
->ExecuteFlag
) {
2413 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2418 static void GLAPIENTRY
2419 save_Fogf(GLenum pname
, GLfloat param
)
2423 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2424 save_Fogfv(pname
, parray
);
2428 static void GLAPIENTRY
2429 save_Fogiv(GLenum pname
, const GLint
*params
)
2434 case GL_FOG_DENSITY
:
2438 p
[0] = (GLfloat
) *params
;
2444 p
[0] = INT_TO_FLOAT(params
[0]);
2445 p
[1] = INT_TO_FLOAT(params
[1]);
2446 p
[2] = INT_TO_FLOAT(params
[2]);
2447 p
[3] = INT_TO_FLOAT(params
[3]);
2450 /* Error will be caught later in gl_Fogfv */
2451 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2453 save_Fogfv(pname
, p
);
2457 static void GLAPIENTRY
2458 save_Fogi(GLenum pname
, GLint param
)
2462 parray
[1] = parray
[2] = parray
[3] = 0;
2463 save_Fogiv(pname
, parray
);
2467 static void GLAPIENTRY
2468 save_FrontFace(GLenum mode
)
2470 GET_CURRENT_CONTEXT(ctx
);
2472 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2473 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2477 if (ctx
->ExecuteFlag
) {
2478 CALL_FrontFace(ctx
->Exec
, (mode
));
2483 static void GLAPIENTRY
2484 save_Frustum(GLdouble left
, GLdouble right
,
2485 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2487 GET_CURRENT_CONTEXT(ctx
);
2489 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2490 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2492 n
[1].f
= (GLfloat
) left
;
2493 n
[2].f
= (GLfloat
) right
;
2494 n
[3].f
= (GLfloat
) bottom
;
2495 n
[4].f
= (GLfloat
) top
;
2496 n
[5].f
= (GLfloat
) nearval
;
2497 n
[6].f
= (GLfloat
) farval
;
2499 if (ctx
->ExecuteFlag
) {
2500 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2505 static void GLAPIENTRY
2506 save_Hint(GLenum target
, GLenum mode
)
2508 GET_CURRENT_CONTEXT(ctx
);
2510 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2511 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2516 if (ctx
->ExecuteFlag
) {
2517 CALL_Hint(ctx
->Exec
, (target
, mode
));
2522 static void GLAPIENTRY
2523 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2526 GET_CURRENT_CONTEXT(ctx
);
2529 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2530 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2534 n
[3].e
= internalFormat
;
2537 if (ctx
->ExecuteFlag
) {
2538 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2543 static void GLAPIENTRY
2544 save_IndexMask(GLuint mask
)
2546 GET_CURRENT_CONTEXT(ctx
);
2548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2549 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2553 if (ctx
->ExecuteFlag
) {
2554 CALL_IndexMask(ctx
->Exec
, (mask
));
2559 static void GLAPIENTRY
2560 save_InitNames(void)
2562 GET_CURRENT_CONTEXT(ctx
);
2563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2564 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2565 if (ctx
->ExecuteFlag
) {
2566 CALL_InitNames(ctx
->Exec
, ());
2571 static void GLAPIENTRY
2572 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2574 GET_CURRENT_CONTEXT(ctx
);
2576 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2577 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2595 case GL_SPOT_DIRECTION
:
2598 case GL_SPOT_EXPONENT
:
2601 case GL_SPOT_CUTOFF
:
2604 case GL_CONSTANT_ATTENUATION
:
2607 case GL_LINEAR_ATTENUATION
:
2610 case GL_QUADRATIC_ATTENUATION
:
2616 for (i
= 0; i
< nParams
; i
++) {
2617 n
[3 + i
].f
= params
[i
];
2620 if (ctx
->ExecuteFlag
) {
2621 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2626 static void GLAPIENTRY
2627 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2631 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2632 save_Lightfv(light
, pname
, parray
);
2636 static void GLAPIENTRY
2637 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2644 fparam
[0] = INT_TO_FLOAT(params
[0]);
2645 fparam
[1] = INT_TO_FLOAT(params
[1]);
2646 fparam
[2] = INT_TO_FLOAT(params
[2]);
2647 fparam
[3] = INT_TO_FLOAT(params
[3]);
2650 fparam
[0] = (GLfloat
) params
[0];
2651 fparam
[1] = (GLfloat
) params
[1];
2652 fparam
[2] = (GLfloat
) params
[2];
2653 fparam
[3] = (GLfloat
) params
[3];
2655 case GL_SPOT_DIRECTION
:
2656 fparam
[0] = (GLfloat
) params
[0];
2657 fparam
[1] = (GLfloat
) params
[1];
2658 fparam
[2] = (GLfloat
) params
[2];
2660 case GL_SPOT_EXPONENT
:
2661 case GL_SPOT_CUTOFF
:
2662 case GL_CONSTANT_ATTENUATION
:
2663 case GL_LINEAR_ATTENUATION
:
2664 case GL_QUADRATIC_ATTENUATION
:
2665 fparam
[0] = (GLfloat
) params
[0];
2668 /* error will be caught later in gl_Lightfv */
2671 save_Lightfv(light
, pname
, fparam
);
2675 static void GLAPIENTRY
2676 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2680 parray
[1] = parray
[2] = parray
[3] = 0;
2681 save_Lightiv(light
, pname
, parray
);
2685 static void GLAPIENTRY
2686 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2688 GET_CURRENT_CONTEXT(ctx
);
2690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2691 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2699 if (ctx
->ExecuteFlag
) {
2700 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2705 static void GLAPIENTRY
2706 save_LightModelf(GLenum pname
, GLfloat param
)
2710 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2711 save_LightModelfv(pname
, parray
);
2715 static void GLAPIENTRY
2716 save_LightModeliv(GLenum pname
, const GLint
*params
)
2720 case GL_LIGHT_MODEL_AMBIENT
:
2721 fparam
[0] = INT_TO_FLOAT(params
[0]);
2722 fparam
[1] = INT_TO_FLOAT(params
[1]);
2723 fparam
[2] = INT_TO_FLOAT(params
[2]);
2724 fparam
[3] = INT_TO_FLOAT(params
[3]);
2726 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2727 case GL_LIGHT_MODEL_TWO_SIDE
:
2728 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2729 fparam
[0] = (GLfloat
) params
[0];
2735 /* Error will be caught later in gl_LightModelfv */
2736 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2738 save_LightModelfv(pname
, fparam
);
2742 static void GLAPIENTRY
2743 save_LightModeli(GLenum pname
, GLint param
)
2747 parray
[1] = parray
[2] = parray
[3] = 0;
2748 save_LightModeliv(pname
, parray
);
2752 static void GLAPIENTRY
2753 save_LineStipple(GLint factor
, GLushort pattern
)
2755 GET_CURRENT_CONTEXT(ctx
);
2757 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2758 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2763 if (ctx
->ExecuteFlag
) {
2764 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2769 static void GLAPIENTRY
2770 save_LineWidth(GLfloat width
)
2772 GET_CURRENT_CONTEXT(ctx
);
2774 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2775 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2779 if (ctx
->ExecuteFlag
) {
2780 CALL_LineWidth(ctx
->Exec
, (width
));
2785 static void GLAPIENTRY
2786 save_ListBase(GLuint base
)
2788 GET_CURRENT_CONTEXT(ctx
);
2790 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2791 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2795 if (ctx
->ExecuteFlag
) {
2796 CALL_ListBase(ctx
->Exec
, (base
));
2801 static void GLAPIENTRY
2802 save_LoadIdentity(void)
2804 GET_CURRENT_CONTEXT(ctx
);
2805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2806 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2807 if (ctx
->ExecuteFlag
) {
2808 CALL_LoadIdentity(ctx
->Exec
, ());
2813 static void GLAPIENTRY
2814 save_LoadMatrixf(const GLfloat
* m
)
2816 GET_CURRENT_CONTEXT(ctx
);
2818 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2819 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2822 for (i
= 0; i
< 16; i
++) {
2826 if (ctx
->ExecuteFlag
) {
2827 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2832 static void GLAPIENTRY
2833 save_LoadMatrixd(const GLdouble
* m
)
2837 for (i
= 0; i
< 16; i
++) {
2838 f
[i
] = (GLfloat
) m
[i
];
2840 save_LoadMatrixf(f
);
2844 static void GLAPIENTRY
2845 save_LoadName(GLuint name
)
2847 GET_CURRENT_CONTEXT(ctx
);
2849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2850 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2854 if (ctx
->ExecuteFlag
) {
2855 CALL_LoadName(ctx
->Exec
, (name
));
2860 static void GLAPIENTRY
2861 save_LogicOp(GLenum opcode
)
2863 GET_CURRENT_CONTEXT(ctx
);
2865 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2866 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2870 if (ctx
->ExecuteFlag
) {
2871 CALL_LogicOp(ctx
->Exec
, (opcode
));
2876 static void GLAPIENTRY
2877 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2878 GLint order
, const GLdouble
* points
)
2880 GET_CURRENT_CONTEXT(ctx
);
2882 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2883 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2885 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2887 n
[2].f
= (GLfloat
) u1
;
2888 n
[3].f
= (GLfloat
) u2
;
2889 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2891 n
[6].data
= (void *) pnts
;
2893 if (ctx
->ExecuteFlag
) {
2894 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2898 static void GLAPIENTRY
2899 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2900 GLint order
, const GLfloat
* points
)
2902 GET_CURRENT_CONTEXT(ctx
);
2904 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2905 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2907 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2911 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2913 n
[6].data
= (void *) pnts
;
2915 if (ctx
->ExecuteFlag
) {
2916 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2921 static void GLAPIENTRY
2922 save_Map2d(GLenum target
,
2923 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2924 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2925 const GLdouble
* points
)
2927 GET_CURRENT_CONTEXT(ctx
);
2929 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2930 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2932 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2933 vstride
, vorder
, points
);
2935 n
[2].f
= (GLfloat
) u1
;
2936 n
[3].f
= (GLfloat
) u2
;
2937 n
[4].f
= (GLfloat
) v1
;
2938 n
[5].f
= (GLfloat
) v2
;
2939 /* XXX verify these strides are correct */
2940 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2941 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2944 n
[10].data
= (void *) pnts
;
2946 if (ctx
->ExecuteFlag
) {
2947 CALL_Map2d(ctx
->Exec
, (target
,
2948 u1
, u2
, ustride
, uorder
,
2949 v1
, v2
, vstride
, vorder
, points
));
2954 static void GLAPIENTRY
2955 save_Map2f(GLenum target
,
2956 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2957 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2958 const GLfloat
* points
)
2960 GET_CURRENT_CONTEXT(ctx
);
2962 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2963 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2965 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2966 vstride
, vorder
, points
);
2972 /* XXX verify these strides are correct */
2973 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2974 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2977 n
[10].data
= (void *) pnts
;
2979 if (ctx
->ExecuteFlag
) {
2980 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2981 v1
, v2
, vstride
, vorder
, points
));
2986 static void GLAPIENTRY
2987 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2989 GET_CURRENT_CONTEXT(ctx
);
2991 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2992 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2998 if (ctx
->ExecuteFlag
) {
2999 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3004 static void GLAPIENTRY
3005 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3007 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3011 static void GLAPIENTRY
3012 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3013 GLint vn
, GLfloat v1
, GLfloat v2
)
3015 GET_CURRENT_CONTEXT(ctx
);
3017 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3018 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3027 if (ctx
->ExecuteFlag
) {
3028 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3034 static void GLAPIENTRY
3035 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3036 GLint vn
, GLdouble v1
, GLdouble v2
)
3038 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3039 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3043 static void GLAPIENTRY
3044 save_MatrixMode(GLenum mode
)
3046 GET_CURRENT_CONTEXT(ctx
);
3048 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3049 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3053 if (ctx
->ExecuteFlag
) {
3054 CALL_MatrixMode(ctx
->Exec
, (mode
));
3059 static void GLAPIENTRY
3060 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
3062 GET_CURRENT_CONTEXT(ctx
);
3065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3066 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
3069 n
[2].e
= internalFormat
;
3072 if (ctx
->ExecuteFlag
) {
3073 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
3078 static void GLAPIENTRY
3079 save_MultMatrixf(const GLfloat
* m
)
3081 GET_CURRENT_CONTEXT(ctx
);
3083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3084 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3087 for (i
= 0; i
< 16; i
++) {
3091 if (ctx
->ExecuteFlag
) {
3092 CALL_MultMatrixf(ctx
->Exec
, (m
));
3097 static void GLAPIENTRY
3098 save_MultMatrixd(const GLdouble
* m
)
3102 for (i
= 0; i
< 16; i
++) {
3103 f
[i
] = (GLfloat
) m
[i
];
3105 save_MultMatrixf(f
);
3109 static void GLAPIENTRY
3110 save_NewList(GLuint name
, GLenum mode
)
3112 GET_CURRENT_CONTEXT(ctx
);
3113 /* It's an error to call this function while building a display list */
3114 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3121 static void GLAPIENTRY
3122 save_Ortho(GLdouble left
, GLdouble right
,
3123 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3125 GET_CURRENT_CONTEXT(ctx
);
3127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3128 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3130 n
[1].f
= (GLfloat
) left
;
3131 n
[2].f
= (GLfloat
) right
;
3132 n
[3].f
= (GLfloat
) bottom
;
3133 n
[4].f
= (GLfloat
) top
;
3134 n
[5].f
= (GLfloat
) nearval
;
3135 n
[6].f
= (GLfloat
) farval
;
3137 if (ctx
->ExecuteFlag
) {
3138 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3143 static void GLAPIENTRY
3144 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3146 GET_CURRENT_CONTEXT(ctx
);
3148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3149 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
3153 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
3154 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
3156 if (ctx
->ExecuteFlag
) {
3157 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3162 static void GLAPIENTRY
3163 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3165 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3167 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3168 for (i
= 0; i
< mapsize
; i
++) {
3169 fvalues
[i
] = (GLfloat
) values
[i
];
3173 for (i
= 0; i
< mapsize
; i
++) {
3174 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3177 save_PixelMapfv(map
, mapsize
, fvalues
);
3181 static void GLAPIENTRY
3182 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3184 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3186 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3187 for (i
= 0; i
< mapsize
; i
++) {
3188 fvalues
[i
] = (GLfloat
) values
[i
];
3192 for (i
= 0; i
< mapsize
; i
++) {
3193 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3196 save_PixelMapfv(map
, mapsize
, fvalues
);
3200 static void GLAPIENTRY
3201 save_PixelTransferf(GLenum pname
, GLfloat param
)
3203 GET_CURRENT_CONTEXT(ctx
);
3205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3206 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3211 if (ctx
->ExecuteFlag
) {
3212 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3217 static void GLAPIENTRY
3218 save_PixelTransferi(GLenum pname
, GLint param
)
3220 save_PixelTransferf(pname
, (GLfloat
) param
);
3224 static void GLAPIENTRY
3225 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3227 GET_CURRENT_CONTEXT(ctx
);
3229 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3230 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3235 if (ctx
->ExecuteFlag
) {
3236 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3241 static void GLAPIENTRY
3242 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3244 GET_CURRENT_CONTEXT(ctx
);
3246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3247 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3254 if (ctx
->ExecuteFlag
) {
3255 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3260 static void GLAPIENTRY
3261 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3265 parray
[1] = parray
[2] = 0.0F
;
3266 save_PointParameterfvEXT(pname
, parray
);
3269 static void GLAPIENTRY
3270 save_PointParameteriNV(GLenum pname
, GLint param
)
3273 parray
[0] = (GLfloat
) param
;
3274 parray
[1] = parray
[2] = 0.0F
;
3275 save_PointParameterfvEXT(pname
, parray
);
3278 static void GLAPIENTRY
3279 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3282 parray
[0] = (GLfloat
) param
[0];
3283 parray
[1] = parray
[2] = 0.0F
;
3284 save_PointParameterfvEXT(pname
, parray
);
3288 static void GLAPIENTRY
3289 save_PointSize(GLfloat size
)
3291 GET_CURRENT_CONTEXT(ctx
);
3293 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3294 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3298 if (ctx
->ExecuteFlag
) {
3299 CALL_PointSize(ctx
->Exec
, (size
));
3304 static void GLAPIENTRY
3305 save_PolygonMode(GLenum face
, GLenum mode
)
3307 GET_CURRENT_CONTEXT(ctx
);
3309 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3310 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3315 if (ctx
->ExecuteFlag
) {
3316 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3321 static void GLAPIENTRY
3322 save_PolygonStipple(const GLubyte
* pattern
)
3324 GET_CURRENT_CONTEXT(ctx
);
3327 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3329 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
3331 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3332 pattern
, &ctx
->Unpack
);
3334 if (ctx
->ExecuteFlag
) {
3335 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3340 static void GLAPIENTRY
3341 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3343 GET_CURRENT_CONTEXT(ctx
);
3345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3346 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3351 if (ctx
->ExecuteFlag
) {
3352 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3357 static void GLAPIENTRY
3358 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3360 GET_CURRENT_CONTEXT(ctx
);
3361 /* XXX mult by DepthMaxF here??? */
3362 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3366 static void GLAPIENTRY
3367 save_PopAttrib(void)
3369 GET_CURRENT_CONTEXT(ctx
);
3370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3371 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3372 if (ctx
->ExecuteFlag
) {
3373 CALL_PopAttrib(ctx
->Exec
, ());
3378 static void GLAPIENTRY
3379 save_PopMatrix(void)
3381 GET_CURRENT_CONTEXT(ctx
);
3382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3383 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3384 if (ctx
->ExecuteFlag
) {
3385 CALL_PopMatrix(ctx
->Exec
, ());
3390 static void GLAPIENTRY
3393 GET_CURRENT_CONTEXT(ctx
);
3394 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3395 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3396 if (ctx
->ExecuteFlag
) {
3397 CALL_PopName(ctx
->Exec
, ());
3402 static void GLAPIENTRY
3403 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3404 const GLclampf
* priorities
)
3406 GET_CURRENT_CONTEXT(ctx
);
3408 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3410 for (i
= 0; i
< num
; i
++) {
3412 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3414 n
[1].ui
= textures
[i
];
3415 n
[2].f
= priorities
[i
];
3418 if (ctx
->ExecuteFlag
) {
3419 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3424 static void GLAPIENTRY
3425 save_PushAttrib(GLbitfield mask
)
3427 GET_CURRENT_CONTEXT(ctx
);
3429 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3430 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3434 if (ctx
->ExecuteFlag
) {
3435 CALL_PushAttrib(ctx
->Exec
, (mask
));
3440 static void GLAPIENTRY
3441 save_PushMatrix(void)
3443 GET_CURRENT_CONTEXT(ctx
);
3444 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3445 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3446 if (ctx
->ExecuteFlag
) {
3447 CALL_PushMatrix(ctx
->Exec
, ());
3452 static void GLAPIENTRY
3453 save_PushName(GLuint name
)
3455 GET_CURRENT_CONTEXT(ctx
);
3457 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3458 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3462 if (ctx
->ExecuteFlag
) {
3463 CALL_PushName(ctx
->Exec
, (name
));
3468 static void GLAPIENTRY
3469 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3471 GET_CURRENT_CONTEXT(ctx
);
3473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3474 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3481 if (ctx
->ExecuteFlag
) {
3482 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3486 static void GLAPIENTRY
3487 save_RasterPos2d(GLdouble x
, GLdouble y
)
3489 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3492 static void GLAPIENTRY
3493 save_RasterPos2f(GLfloat x
, GLfloat y
)
3495 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3498 static void GLAPIENTRY
3499 save_RasterPos2i(GLint x
, GLint y
)
3501 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3504 static void GLAPIENTRY
3505 save_RasterPos2s(GLshort x
, GLshort y
)
3507 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3510 static void GLAPIENTRY
3511 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3513 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3516 static void GLAPIENTRY
3517 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3519 save_RasterPos4f(x
, y
, z
, 1.0F
);
3522 static void GLAPIENTRY
3523 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3525 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3528 static void GLAPIENTRY
3529 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3531 save_RasterPos4f(x
, y
, z
, 1.0F
);
3534 static void GLAPIENTRY
3535 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3537 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3540 static void GLAPIENTRY
3541 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3543 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3546 static void GLAPIENTRY
3547 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3549 save_RasterPos4f(x
, y
, z
, w
);
3552 static void GLAPIENTRY
3553 save_RasterPos2dv(const GLdouble
* v
)
3555 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3558 static void GLAPIENTRY
3559 save_RasterPos2fv(const GLfloat
* v
)
3561 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3564 static void GLAPIENTRY
3565 save_RasterPos2iv(const GLint
* v
)
3567 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3570 static void GLAPIENTRY
3571 save_RasterPos2sv(const GLshort
* v
)
3573 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3576 static void GLAPIENTRY
3577 save_RasterPos3dv(const GLdouble
* v
)
3579 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3582 static void GLAPIENTRY
3583 save_RasterPos3fv(const GLfloat
* v
)
3585 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3588 static void GLAPIENTRY
3589 save_RasterPos3iv(const GLint
* v
)
3591 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3594 static void GLAPIENTRY
3595 save_RasterPos3sv(const GLshort
* v
)
3597 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3600 static void GLAPIENTRY
3601 save_RasterPos4dv(const GLdouble
* v
)
3603 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3604 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3607 static void GLAPIENTRY
3608 save_RasterPos4fv(const GLfloat
* v
)
3610 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3613 static void GLAPIENTRY
3614 save_RasterPos4iv(const GLint
* v
)
3616 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3617 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3620 static void GLAPIENTRY
3621 save_RasterPos4sv(const GLshort
* v
)
3623 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3627 static void GLAPIENTRY
3628 save_PassThrough(GLfloat token
)
3630 GET_CURRENT_CONTEXT(ctx
);
3632 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3633 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3637 if (ctx
->ExecuteFlag
) {
3638 CALL_PassThrough(ctx
->Exec
, (token
));
3643 static void GLAPIENTRY
3644 save_ReadBuffer(GLenum mode
)
3646 GET_CURRENT_CONTEXT(ctx
);
3648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3649 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3653 if (ctx
->ExecuteFlag
) {
3654 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3659 static void GLAPIENTRY
3660 save_ResetHistogram(GLenum target
)
3662 GET_CURRENT_CONTEXT(ctx
);
3664 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3665 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3669 if (ctx
->ExecuteFlag
) {
3670 CALL_ResetHistogram(ctx
->Exec
, (target
));
3675 static void GLAPIENTRY
3676 save_ResetMinmax(GLenum target
)
3678 GET_CURRENT_CONTEXT(ctx
);
3680 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3681 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3685 if (ctx
->ExecuteFlag
) {
3686 CALL_ResetMinmax(ctx
->Exec
, (target
));
3691 static void GLAPIENTRY
3692 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3694 GET_CURRENT_CONTEXT(ctx
);
3696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3697 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3704 if (ctx
->ExecuteFlag
) {
3705 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3710 static void GLAPIENTRY
3711 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3713 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3717 static void GLAPIENTRY
3718 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3720 GET_CURRENT_CONTEXT(ctx
);
3722 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3723 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3729 if (ctx
->ExecuteFlag
) {
3730 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3735 static void GLAPIENTRY
3736 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3738 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3742 static void GLAPIENTRY
3743 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3745 GET_CURRENT_CONTEXT(ctx
);
3747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3748 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3755 if (ctx
->ExecuteFlag
) {
3756 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3761 static void GLAPIENTRY
3762 save_ShadeModel(GLenum mode
)
3764 GET_CURRENT_CONTEXT(ctx
);
3766 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3768 if (ctx
->ExecuteFlag
) {
3769 CALL_ShadeModel(ctx
->Exec
, (mode
));
3772 /* Don't compile this call if it's a no-op.
3773 * By avoiding this state change we have a better chance of
3774 * coalescing subsequent drawing commands into one batch.
3776 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3779 SAVE_FLUSH_VERTICES(ctx
);
3781 ctx
->ListState
.Current
.ShadeModel
= mode
;
3783 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3790 static void GLAPIENTRY
3791 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3793 GET_CURRENT_CONTEXT(ctx
);
3795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3796 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3802 if (ctx
->ExecuteFlag
) {
3803 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3808 static void GLAPIENTRY
3809 save_StencilMask(GLuint mask
)
3811 GET_CURRENT_CONTEXT(ctx
);
3813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3814 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3818 if (ctx
->ExecuteFlag
) {
3819 CALL_StencilMask(ctx
->Exec
, (mask
));
3824 static void GLAPIENTRY
3825 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3827 GET_CURRENT_CONTEXT(ctx
);
3829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3830 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3836 if (ctx
->ExecuteFlag
) {
3837 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3842 static void GLAPIENTRY
3843 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3845 GET_CURRENT_CONTEXT(ctx
);
3847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3848 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3855 if (ctx
->ExecuteFlag
) {
3856 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3861 static void GLAPIENTRY
3862 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3865 GET_CURRENT_CONTEXT(ctx
);
3867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3869 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3877 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3884 if (ctx
->ExecuteFlag
) {
3885 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3886 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3891 static void GLAPIENTRY
3892 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3894 GET_CURRENT_CONTEXT(ctx
);
3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3897 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3902 if (ctx
->ExecuteFlag
) {
3903 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3908 static void GLAPIENTRY
3909 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3911 GET_CURRENT_CONTEXT(ctx
);
3913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3914 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3921 if (ctx
->ExecuteFlag
) {
3922 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3927 static void GLAPIENTRY
3928 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3930 GET_CURRENT_CONTEXT(ctx
);
3932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3933 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3937 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3945 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3948 if (ctx
->ExecuteFlag
) {
3949 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3954 static void GLAPIENTRY
3955 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3958 parray
[0] = (GLfloat
) param
;
3959 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3960 save_TexEnvfv(target
, pname
, parray
);
3964 static void GLAPIENTRY
3965 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3968 p
[0] = (GLfloat
) param
;
3969 p
[1] = p
[2] = p
[3] = 0.0F
;
3970 save_TexEnvfv(target
, pname
, p
);
3974 static void GLAPIENTRY
3975 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3978 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3979 p
[0] = INT_TO_FLOAT(param
[0]);
3980 p
[1] = INT_TO_FLOAT(param
[1]);
3981 p
[2] = INT_TO_FLOAT(param
[2]);
3982 p
[3] = INT_TO_FLOAT(param
[3]);
3985 p
[0] = (GLfloat
) param
[0];
3986 p
[1] = p
[2] = p
[3] = 0.0F
;
3988 save_TexEnvfv(target
, pname
, p
);
3992 static void GLAPIENTRY
3993 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3995 GET_CURRENT_CONTEXT(ctx
);
3997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3998 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4007 if (ctx
->ExecuteFlag
) {
4008 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4013 static void GLAPIENTRY
4014 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4017 p
[0] = (GLfloat
) params
[0];
4018 p
[1] = (GLfloat
) params
[1];
4019 p
[2] = (GLfloat
) params
[2];
4020 p
[3] = (GLfloat
) params
[3];
4021 save_TexGenfv(coord
, pname
, p
);
4025 static void GLAPIENTRY
4026 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4029 parray
[0] = (GLfloat
) param
;
4030 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4031 save_TexGenfv(coord
, pname
, parray
);
4035 static void GLAPIENTRY
4036 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4039 p
[0] = (GLfloat
) params
[0];
4040 p
[1] = (GLfloat
) params
[1];
4041 p
[2] = (GLfloat
) params
[2];
4042 p
[3] = (GLfloat
) params
[3];
4043 save_TexGenfv(coord
, pname
, p
);
4047 static void GLAPIENTRY
4048 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4052 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4053 save_TexGenfv(coord
, pname
, parray
);
4057 static void GLAPIENTRY
4058 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4062 parray
[1] = parray
[2] = parray
[3] = 0;
4063 save_TexGeniv(coord
, pname
, parray
);
4067 static void GLAPIENTRY
4068 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4070 GET_CURRENT_CONTEXT(ctx
);
4072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4073 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4082 if (ctx
->ExecuteFlag
) {
4083 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4088 static void GLAPIENTRY
4089 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4093 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4094 save_TexParameterfv(target
, pname
, parray
);
4098 static void GLAPIENTRY
4099 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4102 fparam
[0] = (GLfloat
) param
;
4103 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4104 save_TexParameterfv(target
, pname
, fparam
);
4108 static void GLAPIENTRY
4109 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4112 fparam
[0] = (GLfloat
) params
[0];
4113 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4114 save_TexParameterfv(target
, pname
, fparam
);
4118 static void GLAPIENTRY
4119 save_TexImage1D(GLenum target
,
4120 GLint level
, GLint components
,
4121 GLsizei width
, GLint border
,
4122 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4124 GET_CURRENT_CONTEXT(ctx
);
4125 if (target
== GL_PROXY_TEXTURE_1D
) {
4126 /* don't compile, execute immediately */
4127 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4128 border
, format
, type
, pixels
));
4132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4133 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
4137 n
[3].i
= components
;
4138 n
[4].i
= (GLint
) width
;
4142 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4143 pixels
, &ctx
->Unpack
);
4145 if (ctx
->ExecuteFlag
) {
4146 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4147 border
, format
, type
, pixels
));
4153 static void GLAPIENTRY
4154 save_TexImage2D(GLenum target
,
4155 GLint level
, GLint components
,
4156 GLsizei width
, GLsizei height
, GLint border
,
4157 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4159 GET_CURRENT_CONTEXT(ctx
);
4160 if (target
== GL_PROXY_TEXTURE_2D
) {
4161 /* don't compile, execute immediately */
4162 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4163 height
, border
, format
, type
, pixels
));
4167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4168 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
4172 n
[3].i
= components
;
4173 n
[4].i
= (GLint
) width
;
4174 n
[5].i
= (GLint
) height
;
4178 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4179 pixels
, &ctx
->Unpack
);
4181 if (ctx
->ExecuteFlag
) {
4182 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4183 height
, border
, format
, type
, pixels
));
4189 static void GLAPIENTRY
4190 save_TexImage3D(GLenum target
,
4191 GLint level
, GLint internalFormat
,
4192 GLsizei width
, GLsizei height
, GLsizei depth
,
4194 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4196 GET_CURRENT_CONTEXT(ctx
);
4197 if (target
== GL_PROXY_TEXTURE_3D
) {
4198 /* don't compile, execute immediately */
4199 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4200 height
, depth
, border
, format
, type
,
4205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4206 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
4210 n
[3].i
= (GLint
) internalFormat
;
4211 n
[4].i
= (GLint
) width
;
4212 n
[5].i
= (GLint
) height
;
4213 n
[6].i
= (GLint
) depth
;
4217 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4218 pixels
, &ctx
->Unpack
);
4220 if (ctx
->ExecuteFlag
) {
4221 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4222 height
, depth
, border
, format
, type
,
4229 static void GLAPIENTRY
4230 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4231 GLsizei width
, GLenum format
, GLenum type
,
4232 const GLvoid
* pixels
)
4234 GET_CURRENT_CONTEXT(ctx
);
4237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4239 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
4244 n
[4].i
= (GLint
) width
;
4247 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4248 pixels
, &ctx
->Unpack
);
4250 if (ctx
->ExecuteFlag
) {
4251 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4252 format
, type
, pixels
));
4257 static void GLAPIENTRY
4258 save_TexSubImage2D(GLenum target
, GLint level
,
4259 GLint xoffset
, GLint yoffset
,
4260 GLsizei width
, GLsizei height
,
4261 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4263 GET_CURRENT_CONTEXT(ctx
);
4266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4268 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
4274 n
[5].i
= (GLint
) width
;
4275 n
[6].i
= (GLint
) height
;
4278 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4279 pixels
, &ctx
->Unpack
);
4281 if (ctx
->ExecuteFlag
) {
4282 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4283 width
, height
, format
, type
, pixels
));
4288 static void GLAPIENTRY
4289 save_TexSubImage3D(GLenum target
, GLint level
,
4290 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4291 GLsizei width
, GLsizei height
, GLsizei depth
,
4292 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4294 GET_CURRENT_CONTEXT(ctx
);
4297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4299 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
4306 n
[6].i
= (GLint
) width
;
4307 n
[7].i
= (GLint
) height
;
4308 n
[8].i
= (GLint
) depth
;
4311 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4312 pixels
, &ctx
->Unpack
);
4314 if (ctx
->ExecuteFlag
) {
4315 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4316 xoffset
, yoffset
, zoffset
,
4317 width
, height
, depth
, format
, type
,
4323 static void GLAPIENTRY
4324 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4326 GET_CURRENT_CONTEXT(ctx
);
4328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4329 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4335 if (ctx
->ExecuteFlag
) {
4336 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4341 static void GLAPIENTRY
4342 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4344 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4349 static void GLAPIENTRY
4350 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4352 GET_CURRENT_CONTEXT(ctx
);
4354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4355 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4359 n
[3].i
= (GLint
) width
;
4360 n
[4].i
= (GLint
) height
;
4362 if (ctx
->ExecuteFlag
) {
4363 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4368 static void GLAPIENTRY
4369 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4371 GET_CURRENT_CONTEXT(ctx
);
4373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4374 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4381 if (ctx
->ExecuteFlag
) {
4382 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4386 static void GLAPIENTRY
4387 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4389 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4392 static void GLAPIENTRY
4393 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4395 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4398 static void GLAPIENTRY
4399 save_WindowPos2iMESA(GLint x
, GLint y
)
4401 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4404 static void GLAPIENTRY
4405 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4407 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4410 static void GLAPIENTRY
4411 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4413 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4416 static void GLAPIENTRY
4417 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4419 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4422 static void GLAPIENTRY
4423 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4425 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4428 static void GLAPIENTRY
4429 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4431 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4434 static void GLAPIENTRY
4435 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4437 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4440 static void GLAPIENTRY
4441 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4443 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4446 static void GLAPIENTRY
4447 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4449 save_WindowPos4fMESA(x
, y
, z
, w
);
4452 static void GLAPIENTRY
4453 save_WindowPos2dvMESA(const GLdouble
* v
)
4455 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4458 static void GLAPIENTRY
4459 save_WindowPos2fvMESA(const GLfloat
* v
)
4461 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4464 static void GLAPIENTRY
4465 save_WindowPos2ivMESA(const GLint
* v
)
4467 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4470 static void GLAPIENTRY
4471 save_WindowPos2svMESA(const GLshort
* v
)
4473 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4476 static void GLAPIENTRY
4477 save_WindowPos3dvMESA(const GLdouble
* v
)
4479 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4482 static void GLAPIENTRY
4483 save_WindowPos3fvMESA(const GLfloat
* v
)
4485 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4488 static void GLAPIENTRY
4489 save_WindowPos3ivMESA(const GLint
* v
)
4491 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4494 static void GLAPIENTRY
4495 save_WindowPos3svMESA(const GLshort
* v
)
4497 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4500 static void GLAPIENTRY
4501 save_WindowPos4dvMESA(const GLdouble
* v
)
4503 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4504 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4507 static void GLAPIENTRY
4508 save_WindowPos4fvMESA(const GLfloat
* v
)
4510 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4513 static void GLAPIENTRY
4514 save_WindowPos4ivMESA(const GLint
* v
)
4516 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4517 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4520 static void GLAPIENTRY
4521 save_WindowPos4svMESA(const GLshort
* v
)
4523 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4528 /* GL_ARB_multitexture */
4529 static void GLAPIENTRY
4530 save_ActiveTextureARB(GLenum target
)
4532 GET_CURRENT_CONTEXT(ctx
);
4534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4535 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4539 if (ctx
->ExecuteFlag
) {
4540 CALL_ActiveTexture(ctx
->Exec
, (target
));
4545 /* GL_ARB_transpose_matrix */
4547 static void GLAPIENTRY
4548 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4551 _math_transposefd(tm
, m
);
4552 save_LoadMatrixf(tm
);
4556 static void GLAPIENTRY
4557 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4560 _math_transposef(tm
, m
);
4561 save_LoadMatrixf(tm
);
4565 static void GLAPIENTRY
4566 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4569 _math_transposefd(tm
, m
);
4570 save_MultMatrixf(tm
);
4574 static void GLAPIENTRY
4575 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4578 _math_transposef(tm
, m
);
4579 save_MultMatrixf(tm
);
4582 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4584 GET_CURRENT_CONTEXT(ctx
);
4590 image
= malloc(size
);
4592 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4595 memcpy(image
, data
, size
);
4601 /* GL_ARB_texture_compression */
4602 static void GLAPIENTRY
4603 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4604 GLenum internalFormat
, GLsizei width
,
4605 GLint border
, GLsizei imageSize
,
4606 const GLvoid
* data
)
4608 GET_CURRENT_CONTEXT(ctx
);
4609 if (target
== GL_PROXY_TEXTURE_1D
) {
4610 /* don't compile, execute immediately */
4611 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4612 width
, border
, imageSize
,
4617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4619 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4623 n
[3].e
= internalFormat
;
4624 n
[4].i
= (GLint
) width
;
4627 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4629 if (ctx
->ExecuteFlag
) {
4630 CALL_CompressedTexImage1D(ctx
->Exec
,
4631 (target
, level
, internalFormat
, width
,
4632 border
, imageSize
, data
));
4638 static void GLAPIENTRY
4639 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4640 GLenum internalFormat
, GLsizei width
,
4641 GLsizei height
, GLint border
, GLsizei imageSize
,
4642 const GLvoid
* data
)
4644 GET_CURRENT_CONTEXT(ctx
);
4645 if (target
== GL_PROXY_TEXTURE_2D
) {
4646 /* don't compile, execute immediately */
4647 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4648 width
, height
, border
,
4653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4655 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4659 n
[3].e
= internalFormat
;
4660 n
[4].i
= (GLint
) width
;
4661 n
[5].i
= (GLint
) height
;
4664 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4666 if (ctx
->ExecuteFlag
) {
4667 CALL_CompressedTexImage2D(ctx
->Exec
,
4668 (target
, level
, internalFormat
, width
,
4669 height
, border
, imageSize
, data
));
4675 static void GLAPIENTRY
4676 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4677 GLenum internalFormat
, GLsizei width
,
4678 GLsizei height
, GLsizei depth
, GLint border
,
4679 GLsizei imageSize
, const GLvoid
* data
)
4681 GET_CURRENT_CONTEXT(ctx
);
4682 if (target
== GL_PROXY_TEXTURE_3D
) {
4683 /* don't compile, execute immediately */
4684 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4685 width
, height
, depth
, border
,
4690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4692 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4696 n
[3].e
= internalFormat
;
4697 n
[4].i
= (GLint
) width
;
4698 n
[5].i
= (GLint
) height
;
4699 n
[6].i
= (GLint
) depth
;
4702 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4704 if (ctx
->ExecuteFlag
) {
4705 CALL_CompressedTexImage3D(ctx
->Exec
,
4706 (target
, level
, internalFormat
, width
,
4707 height
, depth
, border
, imageSize
,
4714 static void GLAPIENTRY
4715 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4716 GLsizei width
, GLenum format
,
4717 GLsizei imageSize
, const GLvoid
* data
)
4720 GET_CURRENT_CONTEXT(ctx
);
4721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4723 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4728 n
[4].i
= (GLint
) width
;
4731 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4733 if (ctx
->ExecuteFlag
) {
4734 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4735 width
, format
, imageSize
,
4741 static void GLAPIENTRY
4742 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4743 GLint yoffset
, GLsizei width
, GLsizei height
,
4744 GLenum format
, GLsizei imageSize
,
4745 const GLvoid
* data
)
4748 GET_CURRENT_CONTEXT(ctx
);
4749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4751 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4757 n
[5].i
= (GLint
) width
;
4758 n
[6].i
= (GLint
) height
;
4761 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4763 if (ctx
->ExecuteFlag
) {
4764 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4765 (target
, level
, xoffset
, yoffset
, width
,
4766 height
, format
, imageSize
, data
));
4771 static void GLAPIENTRY
4772 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4773 GLint yoffset
, GLint zoffset
, GLsizei width
,
4774 GLsizei height
, GLsizei depth
, GLenum format
,
4775 GLsizei imageSize
, const GLvoid
* data
)
4778 GET_CURRENT_CONTEXT(ctx
);
4779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4781 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4788 n
[6].i
= (GLint
) width
;
4789 n
[7].i
= (GLint
) height
;
4790 n
[8].i
= (GLint
) depth
;
4792 n
[10].i
= imageSize
;
4793 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4795 if (ctx
->ExecuteFlag
) {
4796 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4797 (target
, level
, xoffset
, yoffset
,
4798 zoffset
, width
, height
, depth
, format
,
4804 /* GL_ARB_multisample */
4805 static void GLAPIENTRY
4806 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4808 GET_CURRENT_CONTEXT(ctx
);
4810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4811 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4816 if (ctx
->ExecuteFlag
) {
4817 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4823 * GL_NV_fragment_program
4825 static void GLAPIENTRY
4826 save_BindProgramNV(GLenum target
, GLuint id
)
4828 GET_CURRENT_CONTEXT(ctx
);
4830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4831 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4836 if (ctx
->ExecuteFlag
) {
4837 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4841 static void GLAPIENTRY
4842 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4843 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4845 GET_CURRENT_CONTEXT(ctx
);
4847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4848 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4857 if (ctx
->ExecuteFlag
) {
4858 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4863 static void GLAPIENTRY
4864 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4865 const GLfloat
*params
)
4867 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4868 params
[2], params
[3]);
4872 static void GLAPIENTRY
4873 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4874 const GLfloat
* params
)
4876 GET_CURRENT_CONTEXT(ctx
);
4878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4882 const GLfloat
* p
= params
;
4884 for (i
= 0 ; i
< count
; i
++) {
4885 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4898 if (ctx
->ExecuteFlag
) {
4899 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4904 static void GLAPIENTRY
4905 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4906 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4908 save_ProgramEnvParameter4fARB(target
, index
,
4910 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4914 static void GLAPIENTRY
4915 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4916 const GLdouble
*params
)
4918 save_ProgramEnvParameter4fARB(target
, index
,
4919 (GLfloat
) params
[0],
4920 (GLfloat
) params
[1],
4921 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4925 static void GLAPIENTRY
4926 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4927 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4929 GET_CURRENT_CONTEXT(ctx
);
4931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4932 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4941 if (ctx
->ExecuteFlag
) {
4942 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4947 static void GLAPIENTRY
4948 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4949 const GLfloat
*params
)
4951 GET_CURRENT_CONTEXT(ctx
);
4953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4954 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4963 if (ctx
->ExecuteFlag
) {
4964 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4969 static void GLAPIENTRY
4970 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4971 const GLfloat
*params
)
4973 GET_CURRENT_CONTEXT(ctx
);
4975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4979 const GLfloat
* p
= params
;
4981 for (i
= 0 ; i
< count
; i
++) {
4982 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4995 if (ctx
->ExecuteFlag
) {
4996 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5001 static void GLAPIENTRY
5002 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5003 GLdouble x
, GLdouble y
,
5004 GLdouble z
, GLdouble w
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5009 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5013 n
[3].f
= (GLfloat
) x
;
5014 n
[4].f
= (GLfloat
) y
;
5015 n
[5].f
= (GLfloat
) z
;
5016 n
[6].f
= (GLfloat
) w
;
5018 if (ctx
->ExecuteFlag
) {
5019 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5024 static void GLAPIENTRY
5025 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5026 const GLdouble
*params
)
5028 GET_CURRENT_CONTEXT(ctx
);
5030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5031 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5035 n
[3].f
= (GLfloat
) params
[0];
5036 n
[4].f
= (GLfloat
) params
[1];
5037 n
[5].f
= (GLfloat
) params
[2];
5038 n
[6].f
= (GLfloat
) params
[3];
5040 if (ctx
->ExecuteFlag
) {
5041 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5046 /* GL_EXT_stencil_two_side */
5047 static void GLAPIENTRY
5048 save_ActiveStencilFaceEXT(GLenum face
)
5050 GET_CURRENT_CONTEXT(ctx
);
5052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5053 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5057 if (ctx
->ExecuteFlag
) {
5058 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5063 /* GL_EXT_depth_bounds_test */
5064 static void GLAPIENTRY
5065 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5067 GET_CURRENT_CONTEXT(ctx
);
5069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5070 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5072 n
[1].f
= (GLfloat
) zmin
;
5073 n
[2].f
= (GLfloat
) zmax
;
5075 if (ctx
->ExecuteFlag
) {
5076 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5082 static void GLAPIENTRY
5083 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5084 const GLvoid
* string
)
5086 GET_CURRENT_CONTEXT(ctx
);
5089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5091 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
5093 GLubyte
*programCopy
= malloc(len
);
5095 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5098 memcpy(programCopy
, string
, len
);
5102 n
[4].data
= programCopy
;
5104 if (ctx
->ExecuteFlag
) {
5105 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5110 static void GLAPIENTRY
5111 save_BeginQueryARB(GLenum target
, GLuint id
)
5113 GET_CURRENT_CONTEXT(ctx
);
5115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5116 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5121 if (ctx
->ExecuteFlag
) {
5122 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5126 static void GLAPIENTRY
5127 save_EndQueryARB(GLenum target
)
5129 GET_CURRENT_CONTEXT(ctx
);
5131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5132 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5136 if (ctx
->ExecuteFlag
) {
5137 CALL_EndQuery(ctx
->Exec
, (target
));
5141 static void GLAPIENTRY
5142 save_QueryCounter(GLuint id
, GLenum target
)
5144 GET_CURRENT_CONTEXT(ctx
);
5146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5147 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5152 if (ctx
->ExecuteFlag
) {
5153 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5157 static void GLAPIENTRY
5158 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5160 GET_CURRENT_CONTEXT(ctx
);
5162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5163 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5169 if (ctx
->ExecuteFlag
) {
5170 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5174 static void GLAPIENTRY
5175 save_EndQueryIndexed(GLenum target
, GLuint index
)
5177 GET_CURRENT_CONTEXT(ctx
);
5179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5180 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5185 if (ctx
->ExecuteFlag
) {
5186 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5191 static void GLAPIENTRY
5192 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5194 GET_CURRENT_CONTEXT(ctx
);
5196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5197 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5201 if (count
> MAX_DRAW_BUFFERS
)
5202 count
= MAX_DRAW_BUFFERS
;
5203 for (i
= 0; i
< count
; i
++) {
5204 n
[2 + i
].e
= buffers
[i
];
5207 if (ctx
->ExecuteFlag
) {
5208 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5212 static void GLAPIENTRY
5213 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5215 GET_CURRENT_CONTEXT(ctx
);
5218 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5226 if (ctx
->ExecuteFlag
) {
5227 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5231 static void GLAPIENTRY
5232 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5235 p
[0] = INT_TO_FLOAT(param
[0]);
5236 p
[1] = INT_TO_FLOAT(param
[1]);
5237 p
[2] = INT_TO_FLOAT(param
[2]);
5238 p
[3] = INT_TO_FLOAT(param
[3]);
5239 save_TexBumpParameterfvATI(pname
, p
);
5242 static void GLAPIENTRY
5243 save_BindFragmentShaderATI(GLuint id
)
5245 GET_CURRENT_CONTEXT(ctx
);
5248 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5252 if (ctx
->ExecuteFlag
) {
5253 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5257 static void GLAPIENTRY
5258 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5260 GET_CURRENT_CONTEXT(ctx
);
5263 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5271 if (ctx
->ExecuteFlag
) {
5272 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5276 static void GLAPIENTRY
5277 save_Attr1fNV(GLenum attr
, GLfloat x
)
5279 GET_CURRENT_CONTEXT(ctx
);
5281 SAVE_FLUSH_VERTICES(ctx
);
5282 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5288 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5289 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5290 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5292 if (ctx
->ExecuteFlag
) {
5293 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5297 static void GLAPIENTRY
5298 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5300 GET_CURRENT_CONTEXT(ctx
);
5302 SAVE_FLUSH_VERTICES(ctx
);
5303 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5310 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5311 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5312 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5314 if (ctx
->ExecuteFlag
) {
5315 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5319 static void GLAPIENTRY
5320 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5322 GET_CURRENT_CONTEXT(ctx
);
5324 SAVE_FLUSH_VERTICES(ctx
);
5325 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5333 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5334 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5335 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5337 if (ctx
->ExecuteFlag
) {
5338 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5342 static void GLAPIENTRY
5343 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5345 GET_CURRENT_CONTEXT(ctx
);
5347 SAVE_FLUSH_VERTICES(ctx
);
5348 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5357 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5358 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5359 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5361 if (ctx
->ExecuteFlag
) {
5362 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5367 static void GLAPIENTRY
5368 save_Attr1fARB(GLenum attr
, GLfloat x
)
5370 GET_CURRENT_CONTEXT(ctx
);
5372 SAVE_FLUSH_VERTICES(ctx
);
5373 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5379 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5380 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5381 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5383 if (ctx
->ExecuteFlag
) {
5384 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5388 static void GLAPIENTRY
5389 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5391 GET_CURRENT_CONTEXT(ctx
);
5393 SAVE_FLUSH_VERTICES(ctx
);
5394 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5401 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5402 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5403 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5405 if (ctx
->ExecuteFlag
) {
5406 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5410 static void GLAPIENTRY
5411 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5413 GET_CURRENT_CONTEXT(ctx
);
5415 SAVE_FLUSH_VERTICES(ctx
);
5416 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5424 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5425 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5426 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5428 if (ctx
->ExecuteFlag
) {
5429 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5433 static void GLAPIENTRY
5434 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5436 GET_CURRENT_CONTEXT(ctx
);
5438 SAVE_FLUSH_VERTICES(ctx
);
5439 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5448 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5449 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5450 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5452 if (ctx
->ExecuteFlag
) {
5453 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5458 static void GLAPIENTRY
5459 save_EvalCoord1f(GLfloat x
)
5461 GET_CURRENT_CONTEXT(ctx
);
5463 SAVE_FLUSH_VERTICES(ctx
);
5464 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5468 if (ctx
->ExecuteFlag
) {
5469 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5473 static void GLAPIENTRY
5474 save_EvalCoord1fv(const GLfloat
* v
)
5476 save_EvalCoord1f(v
[0]);
5479 static void GLAPIENTRY
5480 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5482 GET_CURRENT_CONTEXT(ctx
);
5484 SAVE_FLUSH_VERTICES(ctx
);
5485 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5490 if (ctx
->ExecuteFlag
) {
5491 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5495 static void GLAPIENTRY
5496 save_EvalCoord2fv(const GLfloat
* v
)
5498 save_EvalCoord2f(v
[0], v
[1]);
5502 static void GLAPIENTRY
5503 save_EvalPoint1(GLint x
)
5505 GET_CURRENT_CONTEXT(ctx
);
5507 SAVE_FLUSH_VERTICES(ctx
);
5508 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5512 if (ctx
->ExecuteFlag
) {
5513 CALL_EvalPoint1(ctx
->Exec
, (x
));
5517 static void GLAPIENTRY
5518 save_EvalPoint2(GLint x
, GLint y
)
5520 GET_CURRENT_CONTEXT(ctx
);
5522 SAVE_FLUSH_VERTICES(ctx
);
5523 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5528 if (ctx
->ExecuteFlag
) {
5529 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5533 static void GLAPIENTRY
5534 save_Indexf(GLfloat x
)
5536 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5539 static void GLAPIENTRY
5540 save_Indexfv(const GLfloat
* v
)
5542 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5545 static void GLAPIENTRY
5546 save_EdgeFlag(GLboolean x
)
5548 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5553 * Compare 'count' elements of vectors 'a' and 'b'.
5554 * \return GL_TRUE if equal, GL_FALSE if different.
5556 static inline GLboolean
5557 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5559 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5564 * This glMaterial function is used for glMaterial calls that are outside
5565 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5567 static void GLAPIENTRY
5568 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5570 GET_CURRENT_CONTEXT(ctx
);
5578 case GL_FRONT_AND_BACK
:
5581 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5590 case GL_AMBIENT_AND_DIFFUSE
:
5596 case GL_COLOR_INDEXES
:
5600 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5604 if (ctx
->ExecuteFlag
) {
5605 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5608 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5610 /* Try to eliminate redundant statechanges. Because it is legal to
5611 * call glMaterial even inside begin/end calls, don't need to worry
5612 * about ctx->Driver.CurrentSavePrimitive here.
5614 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5615 if (bitmask
& (1 << i
)) {
5616 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5617 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5618 /* no change in material value */
5619 bitmask
&= ~(1 << i
);
5622 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5623 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5628 /* If this call has no effect, return early */
5632 SAVE_FLUSH_VERTICES(ctx
);
5634 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5638 for (i
= 0; i
< args
; i
++)
5639 n
[3 + i
].f
= param
[i
];
5643 static void GLAPIENTRY
5644 save_Begin(GLenum mode
)
5646 GET_CURRENT_CONTEXT(ctx
);
5648 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5649 /* compile this error into the display list */
5650 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5652 else if (_mesa_inside_dlist_begin_end(ctx
) &&
5653 ctx
->Driver
.CurrentSavePrimitive
!= PRIM_UNKNOWN
) {
5654 /* compile this error into the display list */
5655 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5660 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5662 /* Give the driver an opportunity to hook in an optimized
5663 * display list compiler.
5665 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5668 SAVE_FLUSH_VERTICES(ctx
);
5669 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5674 if (ctx
->ExecuteFlag
) {
5675 CALL_Begin(ctx
->Exec
, (mode
));
5680 static void GLAPIENTRY
5683 GET_CURRENT_CONTEXT(ctx
);
5684 SAVE_FLUSH_VERTICES(ctx
);
5685 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5686 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5687 if (ctx
->ExecuteFlag
) {
5688 CALL_End(ctx
->Exec
, ());
5692 static void GLAPIENTRY
5693 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5695 GET_CURRENT_CONTEXT(ctx
);
5697 SAVE_FLUSH_VERTICES(ctx
);
5698 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5705 if (ctx
->ExecuteFlag
) {
5706 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5711 static void GLAPIENTRY
5712 save_Vertex2f(GLfloat x
, GLfloat y
)
5714 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5717 static void GLAPIENTRY
5718 save_Vertex2fv(const GLfloat
* v
)
5720 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5723 static void GLAPIENTRY
5724 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5726 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5729 static void GLAPIENTRY
5730 save_Vertex3fv(const GLfloat
* v
)
5732 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5735 static void GLAPIENTRY
5736 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5738 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5741 static void GLAPIENTRY
5742 save_Vertex4fv(const GLfloat
* v
)
5744 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5747 static void GLAPIENTRY
5748 save_TexCoord1f(GLfloat x
)
5750 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5753 static void GLAPIENTRY
5754 save_TexCoord1fv(const GLfloat
* v
)
5756 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5759 static void GLAPIENTRY
5760 save_TexCoord2f(GLfloat x
, GLfloat y
)
5762 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5765 static void GLAPIENTRY
5766 save_TexCoord2fv(const GLfloat
* v
)
5768 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5771 static void GLAPIENTRY
5772 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5774 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5777 static void GLAPIENTRY
5778 save_TexCoord3fv(const GLfloat
* v
)
5780 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5783 static void GLAPIENTRY
5784 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5786 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5789 static void GLAPIENTRY
5790 save_TexCoord4fv(const GLfloat
* v
)
5792 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5795 static void GLAPIENTRY
5796 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5798 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5801 static void GLAPIENTRY
5802 save_Normal3fv(const GLfloat
* v
)
5804 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5807 static void GLAPIENTRY
5808 save_FogCoordfEXT(GLfloat x
)
5810 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5813 static void GLAPIENTRY
5814 save_FogCoordfvEXT(const GLfloat
* v
)
5816 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5819 static void GLAPIENTRY
5820 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5822 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5825 static void GLAPIENTRY
5826 save_Color3fv(const GLfloat
* v
)
5828 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5831 static void GLAPIENTRY
5832 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5834 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5837 static void GLAPIENTRY
5838 save_Color4fv(const GLfloat
* v
)
5840 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5843 static void GLAPIENTRY
5844 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5846 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5849 static void GLAPIENTRY
5850 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5852 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5856 /* Just call the respective ATTR for texcoord
5858 static void GLAPIENTRY
5859 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5861 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5862 save_Attr1fNV(attr
, x
);
5865 static void GLAPIENTRY
5866 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5868 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5869 save_Attr1fNV(attr
, v
[0]);
5872 static void GLAPIENTRY
5873 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5875 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5876 save_Attr2fNV(attr
, x
, y
);
5879 static void GLAPIENTRY
5880 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5882 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5883 save_Attr2fNV(attr
, v
[0], v
[1]);
5886 static void GLAPIENTRY
5887 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5889 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5890 save_Attr3fNV(attr
, x
, y
, z
);
5893 static void GLAPIENTRY
5894 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5896 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5897 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5900 static void GLAPIENTRY
5901 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5902 GLfloat z
, GLfloat w
)
5904 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5905 save_Attr4fNV(attr
, x
, y
, z
, w
);
5908 static void GLAPIENTRY
5909 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5911 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5912 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5917 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5923 GET_CURRENT_CONTEXT(ctx
);
5924 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5929 static void GLAPIENTRY
5930 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5932 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5933 save_Attr1fARB(index
, x
);
5938 static void GLAPIENTRY
5939 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5941 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5942 save_Attr1fARB(index
, v
[0]);
5947 static void GLAPIENTRY
5948 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5950 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5951 save_Attr2fARB(index
, x
, y
);
5956 static void GLAPIENTRY
5957 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5959 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5960 save_Attr2fARB(index
, v
[0], v
[1]);
5965 static void GLAPIENTRY
5966 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5968 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5969 save_Attr3fARB(index
, x
, y
, z
);
5974 static void GLAPIENTRY
5975 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5977 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5978 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5983 static void GLAPIENTRY
5984 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5987 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5988 save_Attr4fARB(index
, x
, y
, z
, w
);
5993 static void GLAPIENTRY
5994 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5996 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5997 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6002 static void GLAPIENTRY
6003 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6004 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6005 GLbitfield mask
, GLenum filter
)
6007 GET_CURRENT_CONTEXT(ctx
);
6009 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6010 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6023 if (ctx
->ExecuteFlag
) {
6024 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6025 dstX0
, dstY0
, dstX1
, dstY1
,
6031 /** GL_EXT_provoking_vertex */
6032 static void GLAPIENTRY
6033 save_ProvokingVertexEXT(GLenum mode
)
6035 GET_CURRENT_CONTEXT(ctx
);
6037 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6038 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6042 if (ctx
->ExecuteFlag
) {
6043 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6044 _mesa_ProvokingVertex(mode
);
6049 /** GL_EXT_transform_feedback */
6050 static void GLAPIENTRY
6051 save_BeginTransformFeedback(GLenum mode
)
6053 GET_CURRENT_CONTEXT(ctx
);
6055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6056 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6060 if (ctx
->ExecuteFlag
) {
6061 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6066 /** GL_EXT_transform_feedback */
6067 static void GLAPIENTRY
6068 save_EndTransformFeedback(void)
6070 GET_CURRENT_CONTEXT(ctx
);
6071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6072 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6073 if (ctx
->ExecuteFlag
) {
6074 CALL_EndTransformFeedback(ctx
->Exec
, ());
6078 static void GLAPIENTRY
6079 save_BindTransformFeedback(GLenum target
, GLuint name
)
6081 GET_CURRENT_CONTEXT(ctx
);
6083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6084 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6089 if (ctx
->ExecuteFlag
) {
6090 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6094 static void GLAPIENTRY
6095 save_PauseTransformFeedback(void)
6097 GET_CURRENT_CONTEXT(ctx
);
6098 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6099 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6100 if (ctx
->ExecuteFlag
) {
6101 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6105 static void GLAPIENTRY
6106 save_ResumeTransformFeedback(void)
6108 GET_CURRENT_CONTEXT(ctx
);
6109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6110 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6111 if (ctx
->ExecuteFlag
) {
6112 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6116 static void GLAPIENTRY
6117 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6119 GET_CURRENT_CONTEXT(ctx
);
6121 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6122 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6127 if (ctx
->ExecuteFlag
) {
6128 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6132 static void GLAPIENTRY
6133 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6135 GET_CURRENT_CONTEXT(ctx
);
6137 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6138 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6144 if (ctx
->ExecuteFlag
) {
6145 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6149 static void GLAPIENTRY
6150 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6153 GET_CURRENT_CONTEXT(ctx
);
6155 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6156 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6160 n
[3].si
= primcount
;
6162 if (ctx
->ExecuteFlag
) {
6163 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6167 static void GLAPIENTRY
6168 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6169 GLuint stream
, GLsizei primcount
)
6171 GET_CURRENT_CONTEXT(ctx
);
6173 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6174 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6179 n
[4].si
= primcount
;
6181 if (ctx
->ExecuteFlag
) {
6182 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6187 /* aka UseProgram() */
6188 static void GLAPIENTRY
6189 save_UseProgramObjectARB(GLhandleARB program
)
6191 GET_CURRENT_CONTEXT(ctx
);
6193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6194 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6198 if (ctx
->ExecuteFlag
) {
6199 CALL_UseProgram(ctx
->Exec
, (program
));
6204 static void GLAPIENTRY
6205 save_Uniform1fARB(GLint location
, GLfloat x
)
6207 GET_CURRENT_CONTEXT(ctx
);
6209 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6210 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6215 if (ctx
->ExecuteFlag
) {
6216 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6221 static void GLAPIENTRY
6222 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6224 GET_CURRENT_CONTEXT(ctx
);
6226 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6227 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6233 if (ctx
->ExecuteFlag
) {
6234 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6239 static void GLAPIENTRY
6240 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6242 GET_CURRENT_CONTEXT(ctx
);
6244 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6245 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6252 if (ctx
->ExecuteFlag
) {
6253 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6258 static void GLAPIENTRY
6259 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6261 GET_CURRENT_CONTEXT(ctx
);
6263 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6264 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6272 if (ctx
->ExecuteFlag
) {
6273 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6278 /** Return copy of memory */
6280 memdup(const void *src
, GLsizei bytes
)
6282 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
6284 memcpy(b
, src
, bytes
);
6289 static void GLAPIENTRY
6290 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6292 GET_CURRENT_CONTEXT(ctx
);
6294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6295 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6299 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6301 if (ctx
->ExecuteFlag
) {
6302 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6306 static void GLAPIENTRY
6307 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6309 GET_CURRENT_CONTEXT(ctx
);
6311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6312 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6316 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6318 if (ctx
->ExecuteFlag
) {
6319 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6323 static void GLAPIENTRY
6324 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6326 GET_CURRENT_CONTEXT(ctx
);
6328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6329 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6333 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6335 if (ctx
->ExecuteFlag
) {
6336 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6340 static void GLAPIENTRY
6341 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6343 GET_CURRENT_CONTEXT(ctx
);
6345 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6346 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6350 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6352 if (ctx
->ExecuteFlag
) {
6353 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6358 static void GLAPIENTRY
6359 save_Uniform1iARB(GLint location
, GLint x
)
6361 GET_CURRENT_CONTEXT(ctx
);
6363 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6364 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6369 if (ctx
->ExecuteFlag
) {
6370 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6374 static void GLAPIENTRY
6375 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6377 GET_CURRENT_CONTEXT(ctx
);
6379 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6380 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6386 if (ctx
->ExecuteFlag
) {
6387 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6391 static void GLAPIENTRY
6392 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6394 GET_CURRENT_CONTEXT(ctx
);
6396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6397 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6404 if (ctx
->ExecuteFlag
) {
6405 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6409 static void GLAPIENTRY
6410 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6412 GET_CURRENT_CONTEXT(ctx
);
6414 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6415 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6423 if (ctx
->ExecuteFlag
) {
6424 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6430 static void GLAPIENTRY
6431 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6433 GET_CURRENT_CONTEXT(ctx
);
6435 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6436 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6440 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6442 if (ctx
->ExecuteFlag
) {
6443 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6447 static void GLAPIENTRY
6448 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6450 GET_CURRENT_CONTEXT(ctx
);
6452 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6453 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6457 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6459 if (ctx
->ExecuteFlag
) {
6460 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6464 static void GLAPIENTRY
6465 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6467 GET_CURRENT_CONTEXT(ctx
);
6469 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6470 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6474 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6476 if (ctx
->ExecuteFlag
) {
6477 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6481 static void GLAPIENTRY
6482 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6484 GET_CURRENT_CONTEXT(ctx
);
6486 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6487 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6491 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6493 if (ctx
->ExecuteFlag
) {
6494 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6500 static void GLAPIENTRY
6501 save_Uniform1ui(GLint location
, GLuint x
)
6503 GET_CURRENT_CONTEXT(ctx
);
6505 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6506 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6511 if (ctx
->ExecuteFlag
) {
6512 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6516 static void GLAPIENTRY
6517 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6519 GET_CURRENT_CONTEXT(ctx
);
6521 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6522 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6528 if (ctx
->ExecuteFlag
) {
6529 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6533 static void GLAPIENTRY
6534 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6536 GET_CURRENT_CONTEXT(ctx
);
6538 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6539 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6546 if (ctx
->ExecuteFlag
) {
6547 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6551 static void GLAPIENTRY
6552 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6554 GET_CURRENT_CONTEXT(ctx
);
6556 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6557 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6565 if (ctx
->ExecuteFlag
) {
6566 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6572 static void GLAPIENTRY
6573 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6575 GET_CURRENT_CONTEXT(ctx
);
6577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6578 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6582 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6584 if (ctx
->ExecuteFlag
) {
6585 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6589 static void GLAPIENTRY
6590 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6592 GET_CURRENT_CONTEXT(ctx
);
6594 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6595 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6599 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6601 if (ctx
->ExecuteFlag
) {
6602 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6606 static void GLAPIENTRY
6607 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6609 GET_CURRENT_CONTEXT(ctx
);
6611 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6612 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6616 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6618 if (ctx
->ExecuteFlag
) {
6619 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6623 static void GLAPIENTRY
6624 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6626 GET_CURRENT_CONTEXT(ctx
);
6628 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6629 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6633 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6635 if (ctx
->ExecuteFlag
) {
6636 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6642 static void GLAPIENTRY
6643 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6646 GET_CURRENT_CONTEXT(ctx
);
6648 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6649 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6654 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6656 if (ctx
->ExecuteFlag
) {
6657 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6661 static void GLAPIENTRY
6662 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6665 GET_CURRENT_CONTEXT(ctx
);
6667 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6668 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6673 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6675 if (ctx
->ExecuteFlag
) {
6676 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6680 static void GLAPIENTRY
6681 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6684 GET_CURRENT_CONTEXT(ctx
);
6686 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6687 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6692 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6694 if (ctx
->ExecuteFlag
) {
6695 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6700 static void GLAPIENTRY
6701 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6704 GET_CURRENT_CONTEXT(ctx
);
6706 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6707 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6712 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6714 if (ctx
->ExecuteFlag
) {
6715 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6719 static void GLAPIENTRY
6720 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6723 GET_CURRENT_CONTEXT(ctx
);
6725 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6726 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6731 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6733 if (ctx
->ExecuteFlag
) {
6734 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6739 static void GLAPIENTRY
6740 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6743 GET_CURRENT_CONTEXT(ctx
);
6745 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6746 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6751 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6753 if (ctx
->ExecuteFlag
) {
6754 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6758 static void GLAPIENTRY
6759 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6762 GET_CURRENT_CONTEXT(ctx
);
6764 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6765 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6770 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6772 if (ctx
->ExecuteFlag
) {
6773 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6778 static void GLAPIENTRY
6779 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6782 GET_CURRENT_CONTEXT(ctx
);
6784 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6785 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6790 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6792 if (ctx
->ExecuteFlag
) {
6793 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6797 static void GLAPIENTRY
6798 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6801 GET_CURRENT_CONTEXT(ctx
);
6803 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6804 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6809 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6811 if (ctx
->ExecuteFlag
) {
6812 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6816 static void GLAPIENTRY
6817 save_ClampColorARB(GLenum target
, GLenum clamp
)
6819 GET_CURRENT_CONTEXT(ctx
);
6821 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6822 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6827 if (ctx
->ExecuteFlag
) {
6828 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6832 static void GLAPIENTRY
6833 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6835 GET_CURRENT_CONTEXT(ctx
);
6837 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6838 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6843 if (ctx
->ExecuteFlag
) {
6844 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6848 static void GLAPIENTRY
6849 save_ActiveProgramEXT(GLuint program
)
6851 GET_CURRENT_CONTEXT(ctx
);
6853 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6854 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6858 if (ctx
->ExecuteFlag
) {
6859 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6863 /** GL_EXT_texture_integer */
6864 static void GLAPIENTRY
6865 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6867 GET_CURRENT_CONTEXT(ctx
);
6869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6870 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6877 if (ctx
->ExecuteFlag
) {
6878 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6882 /** GL_EXT_texture_integer */
6883 static void GLAPIENTRY
6884 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6886 GET_CURRENT_CONTEXT(ctx
);
6888 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6889 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6896 if (ctx
->ExecuteFlag
) {
6897 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6901 /** GL_EXT_texture_integer */
6902 static void GLAPIENTRY
6903 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6905 GET_CURRENT_CONTEXT(ctx
);
6907 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6908 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6917 if (ctx
->ExecuteFlag
) {
6918 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6922 /** GL_EXT_texture_integer */
6923 static void GLAPIENTRY
6924 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6926 GET_CURRENT_CONTEXT(ctx
);
6928 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6929 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6933 n
[3].ui
= params
[0];
6934 n
[4].ui
= params
[1];
6935 n
[5].ui
= params
[2];
6936 n
[6].ui
= params
[3];
6938 if (ctx
->ExecuteFlag
) {
6939 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6943 /* GL_ARB_instanced_arrays */
6944 static void GLAPIENTRY
6945 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6947 GET_CURRENT_CONTEXT(ctx
);
6949 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6950 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6955 if (ctx
->ExecuteFlag
) {
6956 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6961 /* GL_NV_texture_barrier */
6962 static void GLAPIENTRY
6963 save_TextureBarrierNV(void)
6965 GET_CURRENT_CONTEXT(ctx
);
6966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6967 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6968 if (ctx
->ExecuteFlag
) {
6969 CALL_TextureBarrierNV(ctx
->Exec
, ());
6974 /* GL_ARB_sampler_objects */
6975 static void GLAPIENTRY
6976 save_BindSampler(GLuint unit
, GLuint sampler
)
6979 GET_CURRENT_CONTEXT(ctx
);
6980 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6981 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6986 if (ctx
->ExecuteFlag
) {
6987 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6991 static void GLAPIENTRY
6992 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6995 GET_CURRENT_CONTEXT(ctx
);
6996 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6997 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7002 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7008 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7011 if (ctx
->ExecuteFlag
) {
7012 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7016 static void GLAPIENTRY
7017 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7019 save_SamplerParameteriv(sampler
, pname
, ¶m
);
7022 static void GLAPIENTRY
7023 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7026 GET_CURRENT_CONTEXT(ctx
);
7027 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7028 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7033 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7039 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7042 if (ctx
->ExecuteFlag
) {
7043 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7047 static void GLAPIENTRY
7048 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7050 save_SamplerParameterfv(sampler
, pname
, ¶m
);
7053 static void GLAPIENTRY
7054 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7057 GET_CURRENT_CONTEXT(ctx
);
7058 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7059 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7064 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7070 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7073 if (ctx
->ExecuteFlag
) {
7074 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7078 static void GLAPIENTRY
7079 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7082 GET_CURRENT_CONTEXT(ctx
);
7083 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7084 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7088 n
[3].ui
= params
[0];
7089 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7090 n
[4].ui
= params
[1];
7091 n
[5].ui
= params
[2];
7092 n
[6].ui
= params
[3];
7095 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7098 if (ctx
->ExecuteFlag
) {
7099 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7103 /* GL_ARB_geometry_shader4 */
7104 static void GLAPIENTRY
7105 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7108 GET_CURRENT_CONTEXT(ctx
);
7109 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7110 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7116 if (ctx
->ExecuteFlag
) {
7117 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7121 static void GLAPIENTRY
7122 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7123 GLuint texture
, GLint level
)
7126 GET_CURRENT_CONTEXT(ctx
);
7127 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7128 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7131 n
[2].e
= attachment
;
7135 if (ctx
->ExecuteFlag
) {
7136 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7140 static void GLAPIENTRY
7141 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7142 GLuint texture
, GLint level
, GLenum face
)
7145 GET_CURRENT_CONTEXT(ctx
);
7146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7147 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7150 n
[2].e
= attachment
;
7155 if (ctx
->ExecuteFlag
) {
7156 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7163 static void GLAPIENTRY
7164 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7167 GET_CURRENT_CONTEXT(ctx
);
7168 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7169 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7171 union uint64_pair p
;
7175 n
[3].ui
= p
.uint32
[0];
7176 n
[4].ui
= p
.uint32
[1];
7178 if (ctx
->ExecuteFlag
) {
7179 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7184 /** GL_NV_conditional_render */
7185 static void GLAPIENTRY
7186 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7188 GET_CURRENT_CONTEXT(ctx
);
7190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7191 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7196 if (ctx
->ExecuteFlag
) {
7197 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7201 static void GLAPIENTRY
7202 save_EndConditionalRender(void)
7204 GET_CURRENT_CONTEXT(ctx
);
7205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7206 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7207 if (ctx
->ExecuteFlag
) {
7208 CALL_EndConditionalRender(ctx
->Exec
, ());
7212 static void GLAPIENTRY
7213 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7215 GET_CURRENT_CONTEXT(ctx
);
7217 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7218 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7224 if (ctx
->ExecuteFlag
) {
7225 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7231 * Save an error-generating command into display list.
7233 * KW: Will appear in the list before the vertex buffer containing the
7234 * command that provoked the error. I don't see this as a problem.
7237 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7240 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
7243 n
[2].data
= (void *) s
;
7249 * Compile an error into current display list.
7252 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7254 if (ctx
->CompileFlag
)
7255 save_error(ctx
, error
, s
);
7256 if (ctx
->ExecuteFlag
)
7257 _mesa_error(ctx
, error
, "%s", s
);
7262 * Test if ID names a display list.
7265 islist(struct gl_context
*ctx
, GLuint list
)
7267 if (list
> 0 && lookup_list(ctx
, list
)) {
7277 /**********************************************************************/
7278 /* Display list execution */
7279 /**********************************************************************/
7283 * Execute a display list. Note that the ListBase offset must have already
7284 * been added before calling this function. I.e. the list argument is
7285 * the absolute list number, not relative to ListBase.
7286 * \param list - display list number
7289 execute_list(struct gl_context
*ctx
, GLuint list
)
7291 struct gl_display_list
*dlist
;
7295 if (list
== 0 || !islist(ctx
, list
))
7298 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7299 /* raise an error? */
7303 dlist
= lookup_list(ctx
, list
);
7307 ctx
->ListState
.CallDepth
++;
7309 if (ctx
->Driver
.BeginCallList
)
7310 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7316 const OpCode opcode
= n
[0].opcode
;
7318 if (is_ext_opcode(opcode
)) {
7319 n
+= ext_opcode_execute(ctx
, n
);
7324 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
7327 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7329 case OPCODE_ALPHA_FUNC
:
7330 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7332 case OPCODE_BIND_TEXTURE
:
7333 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7337 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7338 ctx
->Unpack
= ctx
->DefaultPacking
;
7339 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7340 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7341 (const GLubyte
*) n
[7].data
));
7342 ctx
->Unpack
= save
; /* restore */
7345 case OPCODE_BLEND_COLOR
:
7346 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7348 case OPCODE_BLEND_EQUATION
:
7349 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7351 case OPCODE_BLEND_EQUATION_SEPARATE
:
7352 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7354 case OPCODE_BLEND_FUNC_SEPARATE
:
7355 CALL_BlendFuncSeparate(ctx
->Exec
,
7356 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7359 case OPCODE_BLEND_FUNC_I
:
7360 /* GL_ARB_draw_buffers_blend */
7361 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7363 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7364 /* GL_ARB_draw_buffers_blend */
7365 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7368 case OPCODE_BLEND_EQUATION_I
:
7369 /* GL_ARB_draw_buffers_blend */
7370 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7372 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7373 /* GL_ARB_draw_buffers_blend */
7374 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7375 (n
[1].ui
, n
[2].e
, n
[3].e
));
7378 case OPCODE_CALL_LIST
:
7379 /* Generated by glCallList(), don't add ListBase */
7380 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7381 execute_list(ctx
, n
[1].ui
);
7384 case OPCODE_CALL_LIST_OFFSET
:
7385 /* Generated by glCallLists() so we must add ListBase */
7387 /* user specified a bad data type at compile time */
7388 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7390 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7391 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7392 execute_list(ctx
, list
);
7396 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7398 case OPCODE_CLEAR_BUFFER_IV
:
7405 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7408 case OPCODE_CLEAR_BUFFER_UIV
:
7415 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7418 case OPCODE_CLEAR_BUFFER_FV
:
7425 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7428 case OPCODE_CLEAR_BUFFER_FI
:
7429 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7431 case OPCODE_CLEAR_COLOR
:
7432 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7434 case OPCODE_CLEAR_ACCUM
:
7435 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7437 case OPCODE_CLEAR_DEPTH
:
7438 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7440 case OPCODE_CLEAR_INDEX
:
7441 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7443 case OPCODE_CLEAR_STENCIL
:
7444 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7446 case OPCODE_CLIP_PLANE
:
7453 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7456 case OPCODE_COLOR_MASK
:
7457 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7459 case OPCODE_COLOR_MASK_INDEXED
:
7460 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7463 case OPCODE_COLOR_MATERIAL
:
7464 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7466 case OPCODE_COLOR_TABLE
:
7468 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7469 ctx
->Unpack
= ctx
->DefaultPacking
;
7470 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
7471 n
[5].e
, n
[6].data
));
7472 ctx
->Unpack
= save
; /* restore */
7475 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7482 CALL_ColorTableParameterfv(ctx
->Exec
,
7483 (n
[1].e
, n
[2].e
, params
));
7486 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7493 CALL_ColorTableParameteriv(ctx
->Exec
,
7494 (n
[1].e
, n
[2].e
, params
));
7497 case OPCODE_COLOR_SUB_TABLE
:
7499 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7500 ctx
->Unpack
= ctx
->DefaultPacking
;
7501 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7502 n
[4].e
, n
[5].e
, n
[6].data
));
7503 ctx
->Unpack
= save
; /* restore */
7506 case OPCODE_CONVOLUTION_FILTER_1D
:
7508 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7509 ctx
->Unpack
= ctx
->DefaultPacking
;
7510 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7513 ctx
->Unpack
= save
; /* restore */
7516 case OPCODE_CONVOLUTION_FILTER_2D
:
7518 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7519 ctx
->Unpack
= ctx
->DefaultPacking
;
7520 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7521 n
[4].i
, n
[5].e
, n
[6].e
,
7523 ctx
->Unpack
= save
; /* restore */
7526 case OPCODE_CONVOLUTION_PARAMETER_I
:
7527 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
7529 case OPCODE_CONVOLUTION_PARAMETER_IV
:
7536 CALL_ConvolutionParameteriv(ctx
->Exec
,
7537 (n
[1].e
, n
[2].e
, params
));
7540 case OPCODE_CONVOLUTION_PARAMETER_F
:
7541 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
7543 case OPCODE_CONVOLUTION_PARAMETER_FV
:
7550 CALL_ConvolutionParameterfv(ctx
->Exec
,
7551 (n
[1].e
, n
[2].e
, params
));
7554 case OPCODE_COPY_COLOR_SUB_TABLE
:
7555 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7556 n
[3].i
, n
[4].i
, n
[5].i
));
7558 case OPCODE_COPY_COLOR_TABLE
:
7559 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7560 n
[3].i
, n
[4].i
, n
[5].i
));
7562 case OPCODE_COPY_PIXELS
:
7563 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7564 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7567 case OPCODE_COPY_TEX_IMAGE1D
:
7568 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7569 n
[5].i
, n
[6].i
, n
[7].i
));
7571 case OPCODE_COPY_TEX_IMAGE2D
:
7572 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7573 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7575 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7576 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7577 n
[4].i
, n
[5].i
, n
[6].i
));
7579 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7580 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7581 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7584 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7585 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7586 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7589 case OPCODE_CULL_FACE
:
7590 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7592 case OPCODE_DEPTH_FUNC
:
7593 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7595 case OPCODE_DEPTH_MASK
:
7596 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7598 case OPCODE_DEPTH_RANGE
:
7599 CALL_DepthRange(ctx
->Exec
,
7600 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7602 case OPCODE_DISABLE
:
7603 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7605 case OPCODE_DISABLE_INDEXED
:
7606 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7608 case OPCODE_DRAW_BUFFER
:
7609 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7611 case OPCODE_DRAW_PIXELS
:
7613 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7614 ctx
->Unpack
= ctx
->DefaultPacking
;
7615 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7617 ctx
->Unpack
= save
; /* restore */
7621 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7623 case OPCODE_ENABLE_INDEXED
:
7624 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7626 case OPCODE_EVALMESH1
:
7627 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7629 case OPCODE_EVALMESH2
:
7630 CALL_EvalMesh2(ctx
->Exec
,
7631 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7640 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7643 case OPCODE_FRONT_FACE
:
7644 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7646 case OPCODE_FRUSTUM
:
7647 CALL_Frustum(ctx
->Exec
,
7648 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7651 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7653 case OPCODE_HISTOGRAM
:
7654 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
7656 case OPCODE_INDEX_MASK
:
7657 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7659 case OPCODE_INIT_NAMES
:
7660 CALL_InitNames(ctx
->Exec
, ());
7669 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7672 case OPCODE_LIGHT_MODEL
:
7679 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7682 case OPCODE_LINE_STIPPLE
:
7683 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7685 case OPCODE_LINE_WIDTH
:
7686 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7688 case OPCODE_LIST_BASE
:
7689 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7691 case OPCODE_LOAD_IDENTITY
:
7692 CALL_LoadIdentity(ctx
->Exec
, ());
7694 case OPCODE_LOAD_MATRIX
:
7695 if (sizeof(Node
) == sizeof(GLfloat
)) {
7696 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7701 for (i
= 0; i
< 16; i
++) {
7704 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7707 case OPCODE_LOAD_NAME
:
7708 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7710 case OPCODE_LOGIC_OP
:
7711 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7715 GLenum target
= n
[1].e
;
7716 GLint ustride
= _mesa_evaluator_components(target
);
7717 GLint uorder
= n
[5].i
;
7718 GLfloat u1
= n
[2].f
;
7719 GLfloat u2
= n
[3].f
;
7720 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7721 (GLfloat
*) n
[6].data
));
7726 GLenum target
= n
[1].e
;
7727 GLfloat u1
= n
[2].f
;
7728 GLfloat u2
= n
[3].f
;
7729 GLfloat v1
= n
[4].f
;
7730 GLfloat v2
= n
[5].f
;
7731 GLint ustride
= n
[6].i
;
7732 GLint vstride
= n
[7].i
;
7733 GLint uorder
= n
[8].i
;
7734 GLint vorder
= n
[9].i
;
7735 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7736 v1
, v2
, vstride
, vorder
,
7737 (GLfloat
*) n
[10].data
));
7740 case OPCODE_MAPGRID1
:
7741 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7743 case OPCODE_MAPGRID2
:
7744 CALL_MapGrid2f(ctx
->Exec
,
7745 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7747 case OPCODE_MATRIX_MODE
:
7748 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7750 case OPCODE_MIN_MAX
:
7751 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
7753 case OPCODE_MULT_MATRIX
:
7754 if (sizeof(Node
) == sizeof(GLfloat
)) {
7755 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7760 for (i
= 0; i
< 16; i
++) {
7763 CALL_MultMatrixf(ctx
->Exec
, (m
));
7767 CALL_Ortho(ctx
->Exec
,
7768 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7770 case OPCODE_PASSTHROUGH
:
7771 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7773 case OPCODE_PIXEL_MAP
:
7774 CALL_PixelMapfv(ctx
->Exec
,
7775 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7777 case OPCODE_PIXEL_TRANSFER
:
7778 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7780 case OPCODE_PIXEL_ZOOM
:
7781 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7783 case OPCODE_POINT_SIZE
:
7784 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7786 case OPCODE_POINT_PARAMETERS
:
7792 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7795 case OPCODE_POLYGON_MODE
:
7796 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7798 case OPCODE_POLYGON_STIPPLE
:
7800 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7801 ctx
->Unpack
= ctx
->DefaultPacking
;
7802 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7803 ctx
->Unpack
= save
; /* restore */
7806 case OPCODE_POLYGON_OFFSET
:
7807 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7809 case OPCODE_POP_ATTRIB
:
7810 CALL_PopAttrib(ctx
->Exec
, ());
7812 case OPCODE_POP_MATRIX
:
7813 CALL_PopMatrix(ctx
->Exec
, ());
7815 case OPCODE_POP_NAME
:
7816 CALL_PopName(ctx
->Exec
, ());
7818 case OPCODE_PRIORITIZE_TEXTURE
:
7819 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7821 case OPCODE_PUSH_ATTRIB
:
7822 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7824 case OPCODE_PUSH_MATRIX
:
7825 CALL_PushMatrix(ctx
->Exec
, ());
7827 case OPCODE_PUSH_NAME
:
7828 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7830 case OPCODE_RASTER_POS
:
7831 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7833 case OPCODE_READ_BUFFER
:
7834 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7836 case OPCODE_RESET_HISTOGRAM
:
7837 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
7839 case OPCODE_RESET_MIN_MAX
:
7840 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7843 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7846 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7848 case OPCODE_SCISSOR
:
7849 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7851 case OPCODE_SHADE_MODEL
:
7852 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7854 case OPCODE_PROVOKING_VERTEX
:
7855 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7857 case OPCODE_STENCIL_FUNC
:
7858 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7860 case OPCODE_STENCIL_MASK
:
7861 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7863 case OPCODE_STENCIL_OP
:
7864 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7866 case OPCODE_STENCIL_FUNC_SEPARATE
:
7867 CALL_StencilFuncSeparate(ctx
->Exec
,
7868 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7870 case OPCODE_STENCIL_MASK_SEPARATE
:
7871 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7873 case OPCODE_STENCIL_OP_SEPARATE
:
7874 CALL_StencilOpSeparate(ctx
->Exec
,
7875 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7884 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7894 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7897 case OPCODE_TEXPARAMETER
:
7904 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7907 case OPCODE_TEX_IMAGE1D
:
7909 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7910 ctx
->Unpack
= ctx
->DefaultPacking
;
7911 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7913 n
[3].i
, /* components */
7915 n
[5].e
, /* border */
7916 n
[6].e
, /* format */
7919 ctx
->Unpack
= save
; /* restore */
7922 case OPCODE_TEX_IMAGE2D
:
7924 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7925 ctx
->Unpack
= ctx
->DefaultPacking
;
7926 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7928 n
[3].i
, /* components */
7930 n
[5].i
, /* height */
7931 n
[6].e
, /* border */
7932 n
[7].e
, /* format */
7935 ctx
->Unpack
= save
; /* restore */
7938 case OPCODE_TEX_IMAGE3D
:
7940 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7941 ctx
->Unpack
= ctx
->DefaultPacking
;
7942 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7944 n
[3].i
, /* components */
7946 n
[5].i
, /* height */
7948 n
[7].e
, /* border */
7949 n
[8].e
, /* format */
7952 ctx
->Unpack
= save
; /* restore */
7955 case OPCODE_TEX_SUB_IMAGE1D
:
7957 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7958 ctx
->Unpack
= ctx
->DefaultPacking
;
7959 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7961 n
[6].e
, n
[7].data
));
7962 ctx
->Unpack
= save
; /* restore */
7965 case OPCODE_TEX_SUB_IMAGE2D
:
7967 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7968 ctx
->Unpack
= ctx
->DefaultPacking
;
7969 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7971 n
[6].i
, n
[7].e
, n
[8].e
,
7973 ctx
->Unpack
= save
; /* restore */
7976 case OPCODE_TEX_SUB_IMAGE3D
:
7978 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7979 ctx
->Unpack
= ctx
->DefaultPacking
;
7980 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7981 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7982 n
[8].i
, n
[9].e
, n
[10].e
,
7984 ctx
->Unpack
= save
; /* restore */
7987 case OPCODE_TRANSLATE
:
7988 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7990 case OPCODE_VIEWPORT
:
7991 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7992 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7994 case OPCODE_WINDOW_POS
:
7995 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7997 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
7998 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8000 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8001 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8002 n
[4].i
, n
[5].i
, n
[6].i
,
8005 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8006 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8007 n
[4].i
, n
[5].i
, n
[6].i
,
8008 n
[7].i
, n
[8].data
));
8010 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8011 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8012 n
[4].i
, n
[5].i
, n
[6].i
,
8016 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8017 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8018 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8019 n
[5].e
, n
[6].i
, n
[7].data
));
8021 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8022 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8023 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8024 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8027 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8028 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8029 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8030 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8031 n
[9].e
, n
[10].i
, n
[11].data
));
8033 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8034 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8036 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8037 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8039 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8040 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8042 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8043 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8044 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8047 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8048 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8050 case OPCODE_DEPTH_BOUNDS_EXT
:
8051 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8053 case OPCODE_PROGRAM_STRING_ARB
:
8054 CALL_ProgramStringARB(ctx
->Exec
,
8055 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
8057 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8058 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8062 case OPCODE_BEGIN_QUERY_ARB
:
8063 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8065 case OPCODE_END_QUERY_ARB
:
8066 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8068 case OPCODE_QUERY_COUNTER
:
8069 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8071 case OPCODE_BEGIN_QUERY_INDEXED
:
8072 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8074 case OPCODE_END_QUERY_INDEXED
:
8075 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8077 case OPCODE_DRAW_BUFFERS_ARB
:
8079 GLenum buffers
[MAX_DRAW_BUFFERS
];
8080 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8081 for (i
= 0; i
< count
; i
++)
8082 buffers
[i
] = n
[2 + i
].e
;
8083 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8086 case OPCODE_BLIT_FRAMEBUFFER
:
8087 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8088 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8091 case OPCODE_USE_PROGRAM
:
8092 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8094 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8095 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8097 case OPCODE_ACTIVE_PROGRAM_EXT
:
8098 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8100 case OPCODE_UNIFORM_1F
:
8101 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8103 case OPCODE_UNIFORM_2F
:
8104 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8106 case OPCODE_UNIFORM_3F
:
8107 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8109 case OPCODE_UNIFORM_4F
:
8110 CALL_Uniform4f(ctx
->Exec
,
8111 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8113 case OPCODE_UNIFORM_1FV
:
8114 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8116 case OPCODE_UNIFORM_2FV
:
8117 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8119 case OPCODE_UNIFORM_3FV
:
8120 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8122 case OPCODE_UNIFORM_4FV
:
8123 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8125 case OPCODE_UNIFORM_1I
:
8126 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8128 case OPCODE_UNIFORM_2I
:
8129 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8131 case OPCODE_UNIFORM_3I
:
8132 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8134 case OPCODE_UNIFORM_4I
:
8135 CALL_Uniform4i(ctx
->Exec
,
8136 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8138 case OPCODE_UNIFORM_1IV
:
8139 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8141 case OPCODE_UNIFORM_2IV
:
8142 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8144 case OPCODE_UNIFORM_3IV
:
8145 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8147 case OPCODE_UNIFORM_4IV
:
8148 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8150 case OPCODE_UNIFORM_1UI
:
8151 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8153 case OPCODE_UNIFORM_2UI
:
8154 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8156 case OPCODE_UNIFORM_3UI
:
8157 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8159 case OPCODE_UNIFORM_4UI
:
8160 /*CALL_Uniform4uiARB(ctx->Exec,
8161 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8164 case OPCODE_UNIFORM_1UIV
:
8165 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8167 case OPCODE_UNIFORM_2UIV
:
8168 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8170 case OPCODE_UNIFORM_3UIV
:
8171 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8173 case OPCODE_UNIFORM_4UIV
:
8174 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8176 case OPCODE_UNIFORM_MATRIX22
:
8177 CALL_UniformMatrix2fv(ctx
->Exec
,
8178 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8180 case OPCODE_UNIFORM_MATRIX33
:
8181 CALL_UniformMatrix3fv(ctx
->Exec
,
8182 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8184 case OPCODE_UNIFORM_MATRIX44
:
8185 CALL_UniformMatrix4fv(ctx
->Exec
,
8186 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8188 case OPCODE_UNIFORM_MATRIX23
:
8189 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8190 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8192 case OPCODE_UNIFORM_MATRIX32
:
8193 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8194 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8196 case OPCODE_UNIFORM_MATRIX24
:
8197 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8198 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8200 case OPCODE_UNIFORM_MATRIX42
:
8201 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8202 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8204 case OPCODE_UNIFORM_MATRIX34
:
8205 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8206 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8208 case OPCODE_UNIFORM_MATRIX43
:
8209 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8210 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8213 case OPCODE_CLAMP_COLOR
:
8214 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8217 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8220 GLuint i
, pname
= n
[1].ui
;
8222 for (i
= 0; i
< 4; i
++)
8223 values
[i
] = n
[1 + i
].f
;
8224 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8227 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8228 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8230 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8233 GLuint i
, dst
= n
[1].ui
;
8235 for (i
= 0; i
< 4; i
++)
8236 values
[i
] = n
[1 + i
].f
;
8237 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8240 case OPCODE_ATTR_1F_NV
:
8241 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8243 case OPCODE_ATTR_2F_NV
:
8244 /* Really shouldn't have to do this - the Node structure
8245 * is convenient, but it would be better to store the data
8246 * packed appropriately so that it can be sent directly
8247 * on. With x86_64 becoming common, this will start to
8250 if (sizeof(Node
) == sizeof(GLfloat
))
8251 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8253 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8255 case OPCODE_ATTR_3F_NV
:
8256 if (sizeof(Node
) == sizeof(GLfloat
))
8257 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8259 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8262 case OPCODE_ATTR_4F_NV
:
8263 if (sizeof(Node
) == sizeof(GLfloat
))
8264 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8266 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8269 case OPCODE_ATTR_1F_ARB
:
8270 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8272 case OPCODE_ATTR_2F_ARB
:
8273 /* Really shouldn't have to do this - the Node structure
8274 * is convenient, but it would be better to store the data
8275 * packed appropriately so that it can be sent directly
8276 * on. With x86_64 becoming common, this will start to
8279 if (sizeof(Node
) == sizeof(GLfloat
))
8280 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8282 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8284 case OPCODE_ATTR_3F_ARB
:
8285 if (sizeof(Node
) == sizeof(GLfloat
))
8286 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8288 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8291 case OPCODE_ATTR_4F_ARB
:
8292 if (sizeof(Node
) == sizeof(GLfloat
))
8293 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8295 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8298 case OPCODE_MATERIAL
:
8299 if (sizeof(Node
) == sizeof(GLfloat
))
8300 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8307 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8311 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8314 CALL_End(ctx
->Exec
, ());
8317 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8319 case OPCODE_EVAL_C1
:
8320 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8322 case OPCODE_EVAL_C2
:
8323 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8325 case OPCODE_EVAL_P1
:
8326 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8328 case OPCODE_EVAL_P2
:
8329 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8332 /* GL_EXT_texture_integer */
8333 case OPCODE_CLEARCOLOR_I
:
8334 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8336 case OPCODE_CLEARCOLOR_UI
:
8337 CALL_ClearColorIuiEXT(ctx
->Exec
,
8338 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8340 case OPCODE_TEXPARAMETER_I
:
8347 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8350 case OPCODE_TEXPARAMETER_UI
:
8353 params
[0] = n
[3].ui
;
8354 params
[1] = n
[4].ui
;
8355 params
[2] = n
[5].ui
;
8356 params
[3] = n
[6].ui
;
8357 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8361 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8362 /* GL_ARB_instanced_arrays */
8363 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8366 case OPCODE_TEXTURE_BARRIER_NV
:
8367 CALL_TextureBarrierNV(ctx
->Exec
, ());
8370 /* GL_EXT/ARB_transform_feedback */
8371 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8372 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8374 case OPCODE_END_TRANSFORM_FEEDBACK
:
8375 CALL_EndTransformFeedback(ctx
->Exec
, ());
8377 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8378 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8380 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8381 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8383 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8384 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8386 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8387 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8389 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8390 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8391 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8393 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8394 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8395 (n
[1].e
, n
[2].ui
, n
[3].si
));
8397 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8398 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8399 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8403 case OPCODE_BIND_SAMPLER
:
8404 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8406 case OPCODE_SAMPLER_PARAMETERIV
:
8413 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8416 case OPCODE_SAMPLER_PARAMETERFV
:
8423 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8426 case OPCODE_SAMPLER_PARAMETERIIV
:
8433 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8436 case OPCODE_SAMPLER_PARAMETERUIV
:
8439 params
[0] = n
[3].ui
;
8440 params
[1] = n
[4].ui
;
8441 params
[2] = n
[5].ui
;
8442 params
[3] = n
[6].ui
;
8443 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8447 /* GL_ARB_geometry_shader4 */
8448 case OPCODE_PROGRAM_PARAMETERI
:
8449 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8451 case OPCODE_FRAMEBUFFER_TEXTURE
:
8452 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8455 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8456 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8457 n
[3].ui
, n
[4].i
, n
[5].e
));
8461 case OPCODE_WAIT_SYNC
:
8463 union uint64_pair p
;
8464 p
.uint32
[0] = n
[3].ui
;
8465 p
.uint32
[1] = n
[4].ui
;
8466 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
8470 /* GL_NV_conditional_render */
8471 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8472 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8474 case OPCODE_END_CONDITIONAL_RENDER
:
8475 CALL_EndConditionalRender(ctx
->Exec
, ());
8478 case OPCODE_UNIFORM_BLOCK_BINDING
:
8479 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8482 case OPCODE_CONTINUE
:
8483 n
= (Node
*) n
[1].next
;
8485 case OPCODE_END_OF_LIST
:
8491 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8493 _mesa_problem(ctx
, "%s", msg
);
8498 /* increment n to point to next compiled command */
8499 if (opcode
!= OPCODE_CONTINUE
) {
8500 n
+= InstSize
[opcode
];
8505 if (ctx
->Driver
.EndCallList
)
8506 ctx
->Driver
.EndCallList(ctx
);
8508 ctx
->ListState
.CallDepth
--;
8513 /**********************************************************************/
8515 /**********************************************************************/
8518 * Test if a display list number is valid.
8520 GLboolean GLAPIENTRY
8521 _mesa_IsList(GLuint list
)
8523 GET_CURRENT_CONTEXT(ctx
);
8524 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8525 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8526 return islist(ctx
, list
);
8531 * Delete a sequence of consecutive display lists.
8534 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8536 GET_CURRENT_CONTEXT(ctx
);
8538 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8539 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8542 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8545 for (i
= list
; i
< list
+ range
; i
++) {
8546 destroy_list(ctx
, i
);
8552 * Return a display list number, n, such that lists n through n+range-1
8556 _mesa_GenLists(GLsizei range
)
8558 GET_CURRENT_CONTEXT(ctx
);
8560 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8561 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8564 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8572 * Make this an atomic operation
8574 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8576 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8578 /* reserve the list IDs by with empty/dummy lists */
8580 for (i
= 0; i
< range
; i
++) {
8581 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8582 make_list(base
+ i
, 1));
8586 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8593 * Begin a new display list.
8596 _mesa_NewList(GLuint name
, GLenum mode
)
8598 GET_CURRENT_CONTEXT(ctx
);
8600 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8601 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8603 if (MESA_VERBOSE
& VERBOSE_API
)
8604 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8605 _mesa_lookup_enum_by_nr(mode
));
8608 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8612 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8613 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8617 if (ctx
->ListState
.CurrentList
) {
8618 /* already compiling a display list */
8619 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8623 ctx
->CompileFlag
= GL_TRUE
;
8624 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8626 /* Reset acumulated list state:
8628 invalidate_saved_current_state( ctx
);
8630 /* Allocate new display list */
8631 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8632 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8633 ctx
->ListState
.CurrentPos
= 0;
8635 ctx
->Driver
.NewList(ctx
, name
, mode
);
8637 ctx
->CurrentDispatch
= ctx
->Save
;
8638 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8643 * End definition of current display list.
8648 GET_CURRENT_CONTEXT(ctx
);
8649 SAVE_FLUSH_VERTICES(ctx
);
8650 FLUSH_VERTICES(ctx
, 0);
8652 if (MESA_VERBOSE
& VERBOSE_API
)
8653 _mesa_debug(ctx
, "glEndList\n");
8655 /* Check that a list is under construction */
8656 if (!ctx
->ListState
.CurrentList
) {
8657 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8661 /* Call before emitting END_OF_LIST, in case the driver wants to
8662 * emit opcodes itself.
8664 ctx
->Driver
.EndList(ctx
);
8666 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8668 /* Destroy old list, if any */
8669 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8671 /* Install the new list */
8672 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8673 ctx
->ListState
.CurrentList
->Name
,
8674 ctx
->ListState
.CurrentList
);
8677 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8678 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8680 ctx
->ListState
.CurrentList
= NULL
;
8681 ctx
->ExecuteFlag
= GL_TRUE
;
8682 ctx
->CompileFlag
= GL_FALSE
;
8684 ctx
->CurrentDispatch
= ctx
->Exec
;
8685 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8690 _mesa_CallList(GLuint list
)
8692 GLboolean save_compile_flag
;
8693 GET_CURRENT_CONTEXT(ctx
);
8694 FLUSH_CURRENT(ctx
, 0);
8696 if (MESA_VERBOSE
& VERBOSE_API
)
8697 _mesa_debug(ctx
, "glCallList %d\n", list
);
8700 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8705 mesa_print_display_list( list
);
8707 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8708 * execute the display list, and restore the CompileFlag.
8710 save_compile_flag
= ctx
->CompileFlag
;
8711 if (save_compile_flag
) {
8712 ctx
->CompileFlag
= GL_FALSE
;
8715 execute_list(ctx
, list
);
8716 ctx
->CompileFlag
= save_compile_flag
;
8718 /* also restore API function pointers to point to "save" versions */
8719 if (save_compile_flag
) {
8720 ctx
->CurrentDispatch
= ctx
->Save
;
8721 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8727 * Execute glCallLists: call multiple display lists.
8730 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8732 GET_CURRENT_CONTEXT(ctx
);
8734 GLboolean save_compile_flag
;
8736 if (MESA_VERBOSE
& VERBOSE_API
)
8737 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8741 case GL_UNSIGNED_BYTE
:
8743 case GL_UNSIGNED_SHORT
:
8745 case GL_UNSIGNED_INT
:
8753 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8757 /* Save the CompileFlag status, turn it off, execute display list,
8758 * and restore the CompileFlag.
8760 save_compile_flag
= ctx
->CompileFlag
;
8761 ctx
->CompileFlag
= GL_FALSE
;
8763 for (i
= 0; i
< n
; i
++) {
8764 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8765 execute_list(ctx
, list
);
8768 ctx
->CompileFlag
= save_compile_flag
;
8770 /* also restore API function pointers to point to "save" versions */
8771 if (save_compile_flag
) {
8772 ctx
->CurrentDispatch
= ctx
->Save
;
8773 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8779 * Set the offset added to list numbers in glCallLists.
8782 _mesa_ListBase(GLuint base
)
8784 GET_CURRENT_CONTEXT(ctx
);
8785 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8786 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8787 ctx
->List
.ListBase
= base
;
8791 * Setup the given dispatch table to point to Mesa's display list
8792 * building functions.
8794 * This does not include any of the tnl functions - they are
8795 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8799 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8801 struct _glapi_table
*table
= ctx
->Save
;
8802 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8804 /* Initially populate the dispatch table with the contents of the
8805 * normal-execution dispatch table. This lets us skip populating functions
8806 * that should be called directly instead of compiled into display lists.
8808 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8810 _mesa_loopback_init_api_table(ctx
, table
);
8813 SET_Accum(table
, save_Accum
);
8814 SET_AlphaFunc(table
, save_AlphaFunc
);
8815 SET_Bitmap(table
, save_Bitmap
);
8816 SET_BlendFunc(table
, save_BlendFunc
);
8817 SET_CallList(table
, save_CallList
);
8818 SET_CallLists(table
, save_CallLists
);
8819 SET_Clear(table
, save_Clear
);
8820 SET_ClearAccum(table
, save_ClearAccum
);
8821 SET_ClearColor(table
, save_ClearColor
);
8822 SET_ClearDepth(table
, save_ClearDepth
);
8823 SET_ClearIndex(table
, save_ClearIndex
);
8824 SET_ClearStencil(table
, save_ClearStencil
);
8825 SET_ClipPlane(table
, save_ClipPlane
);
8826 SET_ColorMask(table
, save_ColorMask
);
8827 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8828 SET_ColorMaterial(table
, save_ColorMaterial
);
8829 SET_CopyPixels(table
, save_CopyPixels
);
8830 SET_CullFace(table
, save_CullFace
);
8831 SET_DepthFunc(table
, save_DepthFunc
);
8832 SET_DepthMask(table
, save_DepthMask
);
8833 SET_DepthRange(table
, save_DepthRange
);
8834 SET_Disable(table
, save_Disable
);
8835 SET_Disablei(table
, save_DisableIndexed
);
8836 SET_DrawBuffer(table
, save_DrawBuffer
);
8837 SET_DrawPixels(table
, save_DrawPixels
);
8838 SET_Enable(table
, save_Enable
);
8839 SET_Enablei(table
, save_EnableIndexed
);
8840 SET_EvalMesh1(table
, save_EvalMesh1
);
8841 SET_EvalMesh2(table
, save_EvalMesh2
);
8842 SET_Fogf(table
, save_Fogf
);
8843 SET_Fogfv(table
, save_Fogfv
);
8844 SET_Fogi(table
, save_Fogi
);
8845 SET_Fogiv(table
, save_Fogiv
);
8846 SET_FrontFace(table
, save_FrontFace
);
8847 SET_Frustum(table
, save_Frustum
);
8848 SET_Hint(table
, save_Hint
);
8849 SET_IndexMask(table
, save_IndexMask
);
8850 SET_InitNames(table
, save_InitNames
);
8851 SET_LightModelf(table
, save_LightModelf
);
8852 SET_LightModelfv(table
, save_LightModelfv
);
8853 SET_LightModeli(table
, save_LightModeli
);
8854 SET_LightModeliv(table
, save_LightModeliv
);
8855 SET_Lightf(table
, save_Lightf
);
8856 SET_Lightfv(table
, save_Lightfv
);
8857 SET_Lighti(table
, save_Lighti
);
8858 SET_Lightiv(table
, save_Lightiv
);
8859 SET_LineStipple(table
, save_LineStipple
);
8860 SET_LineWidth(table
, save_LineWidth
);
8861 SET_ListBase(table
, save_ListBase
);
8862 SET_LoadIdentity(table
, save_LoadIdentity
);
8863 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8864 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8865 SET_LoadName(table
, save_LoadName
);
8866 SET_LogicOp(table
, save_LogicOp
);
8867 SET_Map1d(table
, save_Map1d
);
8868 SET_Map1f(table
, save_Map1f
);
8869 SET_Map2d(table
, save_Map2d
);
8870 SET_Map2f(table
, save_Map2f
);
8871 SET_MapGrid1d(table
, save_MapGrid1d
);
8872 SET_MapGrid1f(table
, save_MapGrid1f
);
8873 SET_MapGrid2d(table
, save_MapGrid2d
);
8874 SET_MapGrid2f(table
, save_MapGrid2f
);
8875 SET_MatrixMode(table
, save_MatrixMode
);
8876 SET_MultMatrixd(table
, save_MultMatrixd
);
8877 SET_MultMatrixf(table
, save_MultMatrixf
);
8878 SET_NewList(table
, save_NewList
);
8879 SET_Ortho(table
, save_Ortho
);
8880 SET_PassThrough(table
, save_PassThrough
);
8881 SET_PixelMapfv(table
, save_PixelMapfv
);
8882 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8883 SET_PixelMapusv(table
, save_PixelMapusv
);
8884 SET_PixelTransferf(table
, save_PixelTransferf
);
8885 SET_PixelTransferi(table
, save_PixelTransferi
);
8886 SET_PixelZoom(table
, save_PixelZoom
);
8887 SET_PointSize(table
, save_PointSize
);
8888 SET_PolygonMode(table
, save_PolygonMode
);
8889 SET_PolygonOffset(table
, save_PolygonOffset
);
8890 SET_PolygonStipple(table
, save_PolygonStipple
);
8891 SET_PopAttrib(table
, save_PopAttrib
);
8892 SET_PopMatrix(table
, save_PopMatrix
);
8893 SET_PopName(table
, save_PopName
);
8894 SET_PushAttrib(table
, save_PushAttrib
);
8895 SET_PushMatrix(table
, save_PushMatrix
);
8896 SET_PushName(table
, save_PushName
);
8897 SET_RasterPos2d(table
, save_RasterPos2d
);
8898 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8899 SET_RasterPos2f(table
, save_RasterPos2f
);
8900 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8901 SET_RasterPos2i(table
, save_RasterPos2i
);
8902 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8903 SET_RasterPos2s(table
, save_RasterPos2s
);
8904 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8905 SET_RasterPos3d(table
, save_RasterPos3d
);
8906 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8907 SET_RasterPos3f(table
, save_RasterPos3f
);
8908 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8909 SET_RasterPos3i(table
, save_RasterPos3i
);
8910 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8911 SET_RasterPos3s(table
, save_RasterPos3s
);
8912 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8913 SET_RasterPos4d(table
, save_RasterPos4d
);
8914 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8915 SET_RasterPos4f(table
, save_RasterPos4f
);
8916 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8917 SET_RasterPos4i(table
, save_RasterPos4i
);
8918 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8919 SET_RasterPos4s(table
, save_RasterPos4s
);
8920 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8921 SET_ReadBuffer(table
, save_ReadBuffer
);
8922 SET_Rotated(table
, save_Rotated
);
8923 SET_Rotatef(table
, save_Rotatef
);
8924 SET_Scaled(table
, save_Scaled
);
8925 SET_Scalef(table
, save_Scalef
);
8926 SET_Scissor(table
, save_Scissor
);
8927 SET_ShadeModel(table
, save_ShadeModel
);
8928 SET_StencilFunc(table
, save_StencilFunc
);
8929 SET_StencilMask(table
, save_StencilMask
);
8930 SET_StencilOp(table
, save_StencilOp
);
8931 SET_TexEnvf(table
, save_TexEnvf
);
8932 SET_TexEnvfv(table
, save_TexEnvfv
);
8933 SET_TexEnvi(table
, save_TexEnvi
);
8934 SET_TexEnviv(table
, save_TexEnviv
);
8935 SET_TexGend(table
, save_TexGend
);
8936 SET_TexGendv(table
, save_TexGendv
);
8937 SET_TexGenf(table
, save_TexGenf
);
8938 SET_TexGenfv(table
, save_TexGenfv
);
8939 SET_TexGeni(table
, save_TexGeni
);
8940 SET_TexGeniv(table
, save_TexGeniv
);
8941 SET_TexImage1D(table
, save_TexImage1D
);
8942 SET_TexImage2D(table
, save_TexImage2D
);
8943 SET_TexParameterf(table
, save_TexParameterf
);
8944 SET_TexParameterfv(table
, save_TexParameterfv
);
8945 SET_TexParameteri(table
, save_TexParameteri
);
8946 SET_TexParameteriv(table
, save_TexParameteriv
);
8947 SET_Translated(table
, save_Translated
);
8948 SET_Translatef(table
, save_Translatef
);
8949 SET_Viewport(table
, save_Viewport
);
8952 SET_BindTexture(table
, save_BindTexture
);
8953 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8954 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8955 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8956 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8957 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8958 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8959 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8962 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8963 SET_TexImage3D(table
, save_TexImage3D
);
8964 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8967 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8968 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8969 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8971 /* ATI_separate_stencil */
8972 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8974 /* GL_ARB_imaging */
8975 /* Not all are supported */
8976 SET_BlendColor(table
, save_BlendColor
);
8977 SET_BlendEquation(table
, save_BlendEquation
);
8978 SET_ColorSubTable(table
, save_ColorSubTable
);
8979 SET_ColorTable(table
, save_ColorTable
);
8980 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
8981 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
8982 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
8983 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
8984 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
8985 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
8986 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
8987 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
8988 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
8989 SET_CopyColorTable(table
, save_CopyColorTable
);
8990 SET_Histogram(table
, save_Histogram
);
8991 SET_Minmax(table
, save_Minmax
);
8992 SET_ResetHistogram(table
, save_ResetHistogram
);
8993 SET_ResetMinmax(table
, save_ResetMinmax
);
8995 /* 2. GL_EXT_blend_color */
8997 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9000 /* 3. GL_EXT_polygon_offset */
9001 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9003 /* 6. GL_EXT_texture3d */
9005 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9006 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9007 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9010 /* 14. GL_SGI_color_table */
9012 SET_ColorTableSGI(table
, save_ColorTable
);
9013 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
9016 /* 37. GL_EXT_blend_minmax */
9018 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9021 /* 54. GL_EXT_point_parameters */
9022 SET_PointParameterf(table
, save_PointParameterfEXT
);
9023 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9025 /* 173. GL_EXT_blend_func_separate */
9026 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9028 /* 197. GL_MESA_window_pos */
9029 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9030 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9031 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9032 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9033 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9034 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9035 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9036 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9037 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9038 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9039 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9040 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9041 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9042 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9043 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9044 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9045 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9046 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9047 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9048 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9049 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9050 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9051 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9052 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9054 /* 233. GL_NV_vertex_program */
9055 /* The following commands DO NOT go into display lists:
9056 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9057 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9059 SET_BindProgramARB(table
, save_BindProgramNV
);
9061 /* 244. GL_ATI_envmap_bumpmap */
9062 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9063 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9065 /* 245. GL_ATI_fragment_shader */
9066 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9067 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9069 /* 262. GL_NV_point_sprite */
9070 SET_PointParameteri(table
, save_PointParameteriNV
);
9071 SET_PointParameteriv(table
, save_PointParameterivNV
);
9073 /* 268. GL_EXT_stencil_two_side */
9074 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9076 /* ???. GL_EXT_depth_bounds_test */
9077 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9079 /* ARB 1. GL_ARB_multitexture */
9080 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9082 /* ARB 3. GL_ARB_transpose_matrix */
9083 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9084 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9085 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9086 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9088 /* ARB 5. GL_ARB_multisample */
9089 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9091 /* ARB 12. GL_ARB_texture_compression */
9092 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9093 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9094 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9095 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9096 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9097 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9099 /* ARB 14. GL_ARB_point_parameters */
9100 /* aliased with EXT_point_parameters functions */
9102 /* ARB 25. GL_ARB_window_pos */
9103 /* aliased with MESA_window_pos functions */
9105 /* ARB 26. GL_ARB_vertex_program */
9106 /* ARB 27. GL_ARB_fragment_program */
9107 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9108 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9109 SET_BindProgramARB(table
, save_BindProgramNV
);
9110 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9111 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9112 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9113 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9114 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9115 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9116 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9117 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9119 SET_BeginQuery(table
, save_BeginQueryARB
);
9120 SET_EndQuery(table
, save_EndQueryARB
);
9121 SET_QueryCounter(table
, save_QueryCounter
);
9123 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9125 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9127 SET_UseProgram(table
, save_UseProgramObjectARB
);
9128 SET_Uniform1f(table
, save_Uniform1fARB
);
9129 SET_Uniform2f(table
, save_Uniform2fARB
);
9130 SET_Uniform3f(table
, save_Uniform3fARB
);
9131 SET_Uniform4f(table
, save_Uniform4fARB
);
9132 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9133 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9134 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9135 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9136 SET_Uniform1i(table
, save_Uniform1iARB
);
9137 SET_Uniform2i(table
, save_Uniform2iARB
);
9138 SET_Uniform3i(table
, save_Uniform3iARB
);
9139 SET_Uniform4i(table
, save_Uniform4iARB
);
9140 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9141 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9142 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9143 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9144 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9145 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9146 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9147 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9148 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9149 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9150 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9151 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9152 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9154 /* 299. GL_EXT_blend_equation_separate */
9155 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9157 /* GL_EXT_gpu_program_parameters */
9158 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9159 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9161 /* 364. GL_EXT_provoking_vertex */
9162 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9164 /* GL_EXT_texture_integer */
9165 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9166 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9167 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9168 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9170 /* 377. GL_EXT_separate_shader_objects */
9171 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9172 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9174 /* GL_ARB_color_buffer_float */
9175 SET_ClampColor(table
, save_ClampColorARB
);
9178 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9179 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9180 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9181 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9183 SET_Uniform1ui(table
, save_Uniform1ui
);
9184 SET_Uniform2ui(table
, save_Uniform2ui
);
9185 SET_Uniform3ui(table
, save_Uniform3ui
);
9186 SET_Uniform4ui(table
, save_Uniform4ui
);
9187 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9188 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9189 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9190 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9192 (void) save_Uniform1ui
;
9193 (void) save_Uniform2ui
;
9194 (void) save_Uniform3ui
;
9195 (void) save_Uniform4ui
;
9196 (void) save_Uniform1uiv
;
9197 (void) save_Uniform2uiv
;
9198 (void) save_Uniform3uiv
;
9199 (void) save_Uniform4uiv
;
9203 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9204 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9205 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9206 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9207 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9208 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9209 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9210 SET_DrawTransformFeedbackInstanced(table
,
9211 save_DrawTransformFeedbackInstanced
);
9212 SET_DrawTransformFeedbackStreamInstanced(table
,
9213 save_DrawTransformFeedbackStreamInstanced
);
9214 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9215 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9217 /* GL_ARB_instanced_arrays */
9218 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9220 /* GL_NV_texture_barrier */
9221 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9223 SET_BindSampler(table
, save_BindSampler
);
9224 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9225 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9226 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9227 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9228 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9229 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9231 /* GL_ARB_draw_buffer_blend */
9232 SET_BlendFunciARB(table
, save_BlendFunci
);
9233 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9234 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9235 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9237 /* GL_ARB_geometry_shader4 */
9238 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9239 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9240 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9242 /* GL_NV_conditional_render */
9243 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9244 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9247 SET_WaitSync(table
, save_WaitSync
);
9249 /* GL_ARB_uniform_buffer_object */
9250 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9256 enum_string(GLenum k
)
9258 return _mesa_lookup_enum_by_nr(k
);
9263 * Print the commands in a display list. For debugging only.
9264 * TODO: many commands aren't handled yet.
9266 static void GLAPIENTRY
9267 print_list(struct gl_context
*ctx
, GLuint list
)
9269 struct gl_display_list
*dlist
;
9273 if (!islist(ctx
, list
)) {
9274 printf("%u is not a display list ID\n", list
);
9278 dlist
= lookup_list(ctx
, list
);
9284 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9286 done
= n
? GL_FALSE
: GL_TRUE
;
9288 const OpCode opcode
= n
[0].opcode
;
9290 if (is_ext_opcode(opcode
)) {
9291 n
+= ext_opcode_print(ctx
, n
);
9296 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9299 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9300 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9302 case OPCODE_CALL_LIST
:
9303 printf("CallList %d\n", (int) n
[1].ui
);
9305 case OPCODE_CALL_LIST_OFFSET
:
9306 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9307 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9309 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9310 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9311 enum_string(n
[1].e
), enum_string(n
[2].e
),
9312 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9314 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9315 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9316 enum_string(n
[1].e
), enum_string(n
[2].e
),
9317 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9319 case OPCODE_DISABLE
:
9320 printf("Disable %s\n", enum_string(n
[1].e
));
9323 printf("Enable %s\n", enum_string(n
[1].e
));
9325 case OPCODE_FRUSTUM
:
9326 printf("Frustum %g %g %g %g %g %g\n",
9327 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9329 case OPCODE_LINE_STIPPLE
:
9330 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9332 case OPCODE_LOAD_IDENTITY
:
9333 printf("LoadIdentity\n");
9335 case OPCODE_LOAD_MATRIX
:
9336 printf("LoadMatrix\n");
9337 printf(" %8f %8f %8f %8f\n",
9338 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9339 printf(" %8f %8f %8f %8f\n",
9340 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9341 printf(" %8f %8f %8f %8f\n",
9342 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9343 printf(" %8f %8f %8f %8f\n",
9344 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9346 case OPCODE_MULT_MATRIX
:
9347 printf("MultMatrix (or Rotate)\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
);
9358 printf("Ortho %g %g %g %g %g %g\n",
9359 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9361 case OPCODE_POP_ATTRIB
:
9362 printf("PopAttrib\n");
9364 case OPCODE_POP_MATRIX
:
9365 printf("PopMatrix\n");
9367 case OPCODE_POP_NAME
:
9368 printf("PopName\n");
9370 case OPCODE_PUSH_ATTRIB
:
9371 printf("PushAttrib %x\n", n
[1].bf
);
9373 case OPCODE_PUSH_MATRIX
:
9374 printf("PushMatrix\n");
9376 case OPCODE_PUSH_NAME
:
9377 printf("PushName %d\n", (int) n
[1].ui
);
9379 case OPCODE_RASTER_POS
:
9380 printf("RasterPos %g %g %g %g\n",
9381 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9384 printf("Rotate %g %g %g %g\n",
9385 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9388 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9390 case OPCODE_TRANSLATE
:
9391 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9393 case OPCODE_BIND_TEXTURE
:
9394 printf("BindTexture %s %d\n",
9395 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9397 case OPCODE_SHADE_MODEL
:
9398 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9401 printf("Map1 %s %.3f %.3f %d %d\n",
9402 _mesa_lookup_enum_by_nr(n
[1].ui
),
9403 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9406 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9407 _mesa_lookup_enum_by_nr(n
[1].ui
),
9408 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9409 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9411 case OPCODE_MAPGRID1
:
9412 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9414 case OPCODE_MAPGRID2
:
9415 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9416 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9418 case OPCODE_EVALMESH1
:
9419 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9421 case OPCODE_EVALMESH2
:
9422 printf("EvalMesh2 %d %d %d %d\n",
9423 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9426 case OPCODE_ATTR_1F_NV
:
9427 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9429 case OPCODE_ATTR_2F_NV
:
9430 printf("ATTR_2F_NV attr %d: %f %f\n",
9431 n
[1].i
, n
[2].f
, n
[3].f
);
9433 case OPCODE_ATTR_3F_NV
:
9434 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9435 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9437 case OPCODE_ATTR_4F_NV
:
9438 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9439 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9441 case OPCODE_ATTR_1F_ARB
:
9442 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9444 case OPCODE_ATTR_2F_ARB
:
9445 printf("ATTR_2F_ARB attr %d: %f %f\n",
9446 n
[1].i
, n
[2].f
, n
[3].f
);
9448 case OPCODE_ATTR_3F_ARB
:
9449 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9450 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9452 case OPCODE_ATTR_4F_ARB
:
9453 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9454 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9457 case OPCODE_MATERIAL
:
9458 printf("MATERIAL %x %x: %f %f %f %f\n",
9459 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9462 printf("BEGIN %x\n", n
[1].i
);
9468 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9471 case OPCODE_EVAL_C1
:
9472 printf("EVAL_C1 %f\n", n
[1].f
);
9474 case OPCODE_EVAL_C2
:
9475 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9477 case OPCODE_EVAL_P1
:
9478 printf("EVAL_P1 %d\n", n
[1].i
);
9480 case OPCODE_EVAL_P2
:
9481 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9484 case OPCODE_PROVOKING_VERTEX
:
9485 printf("ProvokingVertex %s\n",
9486 _mesa_lookup_enum_by_nr(n
[1].ui
));
9490 * meta opcodes/commands
9493 printf("Error: %s %s\n",
9494 enum_string(n
[1].e
), (const char *) n
[2].data
);
9496 case OPCODE_CONTINUE
:
9497 printf("DISPLAY-LIST-CONTINUE\n");
9498 n
= (Node
*) n
[1].next
;
9500 case OPCODE_END_OF_LIST
:
9501 printf("END-LIST %u\n", list
);
9505 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9507 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9508 opcode
, (void *) n
);
9512 printf("command %d, %u operands\n", opcode
,
9516 /* increment n to point to next compiled command */
9517 if (opcode
!= OPCODE_CONTINUE
) {
9518 n
+= InstSize
[opcode
];
9527 * Clients may call this function to help debug display list problems.
9528 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9529 * changed, or break in the future without notice.
9532 mesa_print_display_list(GLuint list
)
9534 GET_CURRENT_CONTEXT(ctx
);
9535 print_list(ctx
, list
);
9539 /**********************************************************************/
9540 /***** Initialization *****/
9541 /**********************************************************************/
9544 save_vtxfmt_init(GLvertexformat
* vfmt
)
9546 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
9548 vfmt
->Begin
= save_Begin
;
9550 _MESA_INIT_DLIST_VTXFMT(vfmt
, save_
);
9552 vfmt
->Color3f
= save_Color3f
;
9553 vfmt
->Color3fv
= save_Color3fv
;
9554 vfmt
->Color4f
= save_Color4f
;
9555 vfmt
->Color4fv
= save_Color4fv
;
9556 vfmt
->EdgeFlag
= save_EdgeFlag
;
9557 vfmt
->End
= save_End
;
9559 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
9561 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9562 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9563 vfmt
->Indexf
= save_Indexf
;
9564 vfmt
->Indexfv
= save_Indexfv
;
9565 vfmt
->Materialfv
= save_Materialfv
;
9566 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9567 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9568 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9569 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9570 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9571 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9572 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9573 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9574 vfmt
->Normal3f
= save_Normal3f
;
9575 vfmt
->Normal3fv
= save_Normal3fv
;
9576 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9577 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9578 vfmt
->TexCoord1f
= save_TexCoord1f
;
9579 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9580 vfmt
->TexCoord2f
= save_TexCoord2f
;
9581 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9582 vfmt
->TexCoord3f
= save_TexCoord3f
;
9583 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9584 vfmt
->TexCoord4f
= save_TexCoord4f
;
9585 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9586 vfmt
->Vertex2f
= save_Vertex2f
;
9587 vfmt
->Vertex2fv
= save_Vertex2fv
;
9588 vfmt
->Vertex3f
= save_Vertex3f
;
9589 vfmt
->Vertex3fv
= save_Vertex3fv
;
9590 vfmt
->Vertex4f
= save_Vertex4f
;
9591 vfmt
->Vertex4fv
= save_Vertex4fv
;
9592 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9593 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9594 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9595 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9596 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9597 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9598 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9599 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9601 vfmt
->Rectf
= save_Rectf
;
9603 /* GL_ARB_draw_instanced */
9604 vfmt
->DrawArraysInstanced
= save_DrawArraysInstancedARB
;
9605 vfmt
->DrawElementsInstanced
= save_DrawElementsInstancedARB
;
9607 /* GL_ARB_draw_elements_base_vertex */
9608 vfmt
->DrawElementsInstancedBaseVertex
= save_DrawElementsInstancedBaseVertexARB
;
9610 /* GL_ARB_base_instance */
9611 vfmt
->DrawArraysInstancedBaseInstance
= save_DrawArraysInstancedBaseInstance
;
9612 vfmt
->DrawElementsInstancedBaseInstance
= save_DrawElementsInstancedBaseInstance
;
9613 vfmt
->DrawElementsInstancedBaseVertexBaseInstance
= save_DrawElementsInstancedBaseVertexBaseInstance
;
9615 /* The driver is required to implement these as
9616 * 1) They can probably do a better job.
9617 * 2) A lot of new mechanisms would have to be added to this module
9618 * to support it. That code would probably never get used,
9622 vfmt
->DrawArrays
= 0;
9623 vfmt
->DrawElements
= 0;
9624 vfmt
->DrawRangeElements
= 0;
9625 vfmt
->MultiDrawElemementsEXT
= 0;
9626 vfmt
->DrawElementsBaseVertex
= 0;
9627 vfmt
->DrawRangeElementsBaseVertex
= 0;
9628 vfmt
->MultiDrawElemementsBaseVertex
= 0;
9634 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9635 const GLvertexformat
*vfmt
)
9637 SET_CallList(disp
, vfmt
->CallList
);
9638 SET_CallLists(disp
, vfmt
->CallLists
);
9643 * Initialize display list state for given context.
9646 _mesa_init_display_list(struct gl_context
*ctx
)
9648 static GLboolean tableInitialized
= GL_FALSE
;
9650 /* zero-out the instruction size table, just once */
9651 if (!tableInitialized
) {
9652 memset(InstSize
, 0, sizeof(InstSize
));
9653 tableInitialized
= GL_TRUE
;
9656 /* extension info */
9657 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9660 ctx
->ListState
.CallDepth
= 0;
9661 ctx
->ExecuteFlag
= GL_TRUE
;
9662 ctx
->CompileFlag
= GL_FALSE
;
9663 ctx
->ListState
.CurrentBlock
= NULL
;
9664 ctx
->ListState
.CurrentPos
= 0;
9666 /* Display List group */
9667 ctx
->List
.ListBase
= 0;
9669 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9674 _mesa_free_display_list_data(struct gl_context
*ctx
)
9677 ctx
->ListExt
= NULL
;