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 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
127 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
133 * Macro to assert that the API call was made outside the
134 * glBegin()/glEnd() pair.
136 * \param ctx GL context.
138 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
140 if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX || \
141 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
142 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
148 * Macro to assert that the API call was made outside the
149 * glBegin()/glEnd() pair and flush the vertices.
151 * \param ctx GL context.
153 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
155 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
156 SAVE_FLUSH_VERTICES(ctx); \
160 * Macro to assert that the API call was made outside the
161 * glBegin()/glEnd() pair and flush the vertices, with return value.
163 * \param ctx GL context.
164 * \param retval value to return value in case the assertion fails.
166 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
168 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
169 SAVE_FLUSH_VERTICES(ctx); \
175 * Display list opcodes.
177 * The fact that these identifiers are assigned consecutive
178 * integer values starting at 0 is very important, see InstSize array usage)
182 OPCODE_INVALID
= -1, /* Force signed enum */
188 OPCODE_BLEND_EQUATION
,
189 OPCODE_BLEND_EQUATION_SEPARATE
,
190 OPCODE_BLEND_FUNC_SEPARATE
,
192 OPCODE_BLEND_EQUATION_I
,
193 OPCODE_BLEND_EQUATION_SEPARATE_I
,
195 OPCODE_BLEND_FUNC_SEPARATE_I
,
198 OPCODE_CALL_LIST_OFFSET
,
204 OPCODE_CLEAR_STENCIL
,
205 OPCODE_CLEAR_BUFFER_IV
,
206 OPCODE_CLEAR_BUFFER_UIV
,
207 OPCODE_CLEAR_BUFFER_FV
,
208 OPCODE_CLEAR_BUFFER_FI
,
211 OPCODE_COLOR_MASK_INDEXED
,
212 OPCODE_COLOR_MATERIAL
,
214 OPCODE_COLOR_TABLE_PARAMETER_FV
,
215 OPCODE_COLOR_TABLE_PARAMETER_IV
,
216 OPCODE_COLOR_SUB_TABLE
,
217 OPCODE_CONVOLUTION_FILTER_1D
,
218 OPCODE_CONVOLUTION_FILTER_2D
,
219 OPCODE_CONVOLUTION_PARAMETER_I
,
220 OPCODE_CONVOLUTION_PARAMETER_IV
,
221 OPCODE_CONVOLUTION_PARAMETER_F
,
222 OPCODE_CONVOLUTION_PARAMETER_FV
,
223 OPCODE_COPY_COLOR_SUB_TABLE
,
224 OPCODE_COPY_COLOR_TABLE
,
226 OPCODE_COPY_TEX_IMAGE1D
,
227 OPCODE_COPY_TEX_IMAGE2D
,
228 OPCODE_COPY_TEX_SUB_IMAGE1D
,
229 OPCODE_COPY_TEX_SUB_IMAGE2D
,
230 OPCODE_COPY_TEX_SUB_IMAGE3D
,
236 OPCODE_DISABLE_INDEXED
,
240 OPCODE_ENABLE_INDEXED
,
255 OPCODE_LOAD_IDENTITY
,
269 OPCODE_PIXEL_TRANSFER
,
272 OPCODE_POINT_PARAMETERS
,
274 OPCODE_POLYGON_STIPPLE
,
275 OPCODE_POLYGON_OFFSET
,
279 OPCODE_PRIORITIZE_TEXTURE
,
285 OPCODE_RESET_HISTOGRAM
,
286 OPCODE_RESET_MIN_MAX
,
290 OPCODE_SELECT_TEXTURE_SGIS
,
291 OPCODE_SELECT_TEXTURE_COORD_SET
,
302 OPCODE_TEX_SUB_IMAGE1D
,
303 OPCODE_TEX_SUB_IMAGE2D
,
304 OPCODE_TEX_SUB_IMAGE3D
,
308 /* GL_ARB_multitexture */
309 OPCODE_ACTIVE_TEXTURE
,
310 /* GL_ARB_texture_compression */
311 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
312 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
313 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
314 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
315 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
316 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
317 /* GL_ARB_multisample */
318 OPCODE_SAMPLE_COVERAGE
,
319 /* GL_ARB_window_pos */
320 OPCODE_WINDOW_POS_ARB
,
321 /* GL_NV_fragment_program */
322 OPCODE_BIND_PROGRAM_NV
,
323 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
324 /* GL_EXT_stencil_two_side */
325 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
326 /* GL_EXT_depth_bounds_test */
327 OPCODE_DEPTH_BOUNDS_EXT
,
328 /* GL_ARB_vertex/fragment_program */
329 OPCODE_PROGRAM_STRING_ARB
,
330 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
331 /* GL_ARB_occlusion_query */
332 OPCODE_BEGIN_QUERY_ARB
,
333 OPCODE_END_QUERY_ARB
,
334 /* GL_ARB_draw_buffers */
335 OPCODE_DRAW_BUFFERS_ARB
,
336 /* GL_ATI_fragment_shader */
337 OPCODE_TEX_BUMP_PARAMETER_ATI
,
338 /* GL_ATI_fragment_shader */
339 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
340 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
342 OPCODE_STENCIL_FUNC_SEPARATE
,
343 OPCODE_STENCIL_OP_SEPARATE
,
344 OPCODE_STENCIL_MASK_SEPARATE
,
346 /* GL_ARB_shader_objects */
364 OPCODE_UNIFORM_MATRIX22
,
365 OPCODE_UNIFORM_MATRIX33
,
366 OPCODE_UNIFORM_MATRIX44
,
367 OPCODE_UNIFORM_MATRIX23
,
368 OPCODE_UNIFORM_MATRIX32
,
369 OPCODE_UNIFORM_MATRIX24
,
370 OPCODE_UNIFORM_MATRIX42
,
371 OPCODE_UNIFORM_MATRIX34
,
372 OPCODE_UNIFORM_MATRIX43
,
384 /* GL_ARB_color_buffer_float */
387 /* GL_EXT_framebuffer_blit */
388 OPCODE_BLIT_FRAMEBUFFER
,
390 /* Vertex attributes -- fallback for when optimized display
391 * list build isn't active.
410 /* GL_EXT_provoking_vertex */
411 OPCODE_PROVOKING_VERTEX
,
413 /* GL_EXT_transform_feedback */
414 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
415 OPCODE_END_TRANSFORM_FEEDBACK
,
416 OPCODE_BIND_TRANSFORM_FEEDBACK
,
417 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
418 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
419 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
421 /* GL_EXT_texture_integer */
423 OPCODE_CLEARCOLOR_UI
,
424 OPCODE_TEXPARAMETER_I
,
425 OPCODE_TEXPARAMETER_UI
,
427 /* GL_EXT_separate_shader_objects */
428 OPCODE_ACTIVE_PROGRAM_EXT
,
429 OPCODE_USE_SHADER_PROGRAM_EXT
,
431 /* GL_ARB_instanced_arrays */
432 OPCODE_VERTEX_ATTRIB_DIVISOR
,
434 /* GL_NV_texture_barrier */
435 OPCODE_TEXTURE_BARRIER_NV
,
437 /* GL_ARB_sampler_object */
439 OPCODE_SAMPLER_PARAMETERIV
,
440 OPCODE_SAMPLER_PARAMETERFV
,
441 OPCODE_SAMPLER_PARAMETERIIV
,
442 OPCODE_SAMPLER_PARAMETERUIV
,
444 /* GL_ARB_geometry_shader4 */
445 OPCODE_PROGRAM_PARAMETERI
,
446 OPCODE_FRAMEBUFFER_TEXTURE
,
447 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
452 /* GL_NV_conditional_render */
453 OPCODE_BEGIN_CONDITIONAL_RENDER
,
454 OPCODE_END_CONDITIONAL_RENDER
,
456 /* ARB_timer_query */
457 OPCODE_QUERY_COUNTER
,
459 /* ARB_transform_feedback3 */
460 OPCODE_BEGIN_QUERY_INDEXED
,
461 OPCODE_END_QUERY_INDEXED
,
462 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
464 /* ARB_transform_feedback_instanced */
465 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
466 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
468 /* ARB_uniform_buffer_object */
469 OPCODE_UNIFORM_BLOCK_BINDING
,
471 /* The following three are meta instructions */
472 OPCODE_ERROR
, /* raise compiled-in error */
483 * Display list instructions are stored as sequences of "nodes". Nodes
484 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
485 * are linked together with a pointer.
487 * Each instruction in the display list is stored as a sequence of
488 * contiguous nodes in memory.
489 * Each node is the union of a variety of data types.
505 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
509 typedef union gl_dlist_node Node
;
513 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
514 * environment. In 64-bit env, sizeof(Node)==8 anyway.
524 * How many nodes to allocate at a time.
526 * \note Reduced now that we hold vertices etc. elsewhere.
528 #define BLOCK_SIZE 256
533 * Number of nodes of storage needed for each instruction.
534 * Sizes for dynamically allocated opcodes are stored in the context struct.
536 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
539 void mesa_print_display_list(GLuint list
);
542 /**********************************************************************/
543 /***** Private *****/
544 /**********************************************************************/
548 * Make an empty display list. This is used by glGenLists() to
549 * reserve display list IDs.
551 static struct gl_display_list
*
552 make_list(GLuint name
, GLuint count
)
554 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
556 dlist
->Head
= malloc(sizeof(Node
) * count
);
557 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
563 * Lookup function to just encapsulate casting.
565 static inline struct gl_display_list
*
566 lookup_list(struct gl_context
*ctx
, GLuint list
)
568 return (struct gl_display_list
*)
569 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
573 /** Is the given opcode an extension code? */
574 static inline GLboolean
575 is_ext_opcode(OpCode opcode
)
577 return (opcode
>= OPCODE_EXT_0
);
581 /** Destroy an extended opcode instruction */
583 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
585 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
587 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
588 step
= ctx
->ListExt
->Opcode
[i
].Size
;
593 /** Execute an extended opcode instruction */
595 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
597 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
599 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
600 step
= ctx
->ListExt
->Opcode
[i
].Size
;
605 /** Print an extended opcode instruction */
607 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
609 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
611 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
612 step
= ctx
->ListExt
->Opcode
[i
].Size
;
618 * Delete the named display list, but don't remove from hash table.
619 * \param dlist - display list pointer
622 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
627 n
= block
= dlist
->Head
;
629 done
= block
? GL_FALSE
: GL_TRUE
;
631 const OpCode opcode
= n
[0].opcode
;
633 /* check for extension opcodes first */
634 if (is_ext_opcode(opcode
)) {
635 n
+= ext_opcode_destroy(ctx
, n
);
639 /* for some commands, we need to free malloc'd memory */
642 n
+= InstSize
[n
[0].opcode
];
646 n
+= InstSize
[n
[0].opcode
];
648 case OPCODE_DRAW_PIXELS
:
650 n
+= InstSize
[n
[0].opcode
];
654 n
+= InstSize
[n
[0].opcode
];
656 case OPCODE_COLOR_TABLE
:
658 n
+= InstSize
[n
[0].opcode
];
660 case OPCODE_COLOR_SUB_TABLE
:
662 n
+= InstSize
[n
[0].opcode
];
664 case OPCODE_CONVOLUTION_FILTER_1D
:
666 n
+= InstSize
[n
[0].opcode
];
668 case OPCODE_CONVOLUTION_FILTER_2D
:
670 n
+= InstSize
[n
[0].opcode
];
672 case OPCODE_POLYGON_STIPPLE
:
674 n
+= InstSize
[n
[0].opcode
];
676 case OPCODE_TEX_IMAGE1D
:
678 n
+= InstSize
[n
[0].opcode
];
680 case OPCODE_TEX_IMAGE2D
:
682 n
+= InstSize
[n
[0].opcode
];
684 case OPCODE_TEX_IMAGE3D
:
686 n
+= InstSize
[n
[0].opcode
];
688 case OPCODE_TEX_SUB_IMAGE1D
:
690 n
+= InstSize
[n
[0].opcode
];
692 case OPCODE_TEX_SUB_IMAGE2D
:
694 n
+= InstSize
[n
[0].opcode
];
696 case OPCODE_TEX_SUB_IMAGE3D
:
698 n
+= InstSize
[n
[0].opcode
];
700 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
702 n
+= InstSize
[n
[0].opcode
];
704 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
706 n
+= InstSize
[n
[0].opcode
];
708 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
710 n
+= InstSize
[n
[0].opcode
];
712 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
714 n
+= InstSize
[n
[0].opcode
];
716 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
718 n
+= InstSize
[n
[0].opcode
];
720 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
722 n
+= InstSize
[n
[0].opcode
];
724 case OPCODE_PROGRAM_STRING_ARB
:
725 free(n
[4].data
); /* program string */
726 n
+= InstSize
[n
[0].opcode
];
728 case OPCODE_UNIFORM_1FV
:
729 case OPCODE_UNIFORM_2FV
:
730 case OPCODE_UNIFORM_3FV
:
731 case OPCODE_UNIFORM_4FV
:
732 case OPCODE_UNIFORM_1IV
:
733 case OPCODE_UNIFORM_2IV
:
734 case OPCODE_UNIFORM_3IV
:
735 case OPCODE_UNIFORM_4IV
:
736 case OPCODE_UNIFORM_1UIV
:
737 case OPCODE_UNIFORM_2UIV
:
738 case OPCODE_UNIFORM_3UIV
:
739 case OPCODE_UNIFORM_4UIV
:
741 n
+= InstSize
[n
[0].opcode
];
743 case OPCODE_UNIFORM_MATRIX22
:
744 case OPCODE_UNIFORM_MATRIX33
:
745 case OPCODE_UNIFORM_MATRIX44
:
746 case OPCODE_UNIFORM_MATRIX24
:
747 case OPCODE_UNIFORM_MATRIX42
:
748 case OPCODE_UNIFORM_MATRIX23
:
749 case OPCODE_UNIFORM_MATRIX32
:
750 case OPCODE_UNIFORM_MATRIX34
:
751 case OPCODE_UNIFORM_MATRIX43
:
753 n
+= InstSize
[n
[0].opcode
];
756 case OPCODE_CONTINUE
:
757 n
= (Node
*) n
[1].next
;
761 case OPCODE_END_OF_LIST
:
766 /* Most frequent case */
767 n
+= InstSize
[n
[0].opcode
];
778 * Destroy a display list and remove from hash table.
779 * \param list - display list number
782 destroy_list(struct gl_context
*ctx
, GLuint list
)
784 struct gl_display_list
*dlist
;
789 dlist
= lookup_list(ctx
, list
);
793 _mesa_delete_list(ctx
, dlist
);
794 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
799 * Translate the nth element of list from <type> to GLint.
802 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
814 bptr
= (GLbyte
*) list
;
815 return (GLint
) bptr
[n
];
816 case GL_UNSIGNED_BYTE
:
817 ubptr
= (GLubyte
*) list
;
818 return (GLint
) ubptr
[n
];
820 sptr
= (GLshort
*) list
;
821 return (GLint
) sptr
[n
];
822 case GL_UNSIGNED_SHORT
:
823 usptr
= (GLushort
*) list
;
824 return (GLint
) usptr
[n
];
826 iptr
= (GLint
*) list
;
828 case GL_UNSIGNED_INT
:
829 uiptr
= (GLuint
*) list
;
830 return (GLint
) uiptr
[n
];
832 fptr
= (GLfloat
*) list
;
833 return (GLint
) FLOORF(fptr
[n
]);
835 ubptr
= ((GLubyte
*) list
) + 2 * n
;
836 return (GLint
) ubptr
[0] * 256
839 ubptr
= ((GLubyte
*) list
) + 3 * n
;
840 return (GLint
) ubptr
[0] * 65536
841 + (GLint
) ubptr
[1] * 256
844 ubptr
= ((GLubyte
*) list
) + 4 * n
;
845 return (GLint
) ubptr
[0] * 16777216
846 + (GLint
) ubptr
[1] * 65536
847 + (GLint
) ubptr
[2] * 256
857 /**********************************************************************/
859 /**********************************************************************/
862 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
863 * If width < 0 or height < 0 or format or type are invalid we'll just
864 * return NULL. We will not generate an error since OpenGL command
865 * arguments aren't error-checked until the command is actually executed
866 * (not when they're compiled).
867 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
870 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
871 GLsizei width
, GLsizei height
, GLsizei depth
,
872 GLenum format
, GLenum type
, const GLvoid
* pixels
,
873 const struct gl_pixelstore_attrib
*unpack
)
875 if (width
<= 0 || height
<= 0) {
879 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
880 /* bad format and/or type */
884 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
888 if (type
== GL_BITMAP
)
889 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
891 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
892 format
, type
, pixels
, unpack
);
893 if (pixels
&& !image
) {
894 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
898 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
899 depth
, format
, type
, INT_MAX
, pixels
)) {
900 const GLubyte
*map
, *src
;
904 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
905 GL_MAP_READ_BIT
, unpack
->BufferObj
);
907 /* unable to map src buffer! */
908 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
912 src
= ADD_POINTERS(map
, pixels
);
913 if (type
== GL_BITMAP
)
914 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
916 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
917 format
, type
, src
, unpack
);
919 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
922 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
928 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
933 * Allocate space for a display list instruction (opcode + payload space).
934 * \param opcode the instruction opcode (OPCODE_* value)
935 * \param bytes instruction payload size (not counting opcode)
936 * \return pointer to allocated memory (the opcode space)
939 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
941 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
944 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
945 if (InstSize
[opcode
] == 0) {
946 /* save instruction size now */
947 InstSize
[opcode
] = numNodes
;
950 /* make sure instruction size agrees */
951 ASSERT(numNodes
== InstSize
[opcode
]);
955 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
956 /* This block is full. Allocate a new block and chain to it */
958 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
959 n
[0].opcode
= OPCODE_CONTINUE
;
960 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
962 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
965 n
[1].next
= (Node
*) newblock
;
966 ctx
->ListState
.CurrentBlock
= newblock
;
967 ctx
->ListState
.CurrentPos
= 0;
970 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
971 ctx
->ListState
.CurrentPos
+= numNodes
;
973 n
[0].opcode
= opcode
;
981 * Allocate space for a display list instruction. Used by callers outside
982 * this file for things like VBO vertex data.
984 * \param opcode the instruction opcode (OPCODE_* value)
985 * \param bytes instruction size in bytes, not counting opcode.
986 * \return pointer to the usable data area (not including the internal
990 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
992 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
994 return n
+ 1; /* return pointer to payload area, after opcode */
1001 * This function allows modules and drivers to get their own opcodes
1002 * for extending display list functionality.
1003 * \param ctx the rendering context
1004 * \param size number of bytes for storing the new display list command
1005 * \param execute function to execute the new display list command
1006 * \param destroy function to destroy the new display list command
1007 * \param print function to print the new display list command
1008 * \return the new opcode number or -1 if error
1011 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1013 void (*execute
) (struct gl_context
*, void *),
1014 void (*destroy
) (struct gl_context
*, void *),
1015 void (*print
) (struct gl_context
*, void *))
1017 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1018 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1019 ctx
->ListExt
->Opcode
[i
].Size
=
1020 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1021 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1022 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1023 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1024 return i
+ OPCODE_EXT_0
;
1031 * Allocate space for a display list instruction. The space is basically
1032 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1033 * function parameter, node[2] is the second parameter, etc.
1035 * \param opcode one of OPCODE_x
1036 * \param nparams number of function parameters
1037 * \return pointer to start of instruction space
1039 static inline Node
*
1040 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1042 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1048 * Display List compilation functions
1050 static void GLAPIENTRY
1051 save_Accum(GLenum op
, GLfloat value
)
1053 GET_CURRENT_CONTEXT(ctx
);
1055 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1056 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1061 if (ctx
->ExecuteFlag
) {
1062 CALL_Accum(ctx
->Exec
, (op
, value
));
1067 static void GLAPIENTRY
1068 save_AlphaFunc(GLenum func
, GLclampf ref
)
1070 GET_CURRENT_CONTEXT(ctx
);
1072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1073 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1076 n
[2].f
= (GLfloat
) ref
;
1078 if (ctx
->ExecuteFlag
) {
1079 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1084 static void GLAPIENTRY
1085 save_BindTexture(GLenum target
, GLuint texture
)
1087 GET_CURRENT_CONTEXT(ctx
);
1089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1090 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1095 if (ctx
->ExecuteFlag
) {
1096 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1101 static void GLAPIENTRY
1102 save_Bitmap(GLsizei width
, GLsizei height
,
1103 GLfloat xorig
, GLfloat yorig
,
1104 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1106 GET_CURRENT_CONTEXT(ctx
);
1108 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1109 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1111 n
[1].i
= (GLint
) width
;
1112 n
[2].i
= (GLint
) height
;
1117 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1118 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1120 if (ctx
->ExecuteFlag
) {
1121 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1122 xorig
, yorig
, xmove
, ymove
, pixels
));
1127 static void GLAPIENTRY
1128 save_BlendEquation(GLenum mode
)
1130 GET_CURRENT_CONTEXT(ctx
);
1132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1133 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1137 if (ctx
->ExecuteFlag
) {
1138 CALL_BlendEquation(ctx
->Exec
, (mode
));
1143 static void GLAPIENTRY
1144 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1146 GET_CURRENT_CONTEXT(ctx
);
1148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1149 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1154 if (ctx
->ExecuteFlag
) {
1155 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1160 static void GLAPIENTRY
1161 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1162 GLenum sfactorA
, GLenum dfactorA
)
1164 GET_CURRENT_CONTEXT(ctx
);
1166 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1167 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1169 n
[1].e
= sfactorRGB
;
1170 n
[2].e
= dfactorRGB
;
1174 if (ctx
->ExecuteFlag
) {
1175 CALL_BlendFuncSeparate(ctx
->Exec
,
1176 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1181 static void GLAPIENTRY
1182 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1184 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1188 static void GLAPIENTRY
1189 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1191 GET_CURRENT_CONTEXT(ctx
);
1193 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1194 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1201 if (ctx
->ExecuteFlag
) {
1202 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1206 /* GL_ARB_draw_buffers_blend */
1207 static void GLAPIENTRY
1208 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1209 GLenum sfactorA
, GLenum dfactorA
)
1211 GET_CURRENT_CONTEXT(ctx
);
1213 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1214 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1217 n
[2].e
= sfactorRGB
;
1218 n
[3].e
= dfactorRGB
;
1222 if (ctx
->ExecuteFlag
) {
1223 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1224 sfactorA
, dfactorA
));
1228 /* GL_ARB_draw_buffers_blend */
1229 static void GLAPIENTRY
1230 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1232 GET_CURRENT_CONTEXT(ctx
);
1234 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1235 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1241 if (ctx
->ExecuteFlag
) {
1242 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1246 /* GL_ARB_draw_buffers_blend */
1247 static void GLAPIENTRY
1248 save_BlendEquationi(GLuint buf
, GLenum mode
)
1250 GET_CURRENT_CONTEXT(ctx
);
1252 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1253 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1258 if (ctx
->ExecuteFlag
) {
1259 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1263 /* GL_ARB_draw_buffers_blend */
1264 static void GLAPIENTRY
1265 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1267 GET_CURRENT_CONTEXT(ctx
);
1269 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1270 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1276 if (ctx
->ExecuteFlag
) {
1277 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1282 /* GL_ARB_draw_instanced. */
1283 static void GLAPIENTRY
1284 save_DrawArraysInstancedARB(GLenum mode
,
1289 GET_CURRENT_CONTEXT(ctx
);
1290 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1291 "glDrawArraysInstanced() during display list compile");
1294 static void GLAPIENTRY
1295 save_DrawElementsInstancedARB(GLenum mode
,
1298 const GLvoid
*indices
,
1301 GET_CURRENT_CONTEXT(ctx
);
1302 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1303 "glDrawElementsInstanced() during display list compile");
1306 static void GLAPIENTRY
1307 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1310 const GLvoid
*indices
,
1314 GET_CURRENT_CONTEXT(ctx
);
1315 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1316 "glDrawElementsInstancedBaseVertex() during display list compile");
1319 /* GL_ARB_base_instance. */
1320 static void GLAPIENTRY
1321 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1325 GLuint baseinstance
)
1327 GET_CURRENT_CONTEXT(ctx
);
1328 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1329 "glDrawArraysInstancedBaseInstance() during display list compile");
1332 static void APIENTRY
1333 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1336 const void *indices
,
1338 GLuint baseinstance
)
1340 GET_CURRENT_CONTEXT(ctx
);
1341 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1342 "glDrawElementsInstancedBaseInstance() during display list compile");
1345 static void APIENTRY
1346 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1349 const void *indices
,
1352 GLuint baseinstance
)
1354 GET_CURRENT_CONTEXT(ctx
);
1355 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1356 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1359 static void invalidate_saved_current_state( struct gl_context
*ctx
)
1363 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1364 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1366 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1367 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1369 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1371 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1374 static void GLAPIENTRY
1375 save_CallList(GLuint list
)
1377 GET_CURRENT_CONTEXT(ctx
);
1379 SAVE_FLUSH_VERTICES(ctx
);
1381 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1386 /* After this, we don't know what state we're in. Invalidate all
1387 * cached information previously gathered:
1389 invalidate_saved_current_state( ctx
);
1391 if (ctx
->ExecuteFlag
) {
1392 _mesa_CallList(list
);
1397 static void GLAPIENTRY
1398 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1400 GET_CURRENT_CONTEXT(ctx
);
1402 GLboolean typeErrorFlag
;
1404 SAVE_FLUSH_VERTICES(ctx
);
1408 case GL_UNSIGNED_BYTE
:
1410 case GL_UNSIGNED_SHORT
:
1412 case GL_UNSIGNED_INT
:
1417 typeErrorFlag
= GL_FALSE
;
1420 typeErrorFlag
= GL_TRUE
;
1423 for (i
= 0; i
< num
; i
++) {
1424 GLint list
= translate_id(i
, type
, lists
);
1425 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1428 n
[2].b
= typeErrorFlag
;
1432 /* After this, we don't know what state we're in. Invalidate all
1433 * cached information previously gathered:
1435 invalidate_saved_current_state( ctx
);
1437 if (ctx
->ExecuteFlag
) {
1438 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1443 static void GLAPIENTRY
1444 save_Clear(GLbitfield mask
)
1446 GET_CURRENT_CONTEXT(ctx
);
1448 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1449 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1453 if (ctx
->ExecuteFlag
) {
1454 CALL_Clear(ctx
->Exec
, (mask
));
1459 static void GLAPIENTRY
1460 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1462 GET_CURRENT_CONTEXT(ctx
);
1464 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1465 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1468 n
[2].i
= drawbuffer
;
1470 if (buffer
== GL_COLOR
) {
1481 if (ctx
->ExecuteFlag
) {
1482 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1487 static void GLAPIENTRY
1488 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1490 GET_CURRENT_CONTEXT(ctx
);
1492 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1493 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1496 n
[2].i
= drawbuffer
;
1498 if (buffer
== GL_COLOR
) {
1509 if (ctx
->ExecuteFlag
) {
1510 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1515 static void GLAPIENTRY
1516 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1518 GET_CURRENT_CONTEXT(ctx
);
1520 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1521 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1524 n
[2].i
= drawbuffer
;
1526 if (buffer
== GL_COLOR
) {
1537 if (ctx
->ExecuteFlag
) {
1538 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1543 static void GLAPIENTRY
1544 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1545 GLfloat depth
, GLint stencil
)
1547 GET_CURRENT_CONTEXT(ctx
);
1549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1550 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1553 n
[2].i
= drawbuffer
;
1557 if (ctx
->ExecuteFlag
) {
1558 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1563 static void GLAPIENTRY
1564 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1566 GET_CURRENT_CONTEXT(ctx
);
1568 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1569 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1576 if (ctx
->ExecuteFlag
) {
1577 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1582 static void GLAPIENTRY
1583 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1585 GET_CURRENT_CONTEXT(ctx
);
1587 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1588 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1595 if (ctx
->ExecuteFlag
) {
1596 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1601 static void GLAPIENTRY
1602 save_ClearDepth(GLclampd depth
)
1604 GET_CURRENT_CONTEXT(ctx
);
1606 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1607 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1609 n
[1].f
= (GLfloat
) depth
;
1611 if (ctx
->ExecuteFlag
) {
1612 CALL_ClearDepth(ctx
->Exec
, (depth
));
1617 static void GLAPIENTRY
1618 save_ClearIndex(GLfloat c
)
1620 GET_CURRENT_CONTEXT(ctx
);
1622 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1623 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1627 if (ctx
->ExecuteFlag
) {
1628 CALL_ClearIndex(ctx
->Exec
, (c
));
1633 static void GLAPIENTRY
1634 save_ClearStencil(GLint s
)
1636 GET_CURRENT_CONTEXT(ctx
);
1638 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1639 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1643 if (ctx
->ExecuteFlag
) {
1644 CALL_ClearStencil(ctx
->Exec
, (s
));
1649 static void GLAPIENTRY
1650 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1652 GET_CURRENT_CONTEXT(ctx
);
1654 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1655 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1658 n
[2].f
= (GLfloat
) equ
[0];
1659 n
[3].f
= (GLfloat
) equ
[1];
1660 n
[4].f
= (GLfloat
) equ
[2];
1661 n
[5].f
= (GLfloat
) equ
[3];
1663 if (ctx
->ExecuteFlag
) {
1664 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1670 static void GLAPIENTRY
1671 save_ColorMask(GLboolean red
, GLboolean green
,
1672 GLboolean blue
, GLboolean alpha
)
1674 GET_CURRENT_CONTEXT(ctx
);
1676 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1677 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1684 if (ctx
->ExecuteFlag
) {
1685 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1690 static void GLAPIENTRY
1691 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1692 GLboolean blue
, GLboolean alpha
)
1694 GET_CURRENT_CONTEXT(ctx
);
1696 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1697 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1705 if (ctx
->ExecuteFlag
) {
1706 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1711 static void GLAPIENTRY
1712 save_ColorMaterial(GLenum face
, GLenum mode
)
1714 GET_CURRENT_CONTEXT(ctx
);
1716 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1718 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1723 if (ctx
->ExecuteFlag
) {
1724 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1729 static void GLAPIENTRY
1730 save_ColorTable(GLenum target
, GLenum internalFormat
,
1731 GLsizei width
, GLenum format
, GLenum type
,
1732 const GLvoid
* table
)
1734 GET_CURRENT_CONTEXT(ctx
);
1735 if (_mesa_is_proxy_texture(target
)) {
1736 /* execute immediately */
1737 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1738 format
, type
, table
));
1742 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1743 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1746 n
[2].e
= internalFormat
;
1750 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1753 if (ctx
->ExecuteFlag
) {
1754 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1755 format
, type
, table
));
1762 static void GLAPIENTRY
1763 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1764 const GLfloat
*params
)
1766 GET_CURRENT_CONTEXT(ctx
);
1769 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1771 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1776 if (pname
== GL_COLOR_TABLE_SGI
||
1777 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1778 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1785 if (ctx
->ExecuteFlag
) {
1786 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1791 static void GLAPIENTRY
1792 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1794 GET_CURRENT_CONTEXT(ctx
);
1797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1799 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1804 if (pname
== GL_COLOR_TABLE_SGI
||
1805 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1806 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1813 if (ctx
->ExecuteFlag
) {
1814 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1820 static void GLAPIENTRY
1821 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1822 GLenum format
, GLenum type
, const GLvoid
* table
)
1824 GET_CURRENT_CONTEXT(ctx
);
1826 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1827 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1834 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1837 if (ctx
->ExecuteFlag
) {
1838 CALL_ColorSubTable(ctx
->Exec
,
1839 (target
, start
, count
, format
, type
, table
));
1844 static void GLAPIENTRY
1845 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1846 GLint x
, GLint y
, GLsizei width
)
1848 GET_CURRENT_CONTEXT(ctx
);
1851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1852 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1860 if (ctx
->ExecuteFlag
) {
1861 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1866 static void GLAPIENTRY
1867 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1868 GLint x
, GLint y
, GLsizei width
)
1870 GET_CURRENT_CONTEXT(ctx
);
1873 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1874 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1877 n
[2].e
= internalformat
;
1882 if (ctx
->ExecuteFlag
) {
1883 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1888 static void GLAPIENTRY
1889 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1890 GLenum format
, GLenum type
, const GLvoid
* filter
)
1892 GET_CURRENT_CONTEXT(ctx
);
1895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1897 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1900 n
[2].e
= internalFormat
;
1904 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1907 if (ctx
->ExecuteFlag
) {
1908 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1909 format
, type
, filter
));
1914 static void GLAPIENTRY
1915 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1916 GLsizei width
, GLsizei height
, GLenum format
,
1917 GLenum type
, const GLvoid
* filter
)
1919 GET_CURRENT_CONTEXT(ctx
);
1922 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1924 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1927 n
[2].e
= internalFormat
;
1932 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1935 if (ctx
->ExecuteFlag
) {
1936 CALL_ConvolutionFilter2D(ctx
->Exec
,
1937 (target
, internalFormat
, width
, height
, format
,
1943 static void GLAPIENTRY
1944 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1946 GET_CURRENT_CONTEXT(ctx
);
1948 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1949 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1955 if (ctx
->ExecuteFlag
) {
1956 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1961 static void GLAPIENTRY
1962 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1964 GET_CURRENT_CONTEXT(ctx
);
1966 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1967 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1972 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1973 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1974 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1980 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1983 if (ctx
->ExecuteFlag
) {
1984 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1989 static void GLAPIENTRY
1990 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1992 GET_CURRENT_CONTEXT(ctx
);
1994 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1995 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
2001 if (ctx
->ExecuteFlag
) {
2002 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
2007 static void GLAPIENTRY
2008 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
2009 const GLfloat
*params
)
2011 GET_CURRENT_CONTEXT(ctx
);
2013 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2014 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
2019 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
2020 pname
== GL_CONVOLUTION_FILTER_SCALE
||
2021 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
2027 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
2030 if (ctx
->ExecuteFlag
) {
2031 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
2036 static void GLAPIENTRY
2037 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2039 GET_CURRENT_CONTEXT(ctx
);
2041 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2042 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2046 n
[3].i
= (GLint
) width
;
2047 n
[4].i
= (GLint
) height
;
2050 if (ctx
->ExecuteFlag
) {
2051 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2057 static void GLAPIENTRY
2058 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2059 GLint x
, GLint y
, GLsizei width
, GLint border
)
2061 GET_CURRENT_CONTEXT(ctx
);
2063 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2064 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2068 n
[3].e
= internalformat
;
2074 if (ctx
->ExecuteFlag
) {
2075 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2076 x
, y
, width
, border
));
2081 static void GLAPIENTRY
2082 save_CopyTexImage2D(GLenum target
, GLint level
,
2083 GLenum internalformat
,
2084 GLint x
, GLint y
, GLsizei width
,
2085 GLsizei height
, GLint border
)
2087 GET_CURRENT_CONTEXT(ctx
);
2089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2090 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2094 n
[3].e
= internalformat
;
2101 if (ctx
->ExecuteFlag
) {
2102 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2103 x
, y
, width
, height
, border
));
2109 static void GLAPIENTRY
2110 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2111 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2113 GET_CURRENT_CONTEXT(ctx
);
2115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2116 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2125 if (ctx
->ExecuteFlag
) {
2126 CALL_CopyTexSubImage1D(ctx
->Exec
,
2127 (target
, level
, xoffset
, x
, y
, width
));
2132 static void GLAPIENTRY
2133 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2134 GLint xoffset
, GLint yoffset
,
2135 GLint x
, GLint y
, GLsizei width
, GLint height
)
2137 GET_CURRENT_CONTEXT(ctx
);
2139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2140 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2151 if (ctx
->ExecuteFlag
) {
2152 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2153 x
, y
, width
, height
));
2158 static void GLAPIENTRY
2159 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2160 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2161 GLint x
, GLint y
, GLsizei width
, GLint height
)
2163 GET_CURRENT_CONTEXT(ctx
);
2165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2166 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2178 if (ctx
->ExecuteFlag
) {
2179 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2180 xoffset
, yoffset
, zoffset
,
2181 x
, y
, width
, height
));
2186 static void GLAPIENTRY
2187 save_CullFace(GLenum mode
)
2189 GET_CURRENT_CONTEXT(ctx
);
2191 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2192 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2196 if (ctx
->ExecuteFlag
) {
2197 CALL_CullFace(ctx
->Exec
, (mode
));
2202 static void GLAPIENTRY
2203 save_DepthFunc(GLenum func
)
2205 GET_CURRENT_CONTEXT(ctx
);
2207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2208 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2212 if (ctx
->ExecuteFlag
) {
2213 CALL_DepthFunc(ctx
->Exec
, (func
));
2218 static void GLAPIENTRY
2219 save_DepthMask(GLboolean mask
)
2221 GET_CURRENT_CONTEXT(ctx
);
2223 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2224 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2228 if (ctx
->ExecuteFlag
) {
2229 CALL_DepthMask(ctx
->Exec
, (mask
));
2234 static void GLAPIENTRY
2235 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2237 GET_CURRENT_CONTEXT(ctx
);
2239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2240 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2242 n
[1].f
= (GLfloat
) nearval
;
2243 n
[2].f
= (GLfloat
) farval
;
2245 if (ctx
->ExecuteFlag
) {
2246 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2251 static void GLAPIENTRY
2252 save_Disable(GLenum cap
)
2254 GET_CURRENT_CONTEXT(ctx
);
2256 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2257 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2261 if (ctx
->ExecuteFlag
) {
2262 CALL_Disable(ctx
->Exec
, (cap
));
2267 static void GLAPIENTRY
2268 save_DisableIndexed(GLuint index
, GLenum cap
)
2270 GET_CURRENT_CONTEXT(ctx
);
2272 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2273 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2278 if (ctx
->ExecuteFlag
) {
2279 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2284 static void GLAPIENTRY
2285 save_DrawBuffer(GLenum mode
)
2287 GET_CURRENT_CONTEXT(ctx
);
2289 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2290 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2294 if (ctx
->ExecuteFlag
) {
2295 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2300 static void GLAPIENTRY
2301 save_DrawPixels(GLsizei width
, GLsizei height
,
2302 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2304 GET_CURRENT_CONTEXT(ctx
);
2307 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2309 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
2315 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2316 pixels
, &ctx
->Unpack
);
2318 if (ctx
->ExecuteFlag
) {
2319 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2325 static void GLAPIENTRY
2326 save_Enable(GLenum cap
)
2328 GET_CURRENT_CONTEXT(ctx
);
2330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2331 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2335 if (ctx
->ExecuteFlag
) {
2336 CALL_Enable(ctx
->Exec
, (cap
));
2342 static void GLAPIENTRY
2343 save_EnableIndexed(GLuint index
, GLenum cap
)
2345 GET_CURRENT_CONTEXT(ctx
);
2347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2348 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2353 if (ctx
->ExecuteFlag
) {
2354 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2360 static void GLAPIENTRY
2361 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2363 GET_CURRENT_CONTEXT(ctx
);
2365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2366 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2372 if (ctx
->ExecuteFlag
) {
2373 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2378 static void GLAPIENTRY
2379 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2381 GET_CURRENT_CONTEXT(ctx
);
2383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2384 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2392 if (ctx
->ExecuteFlag
) {
2393 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2400 static void GLAPIENTRY
2401 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2403 GET_CURRENT_CONTEXT(ctx
);
2405 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2406 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2414 if (ctx
->ExecuteFlag
) {
2415 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2420 static void GLAPIENTRY
2421 save_Fogf(GLenum pname
, GLfloat param
)
2425 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2426 save_Fogfv(pname
, parray
);
2430 static void GLAPIENTRY
2431 save_Fogiv(GLenum pname
, const GLint
*params
)
2436 case GL_FOG_DENSITY
:
2440 p
[0] = (GLfloat
) *params
;
2446 p
[0] = INT_TO_FLOAT(params
[0]);
2447 p
[1] = INT_TO_FLOAT(params
[1]);
2448 p
[2] = INT_TO_FLOAT(params
[2]);
2449 p
[3] = INT_TO_FLOAT(params
[3]);
2452 /* Error will be caught later in gl_Fogfv */
2453 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2455 save_Fogfv(pname
, p
);
2459 static void GLAPIENTRY
2460 save_Fogi(GLenum pname
, GLint param
)
2464 parray
[1] = parray
[2] = parray
[3] = 0;
2465 save_Fogiv(pname
, parray
);
2469 static void GLAPIENTRY
2470 save_FrontFace(GLenum mode
)
2472 GET_CURRENT_CONTEXT(ctx
);
2474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2475 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2479 if (ctx
->ExecuteFlag
) {
2480 CALL_FrontFace(ctx
->Exec
, (mode
));
2485 static void GLAPIENTRY
2486 save_Frustum(GLdouble left
, GLdouble right
,
2487 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2489 GET_CURRENT_CONTEXT(ctx
);
2491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2492 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2494 n
[1].f
= (GLfloat
) left
;
2495 n
[2].f
= (GLfloat
) right
;
2496 n
[3].f
= (GLfloat
) bottom
;
2497 n
[4].f
= (GLfloat
) top
;
2498 n
[5].f
= (GLfloat
) nearval
;
2499 n
[6].f
= (GLfloat
) farval
;
2501 if (ctx
->ExecuteFlag
) {
2502 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2507 static void GLAPIENTRY
2508 save_Hint(GLenum target
, GLenum mode
)
2510 GET_CURRENT_CONTEXT(ctx
);
2512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2513 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2518 if (ctx
->ExecuteFlag
) {
2519 CALL_Hint(ctx
->Exec
, (target
, mode
));
2524 static void GLAPIENTRY
2525 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2528 GET_CURRENT_CONTEXT(ctx
);
2531 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2532 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2536 n
[3].e
= internalFormat
;
2539 if (ctx
->ExecuteFlag
) {
2540 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2545 static void GLAPIENTRY
2546 save_IndexMask(GLuint mask
)
2548 GET_CURRENT_CONTEXT(ctx
);
2550 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2551 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2555 if (ctx
->ExecuteFlag
) {
2556 CALL_IndexMask(ctx
->Exec
, (mask
));
2561 static void GLAPIENTRY
2562 save_InitNames(void)
2564 GET_CURRENT_CONTEXT(ctx
);
2565 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2566 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2567 if (ctx
->ExecuteFlag
) {
2568 CALL_InitNames(ctx
->Exec
, ());
2573 static void GLAPIENTRY
2574 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2576 GET_CURRENT_CONTEXT(ctx
);
2578 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2579 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2597 case GL_SPOT_DIRECTION
:
2600 case GL_SPOT_EXPONENT
:
2603 case GL_SPOT_CUTOFF
:
2606 case GL_CONSTANT_ATTENUATION
:
2609 case GL_LINEAR_ATTENUATION
:
2612 case GL_QUADRATIC_ATTENUATION
:
2618 for (i
= 0; i
< nParams
; i
++) {
2619 n
[3 + i
].f
= params
[i
];
2622 if (ctx
->ExecuteFlag
) {
2623 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2628 static void GLAPIENTRY
2629 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2633 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2634 save_Lightfv(light
, pname
, parray
);
2638 static void GLAPIENTRY
2639 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2646 fparam
[0] = INT_TO_FLOAT(params
[0]);
2647 fparam
[1] = INT_TO_FLOAT(params
[1]);
2648 fparam
[2] = INT_TO_FLOAT(params
[2]);
2649 fparam
[3] = INT_TO_FLOAT(params
[3]);
2652 fparam
[0] = (GLfloat
) params
[0];
2653 fparam
[1] = (GLfloat
) params
[1];
2654 fparam
[2] = (GLfloat
) params
[2];
2655 fparam
[3] = (GLfloat
) params
[3];
2657 case GL_SPOT_DIRECTION
:
2658 fparam
[0] = (GLfloat
) params
[0];
2659 fparam
[1] = (GLfloat
) params
[1];
2660 fparam
[2] = (GLfloat
) params
[2];
2662 case GL_SPOT_EXPONENT
:
2663 case GL_SPOT_CUTOFF
:
2664 case GL_CONSTANT_ATTENUATION
:
2665 case GL_LINEAR_ATTENUATION
:
2666 case GL_QUADRATIC_ATTENUATION
:
2667 fparam
[0] = (GLfloat
) params
[0];
2670 /* error will be caught later in gl_Lightfv */
2673 save_Lightfv(light
, pname
, fparam
);
2677 static void GLAPIENTRY
2678 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2682 parray
[1] = parray
[2] = parray
[3] = 0;
2683 save_Lightiv(light
, pname
, parray
);
2687 static void GLAPIENTRY
2688 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2690 GET_CURRENT_CONTEXT(ctx
);
2692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2693 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2701 if (ctx
->ExecuteFlag
) {
2702 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2707 static void GLAPIENTRY
2708 save_LightModelf(GLenum pname
, GLfloat param
)
2712 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2713 save_LightModelfv(pname
, parray
);
2717 static void GLAPIENTRY
2718 save_LightModeliv(GLenum pname
, const GLint
*params
)
2722 case GL_LIGHT_MODEL_AMBIENT
:
2723 fparam
[0] = INT_TO_FLOAT(params
[0]);
2724 fparam
[1] = INT_TO_FLOAT(params
[1]);
2725 fparam
[2] = INT_TO_FLOAT(params
[2]);
2726 fparam
[3] = INT_TO_FLOAT(params
[3]);
2728 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2729 case GL_LIGHT_MODEL_TWO_SIDE
:
2730 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2731 fparam
[0] = (GLfloat
) params
[0];
2737 /* Error will be caught later in gl_LightModelfv */
2738 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2740 save_LightModelfv(pname
, fparam
);
2744 static void GLAPIENTRY
2745 save_LightModeli(GLenum pname
, GLint param
)
2749 parray
[1] = parray
[2] = parray
[3] = 0;
2750 save_LightModeliv(pname
, parray
);
2754 static void GLAPIENTRY
2755 save_LineStipple(GLint factor
, GLushort pattern
)
2757 GET_CURRENT_CONTEXT(ctx
);
2759 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2760 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2765 if (ctx
->ExecuteFlag
) {
2766 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2771 static void GLAPIENTRY
2772 save_LineWidth(GLfloat width
)
2774 GET_CURRENT_CONTEXT(ctx
);
2776 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2777 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2781 if (ctx
->ExecuteFlag
) {
2782 CALL_LineWidth(ctx
->Exec
, (width
));
2787 static void GLAPIENTRY
2788 save_ListBase(GLuint base
)
2790 GET_CURRENT_CONTEXT(ctx
);
2792 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2793 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2797 if (ctx
->ExecuteFlag
) {
2798 CALL_ListBase(ctx
->Exec
, (base
));
2803 static void GLAPIENTRY
2804 save_LoadIdentity(void)
2806 GET_CURRENT_CONTEXT(ctx
);
2807 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2808 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2809 if (ctx
->ExecuteFlag
) {
2810 CALL_LoadIdentity(ctx
->Exec
, ());
2815 static void GLAPIENTRY
2816 save_LoadMatrixf(const GLfloat
* m
)
2818 GET_CURRENT_CONTEXT(ctx
);
2820 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2821 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2824 for (i
= 0; i
< 16; i
++) {
2828 if (ctx
->ExecuteFlag
) {
2829 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2834 static void GLAPIENTRY
2835 save_LoadMatrixd(const GLdouble
* m
)
2839 for (i
= 0; i
< 16; i
++) {
2840 f
[i
] = (GLfloat
) m
[i
];
2842 save_LoadMatrixf(f
);
2846 static void GLAPIENTRY
2847 save_LoadName(GLuint name
)
2849 GET_CURRENT_CONTEXT(ctx
);
2851 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2852 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2856 if (ctx
->ExecuteFlag
) {
2857 CALL_LoadName(ctx
->Exec
, (name
));
2862 static void GLAPIENTRY
2863 save_LogicOp(GLenum opcode
)
2865 GET_CURRENT_CONTEXT(ctx
);
2867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2868 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2872 if (ctx
->ExecuteFlag
) {
2873 CALL_LogicOp(ctx
->Exec
, (opcode
));
2878 static void GLAPIENTRY
2879 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2880 GLint order
, const GLdouble
* points
)
2882 GET_CURRENT_CONTEXT(ctx
);
2884 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2885 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2887 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2889 n
[2].f
= (GLfloat
) u1
;
2890 n
[3].f
= (GLfloat
) u2
;
2891 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2893 n
[6].data
= (void *) pnts
;
2895 if (ctx
->ExecuteFlag
) {
2896 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2900 static void GLAPIENTRY
2901 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2902 GLint order
, const GLfloat
* points
)
2904 GET_CURRENT_CONTEXT(ctx
);
2906 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2907 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2909 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2913 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2915 n
[6].data
= (void *) pnts
;
2917 if (ctx
->ExecuteFlag
) {
2918 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2923 static void GLAPIENTRY
2924 save_Map2d(GLenum target
,
2925 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2926 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2927 const GLdouble
* points
)
2929 GET_CURRENT_CONTEXT(ctx
);
2931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2932 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2934 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2935 vstride
, vorder
, points
);
2937 n
[2].f
= (GLfloat
) u1
;
2938 n
[3].f
= (GLfloat
) u2
;
2939 n
[4].f
= (GLfloat
) v1
;
2940 n
[5].f
= (GLfloat
) v2
;
2941 /* XXX verify these strides are correct */
2942 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2943 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2946 n
[10].data
= (void *) pnts
;
2948 if (ctx
->ExecuteFlag
) {
2949 CALL_Map2d(ctx
->Exec
, (target
,
2950 u1
, u2
, ustride
, uorder
,
2951 v1
, v2
, vstride
, vorder
, points
));
2956 static void GLAPIENTRY
2957 save_Map2f(GLenum target
,
2958 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2959 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2960 const GLfloat
* points
)
2962 GET_CURRENT_CONTEXT(ctx
);
2964 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2965 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2967 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2968 vstride
, vorder
, points
);
2974 /* XXX verify these strides are correct */
2975 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2976 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2979 n
[10].data
= (void *) pnts
;
2981 if (ctx
->ExecuteFlag
) {
2982 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2983 v1
, v2
, vstride
, vorder
, points
));
2988 static void GLAPIENTRY
2989 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2991 GET_CURRENT_CONTEXT(ctx
);
2993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2994 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
3000 if (ctx
->ExecuteFlag
) {
3001 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3006 static void GLAPIENTRY
3007 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3009 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3013 static void GLAPIENTRY
3014 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3015 GLint vn
, GLfloat v1
, GLfloat v2
)
3017 GET_CURRENT_CONTEXT(ctx
);
3019 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3020 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3029 if (ctx
->ExecuteFlag
) {
3030 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3036 static void GLAPIENTRY
3037 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3038 GLint vn
, GLdouble v1
, GLdouble v2
)
3040 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3041 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3045 static void GLAPIENTRY
3046 save_MatrixMode(GLenum mode
)
3048 GET_CURRENT_CONTEXT(ctx
);
3050 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3051 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3055 if (ctx
->ExecuteFlag
) {
3056 CALL_MatrixMode(ctx
->Exec
, (mode
));
3061 static void GLAPIENTRY
3062 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
3064 GET_CURRENT_CONTEXT(ctx
);
3067 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3068 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
3071 n
[2].e
= internalFormat
;
3074 if (ctx
->ExecuteFlag
) {
3075 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
3080 static void GLAPIENTRY
3081 save_MultMatrixf(const GLfloat
* m
)
3083 GET_CURRENT_CONTEXT(ctx
);
3085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3086 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3089 for (i
= 0; i
< 16; i
++) {
3093 if (ctx
->ExecuteFlag
) {
3094 CALL_MultMatrixf(ctx
->Exec
, (m
));
3099 static void GLAPIENTRY
3100 save_MultMatrixd(const GLdouble
* m
)
3104 for (i
= 0; i
< 16; i
++) {
3105 f
[i
] = (GLfloat
) m
[i
];
3107 save_MultMatrixf(f
);
3111 static void GLAPIENTRY
3112 save_NewList(GLuint name
, GLenum mode
)
3114 GET_CURRENT_CONTEXT(ctx
);
3115 /* It's an error to call this function while building a display list */
3116 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3123 static void GLAPIENTRY
3124 save_Ortho(GLdouble left
, GLdouble right
,
3125 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3127 GET_CURRENT_CONTEXT(ctx
);
3129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3130 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3132 n
[1].f
= (GLfloat
) left
;
3133 n
[2].f
= (GLfloat
) right
;
3134 n
[3].f
= (GLfloat
) bottom
;
3135 n
[4].f
= (GLfloat
) top
;
3136 n
[5].f
= (GLfloat
) nearval
;
3137 n
[6].f
= (GLfloat
) farval
;
3139 if (ctx
->ExecuteFlag
) {
3140 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3145 static void GLAPIENTRY
3146 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3148 GET_CURRENT_CONTEXT(ctx
);
3150 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3151 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
3155 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
3156 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
3158 if (ctx
->ExecuteFlag
) {
3159 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3164 static void GLAPIENTRY
3165 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3167 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3169 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3170 for (i
= 0; i
< mapsize
; i
++) {
3171 fvalues
[i
] = (GLfloat
) values
[i
];
3175 for (i
= 0; i
< mapsize
; i
++) {
3176 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3179 save_PixelMapfv(map
, mapsize
, fvalues
);
3183 static void GLAPIENTRY
3184 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3186 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3188 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3189 for (i
= 0; i
< mapsize
; i
++) {
3190 fvalues
[i
] = (GLfloat
) values
[i
];
3194 for (i
= 0; i
< mapsize
; i
++) {
3195 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3198 save_PixelMapfv(map
, mapsize
, fvalues
);
3202 static void GLAPIENTRY
3203 save_PixelTransferf(GLenum pname
, GLfloat param
)
3205 GET_CURRENT_CONTEXT(ctx
);
3207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3208 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3213 if (ctx
->ExecuteFlag
) {
3214 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3219 static void GLAPIENTRY
3220 save_PixelTransferi(GLenum pname
, GLint param
)
3222 save_PixelTransferf(pname
, (GLfloat
) param
);
3226 static void GLAPIENTRY
3227 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3229 GET_CURRENT_CONTEXT(ctx
);
3231 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3232 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3237 if (ctx
->ExecuteFlag
) {
3238 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3243 static void GLAPIENTRY
3244 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3246 GET_CURRENT_CONTEXT(ctx
);
3248 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3249 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3256 if (ctx
->ExecuteFlag
) {
3257 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3262 static void GLAPIENTRY
3263 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3267 parray
[1] = parray
[2] = 0.0F
;
3268 save_PointParameterfvEXT(pname
, parray
);
3271 static void GLAPIENTRY
3272 save_PointParameteriNV(GLenum pname
, GLint param
)
3275 parray
[0] = (GLfloat
) param
;
3276 parray
[1] = parray
[2] = 0.0F
;
3277 save_PointParameterfvEXT(pname
, parray
);
3280 static void GLAPIENTRY
3281 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3284 parray
[0] = (GLfloat
) param
[0];
3285 parray
[1] = parray
[2] = 0.0F
;
3286 save_PointParameterfvEXT(pname
, parray
);
3290 static void GLAPIENTRY
3291 save_PointSize(GLfloat size
)
3293 GET_CURRENT_CONTEXT(ctx
);
3295 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3296 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3300 if (ctx
->ExecuteFlag
) {
3301 CALL_PointSize(ctx
->Exec
, (size
));
3306 static void GLAPIENTRY
3307 save_PolygonMode(GLenum face
, GLenum mode
)
3309 GET_CURRENT_CONTEXT(ctx
);
3311 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3312 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3317 if (ctx
->ExecuteFlag
) {
3318 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3323 static void GLAPIENTRY
3324 save_PolygonStipple(const GLubyte
* pattern
)
3326 GET_CURRENT_CONTEXT(ctx
);
3329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3331 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
3333 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3334 pattern
, &ctx
->Unpack
);
3336 if (ctx
->ExecuteFlag
) {
3337 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3342 static void GLAPIENTRY
3343 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3345 GET_CURRENT_CONTEXT(ctx
);
3347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3348 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3353 if (ctx
->ExecuteFlag
) {
3354 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3359 static void GLAPIENTRY
3360 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3362 GET_CURRENT_CONTEXT(ctx
);
3363 /* XXX mult by DepthMaxF here??? */
3364 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3368 static void GLAPIENTRY
3369 save_PopAttrib(void)
3371 GET_CURRENT_CONTEXT(ctx
);
3372 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3373 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3374 if (ctx
->ExecuteFlag
) {
3375 CALL_PopAttrib(ctx
->Exec
, ());
3380 static void GLAPIENTRY
3381 save_PopMatrix(void)
3383 GET_CURRENT_CONTEXT(ctx
);
3384 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3385 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3386 if (ctx
->ExecuteFlag
) {
3387 CALL_PopMatrix(ctx
->Exec
, ());
3392 static void GLAPIENTRY
3395 GET_CURRENT_CONTEXT(ctx
);
3396 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3397 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3398 if (ctx
->ExecuteFlag
) {
3399 CALL_PopName(ctx
->Exec
, ());
3404 static void GLAPIENTRY
3405 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3406 const GLclampf
* priorities
)
3408 GET_CURRENT_CONTEXT(ctx
);
3410 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3412 for (i
= 0; i
< num
; i
++) {
3414 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3416 n
[1].ui
= textures
[i
];
3417 n
[2].f
= priorities
[i
];
3420 if (ctx
->ExecuteFlag
) {
3421 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3426 static void GLAPIENTRY
3427 save_PushAttrib(GLbitfield mask
)
3429 GET_CURRENT_CONTEXT(ctx
);
3431 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3432 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3436 if (ctx
->ExecuteFlag
) {
3437 CALL_PushAttrib(ctx
->Exec
, (mask
));
3442 static void GLAPIENTRY
3443 save_PushMatrix(void)
3445 GET_CURRENT_CONTEXT(ctx
);
3446 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3447 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3448 if (ctx
->ExecuteFlag
) {
3449 CALL_PushMatrix(ctx
->Exec
, ());
3454 static void GLAPIENTRY
3455 save_PushName(GLuint name
)
3457 GET_CURRENT_CONTEXT(ctx
);
3459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3460 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3464 if (ctx
->ExecuteFlag
) {
3465 CALL_PushName(ctx
->Exec
, (name
));
3470 static void GLAPIENTRY
3471 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3473 GET_CURRENT_CONTEXT(ctx
);
3475 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3476 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3483 if (ctx
->ExecuteFlag
) {
3484 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3488 static void GLAPIENTRY
3489 save_RasterPos2d(GLdouble x
, GLdouble y
)
3491 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3494 static void GLAPIENTRY
3495 save_RasterPos2f(GLfloat x
, GLfloat y
)
3497 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3500 static void GLAPIENTRY
3501 save_RasterPos2i(GLint x
, GLint y
)
3503 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3506 static void GLAPIENTRY
3507 save_RasterPos2s(GLshort x
, GLshort y
)
3509 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3512 static void GLAPIENTRY
3513 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3515 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3518 static void GLAPIENTRY
3519 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3521 save_RasterPos4f(x
, y
, z
, 1.0F
);
3524 static void GLAPIENTRY
3525 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3527 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3530 static void GLAPIENTRY
3531 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3533 save_RasterPos4f(x
, y
, z
, 1.0F
);
3536 static void GLAPIENTRY
3537 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3539 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3542 static void GLAPIENTRY
3543 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3545 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3548 static void GLAPIENTRY
3549 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3551 save_RasterPos4f(x
, y
, z
, w
);
3554 static void GLAPIENTRY
3555 save_RasterPos2dv(const GLdouble
* v
)
3557 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3560 static void GLAPIENTRY
3561 save_RasterPos2fv(const GLfloat
* v
)
3563 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3566 static void GLAPIENTRY
3567 save_RasterPos2iv(const GLint
* v
)
3569 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3572 static void GLAPIENTRY
3573 save_RasterPos2sv(const GLshort
* v
)
3575 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3578 static void GLAPIENTRY
3579 save_RasterPos3dv(const GLdouble
* v
)
3581 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3584 static void GLAPIENTRY
3585 save_RasterPos3fv(const GLfloat
* v
)
3587 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3590 static void GLAPIENTRY
3591 save_RasterPos3iv(const GLint
* v
)
3593 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3596 static void GLAPIENTRY
3597 save_RasterPos3sv(const GLshort
* v
)
3599 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3602 static void GLAPIENTRY
3603 save_RasterPos4dv(const GLdouble
* v
)
3605 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3606 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3609 static void GLAPIENTRY
3610 save_RasterPos4fv(const GLfloat
* v
)
3612 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3615 static void GLAPIENTRY
3616 save_RasterPos4iv(const GLint
* v
)
3618 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3619 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3622 static void GLAPIENTRY
3623 save_RasterPos4sv(const GLshort
* v
)
3625 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3629 static void GLAPIENTRY
3630 save_PassThrough(GLfloat token
)
3632 GET_CURRENT_CONTEXT(ctx
);
3634 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3635 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3639 if (ctx
->ExecuteFlag
) {
3640 CALL_PassThrough(ctx
->Exec
, (token
));
3645 static void GLAPIENTRY
3646 save_ReadBuffer(GLenum mode
)
3648 GET_CURRENT_CONTEXT(ctx
);
3650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3651 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3655 if (ctx
->ExecuteFlag
) {
3656 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3661 static void GLAPIENTRY
3662 save_ResetHistogram(GLenum target
)
3664 GET_CURRENT_CONTEXT(ctx
);
3666 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3667 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3671 if (ctx
->ExecuteFlag
) {
3672 CALL_ResetHistogram(ctx
->Exec
, (target
));
3677 static void GLAPIENTRY
3678 save_ResetMinmax(GLenum target
)
3680 GET_CURRENT_CONTEXT(ctx
);
3682 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3683 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3687 if (ctx
->ExecuteFlag
) {
3688 CALL_ResetMinmax(ctx
->Exec
, (target
));
3693 static void GLAPIENTRY
3694 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3696 GET_CURRENT_CONTEXT(ctx
);
3698 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3699 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3706 if (ctx
->ExecuteFlag
) {
3707 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3712 static void GLAPIENTRY
3713 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3715 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3719 static void GLAPIENTRY
3720 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3722 GET_CURRENT_CONTEXT(ctx
);
3724 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3725 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3731 if (ctx
->ExecuteFlag
) {
3732 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3737 static void GLAPIENTRY
3738 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3740 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3744 static void GLAPIENTRY
3745 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3747 GET_CURRENT_CONTEXT(ctx
);
3749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3750 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3757 if (ctx
->ExecuteFlag
) {
3758 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3763 static void GLAPIENTRY
3764 save_ShadeModel(GLenum mode
)
3766 GET_CURRENT_CONTEXT(ctx
);
3768 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3770 if (ctx
->ExecuteFlag
) {
3771 CALL_ShadeModel(ctx
->Exec
, (mode
));
3774 /* Don't compile this call if it's a no-op.
3775 * By avoiding this state change we have a better chance of
3776 * coalescing subsequent drawing commands into one batch.
3778 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3781 SAVE_FLUSH_VERTICES(ctx
);
3783 ctx
->ListState
.Current
.ShadeModel
= mode
;
3785 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3792 static void GLAPIENTRY
3793 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3795 GET_CURRENT_CONTEXT(ctx
);
3797 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3798 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3804 if (ctx
->ExecuteFlag
) {
3805 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3810 static void GLAPIENTRY
3811 save_StencilMask(GLuint mask
)
3813 GET_CURRENT_CONTEXT(ctx
);
3815 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3816 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3820 if (ctx
->ExecuteFlag
) {
3821 CALL_StencilMask(ctx
->Exec
, (mask
));
3826 static void GLAPIENTRY
3827 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3829 GET_CURRENT_CONTEXT(ctx
);
3831 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3832 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3838 if (ctx
->ExecuteFlag
) {
3839 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3844 static void GLAPIENTRY
3845 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3847 GET_CURRENT_CONTEXT(ctx
);
3849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3850 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3857 if (ctx
->ExecuteFlag
) {
3858 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3863 static void GLAPIENTRY
3864 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3867 GET_CURRENT_CONTEXT(ctx
);
3869 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3871 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3879 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3886 if (ctx
->ExecuteFlag
) {
3887 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3888 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3893 static void GLAPIENTRY
3894 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3896 GET_CURRENT_CONTEXT(ctx
);
3898 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3899 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3904 if (ctx
->ExecuteFlag
) {
3905 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3910 static void GLAPIENTRY
3911 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3913 GET_CURRENT_CONTEXT(ctx
);
3915 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3916 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3923 if (ctx
->ExecuteFlag
) {
3924 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3929 static void GLAPIENTRY
3930 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3932 GET_CURRENT_CONTEXT(ctx
);
3934 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3935 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3939 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3947 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3950 if (ctx
->ExecuteFlag
) {
3951 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3956 static void GLAPIENTRY
3957 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3960 parray
[0] = (GLfloat
) param
;
3961 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3962 save_TexEnvfv(target
, pname
, parray
);
3966 static void GLAPIENTRY
3967 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3970 p
[0] = (GLfloat
) param
;
3971 p
[1] = p
[2] = p
[3] = 0.0F
;
3972 save_TexEnvfv(target
, pname
, p
);
3976 static void GLAPIENTRY
3977 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3980 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3981 p
[0] = INT_TO_FLOAT(param
[0]);
3982 p
[1] = INT_TO_FLOAT(param
[1]);
3983 p
[2] = INT_TO_FLOAT(param
[2]);
3984 p
[3] = INT_TO_FLOAT(param
[3]);
3987 p
[0] = (GLfloat
) param
[0];
3988 p
[1] = p
[2] = p
[3] = 0.0F
;
3990 save_TexEnvfv(target
, pname
, p
);
3994 static void GLAPIENTRY
3995 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3997 GET_CURRENT_CONTEXT(ctx
);
3999 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4000 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4009 if (ctx
->ExecuteFlag
) {
4010 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4015 static void GLAPIENTRY
4016 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4019 p
[0] = (GLfloat
) params
[0];
4020 p
[1] = (GLfloat
) params
[1];
4021 p
[2] = (GLfloat
) params
[2];
4022 p
[3] = (GLfloat
) params
[3];
4023 save_TexGenfv(coord
, pname
, p
);
4027 static void GLAPIENTRY
4028 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4031 parray
[0] = (GLfloat
) param
;
4032 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4033 save_TexGenfv(coord
, pname
, parray
);
4037 static void GLAPIENTRY
4038 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4041 p
[0] = (GLfloat
) params
[0];
4042 p
[1] = (GLfloat
) params
[1];
4043 p
[2] = (GLfloat
) params
[2];
4044 p
[3] = (GLfloat
) params
[3];
4045 save_TexGenfv(coord
, pname
, p
);
4049 static void GLAPIENTRY
4050 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4054 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4055 save_TexGenfv(coord
, pname
, parray
);
4059 static void GLAPIENTRY
4060 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4064 parray
[1] = parray
[2] = parray
[3] = 0;
4065 save_TexGeniv(coord
, pname
, parray
);
4069 static void GLAPIENTRY
4070 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4072 GET_CURRENT_CONTEXT(ctx
);
4074 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4075 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4084 if (ctx
->ExecuteFlag
) {
4085 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4090 static void GLAPIENTRY
4091 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4095 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4096 save_TexParameterfv(target
, pname
, parray
);
4100 static void GLAPIENTRY
4101 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4104 fparam
[0] = (GLfloat
) param
;
4105 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4106 save_TexParameterfv(target
, pname
, fparam
);
4110 static void GLAPIENTRY
4111 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4114 fparam
[0] = (GLfloat
) params
[0];
4115 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4116 save_TexParameterfv(target
, pname
, fparam
);
4120 static void GLAPIENTRY
4121 save_TexImage1D(GLenum target
,
4122 GLint level
, GLint components
,
4123 GLsizei width
, GLint border
,
4124 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4126 GET_CURRENT_CONTEXT(ctx
);
4127 if (target
== GL_PROXY_TEXTURE_1D
) {
4128 /* don't compile, execute immediately */
4129 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4130 border
, format
, type
, pixels
));
4134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4135 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
4139 n
[3].i
= components
;
4140 n
[4].i
= (GLint
) width
;
4144 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4145 pixels
, &ctx
->Unpack
);
4147 if (ctx
->ExecuteFlag
) {
4148 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4149 border
, format
, type
, pixels
));
4155 static void GLAPIENTRY
4156 save_TexImage2D(GLenum target
,
4157 GLint level
, GLint components
,
4158 GLsizei width
, GLsizei height
, GLint border
,
4159 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4161 GET_CURRENT_CONTEXT(ctx
);
4162 if (target
== GL_PROXY_TEXTURE_2D
) {
4163 /* don't compile, execute immediately */
4164 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4165 height
, border
, format
, type
, pixels
));
4169 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4170 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
4174 n
[3].i
= components
;
4175 n
[4].i
= (GLint
) width
;
4176 n
[5].i
= (GLint
) height
;
4180 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4181 pixels
, &ctx
->Unpack
);
4183 if (ctx
->ExecuteFlag
) {
4184 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4185 height
, border
, format
, type
, pixels
));
4191 static void GLAPIENTRY
4192 save_TexImage3D(GLenum target
,
4193 GLint level
, GLint internalFormat
,
4194 GLsizei width
, GLsizei height
, GLsizei depth
,
4196 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4198 GET_CURRENT_CONTEXT(ctx
);
4199 if (target
== GL_PROXY_TEXTURE_3D
) {
4200 /* don't compile, execute immediately */
4201 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4202 height
, depth
, border
, format
, type
,
4207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4208 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
4212 n
[3].i
= (GLint
) internalFormat
;
4213 n
[4].i
= (GLint
) width
;
4214 n
[5].i
= (GLint
) height
;
4215 n
[6].i
= (GLint
) depth
;
4219 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4220 pixels
, &ctx
->Unpack
);
4222 if (ctx
->ExecuteFlag
) {
4223 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4224 height
, depth
, border
, format
, type
,
4231 static void GLAPIENTRY
4232 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4233 GLsizei width
, GLenum format
, GLenum type
,
4234 const GLvoid
* pixels
)
4236 GET_CURRENT_CONTEXT(ctx
);
4239 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4241 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
4246 n
[4].i
= (GLint
) width
;
4249 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4250 pixels
, &ctx
->Unpack
);
4252 if (ctx
->ExecuteFlag
) {
4253 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4254 format
, type
, pixels
));
4259 static void GLAPIENTRY
4260 save_TexSubImage2D(GLenum target
, GLint level
,
4261 GLint xoffset
, GLint yoffset
,
4262 GLsizei width
, GLsizei height
,
4263 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4265 GET_CURRENT_CONTEXT(ctx
);
4268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4270 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
4276 n
[5].i
= (GLint
) width
;
4277 n
[6].i
= (GLint
) height
;
4280 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4281 pixels
, &ctx
->Unpack
);
4283 if (ctx
->ExecuteFlag
) {
4284 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4285 width
, height
, format
, type
, pixels
));
4290 static void GLAPIENTRY
4291 save_TexSubImage3D(GLenum target
, GLint level
,
4292 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4293 GLsizei width
, GLsizei height
, GLsizei depth
,
4294 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4296 GET_CURRENT_CONTEXT(ctx
);
4299 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4301 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
4308 n
[6].i
= (GLint
) width
;
4309 n
[7].i
= (GLint
) height
;
4310 n
[8].i
= (GLint
) depth
;
4313 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4314 pixels
, &ctx
->Unpack
);
4316 if (ctx
->ExecuteFlag
) {
4317 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4318 xoffset
, yoffset
, zoffset
,
4319 width
, height
, depth
, format
, type
,
4325 static void GLAPIENTRY
4326 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4328 GET_CURRENT_CONTEXT(ctx
);
4330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4331 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4337 if (ctx
->ExecuteFlag
) {
4338 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4343 static void GLAPIENTRY
4344 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4346 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4351 static void GLAPIENTRY
4352 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4354 GET_CURRENT_CONTEXT(ctx
);
4356 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4357 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4361 n
[3].i
= (GLint
) width
;
4362 n
[4].i
= (GLint
) height
;
4364 if (ctx
->ExecuteFlag
) {
4365 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4370 static void GLAPIENTRY
4371 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4373 GET_CURRENT_CONTEXT(ctx
);
4375 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4376 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4383 if (ctx
->ExecuteFlag
) {
4384 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4388 static void GLAPIENTRY
4389 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4391 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4394 static void GLAPIENTRY
4395 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4397 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4400 static void GLAPIENTRY
4401 save_WindowPos2iMESA(GLint x
, GLint y
)
4403 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4406 static void GLAPIENTRY
4407 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4409 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4412 static void GLAPIENTRY
4413 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4415 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4418 static void GLAPIENTRY
4419 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4421 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4424 static void GLAPIENTRY
4425 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4427 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4430 static void GLAPIENTRY
4431 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4433 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4436 static void GLAPIENTRY
4437 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4439 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4442 static void GLAPIENTRY
4443 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4445 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4448 static void GLAPIENTRY
4449 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4451 save_WindowPos4fMESA(x
, y
, z
, w
);
4454 static void GLAPIENTRY
4455 save_WindowPos2dvMESA(const GLdouble
* v
)
4457 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4460 static void GLAPIENTRY
4461 save_WindowPos2fvMESA(const GLfloat
* v
)
4463 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4466 static void GLAPIENTRY
4467 save_WindowPos2ivMESA(const GLint
* v
)
4469 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4472 static void GLAPIENTRY
4473 save_WindowPos2svMESA(const GLshort
* v
)
4475 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4478 static void GLAPIENTRY
4479 save_WindowPos3dvMESA(const GLdouble
* v
)
4481 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4484 static void GLAPIENTRY
4485 save_WindowPos3fvMESA(const GLfloat
* v
)
4487 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4490 static void GLAPIENTRY
4491 save_WindowPos3ivMESA(const GLint
* v
)
4493 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4496 static void GLAPIENTRY
4497 save_WindowPos3svMESA(const GLshort
* v
)
4499 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4502 static void GLAPIENTRY
4503 save_WindowPos4dvMESA(const GLdouble
* v
)
4505 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4506 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4509 static void GLAPIENTRY
4510 save_WindowPos4fvMESA(const GLfloat
* v
)
4512 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4515 static void GLAPIENTRY
4516 save_WindowPos4ivMESA(const GLint
* v
)
4518 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4519 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4522 static void GLAPIENTRY
4523 save_WindowPos4svMESA(const GLshort
* v
)
4525 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4530 /* GL_ARB_multitexture */
4531 static void GLAPIENTRY
4532 save_ActiveTextureARB(GLenum target
)
4534 GET_CURRENT_CONTEXT(ctx
);
4536 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4537 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4541 if (ctx
->ExecuteFlag
) {
4542 CALL_ActiveTexture(ctx
->Exec
, (target
));
4547 /* GL_ARB_transpose_matrix */
4549 static void GLAPIENTRY
4550 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4553 _math_transposefd(tm
, m
);
4554 save_LoadMatrixf(tm
);
4558 static void GLAPIENTRY
4559 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4562 _math_transposef(tm
, m
);
4563 save_LoadMatrixf(tm
);
4567 static void GLAPIENTRY
4568 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4571 _math_transposefd(tm
, m
);
4572 save_MultMatrixf(tm
);
4576 static void GLAPIENTRY
4577 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4580 _math_transposef(tm
, m
);
4581 save_MultMatrixf(tm
);
4584 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4586 GET_CURRENT_CONTEXT(ctx
);
4592 image
= malloc(size
);
4594 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4597 memcpy(image
, data
, size
);
4603 /* GL_ARB_texture_compression */
4604 static void GLAPIENTRY
4605 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4606 GLenum internalFormat
, GLsizei width
,
4607 GLint border
, GLsizei imageSize
,
4608 const GLvoid
* data
)
4610 GET_CURRENT_CONTEXT(ctx
);
4611 if (target
== GL_PROXY_TEXTURE_1D
) {
4612 /* don't compile, execute immediately */
4613 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4614 width
, border
, imageSize
,
4619 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4621 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4625 n
[3].e
= internalFormat
;
4626 n
[4].i
= (GLint
) width
;
4629 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4631 if (ctx
->ExecuteFlag
) {
4632 CALL_CompressedTexImage1D(ctx
->Exec
,
4633 (target
, level
, internalFormat
, width
,
4634 border
, imageSize
, data
));
4640 static void GLAPIENTRY
4641 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4642 GLenum internalFormat
, GLsizei width
,
4643 GLsizei height
, GLint border
, GLsizei imageSize
,
4644 const GLvoid
* data
)
4646 GET_CURRENT_CONTEXT(ctx
);
4647 if (target
== GL_PROXY_TEXTURE_2D
) {
4648 /* don't compile, execute immediately */
4649 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4650 width
, height
, border
,
4655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4657 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4661 n
[3].e
= internalFormat
;
4662 n
[4].i
= (GLint
) width
;
4663 n
[5].i
= (GLint
) height
;
4666 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4668 if (ctx
->ExecuteFlag
) {
4669 CALL_CompressedTexImage2D(ctx
->Exec
,
4670 (target
, level
, internalFormat
, width
,
4671 height
, border
, imageSize
, data
));
4677 static void GLAPIENTRY
4678 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4679 GLenum internalFormat
, GLsizei width
,
4680 GLsizei height
, GLsizei depth
, GLint border
,
4681 GLsizei imageSize
, const GLvoid
* data
)
4683 GET_CURRENT_CONTEXT(ctx
);
4684 if (target
== GL_PROXY_TEXTURE_3D
) {
4685 /* don't compile, execute immediately */
4686 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4687 width
, height
, depth
, border
,
4692 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4694 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4698 n
[3].e
= internalFormat
;
4699 n
[4].i
= (GLint
) width
;
4700 n
[5].i
= (GLint
) height
;
4701 n
[6].i
= (GLint
) depth
;
4704 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4706 if (ctx
->ExecuteFlag
) {
4707 CALL_CompressedTexImage3D(ctx
->Exec
,
4708 (target
, level
, internalFormat
, width
,
4709 height
, depth
, border
, imageSize
,
4716 static void GLAPIENTRY
4717 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4718 GLsizei width
, GLenum format
,
4719 GLsizei imageSize
, const GLvoid
* data
)
4722 GET_CURRENT_CONTEXT(ctx
);
4723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4725 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4730 n
[4].i
= (GLint
) width
;
4733 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4735 if (ctx
->ExecuteFlag
) {
4736 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4737 width
, format
, imageSize
,
4743 static void GLAPIENTRY
4744 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4745 GLint yoffset
, GLsizei width
, GLsizei height
,
4746 GLenum format
, GLsizei imageSize
,
4747 const GLvoid
* data
)
4750 GET_CURRENT_CONTEXT(ctx
);
4751 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4753 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4759 n
[5].i
= (GLint
) width
;
4760 n
[6].i
= (GLint
) height
;
4763 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4765 if (ctx
->ExecuteFlag
) {
4766 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4767 (target
, level
, xoffset
, yoffset
, width
,
4768 height
, format
, imageSize
, data
));
4773 static void GLAPIENTRY
4774 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4775 GLint yoffset
, GLint zoffset
, GLsizei width
,
4776 GLsizei height
, GLsizei depth
, GLenum format
,
4777 GLsizei imageSize
, const GLvoid
* data
)
4780 GET_CURRENT_CONTEXT(ctx
);
4781 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4783 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4790 n
[6].i
= (GLint
) width
;
4791 n
[7].i
= (GLint
) height
;
4792 n
[8].i
= (GLint
) depth
;
4794 n
[10].i
= imageSize
;
4795 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4797 if (ctx
->ExecuteFlag
) {
4798 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4799 (target
, level
, xoffset
, yoffset
,
4800 zoffset
, width
, height
, depth
, format
,
4806 /* GL_ARB_multisample */
4807 static void GLAPIENTRY
4808 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4810 GET_CURRENT_CONTEXT(ctx
);
4812 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4813 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4818 if (ctx
->ExecuteFlag
) {
4819 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4825 * GL_NV_fragment_program
4827 static void GLAPIENTRY
4828 save_BindProgramNV(GLenum target
, GLuint id
)
4830 GET_CURRENT_CONTEXT(ctx
);
4832 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4833 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4838 if (ctx
->ExecuteFlag
) {
4839 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4843 static void GLAPIENTRY
4844 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4845 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4847 GET_CURRENT_CONTEXT(ctx
);
4849 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4850 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4859 if (ctx
->ExecuteFlag
) {
4860 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4865 static void GLAPIENTRY
4866 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4867 const GLfloat
*params
)
4869 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4870 params
[2], params
[3]);
4874 static void GLAPIENTRY
4875 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4876 const GLfloat
* params
)
4878 GET_CURRENT_CONTEXT(ctx
);
4880 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4884 const GLfloat
* p
= params
;
4886 for (i
= 0 ; i
< count
; i
++) {
4887 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4900 if (ctx
->ExecuteFlag
) {
4901 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4906 static void GLAPIENTRY
4907 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4908 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4910 save_ProgramEnvParameter4fARB(target
, index
,
4912 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4916 static void GLAPIENTRY
4917 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4918 const GLdouble
*params
)
4920 save_ProgramEnvParameter4fARB(target
, index
,
4921 (GLfloat
) params
[0],
4922 (GLfloat
) params
[1],
4923 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4927 static void GLAPIENTRY
4928 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4929 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4931 GET_CURRENT_CONTEXT(ctx
);
4933 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4934 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4943 if (ctx
->ExecuteFlag
) {
4944 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4949 static void GLAPIENTRY
4950 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4951 const GLfloat
*params
)
4953 GET_CURRENT_CONTEXT(ctx
);
4955 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4956 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4965 if (ctx
->ExecuteFlag
) {
4966 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4971 static void GLAPIENTRY
4972 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4973 const GLfloat
*params
)
4975 GET_CURRENT_CONTEXT(ctx
);
4977 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4981 const GLfloat
* p
= params
;
4983 for (i
= 0 ; i
< count
; i
++) {
4984 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4997 if (ctx
->ExecuteFlag
) {
4998 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5003 static void GLAPIENTRY
5004 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5005 GLdouble x
, GLdouble y
,
5006 GLdouble z
, GLdouble w
)
5008 GET_CURRENT_CONTEXT(ctx
);
5010 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5011 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5015 n
[3].f
= (GLfloat
) x
;
5016 n
[4].f
= (GLfloat
) y
;
5017 n
[5].f
= (GLfloat
) z
;
5018 n
[6].f
= (GLfloat
) w
;
5020 if (ctx
->ExecuteFlag
) {
5021 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5026 static void GLAPIENTRY
5027 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5028 const GLdouble
*params
)
5030 GET_CURRENT_CONTEXT(ctx
);
5032 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5033 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5037 n
[3].f
= (GLfloat
) params
[0];
5038 n
[4].f
= (GLfloat
) params
[1];
5039 n
[5].f
= (GLfloat
) params
[2];
5040 n
[6].f
= (GLfloat
) params
[3];
5042 if (ctx
->ExecuteFlag
) {
5043 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5048 /* GL_EXT_stencil_two_side */
5049 static void GLAPIENTRY
5050 save_ActiveStencilFaceEXT(GLenum face
)
5052 GET_CURRENT_CONTEXT(ctx
);
5054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5055 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5059 if (ctx
->ExecuteFlag
) {
5060 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5065 /* GL_EXT_depth_bounds_test */
5066 static void GLAPIENTRY
5067 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5069 GET_CURRENT_CONTEXT(ctx
);
5071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5072 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5074 n
[1].f
= (GLfloat
) zmin
;
5075 n
[2].f
= (GLfloat
) zmax
;
5077 if (ctx
->ExecuteFlag
) {
5078 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5084 static void GLAPIENTRY
5085 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5086 const GLvoid
* string
)
5088 GET_CURRENT_CONTEXT(ctx
);
5091 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5093 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
5095 GLubyte
*programCopy
= malloc(len
);
5097 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5100 memcpy(programCopy
, string
, len
);
5104 n
[4].data
= programCopy
;
5106 if (ctx
->ExecuteFlag
) {
5107 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5112 static void GLAPIENTRY
5113 save_BeginQueryARB(GLenum target
, GLuint id
)
5115 GET_CURRENT_CONTEXT(ctx
);
5117 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5118 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5123 if (ctx
->ExecuteFlag
) {
5124 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5128 static void GLAPIENTRY
5129 save_EndQueryARB(GLenum target
)
5131 GET_CURRENT_CONTEXT(ctx
);
5133 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5134 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5138 if (ctx
->ExecuteFlag
) {
5139 CALL_EndQuery(ctx
->Exec
, (target
));
5143 static void GLAPIENTRY
5144 save_QueryCounter(GLuint id
, GLenum target
)
5146 GET_CURRENT_CONTEXT(ctx
);
5148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5149 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5154 if (ctx
->ExecuteFlag
) {
5155 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5159 static void GLAPIENTRY
5160 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5162 GET_CURRENT_CONTEXT(ctx
);
5164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5165 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5171 if (ctx
->ExecuteFlag
) {
5172 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5176 static void GLAPIENTRY
5177 save_EndQueryIndexed(GLenum target
, GLuint index
)
5179 GET_CURRENT_CONTEXT(ctx
);
5181 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5182 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5187 if (ctx
->ExecuteFlag
) {
5188 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5193 static void GLAPIENTRY
5194 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5196 GET_CURRENT_CONTEXT(ctx
);
5198 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5199 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5203 if (count
> MAX_DRAW_BUFFERS
)
5204 count
= MAX_DRAW_BUFFERS
;
5205 for (i
= 0; i
< count
; i
++) {
5206 n
[2 + i
].e
= buffers
[i
];
5209 if (ctx
->ExecuteFlag
) {
5210 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5214 static void GLAPIENTRY
5215 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5217 GET_CURRENT_CONTEXT(ctx
);
5220 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5228 if (ctx
->ExecuteFlag
) {
5229 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5233 static void GLAPIENTRY
5234 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5237 p
[0] = INT_TO_FLOAT(param
[0]);
5238 p
[1] = INT_TO_FLOAT(param
[1]);
5239 p
[2] = INT_TO_FLOAT(param
[2]);
5240 p
[3] = INT_TO_FLOAT(param
[3]);
5241 save_TexBumpParameterfvATI(pname
, p
);
5244 static void GLAPIENTRY
5245 save_BindFragmentShaderATI(GLuint id
)
5247 GET_CURRENT_CONTEXT(ctx
);
5250 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5254 if (ctx
->ExecuteFlag
) {
5255 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5259 static void GLAPIENTRY
5260 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5262 GET_CURRENT_CONTEXT(ctx
);
5265 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5273 if (ctx
->ExecuteFlag
) {
5274 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5278 static void GLAPIENTRY
5279 save_Attr1fNV(GLenum attr
, GLfloat x
)
5281 GET_CURRENT_CONTEXT(ctx
);
5283 SAVE_FLUSH_VERTICES(ctx
);
5284 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5290 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5291 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5292 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5294 if (ctx
->ExecuteFlag
) {
5295 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5299 static void GLAPIENTRY
5300 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5302 GET_CURRENT_CONTEXT(ctx
);
5304 SAVE_FLUSH_VERTICES(ctx
);
5305 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5312 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5313 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5314 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5316 if (ctx
->ExecuteFlag
) {
5317 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5321 static void GLAPIENTRY
5322 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5324 GET_CURRENT_CONTEXT(ctx
);
5326 SAVE_FLUSH_VERTICES(ctx
);
5327 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5335 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5336 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5337 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5339 if (ctx
->ExecuteFlag
) {
5340 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5344 static void GLAPIENTRY
5345 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5347 GET_CURRENT_CONTEXT(ctx
);
5349 SAVE_FLUSH_VERTICES(ctx
);
5350 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5359 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5360 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5361 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5363 if (ctx
->ExecuteFlag
) {
5364 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5369 static void GLAPIENTRY
5370 save_Attr1fARB(GLenum attr
, GLfloat x
)
5372 GET_CURRENT_CONTEXT(ctx
);
5374 SAVE_FLUSH_VERTICES(ctx
);
5375 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5381 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5382 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5383 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5385 if (ctx
->ExecuteFlag
) {
5386 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5390 static void GLAPIENTRY
5391 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5393 GET_CURRENT_CONTEXT(ctx
);
5395 SAVE_FLUSH_VERTICES(ctx
);
5396 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5403 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5404 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5405 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5407 if (ctx
->ExecuteFlag
) {
5408 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5412 static void GLAPIENTRY
5413 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5415 GET_CURRENT_CONTEXT(ctx
);
5417 SAVE_FLUSH_VERTICES(ctx
);
5418 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5426 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5427 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5428 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5430 if (ctx
->ExecuteFlag
) {
5431 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5435 static void GLAPIENTRY
5436 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5438 GET_CURRENT_CONTEXT(ctx
);
5440 SAVE_FLUSH_VERTICES(ctx
);
5441 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5450 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5451 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5452 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5454 if (ctx
->ExecuteFlag
) {
5455 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5460 static void GLAPIENTRY
5461 save_EvalCoord1f(GLfloat x
)
5463 GET_CURRENT_CONTEXT(ctx
);
5465 SAVE_FLUSH_VERTICES(ctx
);
5466 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5470 if (ctx
->ExecuteFlag
) {
5471 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5475 static void GLAPIENTRY
5476 save_EvalCoord1fv(const GLfloat
* v
)
5478 save_EvalCoord1f(v
[0]);
5481 static void GLAPIENTRY
5482 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5484 GET_CURRENT_CONTEXT(ctx
);
5486 SAVE_FLUSH_VERTICES(ctx
);
5487 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5492 if (ctx
->ExecuteFlag
) {
5493 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5497 static void GLAPIENTRY
5498 save_EvalCoord2fv(const GLfloat
* v
)
5500 save_EvalCoord2f(v
[0], v
[1]);
5504 static void GLAPIENTRY
5505 save_EvalPoint1(GLint x
)
5507 GET_CURRENT_CONTEXT(ctx
);
5509 SAVE_FLUSH_VERTICES(ctx
);
5510 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5514 if (ctx
->ExecuteFlag
) {
5515 CALL_EvalPoint1(ctx
->Exec
, (x
));
5519 static void GLAPIENTRY
5520 save_EvalPoint2(GLint x
, GLint y
)
5522 GET_CURRENT_CONTEXT(ctx
);
5524 SAVE_FLUSH_VERTICES(ctx
);
5525 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5530 if (ctx
->ExecuteFlag
) {
5531 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5535 static void GLAPIENTRY
5536 save_Indexf(GLfloat x
)
5538 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5541 static void GLAPIENTRY
5542 save_Indexfv(const GLfloat
* v
)
5544 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5547 static void GLAPIENTRY
5548 save_EdgeFlag(GLboolean x
)
5550 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5555 * Compare 'count' elements of vectors 'a' and 'b'.
5556 * \return GL_TRUE if equal, GL_FALSE if different.
5558 static inline GLboolean
5559 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5561 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5566 * This glMaterial function is used for glMaterial calls that are outside
5567 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5569 static void GLAPIENTRY
5570 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5572 GET_CURRENT_CONTEXT(ctx
);
5580 case GL_FRONT_AND_BACK
:
5583 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5592 case GL_AMBIENT_AND_DIFFUSE
:
5598 case GL_COLOR_INDEXES
:
5602 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5606 if (ctx
->ExecuteFlag
) {
5607 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5610 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5612 /* Try to eliminate redundant statechanges. Because it is legal to
5613 * call glMaterial even inside begin/end calls, don't need to worry
5614 * about ctx->Driver.CurrentSavePrimitive here.
5616 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5617 if (bitmask
& (1 << i
)) {
5618 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5619 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5620 /* no change in material value */
5621 bitmask
&= ~(1 << i
);
5624 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5625 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5630 /* If this call has no effect, return early */
5634 SAVE_FLUSH_VERTICES(ctx
);
5636 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5640 for (i
= 0; i
< args
; i
++)
5641 n
[3 + i
].f
= param
[i
];
5645 static void GLAPIENTRY
5646 save_Begin(GLenum mode
)
5648 GET_CURRENT_CONTEXT(ctx
);
5650 if (!_mesa_is_valid_prim_mode(ctx
, mode
)) {
5651 /* compile this error into the display list */
5652 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glBegin(mode)");
5654 else if (_mesa_inside_dlist_begin_end(ctx
) &&
5655 ctx
->Driver
.CurrentSavePrimitive
!= PRIM_UNKNOWN
) {
5656 /* compile this error into the display list */
5657 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive glBegin");
5662 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5664 /* Give the driver an opportunity to hook in an optimized
5665 * display list compiler.
5667 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5670 SAVE_FLUSH_VERTICES(ctx
);
5671 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5676 if (ctx
->ExecuteFlag
) {
5677 CALL_Begin(ctx
->Exec
, (mode
));
5682 static void GLAPIENTRY
5685 GET_CURRENT_CONTEXT(ctx
);
5686 SAVE_FLUSH_VERTICES(ctx
);
5687 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5688 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5689 if (ctx
->ExecuteFlag
) {
5690 CALL_End(ctx
->Exec
, ());
5694 static void GLAPIENTRY
5695 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5697 GET_CURRENT_CONTEXT(ctx
);
5699 SAVE_FLUSH_VERTICES(ctx
);
5700 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5707 if (ctx
->ExecuteFlag
) {
5708 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5713 static void GLAPIENTRY
5714 save_Vertex2f(GLfloat x
, GLfloat y
)
5716 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5719 static void GLAPIENTRY
5720 save_Vertex2fv(const GLfloat
* v
)
5722 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5725 static void GLAPIENTRY
5726 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5728 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5731 static void GLAPIENTRY
5732 save_Vertex3fv(const GLfloat
* v
)
5734 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5737 static void GLAPIENTRY
5738 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5740 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5743 static void GLAPIENTRY
5744 save_Vertex4fv(const GLfloat
* v
)
5746 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5749 static void GLAPIENTRY
5750 save_TexCoord1f(GLfloat x
)
5752 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5755 static void GLAPIENTRY
5756 save_TexCoord1fv(const GLfloat
* v
)
5758 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5761 static void GLAPIENTRY
5762 save_TexCoord2f(GLfloat x
, GLfloat y
)
5764 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5767 static void GLAPIENTRY
5768 save_TexCoord2fv(const GLfloat
* v
)
5770 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5773 static void GLAPIENTRY
5774 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5776 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5779 static void GLAPIENTRY
5780 save_TexCoord3fv(const GLfloat
* v
)
5782 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5785 static void GLAPIENTRY
5786 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5788 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5791 static void GLAPIENTRY
5792 save_TexCoord4fv(const GLfloat
* v
)
5794 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5797 static void GLAPIENTRY
5798 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5800 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5803 static void GLAPIENTRY
5804 save_Normal3fv(const GLfloat
* v
)
5806 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5809 static void GLAPIENTRY
5810 save_FogCoordfEXT(GLfloat x
)
5812 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5815 static void GLAPIENTRY
5816 save_FogCoordfvEXT(const GLfloat
* v
)
5818 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5821 static void GLAPIENTRY
5822 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5824 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5827 static void GLAPIENTRY
5828 save_Color3fv(const GLfloat
* v
)
5830 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5833 static void GLAPIENTRY
5834 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5836 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5839 static void GLAPIENTRY
5840 save_Color4fv(const GLfloat
* v
)
5842 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5845 static void GLAPIENTRY
5846 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5848 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5851 static void GLAPIENTRY
5852 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5854 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5858 /* Just call the respective ATTR for texcoord
5860 static void GLAPIENTRY
5861 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5863 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5864 save_Attr1fNV(attr
, x
);
5867 static void GLAPIENTRY
5868 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5870 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5871 save_Attr1fNV(attr
, v
[0]);
5874 static void GLAPIENTRY
5875 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5877 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5878 save_Attr2fNV(attr
, x
, y
);
5881 static void GLAPIENTRY
5882 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5884 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5885 save_Attr2fNV(attr
, v
[0], v
[1]);
5888 static void GLAPIENTRY
5889 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5891 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5892 save_Attr3fNV(attr
, x
, y
, z
);
5895 static void GLAPIENTRY
5896 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5898 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5899 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5902 static void GLAPIENTRY
5903 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5904 GLfloat z
, GLfloat w
)
5906 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5907 save_Attr4fNV(attr
, x
, y
, z
, w
);
5910 static void GLAPIENTRY
5911 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5913 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5914 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5919 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5925 GET_CURRENT_CONTEXT(ctx
);
5926 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5931 static void GLAPIENTRY
5932 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5934 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5935 save_Attr1fARB(index
, x
);
5940 static void GLAPIENTRY
5941 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5943 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5944 save_Attr1fARB(index
, v
[0]);
5949 static void GLAPIENTRY
5950 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5952 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5953 save_Attr2fARB(index
, x
, y
);
5958 static void GLAPIENTRY
5959 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5961 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5962 save_Attr2fARB(index
, v
[0], v
[1]);
5967 static void GLAPIENTRY
5968 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5970 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5971 save_Attr3fARB(index
, x
, y
, z
);
5976 static void GLAPIENTRY
5977 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5979 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5980 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5985 static void GLAPIENTRY
5986 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5989 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5990 save_Attr4fARB(index
, x
, y
, z
, w
);
5995 static void GLAPIENTRY
5996 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
5998 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5999 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6004 static void GLAPIENTRY
6005 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6006 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6007 GLbitfield mask
, GLenum filter
)
6009 GET_CURRENT_CONTEXT(ctx
);
6011 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6012 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6025 if (ctx
->ExecuteFlag
) {
6026 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6027 dstX0
, dstY0
, dstX1
, dstY1
,
6033 /** GL_EXT_provoking_vertex */
6034 static void GLAPIENTRY
6035 save_ProvokingVertexEXT(GLenum mode
)
6037 GET_CURRENT_CONTEXT(ctx
);
6039 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6040 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6044 if (ctx
->ExecuteFlag
) {
6045 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6046 _mesa_ProvokingVertex(mode
);
6051 /** GL_EXT_transform_feedback */
6052 static void GLAPIENTRY
6053 save_BeginTransformFeedback(GLenum mode
)
6055 GET_CURRENT_CONTEXT(ctx
);
6057 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6058 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6062 if (ctx
->ExecuteFlag
) {
6063 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6068 /** GL_EXT_transform_feedback */
6069 static void GLAPIENTRY
6070 save_EndTransformFeedback(void)
6072 GET_CURRENT_CONTEXT(ctx
);
6073 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6074 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6075 if (ctx
->ExecuteFlag
) {
6076 CALL_EndTransformFeedback(ctx
->Exec
, ());
6080 static void GLAPIENTRY
6081 save_BindTransformFeedback(GLenum target
, GLuint name
)
6083 GET_CURRENT_CONTEXT(ctx
);
6085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6086 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6091 if (ctx
->ExecuteFlag
) {
6092 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6096 static void GLAPIENTRY
6097 save_PauseTransformFeedback(void)
6099 GET_CURRENT_CONTEXT(ctx
);
6100 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6101 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6102 if (ctx
->ExecuteFlag
) {
6103 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6107 static void GLAPIENTRY
6108 save_ResumeTransformFeedback(void)
6110 GET_CURRENT_CONTEXT(ctx
);
6111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6112 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6113 if (ctx
->ExecuteFlag
) {
6114 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6118 static void GLAPIENTRY
6119 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6121 GET_CURRENT_CONTEXT(ctx
);
6123 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6124 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6129 if (ctx
->ExecuteFlag
) {
6130 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6134 static void GLAPIENTRY
6135 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6137 GET_CURRENT_CONTEXT(ctx
);
6139 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6140 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6146 if (ctx
->ExecuteFlag
) {
6147 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6151 static void GLAPIENTRY
6152 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6155 GET_CURRENT_CONTEXT(ctx
);
6157 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6158 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6162 n
[3].si
= primcount
;
6164 if (ctx
->ExecuteFlag
) {
6165 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6169 static void GLAPIENTRY
6170 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6171 GLuint stream
, GLsizei primcount
)
6173 GET_CURRENT_CONTEXT(ctx
);
6175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6176 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6181 n
[4].si
= primcount
;
6183 if (ctx
->ExecuteFlag
) {
6184 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6189 /* aka UseProgram() */
6190 static void GLAPIENTRY
6191 save_UseProgramObjectARB(GLhandleARB program
)
6193 GET_CURRENT_CONTEXT(ctx
);
6195 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6196 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6200 if (ctx
->ExecuteFlag
) {
6201 CALL_UseProgram(ctx
->Exec
, (program
));
6206 static void GLAPIENTRY
6207 save_Uniform1fARB(GLint location
, GLfloat x
)
6209 GET_CURRENT_CONTEXT(ctx
);
6211 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6212 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6217 if (ctx
->ExecuteFlag
) {
6218 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6223 static void GLAPIENTRY
6224 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6226 GET_CURRENT_CONTEXT(ctx
);
6228 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6229 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6235 if (ctx
->ExecuteFlag
) {
6236 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6241 static void GLAPIENTRY
6242 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6244 GET_CURRENT_CONTEXT(ctx
);
6246 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6247 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6254 if (ctx
->ExecuteFlag
) {
6255 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6260 static void GLAPIENTRY
6261 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6263 GET_CURRENT_CONTEXT(ctx
);
6265 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6266 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6274 if (ctx
->ExecuteFlag
) {
6275 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6280 /** Return copy of memory */
6282 memdup(const void *src
, GLsizei bytes
)
6284 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
6286 memcpy(b
, src
, bytes
);
6291 static void GLAPIENTRY
6292 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6294 GET_CURRENT_CONTEXT(ctx
);
6296 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6297 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6301 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6303 if (ctx
->ExecuteFlag
) {
6304 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6308 static void GLAPIENTRY
6309 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6311 GET_CURRENT_CONTEXT(ctx
);
6313 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6314 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6318 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6320 if (ctx
->ExecuteFlag
) {
6321 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6325 static void GLAPIENTRY
6326 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6328 GET_CURRENT_CONTEXT(ctx
);
6330 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6331 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6335 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6337 if (ctx
->ExecuteFlag
) {
6338 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6342 static void GLAPIENTRY
6343 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6345 GET_CURRENT_CONTEXT(ctx
);
6347 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6348 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6352 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6354 if (ctx
->ExecuteFlag
) {
6355 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6360 static void GLAPIENTRY
6361 save_Uniform1iARB(GLint location
, GLint x
)
6363 GET_CURRENT_CONTEXT(ctx
);
6365 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6366 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6371 if (ctx
->ExecuteFlag
) {
6372 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6376 static void GLAPIENTRY
6377 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6379 GET_CURRENT_CONTEXT(ctx
);
6381 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6382 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6388 if (ctx
->ExecuteFlag
) {
6389 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6393 static void GLAPIENTRY
6394 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6396 GET_CURRENT_CONTEXT(ctx
);
6398 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6399 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6406 if (ctx
->ExecuteFlag
) {
6407 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6411 static void GLAPIENTRY
6412 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6414 GET_CURRENT_CONTEXT(ctx
);
6416 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6417 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6425 if (ctx
->ExecuteFlag
) {
6426 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6432 static void GLAPIENTRY
6433 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6435 GET_CURRENT_CONTEXT(ctx
);
6437 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6438 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6442 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6444 if (ctx
->ExecuteFlag
) {
6445 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6449 static void GLAPIENTRY
6450 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6452 GET_CURRENT_CONTEXT(ctx
);
6454 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6455 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6459 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6461 if (ctx
->ExecuteFlag
) {
6462 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6466 static void GLAPIENTRY
6467 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6469 GET_CURRENT_CONTEXT(ctx
);
6471 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6472 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6476 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6478 if (ctx
->ExecuteFlag
) {
6479 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6483 static void GLAPIENTRY
6484 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6486 GET_CURRENT_CONTEXT(ctx
);
6488 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6489 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6493 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6495 if (ctx
->ExecuteFlag
) {
6496 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6502 static void GLAPIENTRY
6503 save_Uniform1ui(GLint location
, GLuint x
)
6505 GET_CURRENT_CONTEXT(ctx
);
6507 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6508 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6513 if (ctx
->ExecuteFlag
) {
6514 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6518 static void GLAPIENTRY
6519 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6521 GET_CURRENT_CONTEXT(ctx
);
6523 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6524 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6530 if (ctx
->ExecuteFlag
) {
6531 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6535 static void GLAPIENTRY
6536 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6538 GET_CURRENT_CONTEXT(ctx
);
6540 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6541 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6548 if (ctx
->ExecuteFlag
) {
6549 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6553 static void GLAPIENTRY
6554 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6556 GET_CURRENT_CONTEXT(ctx
);
6558 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6559 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6567 if (ctx
->ExecuteFlag
) {
6568 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6574 static void GLAPIENTRY
6575 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6577 GET_CURRENT_CONTEXT(ctx
);
6579 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6580 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6584 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6586 if (ctx
->ExecuteFlag
) {
6587 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6591 static void GLAPIENTRY
6592 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6594 GET_CURRENT_CONTEXT(ctx
);
6596 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6597 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6601 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6603 if (ctx
->ExecuteFlag
) {
6604 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6608 static void GLAPIENTRY
6609 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6611 GET_CURRENT_CONTEXT(ctx
);
6613 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6614 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6618 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6620 if (ctx
->ExecuteFlag
) {
6621 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6625 static void GLAPIENTRY
6626 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6628 GET_CURRENT_CONTEXT(ctx
);
6630 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6631 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6635 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6637 if (ctx
->ExecuteFlag
) {
6638 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6644 static void GLAPIENTRY
6645 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6648 GET_CURRENT_CONTEXT(ctx
);
6650 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6651 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6656 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6658 if (ctx
->ExecuteFlag
) {
6659 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6663 static void GLAPIENTRY
6664 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6667 GET_CURRENT_CONTEXT(ctx
);
6669 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6670 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6675 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6677 if (ctx
->ExecuteFlag
) {
6678 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6682 static void GLAPIENTRY
6683 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6686 GET_CURRENT_CONTEXT(ctx
);
6688 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6689 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6694 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6696 if (ctx
->ExecuteFlag
) {
6697 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6702 static void GLAPIENTRY
6703 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6706 GET_CURRENT_CONTEXT(ctx
);
6708 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6709 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6714 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6716 if (ctx
->ExecuteFlag
) {
6717 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6721 static void GLAPIENTRY
6722 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6725 GET_CURRENT_CONTEXT(ctx
);
6727 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6728 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6733 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6735 if (ctx
->ExecuteFlag
) {
6736 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6741 static void GLAPIENTRY
6742 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6745 GET_CURRENT_CONTEXT(ctx
);
6747 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6748 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6753 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6755 if (ctx
->ExecuteFlag
) {
6756 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6760 static void GLAPIENTRY
6761 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6764 GET_CURRENT_CONTEXT(ctx
);
6766 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6767 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6772 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6774 if (ctx
->ExecuteFlag
) {
6775 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6780 static void GLAPIENTRY
6781 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6784 GET_CURRENT_CONTEXT(ctx
);
6786 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6787 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6792 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6794 if (ctx
->ExecuteFlag
) {
6795 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6799 static void GLAPIENTRY
6800 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6803 GET_CURRENT_CONTEXT(ctx
);
6805 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6806 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6811 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6813 if (ctx
->ExecuteFlag
) {
6814 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6818 static void GLAPIENTRY
6819 save_ClampColorARB(GLenum target
, GLenum clamp
)
6821 GET_CURRENT_CONTEXT(ctx
);
6823 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6824 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6829 if (ctx
->ExecuteFlag
) {
6830 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6834 static void GLAPIENTRY
6835 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6837 GET_CURRENT_CONTEXT(ctx
);
6839 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6840 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6845 if (ctx
->ExecuteFlag
) {
6846 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6850 static void GLAPIENTRY
6851 save_ActiveProgramEXT(GLuint program
)
6853 GET_CURRENT_CONTEXT(ctx
);
6855 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6856 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6860 if (ctx
->ExecuteFlag
) {
6861 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6865 /** GL_EXT_texture_integer */
6866 static void GLAPIENTRY
6867 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6869 GET_CURRENT_CONTEXT(ctx
);
6871 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6872 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6879 if (ctx
->ExecuteFlag
) {
6880 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6884 /** GL_EXT_texture_integer */
6885 static void GLAPIENTRY
6886 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6888 GET_CURRENT_CONTEXT(ctx
);
6890 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6891 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6898 if (ctx
->ExecuteFlag
) {
6899 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6903 /** GL_EXT_texture_integer */
6904 static void GLAPIENTRY
6905 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6907 GET_CURRENT_CONTEXT(ctx
);
6909 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6910 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6919 if (ctx
->ExecuteFlag
) {
6920 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6924 /** GL_EXT_texture_integer */
6925 static void GLAPIENTRY
6926 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6928 GET_CURRENT_CONTEXT(ctx
);
6930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6931 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6935 n
[3].ui
= params
[0];
6936 n
[4].ui
= params
[1];
6937 n
[5].ui
= params
[2];
6938 n
[6].ui
= params
[3];
6940 if (ctx
->ExecuteFlag
) {
6941 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6945 /* GL_ARB_instanced_arrays */
6946 static void GLAPIENTRY
6947 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6949 GET_CURRENT_CONTEXT(ctx
);
6951 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6952 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6957 if (ctx
->ExecuteFlag
) {
6958 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6963 /* GL_NV_texture_barrier */
6964 static void GLAPIENTRY
6965 save_TextureBarrierNV(void)
6967 GET_CURRENT_CONTEXT(ctx
);
6968 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6969 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6970 if (ctx
->ExecuteFlag
) {
6971 CALL_TextureBarrierNV(ctx
->Exec
, ());
6976 /* GL_ARB_sampler_objects */
6977 static void GLAPIENTRY
6978 save_BindSampler(GLuint unit
, GLuint sampler
)
6981 GET_CURRENT_CONTEXT(ctx
);
6982 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6983 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6988 if (ctx
->ExecuteFlag
) {
6989 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6993 static void GLAPIENTRY
6994 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
6997 GET_CURRENT_CONTEXT(ctx
);
6998 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6999 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7004 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7010 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7013 if (ctx
->ExecuteFlag
) {
7014 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7018 static void GLAPIENTRY
7019 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7021 save_SamplerParameteriv(sampler
, pname
, ¶m
);
7024 static void GLAPIENTRY
7025 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7028 GET_CURRENT_CONTEXT(ctx
);
7029 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7030 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7035 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7041 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7044 if (ctx
->ExecuteFlag
) {
7045 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7049 static void GLAPIENTRY
7050 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7052 save_SamplerParameterfv(sampler
, pname
, ¶m
);
7055 static void GLAPIENTRY
7056 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7059 GET_CURRENT_CONTEXT(ctx
);
7060 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7061 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7066 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7072 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7075 if (ctx
->ExecuteFlag
) {
7076 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7080 static void GLAPIENTRY
7081 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7084 GET_CURRENT_CONTEXT(ctx
);
7085 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7086 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7090 n
[3].ui
= params
[0];
7091 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7092 n
[4].ui
= params
[1];
7093 n
[5].ui
= params
[2];
7094 n
[6].ui
= params
[3];
7097 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7100 if (ctx
->ExecuteFlag
) {
7101 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7105 /* GL_ARB_geometry_shader4 */
7106 static void GLAPIENTRY
7107 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7110 GET_CURRENT_CONTEXT(ctx
);
7111 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7112 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7118 if (ctx
->ExecuteFlag
) {
7119 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7123 static void GLAPIENTRY
7124 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7125 GLuint texture
, GLint level
)
7128 GET_CURRENT_CONTEXT(ctx
);
7129 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7130 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7133 n
[2].e
= attachment
;
7137 if (ctx
->ExecuteFlag
) {
7138 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7142 static void GLAPIENTRY
7143 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7144 GLuint texture
, GLint level
, GLenum face
)
7147 GET_CURRENT_CONTEXT(ctx
);
7148 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7149 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7152 n
[2].e
= attachment
;
7157 if (ctx
->ExecuteFlag
) {
7158 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7165 static void GLAPIENTRY
7166 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7169 GET_CURRENT_CONTEXT(ctx
);
7170 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7171 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7173 union uint64_pair p
;
7177 n
[3].ui
= p
.uint32
[0];
7178 n
[4].ui
= p
.uint32
[1];
7180 if (ctx
->ExecuteFlag
) {
7181 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7186 /** GL_NV_conditional_render */
7187 static void GLAPIENTRY
7188 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7190 GET_CURRENT_CONTEXT(ctx
);
7192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7193 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7198 if (ctx
->ExecuteFlag
) {
7199 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7203 static void GLAPIENTRY
7204 save_EndConditionalRender(void)
7206 GET_CURRENT_CONTEXT(ctx
);
7207 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7208 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7209 if (ctx
->ExecuteFlag
) {
7210 CALL_EndConditionalRender(ctx
->Exec
, ());
7214 static void GLAPIENTRY
7215 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7217 GET_CURRENT_CONTEXT(ctx
);
7219 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7220 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7226 if (ctx
->ExecuteFlag
) {
7227 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7233 * Save an error-generating command into display list.
7235 * KW: Will appear in the list before the vertex buffer containing the
7236 * command that provoked the error. I don't see this as a problem.
7239 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7242 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
7245 n
[2].data
= (void *) s
;
7251 * Compile an error into current display list.
7254 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7256 if (ctx
->CompileFlag
)
7257 save_error(ctx
, error
, s
);
7258 if (ctx
->ExecuteFlag
)
7259 _mesa_error(ctx
, error
, "%s", s
);
7264 * Test if ID names a display list.
7267 islist(struct gl_context
*ctx
, GLuint list
)
7269 if (list
> 0 && lookup_list(ctx
, list
)) {
7279 /**********************************************************************/
7280 /* Display list execution */
7281 /**********************************************************************/
7285 * Execute a display list. Note that the ListBase offset must have already
7286 * been added before calling this function. I.e. the list argument is
7287 * the absolute list number, not relative to ListBase.
7288 * \param list - display list number
7291 execute_list(struct gl_context
*ctx
, GLuint list
)
7293 struct gl_display_list
*dlist
;
7297 if (list
== 0 || !islist(ctx
, list
))
7300 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7301 /* raise an error? */
7305 dlist
= lookup_list(ctx
, list
);
7309 ctx
->ListState
.CallDepth
++;
7311 if (ctx
->Driver
.BeginCallList
)
7312 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7318 const OpCode opcode
= n
[0].opcode
;
7320 if (is_ext_opcode(opcode
)) {
7321 n
+= ext_opcode_execute(ctx
, n
);
7326 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
7329 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7331 case OPCODE_ALPHA_FUNC
:
7332 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7334 case OPCODE_BIND_TEXTURE
:
7335 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7339 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7340 ctx
->Unpack
= ctx
->DefaultPacking
;
7341 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7342 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7343 (const GLubyte
*) n
[7].data
));
7344 ctx
->Unpack
= save
; /* restore */
7347 case OPCODE_BLEND_COLOR
:
7348 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7350 case OPCODE_BLEND_EQUATION
:
7351 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7353 case OPCODE_BLEND_EQUATION_SEPARATE
:
7354 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7356 case OPCODE_BLEND_FUNC_SEPARATE
:
7357 CALL_BlendFuncSeparate(ctx
->Exec
,
7358 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7361 case OPCODE_BLEND_FUNC_I
:
7362 /* GL_ARB_draw_buffers_blend */
7363 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7365 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7366 /* GL_ARB_draw_buffers_blend */
7367 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7370 case OPCODE_BLEND_EQUATION_I
:
7371 /* GL_ARB_draw_buffers_blend */
7372 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7374 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7375 /* GL_ARB_draw_buffers_blend */
7376 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7377 (n
[1].ui
, n
[2].e
, n
[3].e
));
7380 case OPCODE_CALL_LIST
:
7381 /* Generated by glCallList(), don't add ListBase */
7382 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7383 execute_list(ctx
, n
[1].ui
);
7386 case OPCODE_CALL_LIST_OFFSET
:
7387 /* Generated by glCallLists() so we must add ListBase */
7389 /* user specified a bad data type at compile time */
7390 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7392 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7393 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7394 execute_list(ctx
, list
);
7398 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7400 case OPCODE_CLEAR_BUFFER_IV
:
7407 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7410 case OPCODE_CLEAR_BUFFER_UIV
:
7417 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7420 case OPCODE_CLEAR_BUFFER_FV
:
7427 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7430 case OPCODE_CLEAR_BUFFER_FI
:
7431 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7433 case OPCODE_CLEAR_COLOR
:
7434 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7436 case OPCODE_CLEAR_ACCUM
:
7437 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7439 case OPCODE_CLEAR_DEPTH
:
7440 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7442 case OPCODE_CLEAR_INDEX
:
7443 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7445 case OPCODE_CLEAR_STENCIL
:
7446 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7448 case OPCODE_CLIP_PLANE
:
7455 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7458 case OPCODE_COLOR_MASK
:
7459 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7461 case OPCODE_COLOR_MASK_INDEXED
:
7462 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7465 case OPCODE_COLOR_MATERIAL
:
7466 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7468 case OPCODE_COLOR_TABLE
:
7470 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7471 ctx
->Unpack
= ctx
->DefaultPacking
;
7472 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
7473 n
[5].e
, n
[6].data
));
7474 ctx
->Unpack
= save
; /* restore */
7477 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7484 CALL_ColorTableParameterfv(ctx
->Exec
,
7485 (n
[1].e
, n
[2].e
, params
));
7488 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7495 CALL_ColorTableParameteriv(ctx
->Exec
,
7496 (n
[1].e
, n
[2].e
, params
));
7499 case OPCODE_COLOR_SUB_TABLE
:
7501 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7502 ctx
->Unpack
= ctx
->DefaultPacking
;
7503 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7504 n
[4].e
, n
[5].e
, n
[6].data
));
7505 ctx
->Unpack
= save
; /* restore */
7508 case OPCODE_CONVOLUTION_FILTER_1D
:
7510 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7511 ctx
->Unpack
= ctx
->DefaultPacking
;
7512 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7515 ctx
->Unpack
= save
; /* restore */
7518 case OPCODE_CONVOLUTION_FILTER_2D
:
7520 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7521 ctx
->Unpack
= ctx
->DefaultPacking
;
7522 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7523 n
[4].i
, n
[5].e
, n
[6].e
,
7525 ctx
->Unpack
= save
; /* restore */
7528 case OPCODE_CONVOLUTION_PARAMETER_I
:
7529 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
7531 case OPCODE_CONVOLUTION_PARAMETER_IV
:
7538 CALL_ConvolutionParameteriv(ctx
->Exec
,
7539 (n
[1].e
, n
[2].e
, params
));
7542 case OPCODE_CONVOLUTION_PARAMETER_F
:
7543 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
7545 case OPCODE_CONVOLUTION_PARAMETER_FV
:
7552 CALL_ConvolutionParameterfv(ctx
->Exec
,
7553 (n
[1].e
, n
[2].e
, params
));
7556 case OPCODE_COPY_COLOR_SUB_TABLE
:
7557 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7558 n
[3].i
, n
[4].i
, n
[5].i
));
7560 case OPCODE_COPY_COLOR_TABLE
:
7561 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7562 n
[3].i
, n
[4].i
, n
[5].i
));
7564 case OPCODE_COPY_PIXELS
:
7565 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7566 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7569 case OPCODE_COPY_TEX_IMAGE1D
:
7570 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7571 n
[5].i
, n
[6].i
, n
[7].i
));
7573 case OPCODE_COPY_TEX_IMAGE2D
:
7574 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7575 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7577 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7578 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7579 n
[4].i
, n
[5].i
, n
[6].i
));
7581 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7582 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7583 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7586 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7587 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7588 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7591 case OPCODE_CULL_FACE
:
7592 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7594 case OPCODE_DEPTH_FUNC
:
7595 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7597 case OPCODE_DEPTH_MASK
:
7598 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7600 case OPCODE_DEPTH_RANGE
:
7601 CALL_DepthRange(ctx
->Exec
,
7602 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7604 case OPCODE_DISABLE
:
7605 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7607 case OPCODE_DISABLE_INDEXED
:
7608 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7610 case OPCODE_DRAW_BUFFER
:
7611 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7613 case OPCODE_DRAW_PIXELS
:
7615 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7616 ctx
->Unpack
= ctx
->DefaultPacking
;
7617 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7619 ctx
->Unpack
= save
; /* restore */
7623 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7625 case OPCODE_ENABLE_INDEXED
:
7626 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7628 case OPCODE_EVALMESH1
:
7629 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7631 case OPCODE_EVALMESH2
:
7632 CALL_EvalMesh2(ctx
->Exec
,
7633 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7642 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7645 case OPCODE_FRONT_FACE
:
7646 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7648 case OPCODE_FRUSTUM
:
7649 CALL_Frustum(ctx
->Exec
,
7650 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7653 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7655 case OPCODE_HISTOGRAM
:
7656 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
7658 case OPCODE_INDEX_MASK
:
7659 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7661 case OPCODE_INIT_NAMES
:
7662 CALL_InitNames(ctx
->Exec
, ());
7671 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7674 case OPCODE_LIGHT_MODEL
:
7681 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7684 case OPCODE_LINE_STIPPLE
:
7685 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7687 case OPCODE_LINE_WIDTH
:
7688 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7690 case OPCODE_LIST_BASE
:
7691 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7693 case OPCODE_LOAD_IDENTITY
:
7694 CALL_LoadIdentity(ctx
->Exec
, ());
7696 case OPCODE_LOAD_MATRIX
:
7697 if (sizeof(Node
) == sizeof(GLfloat
)) {
7698 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7703 for (i
= 0; i
< 16; i
++) {
7706 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7709 case OPCODE_LOAD_NAME
:
7710 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7712 case OPCODE_LOGIC_OP
:
7713 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7717 GLenum target
= n
[1].e
;
7718 GLint ustride
= _mesa_evaluator_components(target
);
7719 GLint uorder
= n
[5].i
;
7720 GLfloat u1
= n
[2].f
;
7721 GLfloat u2
= n
[3].f
;
7722 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7723 (GLfloat
*) n
[6].data
));
7728 GLenum target
= n
[1].e
;
7729 GLfloat u1
= n
[2].f
;
7730 GLfloat u2
= n
[3].f
;
7731 GLfloat v1
= n
[4].f
;
7732 GLfloat v2
= n
[5].f
;
7733 GLint ustride
= n
[6].i
;
7734 GLint vstride
= n
[7].i
;
7735 GLint uorder
= n
[8].i
;
7736 GLint vorder
= n
[9].i
;
7737 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7738 v1
, v2
, vstride
, vorder
,
7739 (GLfloat
*) n
[10].data
));
7742 case OPCODE_MAPGRID1
:
7743 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7745 case OPCODE_MAPGRID2
:
7746 CALL_MapGrid2f(ctx
->Exec
,
7747 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7749 case OPCODE_MATRIX_MODE
:
7750 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7752 case OPCODE_MIN_MAX
:
7753 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
7755 case OPCODE_MULT_MATRIX
:
7756 if (sizeof(Node
) == sizeof(GLfloat
)) {
7757 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7762 for (i
= 0; i
< 16; i
++) {
7765 CALL_MultMatrixf(ctx
->Exec
, (m
));
7769 CALL_Ortho(ctx
->Exec
,
7770 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7772 case OPCODE_PASSTHROUGH
:
7773 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7775 case OPCODE_PIXEL_MAP
:
7776 CALL_PixelMapfv(ctx
->Exec
,
7777 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7779 case OPCODE_PIXEL_TRANSFER
:
7780 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7782 case OPCODE_PIXEL_ZOOM
:
7783 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7785 case OPCODE_POINT_SIZE
:
7786 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7788 case OPCODE_POINT_PARAMETERS
:
7794 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7797 case OPCODE_POLYGON_MODE
:
7798 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7800 case OPCODE_POLYGON_STIPPLE
:
7802 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7803 ctx
->Unpack
= ctx
->DefaultPacking
;
7804 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7805 ctx
->Unpack
= save
; /* restore */
7808 case OPCODE_POLYGON_OFFSET
:
7809 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7811 case OPCODE_POP_ATTRIB
:
7812 CALL_PopAttrib(ctx
->Exec
, ());
7814 case OPCODE_POP_MATRIX
:
7815 CALL_PopMatrix(ctx
->Exec
, ());
7817 case OPCODE_POP_NAME
:
7818 CALL_PopName(ctx
->Exec
, ());
7820 case OPCODE_PRIORITIZE_TEXTURE
:
7821 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7823 case OPCODE_PUSH_ATTRIB
:
7824 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7826 case OPCODE_PUSH_MATRIX
:
7827 CALL_PushMatrix(ctx
->Exec
, ());
7829 case OPCODE_PUSH_NAME
:
7830 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7832 case OPCODE_RASTER_POS
:
7833 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7835 case OPCODE_READ_BUFFER
:
7836 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7838 case OPCODE_RESET_HISTOGRAM
:
7839 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
7841 case OPCODE_RESET_MIN_MAX
:
7842 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7845 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7848 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7850 case OPCODE_SCISSOR
:
7851 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7853 case OPCODE_SHADE_MODEL
:
7854 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7856 case OPCODE_PROVOKING_VERTEX
:
7857 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7859 case OPCODE_STENCIL_FUNC
:
7860 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7862 case OPCODE_STENCIL_MASK
:
7863 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7865 case OPCODE_STENCIL_OP
:
7866 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7868 case OPCODE_STENCIL_FUNC_SEPARATE
:
7869 CALL_StencilFuncSeparate(ctx
->Exec
,
7870 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7872 case OPCODE_STENCIL_MASK_SEPARATE
:
7873 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7875 case OPCODE_STENCIL_OP_SEPARATE
:
7876 CALL_StencilOpSeparate(ctx
->Exec
,
7877 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7886 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7896 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7899 case OPCODE_TEXPARAMETER
:
7906 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7909 case OPCODE_TEX_IMAGE1D
:
7911 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7912 ctx
->Unpack
= ctx
->DefaultPacking
;
7913 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7915 n
[3].i
, /* components */
7917 n
[5].e
, /* border */
7918 n
[6].e
, /* format */
7921 ctx
->Unpack
= save
; /* restore */
7924 case OPCODE_TEX_IMAGE2D
:
7926 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7927 ctx
->Unpack
= ctx
->DefaultPacking
;
7928 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7930 n
[3].i
, /* components */
7932 n
[5].i
, /* height */
7933 n
[6].e
, /* border */
7934 n
[7].e
, /* format */
7937 ctx
->Unpack
= save
; /* restore */
7940 case OPCODE_TEX_IMAGE3D
:
7942 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7943 ctx
->Unpack
= ctx
->DefaultPacking
;
7944 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7946 n
[3].i
, /* components */
7948 n
[5].i
, /* height */
7950 n
[7].e
, /* border */
7951 n
[8].e
, /* format */
7954 ctx
->Unpack
= save
; /* restore */
7957 case OPCODE_TEX_SUB_IMAGE1D
:
7959 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7960 ctx
->Unpack
= ctx
->DefaultPacking
;
7961 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7963 n
[6].e
, n
[7].data
));
7964 ctx
->Unpack
= save
; /* restore */
7967 case OPCODE_TEX_SUB_IMAGE2D
:
7969 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7970 ctx
->Unpack
= ctx
->DefaultPacking
;
7971 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7973 n
[6].i
, n
[7].e
, n
[8].e
,
7975 ctx
->Unpack
= save
; /* restore */
7978 case OPCODE_TEX_SUB_IMAGE3D
:
7980 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7981 ctx
->Unpack
= ctx
->DefaultPacking
;
7982 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7983 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7984 n
[8].i
, n
[9].e
, n
[10].e
,
7986 ctx
->Unpack
= save
; /* restore */
7989 case OPCODE_TRANSLATE
:
7990 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7992 case OPCODE_VIEWPORT
:
7993 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7994 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
7996 case OPCODE_WINDOW_POS
:
7997 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7999 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8000 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8002 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8003 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8004 n
[4].i
, n
[5].i
, n
[6].i
,
8007 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8008 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8009 n
[4].i
, n
[5].i
, n
[6].i
,
8010 n
[7].i
, n
[8].data
));
8012 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8013 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8014 n
[4].i
, n
[5].i
, n
[6].i
,
8018 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8019 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8020 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8021 n
[5].e
, n
[6].i
, n
[7].data
));
8023 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8024 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8025 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8026 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8029 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8030 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8031 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8032 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8033 n
[9].e
, n
[10].i
, n
[11].data
));
8035 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8036 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8038 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8039 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8041 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8042 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8044 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8045 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8046 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8049 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8050 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8052 case OPCODE_DEPTH_BOUNDS_EXT
:
8053 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8055 case OPCODE_PROGRAM_STRING_ARB
:
8056 CALL_ProgramStringARB(ctx
->Exec
,
8057 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
8059 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8060 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8064 case OPCODE_BEGIN_QUERY_ARB
:
8065 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8067 case OPCODE_END_QUERY_ARB
:
8068 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8070 case OPCODE_QUERY_COUNTER
:
8071 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8073 case OPCODE_BEGIN_QUERY_INDEXED
:
8074 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8076 case OPCODE_END_QUERY_INDEXED
:
8077 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8079 case OPCODE_DRAW_BUFFERS_ARB
:
8081 GLenum buffers
[MAX_DRAW_BUFFERS
];
8082 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8083 for (i
= 0; i
< count
; i
++)
8084 buffers
[i
] = n
[2 + i
].e
;
8085 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8088 case OPCODE_BLIT_FRAMEBUFFER
:
8089 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8090 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8093 case OPCODE_USE_PROGRAM
:
8094 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8096 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8097 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8099 case OPCODE_ACTIVE_PROGRAM_EXT
:
8100 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8102 case OPCODE_UNIFORM_1F
:
8103 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8105 case OPCODE_UNIFORM_2F
:
8106 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8108 case OPCODE_UNIFORM_3F
:
8109 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8111 case OPCODE_UNIFORM_4F
:
8112 CALL_Uniform4f(ctx
->Exec
,
8113 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8115 case OPCODE_UNIFORM_1FV
:
8116 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8118 case OPCODE_UNIFORM_2FV
:
8119 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8121 case OPCODE_UNIFORM_3FV
:
8122 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8124 case OPCODE_UNIFORM_4FV
:
8125 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8127 case OPCODE_UNIFORM_1I
:
8128 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8130 case OPCODE_UNIFORM_2I
:
8131 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8133 case OPCODE_UNIFORM_3I
:
8134 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8136 case OPCODE_UNIFORM_4I
:
8137 CALL_Uniform4i(ctx
->Exec
,
8138 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8140 case OPCODE_UNIFORM_1IV
:
8141 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8143 case OPCODE_UNIFORM_2IV
:
8144 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8146 case OPCODE_UNIFORM_3IV
:
8147 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8149 case OPCODE_UNIFORM_4IV
:
8150 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8152 case OPCODE_UNIFORM_1UI
:
8153 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8155 case OPCODE_UNIFORM_2UI
:
8156 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8158 case OPCODE_UNIFORM_3UI
:
8159 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8161 case OPCODE_UNIFORM_4UI
:
8162 /*CALL_Uniform4uiARB(ctx->Exec,
8163 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8166 case OPCODE_UNIFORM_1UIV
:
8167 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8169 case OPCODE_UNIFORM_2UIV
:
8170 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8172 case OPCODE_UNIFORM_3UIV
:
8173 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8175 case OPCODE_UNIFORM_4UIV
:
8176 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8178 case OPCODE_UNIFORM_MATRIX22
:
8179 CALL_UniformMatrix2fv(ctx
->Exec
,
8180 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8182 case OPCODE_UNIFORM_MATRIX33
:
8183 CALL_UniformMatrix3fv(ctx
->Exec
,
8184 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8186 case OPCODE_UNIFORM_MATRIX44
:
8187 CALL_UniformMatrix4fv(ctx
->Exec
,
8188 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8190 case OPCODE_UNIFORM_MATRIX23
:
8191 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8192 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8194 case OPCODE_UNIFORM_MATRIX32
:
8195 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8196 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8198 case OPCODE_UNIFORM_MATRIX24
:
8199 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8200 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8202 case OPCODE_UNIFORM_MATRIX42
:
8203 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8204 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8206 case OPCODE_UNIFORM_MATRIX34
:
8207 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8208 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8210 case OPCODE_UNIFORM_MATRIX43
:
8211 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8212 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8215 case OPCODE_CLAMP_COLOR
:
8216 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8219 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8222 GLuint i
, pname
= n
[1].ui
;
8224 for (i
= 0; i
< 4; i
++)
8225 values
[i
] = n
[1 + i
].f
;
8226 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8229 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8230 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8232 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8235 GLuint i
, dst
= n
[1].ui
;
8237 for (i
= 0; i
< 4; i
++)
8238 values
[i
] = n
[1 + i
].f
;
8239 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8242 case OPCODE_ATTR_1F_NV
:
8243 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8245 case OPCODE_ATTR_2F_NV
:
8246 /* Really shouldn't have to do this - the Node structure
8247 * is convenient, but it would be better to store the data
8248 * packed appropriately so that it can be sent directly
8249 * on. With x86_64 becoming common, this will start to
8252 if (sizeof(Node
) == sizeof(GLfloat
))
8253 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8255 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8257 case OPCODE_ATTR_3F_NV
:
8258 if (sizeof(Node
) == sizeof(GLfloat
))
8259 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8261 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8264 case OPCODE_ATTR_4F_NV
:
8265 if (sizeof(Node
) == sizeof(GLfloat
))
8266 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8268 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8271 case OPCODE_ATTR_1F_ARB
:
8272 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8274 case OPCODE_ATTR_2F_ARB
:
8275 /* Really shouldn't have to do this - the Node structure
8276 * is convenient, but it would be better to store the data
8277 * packed appropriately so that it can be sent directly
8278 * on. With x86_64 becoming common, this will start to
8281 if (sizeof(Node
) == sizeof(GLfloat
))
8282 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8284 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8286 case OPCODE_ATTR_3F_ARB
:
8287 if (sizeof(Node
) == sizeof(GLfloat
))
8288 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8290 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8293 case OPCODE_ATTR_4F_ARB
:
8294 if (sizeof(Node
) == sizeof(GLfloat
))
8295 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8297 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8300 case OPCODE_MATERIAL
:
8301 if (sizeof(Node
) == sizeof(GLfloat
))
8302 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8309 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8313 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8316 CALL_End(ctx
->Exec
, ());
8319 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8321 case OPCODE_EVAL_C1
:
8322 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8324 case OPCODE_EVAL_C2
:
8325 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8327 case OPCODE_EVAL_P1
:
8328 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8330 case OPCODE_EVAL_P2
:
8331 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8334 /* GL_EXT_texture_integer */
8335 case OPCODE_CLEARCOLOR_I
:
8336 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8338 case OPCODE_CLEARCOLOR_UI
:
8339 CALL_ClearColorIuiEXT(ctx
->Exec
,
8340 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8342 case OPCODE_TEXPARAMETER_I
:
8349 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8352 case OPCODE_TEXPARAMETER_UI
:
8355 params
[0] = n
[3].ui
;
8356 params
[1] = n
[4].ui
;
8357 params
[2] = n
[5].ui
;
8358 params
[3] = n
[6].ui
;
8359 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8363 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8364 /* GL_ARB_instanced_arrays */
8365 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8368 case OPCODE_TEXTURE_BARRIER_NV
:
8369 CALL_TextureBarrierNV(ctx
->Exec
, ());
8372 /* GL_EXT/ARB_transform_feedback */
8373 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8374 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8376 case OPCODE_END_TRANSFORM_FEEDBACK
:
8377 CALL_EndTransformFeedback(ctx
->Exec
, ());
8379 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8380 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8382 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8383 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8385 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8386 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8388 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8389 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8391 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8392 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8393 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8395 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8396 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8397 (n
[1].e
, n
[2].ui
, n
[3].si
));
8399 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8400 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8401 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8405 case OPCODE_BIND_SAMPLER
:
8406 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8408 case OPCODE_SAMPLER_PARAMETERIV
:
8415 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8418 case OPCODE_SAMPLER_PARAMETERFV
:
8425 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8428 case OPCODE_SAMPLER_PARAMETERIIV
:
8435 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8438 case OPCODE_SAMPLER_PARAMETERUIV
:
8441 params
[0] = n
[3].ui
;
8442 params
[1] = n
[4].ui
;
8443 params
[2] = n
[5].ui
;
8444 params
[3] = n
[6].ui
;
8445 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8449 /* GL_ARB_geometry_shader4 */
8450 case OPCODE_PROGRAM_PARAMETERI
:
8451 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8453 case OPCODE_FRAMEBUFFER_TEXTURE
:
8454 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8457 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8458 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8459 n
[3].ui
, n
[4].i
, n
[5].e
));
8463 case OPCODE_WAIT_SYNC
:
8465 union uint64_pair p
;
8466 p
.uint32
[0] = n
[3].ui
;
8467 p
.uint32
[1] = n
[4].ui
;
8468 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
8472 /* GL_NV_conditional_render */
8473 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8474 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8476 case OPCODE_END_CONDITIONAL_RENDER
:
8477 CALL_EndConditionalRender(ctx
->Exec
, ());
8480 case OPCODE_UNIFORM_BLOCK_BINDING
:
8481 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8484 case OPCODE_CONTINUE
:
8485 n
= (Node
*) n
[1].next
;
8487 case OPCODE_END_OF_LIST
:
8493 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8495 _mesa_problem(ctx
, "%s", msg
);
8500 /* increment n to point to next compiled command */
8501 if (opcode
!= OPCODE_CONTINUE
) {
8502 n
+= InstSize
[opcode
];
8507 if (ctx
->Driver
.EndCallList
)
8508 ctx
->Driver
.EndCallList(ctx
);
8510 ctx
->ListState
.CallDepth
--;
8515 /**********************************************************************/
8517 /**********************************************************************/
8520 * Test if a display list number is valid.
8522 GLboolean GLAPIENTRY
8523 _mesa_IsList(GLuint list
)
8525 GET_CURRENT_CONTEXT(ctx
);
8526 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8527 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8528 return islist(ctx
, list
);
8533 * Delete a sequence of consecutive display lists.
8536 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8538 GET_CURRENT_CONTEXT(ctx
);
8540 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8541 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8544 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8547 for (i
= list
; i
< list
+ range
; i
++) {
8548 destroy_list(ctx
, i
);
8554 * Return a display list number, n, such that lists n through n+range-1
8558 _mesa_GenLists(GLsizei range
)
8560 GET_CURRENT_CONTEXT(ctx
);
8562 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8563 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8566 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8574 * Make this an atomic operation
8576 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8578 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8580 /* reserve the list IDs by with empty/dummy lists */
8582 for (i
= 0; i
< range
; i
++) {
8583 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8584 make_list(base
+ i
, 1));
8588 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8595 * Begin a new display list.
8598 _mesa_NewList(GLuint name
, GLenum mode
)
8600 GET_CURRENT_CONTEXT(ctx
);
8602 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8603 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8605 if (MESA_VERBOSE
& VERBOSE_API
)
8606 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8607 _mesa_lookup_enum_by_nr(mode
));
8610 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8614 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8615 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8619 if (ctx
->ListState
.CurrentList
) {
8620 /* already compiling a display list */
8621 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8625 ctx
->CompileFlag
= GL_TRUE
;
8626 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8628 /* Reset acumulated list state:
8630 invalidate_saved_current_state( ctx
);
8632 /* Allocate new display list */
8633 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8634 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8635 ctx
->ListState
.CurrentPos
= 0;
8637 ctx
->Driver
.NewList(ctx
, name
, mode
);
8639 ctx
->CurrentDispatch
= ctx
->Save
;
8640 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8645 * End definition of current display list.
8650 GET_CURRENT_CONTEXT(ctx
);
8651 SAVE_FLUSH_VERTICES(ctx
);
8652 FLUSH_VERTICES(ctx
, 0);
8654 if (MESA_VERBOSE
& VERBOSE_API
)
8655 _mesa_debug(ctx
, "glEndList\n");
8657 /* Check that a list is under construction */
8658 if (!ctx
->ListState
.CurrentList
) {
8659 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8663 /* Call before emitting END_OF_LIST, in case the driver wants to
8664 * emit opcodes itself.
8666 ctx
->Driver
.EndList(ctx
);
8668 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8670 /* Destroy old list, if any */
8671 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8673 /* Install the new list */
8674 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8675 ctx
->ListState
.CurrentList
->Name
,
8676 ctx
->ListState
.CurrentList
);
8679 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8680 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8682 ctx
->ListState
.CurrentList
= NULL
;
8683 ctx
->ExecuteFlag
= GL_TRUE
;
8684 ctx
->CompileFlag
= GL_FALSE
;
8686 ctx
->CurrentDispatch
= ctx
->Exec
;
8687 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8692 _mesa_CallList(GLuint list
)
8694 GLboolean save_compile_flag
;
8695 GET_CURRENT_CONTEXT(ctx
);
8696 FLUSH_CURRENT(ctx
, 0);
8698 if (MESA_VERBOSE
& VERBOSE_API
)
8699 _mesa_debug(ctx
, "glCallList %d\n", list
);
8702 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8707 mesa_print_display_list( list
);
8709 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8710 * execute the display list, and restore the CompileFlag.
8712 save_compile_flag
= ctx
->CompileFlag
;
8713 if (save_compile_flag
) {
8714 ctx
->CompileFlag
= GL_FALSE
;
8717 execute_list(ctx
, list
);
8718 ctx
->CompileFlag
= save_compile_flag
;
8720 /* also restore API function pointers to point to "save" versions */
8721 if (save_compile_flag
) {
8722 ctx
->CurrentDispatch
= ctx
->Save
;
8723 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8729 * Execute glCallLists: call multiple display lists.
8732 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8734 GET_CURRENT_CONTEXT(ctx
);
8736 GLboolean save_compile_flag
;
8738 if (MESA_VERBOSE
& VERBOSE_API
)
8739 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8743 case GL_UNSIGNED_BYTE
:
8745 case GL_UNSIGNED_SHORT
:
8747 case GL_UNSIGNED_INT
:
8755 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8759 /* Save the CompileFlag status, turn it off, execute display list,
8760 * and restore the CompileFlag.
8762 save_compile_flag
= ctx
->CompileFlag
;
8763 ctx
->CompileFlag
= GL_FALSE
;
8765 for (i
= 0; i
< n
; i
++) {
8766 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8767 execute_list(ctx
, list
);
8770 ctx
->CompileFlag
= save_compile_flag
;
8772 /* also restore API function pointers to point to "save" versions */
8773 if (save_compile_flag
) {
8774 ctx
->CurrentDispatch
= ctx
->Save
;
8775 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8781 * Set the offset added to list numbers in glCallLists.
8784 _mesa_ListBase(GLuint base
)
8786 GET_CURRENT_CONTEXT(ctx
);
8787 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8788 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8789 ctx
->List
.ListBase
= base
;
8793 * Setup the given dispatch table to point to Mesa's display list
8794 * building functions.
8796 * This does not include any of the tnl functions - they are
8797 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8801 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8803 struct _glapi_table
*table
= ctx
->Save
;
8804 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8806 /* Initially populate the dispatch table with the contents of the
8807 * normal-execution dispatch table. This lets us skip populating functions
8808 * that should be called directly instead of compiled into display lists.
8810 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8812 _mesa_loopback_init_api_table(ctx
, table
);
8815 SET_Accum(table
, save_Accum
);
8816 SET_AlphaFunc(table
, save_AlphaFunc
);
8817 SET_Bitmap(table
, save_Bitmap
);
8818 SET_BlendFunc(table
, save_BlendFunc
);
8819 SET_CallList(table
, save_CallList
);
8820 SET_CallLists(table
, save_CallLists
);
8821 SET_Clear(table
, save_Clear
);
8822 SET_ClearAccum(table
, save_ClearAccum
);
8823 SET_ClearColor(table
, save_ClearColor
);
8824 SET_ClearDepth(table
, save_ClearDepth
);
8825 SET_ClearIndex(table
, save_ClearIndex
);
8826 SET_ClearStencil(table
, save_ClearStencil
);
8827 SET_ClipPlane(table
, save_ClipPlane
);
8828 SET_ColorMask(table
, save_ColorMask
);
8829 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8830 SET_ColorMaterial(table
, save_ColorMaterial
);
8831 SET_CopyPixels(table
, save_CopyPixels
);
8832 SET_CullFace(table
, save_CullFace
);
8833 SET_DepthFunc(table
, save_DepthFunc
);
8834 SET_DepthMask(table
, save_DepthMask
);
8835 SET_DepthRange(table
, save_DepthRange
);
8836 SET_Disable(table
, save_Disable
);
8837 SET_Disablei(table
, save_DisableIndexed
);
8838 SET_DrawBuffer(table
, save_DrawBuffer
);
8839 SET_DrawPixels(table
, save_DrawPixels
);
8840 SET_Enable(table
, save_Enable
);
8841 SET_Enablei(table
, save_EnableIndexed
);
8842 SET_EvalMesh1(table
, save_EvalMesh1
);
8843 SET_EvalMesh2(table
, save_EvalMesh2
);
8844 SET_Fogf(table
, save_Fogf
);
8845 SET_Fogfv(table
, save_Fogfv
);
8846 SET_Fogi(table
, save_Fogi
);
8847 SET_Fogiv(table
, save_Fogiv
);
8848 SET_FrontFace(table
, save_FrontFace
);
8849 SET_Frustum(table
, save_Frustum
);
8850 SET_Hint(table
, save_Hint
);
8851 SET_IndexMask(table
, save_IndexMask
);
8852 SET_InitNames(table
, save_InitNames
);
8853 SET_LightModelf(table
, save_LightModelf
);
8854 SET_LightModelfv(table
, save_LightModelfv
);
8855 SET_LightModeli(table
, save_LightModeli
);
8856 SET_LightModeliv(table
, save_LightModeliv
);
8857 SET_Lightf(table
, save_Lightf
);
8858 SET_Lightfv(table
, save_Lightfv
);
8859 SET_Lighti(table
, save_Lighti
);
8860 SET_Lightiv(table
, save_Lightiv
);
8861 SET_LineStipple(table
, save_LineStipple
);
8862 SET_LineWidth(table
, save_LineWidth
);
8863 SET_ListBase(table
, save_ListBase
);
8864 SET_LoadIdentity(table
, save_LoadIdentity
);
8865 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8866 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8867 SET_LoadName(table
, save_LoadName
);
8868 SET_LogicOp(table
, save_LogicOp
);
8869 SET_Map1d(table
, save_Map1d
);
8870 SET_Map1f(table
, save_Map1f
);
8871 SET_Map2d(table
, save_Map2d
);
8872 SET_Map2f(table
, save_Map2f
);
8873 SET_MapGrid1d(table
, save_MapGrid1d
);
8874 SET_MapGrid1f(table
, save_MapGrid1f
);
8875 SET_MapGrid2d(table
, save_MapGrid2d
);
8876 SET_MapGrid2f(table
, save_MapGrid2f
);
8877 SET_MatrixMode(table
, save_MatrixMode
);
8878 SET_MultMatrixd(table
, save_MultMatrixd
);
8879 SET_MultMatrixf(table
, save_MultMatrixf
);
8880 SET_NewList(table
, save_NewList
);
8881 SET_Ortho(table
, save_Ortho
);
8882 SET_PassThrough(table
, save_PassThrough
);
8883 SET_PixelMapfv(table
, save_PixelMapfv
);
8884 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8885 SET_PixelMapusv(table
, save_PixelMapusv
);
8886 SET_PixelTransferf(table
, save_PixelTransferf
);
8887 SET_PixelTransferi(table
, save_PixelTransferi
);
8888 SET_PixelZoom(table
, save_PixelZoom
);
8889 SET_PointSize(table
, save_PointSize
);
8890 SET_PolygonMode(table
, save_PolygonMode
);
8891 SET_PolygonOffset(table
, save_PolygonOffset
);
8892 SET_PolygonStipple(table
, save_PolygonStipple
);
8893 SET_PopAttrib(table
, save_PopAttrib
);
8894 SET_PopMatrix(table
, save_PopMatrix
);
8895 SET_PopName(table
, save_PopName
);
8896 SET_PushAttrib(table
, save_PushAttrib
);
8897 SET_PushMatrix(table
, save_PushMatrix
);
8898 SET_PushName(table
, save_PushName
);
8899 SET_RasterPos2d(table
, save_RasterPos2d
);
8900 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8901 SET_RasterPos2f(table
, save_RasterPos2f
);
8902 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8903 SET_RasterPos2i(table
, save_RasterPos2i
);
8904 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8905 SET_RasterPos2s(table
, save_RasterPos2s
);
8906 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8907 SET_RasterPos3d(table
, save_RasterPos3d
);
8908 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8909 SET_RasterPos3f(table
, save_RasterPos3f
);
8910 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8911 SET_RasterPos3i(table
, save_RasterPos3i
);
8912 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8913 SET_RasterPos3s(table
, save_RasterPos3s
);
8914 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8915 SET_RasterPos4d(table
, save_RasterPos4d
);
8916 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8917 SET_RasterPos4f(table
, save_RasterPos4f
);
8918 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8919 SET_RasterPos4i(table
, save_RasterPos4i
);
8920 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8921 SET_RasterPos4s(table
, save_RasterPos4s
);
8922 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8923 SET_ReadBuffer(table
, save_ReadBuffer
);
8924 SET_Rotated(table
, save_Rotated
);
8925 SET_Rotatef(table
, save_Rotatef
);
8926 SET_Scaled(table
, save_Scaled
);
8927 SET_Scalef(table
, save_Scalef
);
8928 SET_Scissor(table
, save_Scissor
);
8929 SET_ShadeModel(table
, save_ShadeModel
);
8930 SET_StencilFunc(table
, save_StencilFunc
);
8931 SET_StencilMask(table
, save_StencilMask
);
8932 SET_StencilOp(table
, save_StencilOp
);
8933 SET_TexEnvf(table
, save_TexEnvf
);
8934 SET_TexEnvfv(table
, save_TexEnvfv
);
8935 SET_TexEnvi(table
, save_TexEnvi
);
8936 SET_TexEnviv(table
, save_TexEnviv
);
8937 SET_TexGend(table
, save_TexGend
);
8938 SET_TexGendv(table
, save_TexGendv
);
8939 SET_TexGenf(table
, save_TexGenf
);
8940 SET_TexGenfv(table
, save_TexGenfv
);
8941 SET_TexGeni(table
, save_TexGeni
);
8942 SET_TexGeniv(table
, save_TexGeniv
);
8943 SET_TexImage1D(table
, save_TexImage1D
);
8944 SET_TexImage2D(table
, save_TexImage2D
);
8945 SET_TexParameterf(table
, save_TexParameterf
);
8946 SET_TexParameterfv(table
, save_TexParameterfv
);
8947 SET_TexParameteri(table
, save_TexParameteri
);
8948 SET_TexParameteriv(table
, save_TexParameteriv
);
8949 SET_Translated(table
, save_Translated
);
8950 SET_Translatef(table
, save_Translatef
);
8951 SET_Viewport(table
, save_Viewport
);
8954 SET_BindTexture(table
, save_BindTexture
);
8955 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8956 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8957 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8958 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8959 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8960 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8961 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8964 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8965 SET_TexImage3D(table
, save_TexImage3D
);
8966 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8969 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8970 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8971 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8973 /* ATI_separate_stencil */
8974 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8976 /* GL_ARB_imaging */
8977 /* Not all are supported */
8978 SET_BlendColor(table
, save_BlendColor
);
8979 SET_BlendEquation(table
, save_BlendEquation
);
8980 SET_ColorSubTable(table
, save_ColorSubTable
);
8981 SET_ColorTable(table
, save_ColorTable
);
8982 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
8983 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
8984 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
8985 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
8986 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
8987 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
8988 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
8989 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
8990 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
8991 SET_CopyColorTable(table
, save_CopyColorTable
);
8992 SET_Histogram(table
, save_Histogram
);
8993 SET_Minmax(table
, save_Minmax
);
8994 SET_ResetHistogram(table
, save_ResetHistogram
);
8995 SET_ResetMinmax(table
, save_ResetMinmax
);
8997 /* 2. GL_EXT_blend_color */
8999 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9002 /* 3. GL_EXT_polygon_offset */
9003 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9005 /* 6. GL_EXT_texture3d */
9007 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9008 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9009 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9012 /* 14. GL_SGI_color_table */
9014 SET_ColorTableSGI(table
, save_ColorTable
);
9015 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
9018 /* 37. GL_EXT_blend_minmax */
9020 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9023 /* 54. GL_EXT_point_parameters */
9024 SET_PointParameterf(table
, save_PointParameterfEXT
);
9025 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9027 /* 173. GL_EXT_blend_func_separate */
9028 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9030 /* 197. GL_MESA_window_pos */
9031 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9032 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9033 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9034 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9035 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9036 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9037 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9038 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9039 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9040 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9041 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9042 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9043 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9044 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9045 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9046 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9047 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9048 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9049 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9050 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9051 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9052 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9053 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9054 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9056 /* 233. GL_NV_vertex_program */
9057 /* The following commands DO NOT go into display lists:
9058 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9059 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9061 SET_BindProgramARB(table
, save_BindProgramNV
);
9063 /* 244. GL_ATI_envmap_bumpmap */
9064 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9065 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9067 /* 245. GL_ATI_fragment_shader */
9068 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9069 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9071 /* 262. GL_NV_point_sprite */
9072 SET_PointParameteri(table
, save_PointParameteriNV
);
9073 SET_PointParameteriv(table
, save_PointParameterivNV
);
9075 /* 268. GL_EXT_stencil_two_side */
9076 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9078 /* ???. GL_EXT_depth_bounds_test */
9079 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9081 /* ARB 1. GL_ARB_multitexture */
9082 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9084 /* ARB 3. GL_ARB_transpose_matrix */
9085 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9086 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9087 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9088 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9090 /* ARB 5. GL_ARB_multisample */
9091 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9093 /* ARB 12. GL_ARB_texture_compression */
9094 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9095 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9096 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9097 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9098 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9099 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9101 /* ARB 14. GL_ARB_point_parameters */
9102 /* aliased with EXT_point_parameters functions */
9104 /* ARB 25. GL_ARB_window_pos */
9105 /* aliased with MESA_window_pos functions */
9107 /* ARB 26. GL_ARB_vertex_program */
9108 /* ARB 27. GL_ARB_fragment_program */
9109 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9110 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9111 SET_BindProgramARB(table
, save_BindProgramNV
);
9112 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9113 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9114 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9115 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9116 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9117 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9118 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9119 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9121 SET_BeginQuery(table
, save_BeginQueryARB
);
9122 SET_EndQuery(table
, save_EndQueryARB
);
9123 SET_QueryCounter(table
, save_QueryCounter
);
9125 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9127 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9129 SET_UseProgram(table
, save_UseProgramObjectARB
);
9130 SET_Uniform1f(table
, save_Uniform1fARB
);
9131 SET_Uniform2f(table
, save_Uniform2fARB
);
9132 SET_Uniform3f(table
, save_Uniform3fARB
);
9133 SET_Uniform4f(table
, save_Uniform4fARB
);
9134 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9135 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9136 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9137 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9138 SET_Uniform1i(table
, save_Uniform1iARB
);
9139 SET_Uniform2i(table
, save_Uniform2iARB
);
9140 SET_Uniform3i(table
, save_Uniform3iARB
);
9141 SET_Uniform4i(table
, save_Uniform4iARB
);
9142 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9143 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9144 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9145 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9146 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9147 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9148 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9149 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9150 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9151 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9152 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9153 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9154 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9156 /* 299. GL_EXT_blend_equation_separate */
9157 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9159 /* GL_EXT_gpu_program_parameters */
9160 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9161 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9163 /* 364. GL_EXT_provoking_vertex */
9164 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9166 /* GL_EXT_texture_integer */
9167 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9168 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9169 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9170 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9172 /* 377. GL_EXT_separate_shader_objects */
9173 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9174 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9176 /* GL_ARB_color_buffer_float */
9177 SET_ClampColor(table
, save_ClampColorARB
);
9180 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9181 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9182 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9183 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9185 SET_Uniform1ui(table
, save_Uniform1ui
);
9186 SET_Uniform2ui(table
, save_Uniform2ui
);
9187 SET_Uniform3ui(table
, save_Uniform3ui
);
9188 SET_Uniform4ui(table
, save_Uniform4ui
);
9189 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9190 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9191 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9192 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9194 (void) save_Uniform1ui
;
9195 (void) save_Uniform2ui
;
9196 (void) save_Uniform3ui
;
9197 (void) save_Uniform4ui
;
9198 (void) save_Uniform1uiv
;
9199 (void) save_Uniform2uiv
;
9200 (void) save_Uniform3uiv
;
9201 (void) save_Uniform4uiv
;
9205 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9206 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9207 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9208 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9209 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9210 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9211 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9212 SET_DrawTransformFeedbackInstanced(table
,
9213 save_DrawTransformFeedbackInstanced
);
9214 SET_DrawTransformFeedbackStreamInstanced(table
,
9215 save_DrawTransformFeedbackStreamInstanced
);
9216 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9217 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9219 /* GL_ARB_instanced_arrays */
9220 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9222 /* GL_NV_texture_barrier */
9223 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9225 SET_BindSampler(table
, save_BindSampler
);
9226 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9227 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9228 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9229 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9230 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9231 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9233 /* GL_ARB_draw_buffer_blend */
9234 SET_BlendFunciARB(table
, save_BlendFunci
);
9235 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9236 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9237 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9239 /* GL_ARB_geometry_shader4 */
9240 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9241 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9242 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9244 /* GL_NV_conditional_render */
9245 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9246 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9249 SET_WaitSync(table
, save_WaitSync
);
9251 /* GL_ARB_uniform_buffer_object */
9252 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9258 enum_string(GLenum k
)
9260 return _mesa_lookup_enum_by_nr(k
);
9265 * Print the commands in a display list. For debugging only.
9266 * TODO: many commands aren't handled yet.
9268 static void GLAPIENTRY
9269 print_list(struct gl_context
*ctx
, GLuint list
)
9271 struct gl_display_list
*dlist
;
9275 if (!islist(ctx
, list
)) {
9276 printf("%u is not a display list ID\n", list
);
9280 dlist
= lookup_list(ctx
, list
);
9286 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9288 done
= n
? GL_FALSE
: GL_TRUE
;
9290 const OpCode opcode
= n
[0].opcode
;
9292 if (is_ext_opcode(opcode
)) {
9293 n
+= ext_opcode_print(ctx
, n
);
9298 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9301 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9302 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9304 case OPCODE_CALL_LIST
:
9305 printf("CallList %d\n", (int) n
[1].ui
);
9307 case OPCODE_CALL_LIST_OFFSET
:
9308 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9309 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9311 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9312 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9313 enum_string(n
[1].e
), enum_string(n
[2].e
),
9314 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9316 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9317 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9318 enum_string(n
[1].e
), enum_string(n
[2].e
),
9319 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9321 case OPCODE_DISABLE
:
9322 printf("Disable %s\n", enum_string(n
[1].e
));
9325 printf("Enable %s\n", enum_string(n
[1].e
));
9327 case OPCODE_FRUSTUM
:
9328 printf("Frustum %g %g %g %g %g %g\n",
9329 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9331 case OPCODE_LINE_STIPPLE
:
9332 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9334 case OPCODE_LOAD_IDENTITY
:
9335 printf("LoadIdentity\n");
9337 case OPCODE_LOAD_MATRIX
:
9338 printf("LoadMatrix\n");
9339 printf(" %8f %8f %8f %8f\n",
9340 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9341 printf(" %8f %8f %8f %8f\n",
9342 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9343 printf(" %8f %8f %8f %8f\n",
9344 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9345 printf(" %8f %8f %8f %8f\n",
9346 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9348 case OPCODE_MULT_MATRIX
:
9349 printf("MultMatrix (or Rotate)\n");
9350 printf(" %8f %8f %8f %8f\n",
9351 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9352 printf(" %8f %8f %8f %8f\n",
9353 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9354 printf(" %8f %8f %8f %8f\n",
9355 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9356 printf(" %8f %8f %8f %8f\n",
9357 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9360 printf("Ortho %g %g %g %g %g %g\n",
9361 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9363 case OPCODE_POP_ATTRIB
:
9364 printf("PopAttrib\n");
9366 case OPCODE_POP_MATRIX
:
9367 printf("PopMatrix\n");
9369 case OPCODE_POP_NAME
:
9370 printf("PopName\n");
9372 case OPCODE_PUSH_ATTRIB
:
9373 printf("PushAttrib %x\n", n
[1].bf
);
9375 case OPCODE_PUSH_MATRIX
:
9376 printf("PushMatrix\n");
9378 case OPCODE_PUSH_NAME
:
9379 printf("PushName %d\n", (int) n
[1].ui
);
9381 case OPCODE_RASTER_POS
:
9382 printf("RasterPos %g %g %g %g\n",
9383 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9386 printf("Rotate %g %g %g %g\n",
9387 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9390 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9392 case OPCODE_TRANSLATE
:
9393 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9395 case OPCODE_BIND_TEXTURE
:
9396 printf("BindTexture %s %d\n",
9397 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9399 case OPCODE_SHADE_MODEL
:
9400 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9403 printf("Map1 %s %.3f %.3f %d %d\n",
9404 _mesa_lookup_enum_by_nr(n
[1].ui
),
9405 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9408 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9409 _mesa_lookup_enum_by_nr(n
[1].ui
),
9410 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9411 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9413 case OPCODE_MAPGRID1
:
9414 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9416 case OPCODE_MAPGRID2
:
9417 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9418 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9420 case OPCODE_EVALMESH1
:
9421 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9423 case OPCODE_EVALMESH2
:
9424 printf("EvalMesh2 %d %d %d %d\n",
9425 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9428 case OPCODE_ATTR_1F_NV
:
9429 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9431 case OPCODE_ATTR_2F_NV
:
9432 printf("ATTR_2F_NV attr %d: %f %f\n",
9433 n
[1].i
, n
[2].f
, n
[3].f
);
9435 case OPCODE_ATTR_3F_NV
:
9436 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9437 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9439 case OPCODE_ATTR_4F_NV
:
9440 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9441 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9443 case OPCODE_ATTR_1F_ARB
:
9444 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9446 case OPCODE_ATTR_2F_ARB
:
9447 printf("ATTR_2F_ARB attr %d: %f %f\n",
9448 n
[1].i
, n
[2].f
, n
[3].f
);
9450 case OPCODE_ATTR_3F_ARB
:
9451 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9452 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9454 case OPCODE_ATTR_4F_ARB
:
9455 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9456 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9459 case OPCODE_MATERIAL
:
9460 printf("MATERIAL %x %x: %f %f %f %f\n",
9461 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9464 printf("BEGIN %x\n", n
[1].i
);
9470 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9473 case OPCODE_EVAL_C1
:
9474 printf("EVAL_C1 %f\n", n
[1].f
);
9476 case OPCODE_EVAL_C2
:
9477 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9479 case OPCODE_EVAL_P1
:
9480 printf("EVAL_P1 %d\n", n
[1].i
);
9482 case OPCODE_EVAL_P2
:
9483 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9486 case OPCODE_PROVOKING_VERTEX
:
9487 printf("ProvokingVertex %s\n",
9488 _mesa_lookup_enum_by_nr(n
[1].ui
));
9492 * meta opcodes/commands
9495 printf("Error: %s %s\n",
9496 enum_string(n
[1].e
), (const char *) n
[2].data
);
9498 case OPCODE_CONTINUE
:
9499 printf("DISPLAY-LIST-CONTINUE\n");
9500 n
= (Node
*) n
[1].next
;
9502 case OPCODE_END_OF_LIST
:
9503 printf("END-LIST %u\n", list
);
9507 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9509 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9510 opcode
, (void *) n
);
9514 printf("command %d, %u operands\n", opcode
,
9518 /* increment n to point to next compiled command */
9519 if (opcode
!= OPCODE_CONTINUE
) {
9520 n
+= InstSize
[opcode
];
9529 * Clients may call this function to help debug display list problems.
9530 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9531 * changed, or break in the future without notice.
9534 mesa_print_display_list(GLuint list
)
9536 GET_CURRENT_CONTEXT(ctx
);
9537 print_list(ctx
, list
);
9541 /**********************************************************************/
9542 /***** Initialization *****/
9543 /**********************************************************************/
9546 save_vtxfmt_init(GLvertexformat
* vfmt
)
9548 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
9550 vfmt
->Begin
= save_Begin
;
9552 _MESA_INIT_DLIST_VTXFMT(vfmt
, save_
);
9554 vfmt
->Color3f
= save_Color3f
;
9555 vfmt
->Color3fv
= save_Color3fv
;
9556 vfmt
->Color4f
= save_Color4f
;
9557 vfmt
->Color4fv
= save_Color4fv
;
9558 vfmt
->EdgeFlag
= save_EdgeFlag
;
9559 vfmt
->End
= save_End
;
9561 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
9563 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9564 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9565 vfmt
->Indexf
= save_Indexf
;
9566 vfmt
->Indexfv
= save_Indexfv
;
9567 vfmt
->Materialfv
= save_Materialfv
;
9568 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9569 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9570 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9571 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9572 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9573 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9574 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9575 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9576 vfmt
->Normal3f
= save_Normal3f
;
9577 vfmt
->Normal3fv
= save_Normal3fv
;
9578 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9579 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9580 vfmt
->TexCoord1f
= save_TexCoord1f
;
9581 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9582 vfmt
->TexCoord2f
= save_TexCoord2f
;
9583 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9584 vfmt
->TexCoord3f
= save_TexCoord3f
;
9585 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9586 vfmt
->TexCoord4f
= save_TexCoord4f
;
9587 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9588 vfmt
->Vertex2f
= save_Vertex2f
;
9589 vfmt
->Vertex2fv
= save_Vertex2fv
;
9590 vfmt
->Vertex3f
= save_Vertex3f
;
9591 vfmt
->Vertex3fv
= save_Vertex3fv
;
9592 vfmt
->Vertex4f
= save_Vertex4f
;
9593 vfmt
->Vertex4fv
= save_Vertex4fv
;
9594 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9595 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9596 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9597 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9598 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9599 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9600 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9601 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9603 vfmt
->Rectf
= save_Rectf
;
9605 /* GL_ARB_draw_instanced */
9606 vfmt
->DrawArraysInstanced
= save_DrawArraysInstancedARB
;
9607 vfmt
->DrawElementsInstanced
= save_DrawElementsInstancedARB
;
9609 /* GL_ARB_draw_elements_base_vertex */
9610 vfmt
->DrawElementsInstancedBaseVertex
= save_DrawElementsInstancedBaseVertexARB
;
9612 /* GL_ARB_base_instance */
9613 vfmt
->DrawArraysInstancedBaseInstance
= save_DrawArraysInstancedBaseInstance
;
9614 vfmt
->DrawElementsInstancedBaseInstance
= save_DrawElementsInstancedBaseInstance
;
9615 vfmt
->DrawElementsInstancedBaseVertexBaseInstance
= save_DrawElementsInstancedBaseVertexBaseInstance
;
9617 /* The driver is required to implement these as
9618 * 1) They can probably do a better job.
9619 * 2) A lot of new mechanisms would have to be added to this module
9620 * to support it. That code would probably never get used,
9624 vfmt
->DrawArrays
= 0;
9625 vfmt
->DrawElements
= 0;
9626 vfmt
->DrawRangeElements
= 0;
9627 vfmt
->MultiDrawElemementsEXT
= 0;
9628 vfmt
->DrawElementsBaseVertex
= 0;
9629 vfmt
->DrawRangeElementsBaseVertex
= 0;
9630 vfmt
->MultiDrawElemementsBaseVertex
= 0;
9636 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9637 const GLvertexformat
*vfmt
)
9639 SET_CallList(disp
, vfmt
->CallList
);
9640 SET_CallLists(disp
, vfmt
->CallLists
);
9645 * Initialize display list state for given context.
9648 _mesa_init_display_list(struct gl_context
*ctx
)
9650 static GLboolean tableInitialized
= GL_FALSE
;
9652 /* zero-out the instruction size table, just once */
9653 if (!tableInitialized
) {
9654 memset(InstSize
, 0, sizeof(InstSize
));
9655 tableInitialized
= GL_TRUE
;
9658 /* extension info */
9659 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9662 ctx
->ListState
.CallDepth
= 0;
9663 ctx
->ExecuteFlag
= GL_TRUE
;
9664 ctx
->CompileFlag
= GL_FALSE
;
9665 ctx
->ListState
.CurrentBlock
= NULL
;
9666 ctx
->ListState
.CurrentPos
= 0;
9668 /* Display List group */
9669 ctx
->List
.ListBase
= 0;
9671 save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9676 _mesa_free_display_list_data(struct gl_context
*ctx
)
9679 ctx
->ListExt
= NULL
;