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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * Display lists management functions.
34 #include "api_arrayelt.h"
36 #include "api_loopback.h"
37 #include "api_validate.h"
38 #include "atifragshader.h"
40 #include "bufferobj.h"
47 #include "framebuffer.h"
48 #include "glapi/glapi.h"
49 #include "glformats.h"
57 #include "samplerobj.h"
58 #include "shaderapi.h"
61 #include "texstorage.h"
64 #include "arbprogram.h"
65 #include "transformfeedback.h"
67 #include "math/m_matrix.h"
69 #include "main/dispatch.h"
74 * Other parts of Mesa (such as the VBO module) can plug into the display
75 * list system. This structure describes new display list instructions.
77 struct gl_list_instruction
80 void (*Execute
)( struct gl_context
*ctx
, void *data
);
81 void (*Destroy
)( struct gl_context
*ctx
, void *data
);
82 void (*Print
)( struct gl_context
*ctx
, void *data
);
86 #define MAX_DLIST_EXT_OPCODES 16
89 * Used by device drivers to hook new commands into display lists.
91 struct gl_list_extensions
93 struct gl_list_instruction Opcode
[MAX_DLIST_EXT_OPCODES
];
102 * \param ctx GL context.
104 * Checks if dd_function_table::SaveNeedFlush is marked to flush
105 * stored (save) vertices, and calls
106 * dd_function_table::SaveFlushVertices if so.
108 #define SAVE_FLUSH_VERTICES(ctx) \
110 if (ctx->Driver.SaveNeedFlush) \
111 ctx->Driver.SaveFlushVertices(ctx); \
116 * Macro to assert that the API call was made outside the
117 * glBegin()/glEnd() pair, with return value.
119 * \param ctx GL context.
120 * \param retval value to return value in case the assertion fails.
122 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
124 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
125 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
126 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
132 * Macro to assert that the API call was made outside the
133 * glBegin()/glEnd() pair.
135 * \param ctx GL context.
137 #define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
139 if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
140 ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
141 _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
147 * Macro to assert that the API call was made outside the
148 * glBegin()/glEnd() pair and flush the vertices.
150 * \param ctx GL context.
152 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \
154 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \
155 SAVE_FLUSH_VERTICES(ctx); \
159 * Macro to assert that the API call was made outside the
160 * glBegin()/glEnd() pair and flush the vertices, with return value.
162 * \param ctx GL context.
163 * \param retval value to return value in case the assertion fails.
165 #define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
167 ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \
168 SAVE_FLUSH_VERTICES(ctx); \
174 * Display list opcodes.
176 * The fact that these identifiers are assigned consecutive
177 * integer values starting at 0 is very important, see InstSize array usage)
181 OPCODE_INVALID
= -1, /* Force signed enum */
187 OPCODE_BLEND_EQUATION
,
188 OPCODE_BLEND_EQUATION_SEPARATE
,
189 OPCODE_BLEND_FUNC_SEPARATE
,
191 OPCODE_BLEND_EQUATION_I
,
192 OPCODE_BLEND_EQUATION_SEPARATE_I
,
194 OPCODE_BLEND_FUNC_SEPARATE_I
,
197 OPCODE_CALL_LIST_OFFSET
,
203 OPCODE_CLEAR_STENCIL
,
204 OPCODE_CLEAR_BUFFER_IV
,
205 OPCODE_CLEAR_BUFFER_UIV
,
206 OPCODE_CLEAR_BUFFER_FV
,
207 OPCODE_CLEAR_BUFFER_FI
,
210 OPCODE_COLOR_MASK_INDEXED
,
211 OPCODE_COLOR_MATERIAL
,
213 OPCODE_COLOR_TABLE_PARAMETER_FV
,
214 OPCODE_COLOR_TABLE_PARAMETER_IV
,
215 OPCODE_COLOR_SUB_TABLE
,
216 OPCODE_CONVOLUTION_FILTER_1D
,
217 OPCODE_CONVOLUTION_FILTER_2D
,
218 OPCODE_CONVOLUTION_PARAMETER_I
,
219 OPCODE_CONVOLUTION_PARAMETER_IV
,
220 OPCODE_CONVOLUTION_PARAMETER_F
,
221 OPCODE_CONVOLUTION_PARAMETER_FV
,
222 OPCODE_COPY_COLOR_SUB_TABLE
,
223 OPCODE_COPY_COLOR_TABLE
,
225 OPCODE_COPY_TEX_IMAGE1D
,
226 OPCODE_COPY_TEX_IMAGE2D
,
227 OPCODE_COPY_TEX_SUB_IMAGE1D
,
228 OPCODE_COPY_TEX_SUB_IMAGE2D
,
229 OPCODE_COPY_TEX_SUB_IMAGE3D
,
235 OPCODE_DISABLE_INDEXED
,
239 OPCODE_ENABLE_INDEXED
,
254 OPCODE_LOAD_IDENTITY
,
268 OPCODE_PIXEL_TRANSFER
,
271 OPCODE_POINT_PARAMETERS
,
273 OPCODE_POLYGON_STIPPLE
,
274 OPCODE_POLYGON_OFFSET
,
278 OPCODE_PRIORITIZE_TEXTURE
,
284 OPCODE_RESET_HISTOGRAM
,
285 OPCODE_RESET_MIN_MAX
,
289 OPCODE_SELECT_TEXTURE_SGIS
,
290 OPCODE_SELECT_TEXTURE_COORD_SET
,
301 OPCODE_TEX_SUB_IMAGE1D
,
302 OPCODE_TEX_SUB_IMAGE2D
,
303 OPCODE_TEX_SUB_IMAGE3D
,
307 /* GL_ARB_multitexture */
308 OPCODE_ACTIVE_TEXTURE
,
309 /* GL_ARB_texture_compression */
310 OPCODE_COMPRESSED_TEX_IMAGE_1D
,
311 OPCODE_COMPRESSED_TEX_IMAGE_2D
,
312 OPCODE_COMPRESSED_TEX_IMAGE_3D
,
313 OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
,
314 OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
,
315 OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
,
316 /* GL_ARB_multisample */
317 OPCODE_SAMPLE_COVERAGE
,
318 /* GL_ARB_window_pos */
319 OPCODE_WINDOW_POS_ARB
,
320 /* GL_NV_fragment_program */
321 OPCODE_BIND_PROGRAM_NV
,
322 OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
,
323 /* GL_EXT_stencil_two_side */
324 OPCODE_ACTIVE_STENCIL_FACE_EXT
,
325 /* GL_EXT_depth_bounds_test */
326 OPCODE_DEPTH_BOUNDS_EXT
,
327 /* GL_ARB_vertex/fragment_program */
328 OPCODE_PROGRAM_STRING_ARB
,
329 OPCODE_PROGRAM_ENV_PARAMETER_ARB
,
330 /* GL_ARB_occlusion_query */
331 OPCODE_BEGIN_QUERY_ARB
,
332 OPCODE_END_QUERY_ARB
,
333 /* GL_ARB_draw_buffers */
334 OPCODE_DRAW_BUFFERS_ARB
,
335 /* GL_ATI_fragment_shader */
336 OPCODE_TEX_BUMP_PARAMETER_ATI
,
337 /* GL_ATI_fragment_shader */
338 OPCODE_BIND_FRAGMENT_SHADER_ATI
,
339 OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
,
341 OPCODE_STENCIL_FUNC_SEPARATE
,
342 OPCODE_STENCIL_OP_SEPARATE
,
343 OPCODE_STENCIL_MASK_SEPARATE
,
345 /* GL_ARB_shader_objects */
363 OPCODE_UNIFORM_MATRIX22
,
364 OPCODE_UNIFORM_MATRIX33
,
365 OPCODE_UNIFORM_MATRIX44
,
366 OPCODE_UNIFORM_MATRIX23
,
367 OPCODE_UNIFORM_MATRIX32
,
368 OPCODE_UNIFORM_MATRIX24
,
369 OPCODE_UNIFORM_MATRIX42
,
370 OPCODE_UNIFORM_MATRIX34
,
371 OPCODE_UNIFORM_MATRIX43
,
383 /* GL_ARB_color_buffer_float */
386 /* GL_EXT_framebuffer_blit */
387 OPCODE_BLIT_FRAMEBUFFER
,
389 /* Vertex attributes -- fallback for when optimized display
390 * list build isn't active.
409 /* GL_EXT_provoking_vertex */
410 OPCODE_PROVOKING_VERTEX
,
412 /* GL_EXT_transform_feedback */
413 OPCODE_BEGIN_TRANSFORM_FEEDBACK
,
414 OPCODE_END_TRANSFORM_FEEDBACK
,
415 OPCODE_BIND_TRANSFORM_FEEDBACK
,
416 OPCODE_PAUSE_TRANSFORM_FEEDBACK
,
417 OPCODE_RESUME_TRANSFORM_FEEDBACK
,
418 OPCODE_DRAW_TRANSFORM_FEEDBACK
,
420 /* GL_EXT_texture_integer */
422 OPCODE_CLEARCOLOR_UI
,
423 OPCODE_TEXPARAMETER_I
,
424 OPCODE_TEXPARAMETER_UI
,
426 /* GL_EXT_separate_shader_objects */
427 OPCODE_ACTIVE_PROGRAM_EXT
,
428 OPCODE_USE_SHADER_PROGRAM_EXT
,
430 /* GL_ARB_instanced_arrays */
431 OPCODE_VERTEX_ATTRIB_DIVISOR
,
433 /* GL_NV_texture_barrier */
434 OPCODE_TEXTURE_BARRIER_NV
,
436 /* GL_ARB_sampler_object */
438 OPCODE_SAMPLER_PARAMETERIV
,
439 OPCODE_SAMPLER_PARAMETERFV
,
440 OPCODE_SAMPLER_PARAMETERIIV
,
441 OPCODE_SAMPLER_PARAMETERUIV
,
443 /* GL_ARB_geometry_shader4 */
444 OPCODE_PROGRAM_PARAMETERI
,
445 OPCODE_FRAMEBUFFER_TEXTURE
,
446 OPCODE_FRAMEBUFFER_TEXTURE_FACE
,
451 /* GL_NV_conditional_render */
452 OPCODE_BEGIN_CONDITIONAL_RENDER
,
453 OPCODE_END_CONDITIONAL_RENDER
,
455 /* ARB_timer_query */
456 OPCODE_QUERY_COUNTER
,
458 /* ARB_transform_feedback3 */
459 OPCODE_BEGIN_QUERY_INDEXED
,
460 OPCODE_END_QUERY_INDEXED
,
461 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
,
463 /* ARB_transform_feedback_instanced */
464 OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
,
465 OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
,
467 /* ARB_uniform_buffer_object */
468 OPCODE_UNIFORM_BLOCK_BINDING
,
470 /* The following three are meta instructions */
471 OPCODE_ERROR
, /* raise compiled-in error */
482 * Display list instructions are stored as sequences of "nodes". Nodes
483 * are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
484 * are linked together with a pointer.
486 * Each instruction in the display list is stored as a sequence of
487 * contiguous nodes in memory.
488 * Each node is the union of a variety of data types.
504 void *next
; /* If prev node's opcode==OPCODE_CONTINUE */
508 typedef union gl_dlist_node Node
;
512 * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
513 * environment. In 64-bit env, sizeof(Node)==8 anyway.
523 * How many nodes to allocate at a time.
525 * \note Reduced now that we hold vertices etc. elsewhere.
527 #define BLOCK_SIZE 256
532 * Number of nodes of storage needed for each instruction.
533 * Sizes for dynamically allocated opcodes are stored in the context struct.
535 static GLuint InstSize
[OPCODE_END_OF_LIST
+ 1];
538 void mesa_print_display_list(GLuint list
);
541 /**********************************************************************/
542 /***** Private *****/
543 /**********************************************************************/
547 * Make an empty display list. This is used by glGenLists() to
548 * reserve display list IDs.
550 static struct gl_display_list
*
551 make_list(GLuint name
, GLuint count
)
553 struct gl_display_list
*dlist
= CALLOC_STRUCT(gl_display_list
);
555 dlist
->Head
= malloc(sizeof(Node
) * count
);
556 dlist
->Head
[0].opcode
= OPCODE_END_OF_LIST
;
562 * Lookup function to just encapsulate casting.
564 static inline struct gl_display_list
*
565 lookup_list(struct gl_context
*ctx
, GLuint list
)
567 return (struct gl_display_list
*)
568 _mesa_HashLookup(ctx
->Shared
->DisplayList
, list
);
572 /** Is the given opcode an extension code? */
573 static inline GLboolean
574 is_ext_opcode(OpCode opcode
)
576 return (opcode
>= OPCODE_EXT_0
);
580 /** Destroy an extended opcode instruction */
582 ext_opcode_destroy(struct gl_context
*ctx
, Node
*node
)
584 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
586 ctx
->ListExt
->Opcode
[i
].Destroy(ctx
, &node
[1]);
587 step
= ctx
->ListExt
->Opcode
[i
].Size
;
592 /** Execute an extended opcode instruction */
594 ext_opcode_execute(struct gl_context
*ctx
, Node
*node
)
596 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
598 ctx
->ListExt
->Opcode
[i
].Execute(ctx
, &node
[1]);
599 step
= ctx
->ListExt
->Opcode
[i
].Size
;
604 /** Print an extended opcode instruction */
606 ext_opcode_print(struct gl_context
*ctx
, Node
*node
)
608 const GLint i
= node
[0].opcode
- OPCODE_EXT_0
;
610 ctx
->ListExt
->Opcode
[i
].Print(ctx
, &node
[1]);
611 step
= ctx
->ListExt
->Opcode
[i
].Size
;
617 * Delete the named display list, but don't remove from hash table.
618 * \param dlist - display list pointer
621 _mesa_delete_list(struct gl_context
*ctx
, struct gl_display_list
*dlist
)
626 n
= block
= dlist
->Head
;
628 done
= block
? GL_FALSE
: GL_TRUE
;
630 const OpCode opcode
= n
[0].opcode
;
632 /* check for extension opcodes first */
633 if (is_ext_opcode(opcode
)) {
634 n
+= ext_opcode_destroy(ctx
, n
);
638 /* for some commands, we need to free malloc'd memory */
641 n
+= InstSize
[n
[0].opcode
];
645 n
+= InstSize
[n
[0].opcode
];
647 case OPCODE_DRAW_PIXELS
:
649 n
+= InstSize
[n
[0].opcode
];
653 n
+= InstSize
[n
[0].opcode
];
655 case OPCODE_COLOR_TABLE
:
657 n
+= InstSize
[n
[0].opcode
];
659 case OPCODE_COLOR_SUB_TABLE
:
661 n
+= InstSize
[n
[0].opcode
];
663 case OPCODE_CONVOLUTION_FILTER_1D
:
665 n
+= InstSize
[n
[0].opcode
];
667 case OPCODE_CONVOLUTION_FILTER_2D
:
669 n
+= InstSize
[n
[0].opcode
];
671 case OPCODE_POLYGON_STIPPLE
:
673 n
+= InstSize
[n
[0].opcode
];
675 case OPCODE_TEX_IMAGE1D
:
677 n
+= InstSize
[n
[0].opcode
];
679 case OPCODE_TEX_IMAGE2D
:
681 n
+= InstSize
[n
[0].opcode
];
683 case OPCODE_TEX_IMAGE3D
:
685 n
+= InstSize
[n
[0].opcode
];
687 case OPCODE_TEX_SUB_IMAGE1D
:
689 n
+= InstSize
[n
[0].opcode
];
691 case OPCODE_TEX_SUB_IMAGE2D
:
693 n
+= InstSize
[n
[0].opcode
];
695 case OPCODE_TEX_SUB_IMAGE3D
:
697 n
+= InstSize
[n
[0].opcode
];
699 case OPCODE_COMPRESSED_TEX_IMAGE_1D
:
701 n
+= InstSize
[n
[0].opcode
];
703 case OPCODE_COMPRESSED_TEX_IMAGE_2D
:
705 n
+= InstSize
[n
[0].opcode
];
707 case OPCODE_COMPRESSED_TEX_IMAGE_3D
:
709 n
+= InstSize
[n
[0].opcode
];
711 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
:
713 n
+= InstSize
[n
[0].opcode
];
715 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
:
717 n
+= InstSize
[n
[0].opcode
];
719 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
:
721 n
+= InstSize
[n
[0].opcode
];
723 case OPCODE_PROGRAM_STRING_ARB
:
724 free(n
[4].data
); /* program string */
725 n
+= InstSize
[n
[0].opcode
];
727 case OPCODE_UNIFORM_1FV
:
728 case OPCODE_UNIFORM_2FV
:
729 case OPCODE_UNIFORM_3FV
:
730 case OPCODE_UNIFORM_4FV
:
731 case OPCODE_UNIFORM_1IV
:
732 case OPCODE_UNIFORM_2IV
:
733 case OPCODE_UNIFORM_3IV
:
734 case OPCODE_UNIFORM_4IV
:
735 case OPCODE_UNIFORM_1UIV
:
736 case OPCODE_UNIFORM_2UIV
:
737 case OPCODE_UNIFORM_3UIV
:
738 case OPCODE_UNIFORM_4UIV
:
740 n
+= InstSize
[n
[0].opcode
];
742 case OPCODE_UNIFORM_MATRIX22
:
743 case OPCODE_UNIFORM_MATRIX33
:
744 case OPCODE_UNIFORM_MATRIX44
:
745 case OPCODE_UNIFORM_MATRIX24
:
746 case OPCODE_UNIFORM_MATRIX42
:
747 case OPCODE_UNIFORM_MATRIX23
:
748 case OPCODE_UNIFORM_MATRIX32
:
749 case OPCODE_UNIFORM_MATRIX34
:
750 case OPCODE_UNIFORM_MATRIX43
:
752 n
+= InstSize
[n
[0].opcode
];
755 case OPCODE_CONTINUE
:
756 n
= (Node
*) n
[1].next
;
760 case OPCODE_END_OF_LIST
:
765 /* Most frequent case */
766 n
+= InstSize
[n
[0].opcode
];
777 * Destroy a display list and remove from hash table.
778 * \param list - display list number
781 destroy_list(struct gl_context
*ctx
, GLuint list
)
783 struct gl_display_list
*dlist
;
788 dlist
= lookup_list(ctx
, list
);
792 _mesa_delete_list(ctx
, dlist
);
793 _mesa_HashRemove(ctx
->Shared
->DisplayList
, list
);
798 * Translate the nth element of list from <type> to GLint.
801 translate_id(GLsizei n
, GLenum type
, const GLvoid
* list
)
813 bptr
= (GLbyte
*) list
;
814 return (GLint
) bptr
[n
];
815 case GL_UNSIGNED_BYTE
:
816 ubptr
= (GLubyte
*) list
;
817 return (GLint
) ubptr
[n
];
819 sptr
= (GLshort
*) list
;
820 return (GLint
) sptr
[n
];
821 case GL_UNSIGNED_SHORT
:
822 usptr
= (GLushort
*) list
;
823 return (GLint
) usptr
[n
];
825 iptr
= (GLint
*) list
;
827 case GL_UNSIGNED_INT
:
828 uiptr
= (GLuint
*) list
;
829 return (GLint
) uiptr
[n
];
831 fptr
= (GLfloat
*) list
;
832 return (GLint
) FLOORF(fptr
[n
]);
834 ubptr
= ((GLubyte
*) list
) + 2 * n
;
835 return (GLint
) ubptr
[0] * 256
838 ubptr
= ((GLubyte
*) list
) + 3 * n
;
839 return (GLint
) ubptr
[0] * 65536
840 + (GLint
) ubptr
[1] * 256
843 ubptr
= ((GLubyte
*) list
) + 4 * n
;
844 return (GLint
) ubptr
[0] * 16777216
845 + (GLint
) ubptr
[1] * 65536
846 + (GLint
) ubptr
[2] * 256
856 /**********************************************************************/
858 /**********************************************************************/
861 * Wrapper for _mesa_unpack_image/bitmap() that handles pixel buffer objects.
862 * If width < 0 or height < 0 or format or type are invalid we'll just
863 * return NULL. We will not generate an error since OpenGL command
864 * arguments aren't error-checked until the command is actually executed
865 * (not when they're compiled).
866 * But if we run out of memory, GL_OUT_OF_MEMORY will be recorded.
869 unpack_image(struct gl_context
*ctx
, GLuint dimensions
,
870 GLsizei width
, GLsizei height
, GLsizei depth
,
871 GLenum format
, GLenum type
, const GLvoid
* pixels
,
872 const struct gl_pixelstore_attrib
*unpack
)
874 if (width
<= 0 || height
<= 0) {
878 if (_mesa_bytes_per_pixel(format
, type
) < 0) {
879 /* bad format and/or type */
883 if (!_mesa_is_bufferobj(unpack
->BufferObj
)) {
887 if (type
== GL_BITMAP
)
888 image
= _mesa_unpack_bitmap(width
, height
, pixels
, unpack
);
890 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
891 format
, type
, pixels
, unpack
);
892 if (pixels
&& !image
) {
893 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
897 else if (_mesa_validate_pbo_access(dimensions
, unpack
, width
, height
,
898 depth
, format
, type
, INT_MAX
, pixels
)) {
899 const GLubyte
*map
, *src
;
903 ctx
->Driver
.MapBufferRange(ctx
, 0, unpack
->BufferObj
->Size
,
904 GL_MAP_READ_BIT
, unpack
->BufferObj
);
906 /* unable to map src buffer! */
907 _mesa_error(ctx
, GL_INVALID_OPERATION
, "unable to map PBO");
911 src
= ADD_POINTERS(map
, pixels
);
912 if (type
== GL_BITMAP
)
913 image
= _mesa_unpack_bitmap(width
, height
, src
, unpack
);
915 image
= _mesa_unpack_image(dimensions
, width
, height
, depth
,
916 format
, type
, src
, unpack
);
918 ctx
->Driver
.UnmapBuffer(ctx
, unpack
->BufferObj
);
921 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "display list construction");
927 _mesa_error(ctx
, GL_INVALID_OPERATION
, "invalid PBO access");
932 * Allocate space for a display list instruction (opcode + payload space).
933 * \param opcode the instruction opcode (OPCODE_* value)
934 * \param bytes instruction payload size (not counting opcode)
935 * \return pointer to allocated memory (the opcode space)
938 dlist_alloc(struct gl_context
*ctx
, OpCode opcode
, GLuint bytes
)
940 const GLuint numNodes
= 1 + (bytes
+ sizeof(Node
) - 1) / sizeof(Node
);
943 if (opcode
< (GLuint
) OPCODE_EXT_0
) {
944 if (InstSize
[opcode
] == 0) {
945 /* save instruction size now */
946 InstSize
[opcode
] = numNodes
;
949 /* make sure instruction size agrees */
950 ASSERT(numNodes
== InstSize
[opcode
]);
954 if (ctx
->ListState
.CurrentPos
+ numNodes
+ 2 > BLOCK_SIZE
) {
955 /* This block is full. Allocate a new block and chain to it */
957 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
958 n
[0].opcode
= OPCODE_CONTINUE
;
959 newblock
= malloc(sizeof(Node
) * BLOCK_SIZE
);
961 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "Building display list");
964 n
[1].next
= (Node
*) newblock
;
965 ctx
->ListState
.CurrentBlock
= newblock
;
966 ctx
->ListState
.CurrentPos
= 0;
969 n
= ctx
->ListState
.CurrentBlock
+ ctx
->ListState
.CurrentPos
;
970 ctx
->ListState
.CurrentPos
+= numNodes
;
972 n
[0].opcode
= opcode
;
980 * Allocate space for a display list instruction. Used by callers outside
981 * this file for things like VBO vertex data.
983 * \param opcode the instruction opcode (OPCODE_* value)
984 * \param bytes instruction size in bytes, not counting opcode.
985 * \return pointer to the usable data area (not including the internal
989 _mesa_dlist_alloc(struct gl_context
*ctx
, GLuint opcode
, GLuint bytes
)
991 Node
*n
= dlist_alloc(ctx
, (OpCode
) opcode
, bytes
);
993 return n
+ 1; /* return pointer to payload area, after opcode */
1000 * This function allows modules and drivers to get their own opcodes
1001 * for extending display list functionality.
1002 * \param ctx the rendering context
1003 * \param size number of bytes for storing the new display list command
1004 * \param execute function to execute the new display list command
1005 * \param destroy function to destroy the new display list command
1006 * \param print function to print the new display list command
1007 * \return the new opcode number or -1 if error
1010 _mesa_dlist_alloc_opcode(struct gl_context
*ctx
,
1012 void (*execute
) (struct gl_context
*, void *),
1013 void (*destroy
) (struct gl_context
*, void *),
1014 void (*print
) (struct gl_context
*, void *))
1016 if (ctx
->ListExt
->NumOpcodes
< MAX_DLIST_EXT_OPCODES
) {
1017 const GLuint i
= ctx
->ListExt
->NumOpcodes
++;
1018 ctx
->ListExt
->Opcode
[i
].Size
=
1019 1 + (size
+ sizeof(Node
) - 1) / sizeof(Node
);
1020 ctx
->ListExt
->Opcode
[i
].Execute
= execute
;
1021 ctx
->ListExt
->Opcode
[i
].Destroy
= destroy
;
1022 ctx
->ListExt
->Opcode
[i
].Print
= print
;
1023 return i
+ OPCODE_EXT_0
;
1030 * Allocate space for a display list instruction. The space is basically
1031 * an array of Nodes where node[0] holds the opcode, node[1] is the first
1032 * function parameter, node[2] is the second parameter, etc.
1034 * \param opcode one of OPCODE_x
1035 * \param nparams number of function parameters
1036 * \return pointer to start of instruction space
1038 static inline Node
*
1039 alloc_instruction(struct gl_context
*ctx
, OpCode opcode
, GLuint nparams
)
1041 return dlist_alloc(ctx
, opcode
, nparams
* sizeof(Node
));
1047 * Display List compilation functions
1049 static void GLAPIENTRY
1050 save_Accum(GLenum op
, GLfloat value
)
1052 GET_CURRENT_CONTEXT(ctx
);
1054 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1055 n
= alloc_instruction(ctx
, OPCODE_ACCUM
, 2);
1060 if (ctx
->ExecuteFlag
) {
1061 CALL_Accum(ctx
->Exec
, (op
, value
));
1066 static void GLAPIENTRY
1067 save_AlphaFunc(GLenum func
, GLclampf ref
)
1069 GET_CURRENT_CONTEXT(ctx
);
1071 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1072 n
= alloc_instruction(ctx
, OPCODE_ALPHA_FUNC
, 2);
1075 n
[2].f
= (GLfloat
) ref
;
1077 if (ctx
->ExecuteFlag
) {
1078 CALL_AlphaFunc(ctx
->Exec
, (func
, ref
));
1083 static void GLAPIENTRY
1084 save_BindTexture(GLenum target
, GLuint texture
)
1086 GET_CURRENT_CONTEXT(ctx
);
1088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1089 n
= alloc_instruction(ctx
, OPCODE_BIND_TEXTURE
, 2);
1094 if (ctx
->ExecuteFlag
) {
1095 CALL_BindTexture(ctx
->Exec
, (target
, texture
));
1100 static void GLAPIENTRY
1101 save_Bitmap(GLsizei width
, GLsizei height
,
1102 GLfloat xorig
, GLfloat yorig
,
1103 GLfloat xmove
, GLfloat ymove
, const GLubyte
* pixels
)
1105 GET_CURRENT_CONTEXT(ctx
);
1107 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1108 n
= alloc_instruction(ctx
, OPCODE_BITMAP
, 7);
1110 n
[1].i
= (GLint
) width
;
1111 n
[2].i
= (GLint
) height
;
1116 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, GL_COLOR_INDEX
,
1117 GL_BITMAP
, pixels
, &ctx
->Unpack
);
1119 if (ctx
->ExecuteFlag
) {
1120 CALL_Bitmap(ctx
->Exec
, (width
, height
,
1121 xorig
, yorig
, xmove
, ymove
, pixels
));
1126 static void GLAPIENTRY
1127 save_BlendEquation(GLenum mode
)
1129 GET_CURRENT_CONTEXT(ctx
);
1131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1132 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION
, 1);
1136 if (ctx
->ExecuteFlag
) {
1137 CALL_BlendEquation(ctx
->Exec
, (mode
));
1142 static void GLAPIENTRY
1143 save_BlendEquationSeparateEXT(GLenum modeRGB
, GLenum modeA
)
1145 GET_CURRENT_CONTEXT(ctx
);
1147 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1148 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE
, 2);
1153 if (ctx
->ExecuteFlag
) {
1154 CALL_BlendEquationSeparate(ctx
->Exec
, (modeRGB
, modeA
));
1159 static void GLAPIENTRY
1160 save_BlendFuncSeparateEXT(GLenum sfactorRGB
, GLenum dfactorRGB
,
1161 GLenum sfactorA
, GLenum dfactorA
)
1163 GET_CURRENT_CONTEXT(ctx
);
1165 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1166 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE
, 4);
1168 n
[1].e
= sfactorRGB
;
1169 n
[2].e
= dfactorRGB
;
1173 if (ctx
->ExecuteFlag
) {
1174 CALL_BlendFuncSeparate(ctx
->Exec
,
1175 (sfactorRGB
, dfactorRGB
, sfactorA
, dfactorA
));
1180 static void GLAPIENTRY
1181 save_BlendFunc(GLenum srcfactor
, GLenum dstfactor
)
1183 save_BlendFuncSeparateEXT(srcfactor
, dstfactor
, srcfactor
, dstfactor
);
1187 static void GLAPIENTRY
1188 save_BlendColor(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1190 GET_CURRENT_CONTEXT(ctx
);
1192 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1193 n
= alloc_instruction(ctx
, OPCODE_BLEND_COLOR
, 4);
1200 if (ctx
->ExecuteFlag
) {
1201 CALL_BlendColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1205 /* GL_ARB_draw_buffers_blend */
1206 static void GLAPIENTRY
1207 save_BlendFuncSeparatei(GLuint buf
, GLenum sfactorRGB
, GLenum dfactorRGB
,
1208 GLenum sfactorA
, GLenum dfactorA
)
1210 GET_CURRENT_CONTEXT(ctx
);
1212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1213 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 5);
1216 n
[2].e
= sfactorRGB
;
1217 n
[3].e
= dfactorRGB
;
1221 if (ctx
->ExecuteFlag
) {
1222 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (buf
, sfactorRGB
, dfactorRGB
,
1223 sfactorA
, dfactorA
));
1227 /* GL_ARB_draw_buffers_blend */
1228 static void GLAPIENTRY
1229 save_BlendFunci(GLuint buf
, GLenum sfactor
, GLenum dfactor
)
1231 GET_CURRENT_CONTEXT(ctx
);
1233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1234 n
= alloc_instruction(ctx
, OPCODE_BLEND_FUNC_SEPARATE_I
, 3);
1240 if (ctx
->ExecuteFlag
) {
1241 CALL_BlendFunciARB(ctx
->Exec
, (buf
, sfactor
, dfactor
));
1245 /* GL_ARB_draw_buffers_blend */
1246 static void GLAPIENTRY
1247 save_BlendEquationi(GLuint buf
, GLenum mode
)
1249 GET_CURRENT_CONTEXT(ctx
);
1251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1252 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_I
, 2);
1257 if (ctx
->ExecuteFlag
) {
1258 CALL_BlendEquationiARB(ctx
->Exec
, (buf
, mode
));
1262 /* GL_ARB_draw_buffers_blend */
1263 static void GLAPIENTRY
1264 save_BlendEquationSeparatei(GLuint buf
, GLenum modeRGB
, GLenum modeA
)
1266 GET_CURRENT_CONTEXT(ctx
);
1268 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1269 n
= alloc_instruction(ctx
, OPCODE_BLEND_EQUATION_SEPARATE_I
, 3);
1275 if (ctx
->ExecuteFlag
) {
1276 CALL_BlendEquationSeparateiARB(ctx
->Exec
, (buf
, modeRGB
, modeA
));
1281 /* GL_ARB_draw_instanced. */
1282 static void GLAPIENTRY
1283 save_DrawArraysInstancedARB(GLenum mode
,
1288 GET_CURRENT_CONTEXT(ctx
);
1289 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1290 "glDrawArraysInstanced() during display list compile");
1293 static void GLAPIENTRY
1294 save_DrawElementsInstancedARB(GLenum mode
,
1297 const GLvoid
*indices
,
1300 GET_CURRENT_CONTEXT(ctx
);
1301 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1302 "glDrawElementsInstanced() during display list compile");
1305 static void GLAPIENTRY
1306 save_DrawElementsInstancedBaseVertexARB(GLenum mode
,
1309 const GLvoid
*indices
,
1313 GET_CURRENT_CONTEXT(ctx
);
1314 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1315 "glDrawElementsInstancedBaseVertex() during display list compile");
1318 /* GL_ARB_base_instance. */
1319 static void GLAPIENTRY
1320 save_DrawArraysInstancedBaseInstance(GLenum mode
,
1324 GLuint baseinstance
)
1326 GET_CURRENT_CONTEXT(ctx
);
1327 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1328 "glDrawArraysInstancedBaseInstance() during display list compile");
1331 static void APIENTRY
1332 save_DrawElementsInstancedBaseInstance(GLenum mode
,
1335 const void *indices
,
1337 GLuint baseinstance
)
1339 GET_CURRENT_CONTEXT(ctx
);
1340 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1341 "glDrawElementsInstancedBaseInstance() during display list compile");
1344 static void APIENTRY
1345 save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode
,
1348 const void *indices
,
1351 GLuint baseinstance
)
1353 GET_CURRENT_CONTEXT(ctx
);
1354 _mesa_error(ctx
, GL_INVALID_OPERATION
,
1355 "glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
1358 static void invalidate_saved_current_state( struct gl_context
*ctx
)
1362 for (i
= 0; i
< VERT_ATTRIB_MAX
; i
++)
1363 ctx
->ListState
.ActiveAttribSize
[i
] = 0;
1365 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++)
1366 ctx
->ListState
.ActiveMaterialSize
[i
] = 0;
1368 memset(&ctx
->ListState
.Current
, 0, sizeof ctx
->ListState
.Current
);
1370 ctx
->Driver
.CurrentSavePrimitive
= PRIM_UNKNOWN
;
1373 static void GLAPIENTRY
1374 save_CallList(GLuint list
)
1376 GET_CURRENT_CONTEXT(ctx
);
1378 SAVE_FLUSH_VERTICES(ctx
);
1380 n
= alloc_instruction(ctx
, OPCODE_CALL_LIST
, 1);
1385 /* After this, we don't know what state we're in. Invalidate all
1386 * cached information previously gathered:
1388 invalidate_saved_current_state( ctx
);
1390 if (ctx
->ExecuteFlag
) {
1391 _mesa_CallList(list
);
1396 static void GLAPIENTRY
1397 save_CallLists(GLsizei num
, GLenum type
, const GLvoid
* lists
)
1399 GET_CURRENT_CONTEXT(ctx
);
1401 GLboolean typeErrorFlag
;
1403 SAVE_FLUSH_VERTICES(ctx
);
1407 case GL_UNSIGNED_BYTE
:
1409 case GL_UNSIGNED_SHORT
:
1411 case GL_UNSIGNED_INT
:
1416 typeErrorFlag
= GL_FALSE
;
1419 typeErrorFlag
= GL_TRUE
;
1422 for (i
= 0; i
< num
; i
++) {
1423 GLint list
= translate_id(i
, type
, lists
);
1424 Node
*n
= alloc_instruction(ctx
, OPCODE_CALL_LIST_OFFSET
, 2);
1427 n
[2].b
= typeErrorFlag
;
1431 /* After this, we don't know what state we're in. Invalidate all
1432 * cached information previously gathered:
1434 invalidate_saved_current_state( ctx
);
1436 if (ctx
->ExecuteFlag
) {
1437 CALL_CallLists(ctx
->Exec
, (num
, type
, lists
));
1442 static void GLAPIENTRY
1443 save_Clear(GLbitfield mask
)
1445 GET_CURRENT_CONTEXT(ctx
);
1447 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1448 n
= alloc_instruction(ctx
, OPCODE_CLEAR
, 1);
1452 if (ctx
->ExecuteFlag
) {
1453 CALL_Clear(ctx
->Exec
, (mask
));
1458 static void GLAPIENTRY
1459 save_ClearBufferiv(GLenum buffer
, GLint drawbuffer
, const GLint
*value
)
1461 GET_CURRENT_CONTEXT(ctx
);
1463 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1464 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_IV
, 6);
1467 n
[2].i
= drawbuffer
;
1469 if (buffer
== GL_COLOR
) {
1480 if (ctx
->ExecuteFlag
) {
1481 CALL_ClearBufferiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1486 static void GLAPIENTRY
1487 save_ClearBufferuiv(GLenum buffer
, GLint drawbuffer
, const GLuint
*value
)
1489 GET_CURRENT_CONTEXT(ctx
);
1491 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1492 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_UIV
, 6);
1495 n
[2].i
= drawbuffer
;
1497 if (buffer
== GL_COLOR
) {
1508 if (ctx
->ExecuteFlag
) {
1509 CALL_ClearBufferuiv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1514 static void GLAPIENTRY
1515 save_ClearBufferfv(GLenum buffer
, GLint drawbuffer
, const GLfloat
*value
)
1517 GET_CURRENT_CONTEXT(ctx
);
1519 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1520 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FV
, 6);
1523 n
[2].i
= drawbuffer
;
1525 if (buffer
== GL_COLOR
) {
1536 if (ctx
->ExecuteFlag
) {
1537 CALL_ClearBufferfv(ctx
->Exec
, (buffer
, drawbuffer
, value
));
1542 static void GLAPIENTRY
1543 save_ClearBufferfi(GLenum buffer
, GLint drawbuffer
,
1544 GLfloat depth
, GLint stencil
)
1546 GET_CURRENT_CONTEXT(ctx
);
1548 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1549 n
= alloc_instruction(ctx
, OPCODE_CLEAR_BUFFER_FI
, 4);
1552 n
[2].i
= drawbuffer
;
1556 if (ctx
->ExecuteFlag
) {
1557 CALL_ClearBufferfi(ctx
->Exec
, (buffer
, drawbuffer
, depth
, stencil
));
1562 static void GLAPIENTRY
1563 save_ClearAccum(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
1565 GET_CURRENT_CONTEXT(ctx
);
1567 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1568 n
= alloc_instruction(ctx
, OPCODE_CLEAR_ACCUM
, 4);
1575 if (ctx
->ExecuteFlag
) {
1576 CALL_ClearAccum(ctx
->Exec
, (red
, green
, blue
, alpha
));
1581 static void GLAPIENTRY
1582 save_ClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
1584 GET_CURRENT_CONTEXT(ctx
);
1586 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1587 n
= alloc_instruction(ctx
, OPCODE_CLEAR_COLOR
, 4);
1594 if (ctx
->ExecuteFlag
) {
1595 CALL_ClearColor(ctx
->Exec
, (red
, green
, blue
, alpha
));
1600 static void GLAPIENTRY
1601 save_ClearDepth(GLclampd depth
)
1603 GET_CURRENT_CONTEXT(ctx
);
1605 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1606 n
= alloc_instruction(ctx
, OPCODE_CLEAR_DEPTH
, 1);
1608 n
[1].f
= (GLfloat
) depth
;
1610 if (ctx
->ExecuteFlag
) {
1611 CALL_ClearDepth(ctx
->Exec
, (depth
));
1616 static void GLAPIENTRY
1617 save_ClearIndex(GLfloat c
)
1619 GET_CURRENT_CONTEXT(ctx
);
1621 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1622 n
= alloc_instruction(ctx
, OPCODE_CLEAR_INDEX
, 1);
1626 if (ctx
->ExecuteFlag
) {
1627 CALL_ClearIndex(ctx
->Exec
, (c
));
1632 static void GLAPIENTRY
1633 save_ClearStencil(GLint s
)
1635 GET_CURRENT_CONTEXT(ctx
);
1637 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1638 n
= alloc_instruction(ctx
, OPCODE_CLEAR_STENCIL
, 1);
1642 if (ctx
->ExecuteFlag
) {
1643 CALL_ClearStencil(ctx
->Exec
, (s
));
1648 static void GLAPIENTRY
1649 save_ClipPlane(GLenum plane
, const GLdouble
* equ
)
1651 GET_CURRENT_CONTEXT(ctx
);
1653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1654 n
= alloc_instruction(ctx
, OPCODE_CLIP_PLANE
, 5);
1657 n
[2].f
= (GLfloat
) equ
[0];
1658 n
[3].f
= (GLfloat
) equ
[1];
1659 n
[4].f
= (GLfloat
) equ
[2];
1660 n
[5].f
= (GLfloat
) equ
[3];
1662 if (ctx
->ExecuteFlag
) {
1663 CALL_ClipPlane(ctx
->Exec
, (plane
, equ
));
1669 static void GLAPIENTRY
1670 save_ColorMask(GLboolean red
, GLboolean green
,
1671 GLboolean blue
, GLboolean alpha
)
1673 GET_CURRENT_CONTEXT(ctx
);
1675 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1676 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK
, 4);
1683 if (ctx
->ExecuteFlag
) {
1684 CALL_ColorMask(ctx
->Exec
, (red
, green
, blue
, alpha
));
1689 static void GLAPIENTRY
1690 save_ColorMaskIndexed(GLuint buf
, GLboolean red
, GLboolean green
,
1691 GLboolean blue
, GLboolean alpha
)
1693 GET_CURRENT_CONTEXT(ctx
);
1695 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1696 n
= alloc_instruction(ctx
, OPCODE_COLOR_MASK_INDEXED
, 5);
1704 if (ctx
->ExecuteFlag
) {
1705 /*CALL_ColorMaski(ctx->Exec, (buf, red, green, blue, alpha));*/
1710 static void GLAPIENTRY
1711 save_ColorMaterial(GLenum face
, GLenum mode
)
1713 GET_CURRENT_CONTEXT(ctx
);
1715 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1717 n
= alloc_instruction(ctx
, OPCODE_COLOR_MATERIAL
, 2);
1722 if (ctx
->ExecuteFlag
) {
1723 CALL_ColorMaterial(ctx
->Exec
, (face
, mode
));
1728 static void GLAPIENTRY
1729 save_ColorTable(GLenum target
, GLenum internalFormat
,
1730 GLsizei width
, GLenum format
, GLenum type
,
1731 const GLvoid
* table
)
1733 GET_CURRENT_CONTEXT(ctx
);
1734 if (_mesa_is_proxy_texture(target
)) {
1735 /* execute immediately */
1736 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1737 format
, type
, table
));
1741 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1742 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE
, 6);
1745 n
[2].e
= internalFormat
;
1749 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, table
,
1752 if (ctx
->ExecuteFlag
) {
1753 CALL_ColorTable(ctx
->Exec
, (target
, internalFormat
, width
,
1754 format
, type
, table
));
1761 static void GLAPIENTRY
1762 save_ColorTableParameterfv(GLenum target
, GLenum pname
,
1763 const GLfloat
*params
)
1765 GET_CURRENT_CONTEXT(ctx
);
1768 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1770 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_FV
, 6);
1775 if (pname
== GL_COLOR_TABLE_SGI
||
1776 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1777 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1784 if (ctx
->ExecuteFlag
) {
1785 CALL_ColorTableParameterfv(ctx
->Exec
, (target
, pname
, params
));
1790 static void GLAPIENTRY
1791 save_ColorTableParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1793 GET_CURRENT_CONTEXT(ctx
);
1796 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1798 n
= alloc_instruction(ctx
, OPCODE_COLOR_TABLE_PARAMETER_IV
, 6);
1803 if (pname
== GL_COLOR_TABLE_SGI
||
1804 pname
== GL_POST_CONVOLUTION_COLOR_TABLE_SGI
||
1805 pname
== GL_TEXTURE_COLOR_TABLE_SGI
) {
1812 if (ctx
->ExecuteFlag
) {
1813 CALL_ColorTableParameteriv(ctx
->Exec
, (target
, pname
, params
));
1819 static void GLAPIENTRY
1820 save_ColorSubTable(GLenum target
, GLsizei start
, GLsizei count
,
1821 GLenum format
, GLenum type
, const GLvoid
* table
)
1823 GET_CURRENT_CONTEXT(ctx
);
1825 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1826 n
= alloc_instruction(ctx
, OPCODE_COLOR_SUB_TABLE
, 6);
1833 n
[6].data
= unpack_image(ctx
, 1, count
, 1, 1, format
, type
, table
,
1836 if (ctx
->ExecuteFlag
) {
1837 CALL_ColorSubTable(ctx
->Exec
,
1838 (target
, start
, count
, format
, type
, table
));
1843 static void GLAPIENTRY
1844 save_CopyColorSubTable(GLenum target
, GLsizei start
,
1845 GLint x
, GLint y
, GLsizei width
)
1847 GET_CURRENT_CONTEXT(ctx
);
1850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1851 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_SUB_TABLE
, 5);
1859 if (ctx
->ExecuteFlag
) {
1860 CALL_CopyColorSubTable(ctx
->Exec
, (target
, start
, x
, y
, width
));
1865 static void GLAPIENTRY
1866 save_CopyColorTable(GLenum target
, GLenum internalformat
,
1867 GLint x
, GLint y
, GLsizei width
)
1869 GET_CURRENT_CONTEXT(ctx
);
1872 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1873 n
= alloc_instruction(ctx
, OPCODE_COPY_COLOR_TABLE
, 5);
1876 n
[2].e
= internalformat
;
1881 if (ctx
->ExecuteFlag
) {
1882 CALL_CopyColorTable(ctx
->Exec
, (target
, internalformat
, x
, y
, width
));
1887 static void GLAPIENTRY
1888 save_ConvolutionFilter1D(GLenum target
, GLenum internalFormat
, GLsizei width
,
1889 GLenum format
, GLenum type
, const GLvoid
* filter
)
1891 GET_CURRENT_CONTEXT(ctx
);
1894 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1896 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_1D
, 6);
1899 n
[2].e
= internalFormat
;
1903 n
[6].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
, filter
,
1906 if (ctx
->ExecuteFlag
) {
1907 CALL_ConvolutionFilter1D(ctx
->Exec
, (target
, internalFormat
, width
,
1908 format
, type
, filter
));
1913 static void GLAPIENTRY
1914 save_ConvolutionFilter2D(GLenum target
, GLenum internalFormat
,
1915 GLsizei width
, GLsizei height
, GLenum format
,
1916 GLenum type
, const GLvoid
* filter
)
1918 GET_CURRENT_CONTEXT(ctx
);
1921 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1923 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_FILTER_2D
, 7);
1926 n
[2].e
= internalFormat
;
1931 n
[7].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
, filter
,
1934 if (ctx
->ExecuteFlag
) {
1935 CALL_ConvolutionFilter2D(ctx
->Exec
,
1936 (target
, internalFormat
, width
, height
, format
,
1942 static void GLAPIENTRY
1943 save_ConvolutionParameteri(GLenum target
, GLenum pname
, GLint param
)
1945 GET_CURRENT_CONTEXT(ctx
);
1947 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1948 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_I
, 3);
1954 if (ctx
->ExecuteFlag
) {
1955 CALL_ConvolutionParameteri(ctx
->Exec
, (target
, pname
, param
));
1960 static void GLAPIENTRY
1961 save_ConvolutionParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
1963 GET_CURRENT_CONTEXT(ctx
);
1965 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1966 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_IV
, 6);
1971 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
1972 pname
== GL_CONVOLUTION_FILTER_SCALE
||
1973 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
1979 n
[4].i
= n
[5].i
= n
[6].i
= 0;
1982 if (ctx
->ExecuteFlag
) {
1983 CALL_ConvolutionParameteriv(ctx
->Exec
, (target
, pname
, params
));
1988 static void GLAPIENTRY
1989 save_ConvolutionParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1991 GET_CURRENT_CONTEXT(ctx
);
1993 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
1994 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_F
, 3);
2000 if (ctx
->ExecuteFlag
) {
2001 CALL_ConvolutionParameterf(ctx
->Exec
, (target
, pname
, param
));
2006 static void GLAPIENTRY
2007 save_ConvolutionParameterfv(GLenum target
, GLenum pname
,
2008 const GLfloat
*params
)
2010 GET_CURRENT_CONTEXT(ctx
);
2012 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2013 n
= alloc_instruction(ctx
, OPCODE_CONVOLUTION_PARAMETER_FV
, 6);
2018 if (pname
== GL_CONVOLUTION_BORDER_COLOR
||
2019 pname
== GL_CONVOLUTION_FILTER_SCALE
||
2020 pname
== GL_CONVOLUTION_FILTER_BIAS
) {
2026 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
2029 if (ctx
->ExecuteFlag
) {
2030 CALL_ConvolutionParameterfv(ctx
->Exec
, (target
, pname
, params
));
2035 static void GLAPIENTRY
2036 save_CopyPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum type
)
2038 GET_CURRENT_CONTEXT(ctx
);
2040 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2041 n
= alloc_instruction(ctx
, OPCODE_COPY_PIXELS
, 5);
2045 n
[3].i
= (GLint
) width
;
2046 n
[4].i
= (GLint
) height
;
2049 if (ctx
->ExecuteFlag
) {
2050 CALL_CopyPixels(ctx
->Exec
, (x
, y
, width
, height
, type
));
2056 static void GLAPIENTRY
2057 save_CopyTexImage1D(GLenum target
, GLint level
, GLenum internalformat
,
2058 GLint x
, GLint y
, GLsizei width
, GLint border
)
2060 GET_CURRENT_CONTEXT(ctx
);
2062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2063 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE1D
, 7);
2067 n
[3].e
= internalformat
;
2073 if (ctx
->ExecuteFlag
) {
2074 CALL_CopyTexImage1D(ctx
->Exec
, (target
, level
, internalformat
,
2075 x
, y
, width
, border
));
2080 static void GLAPIENTRY
2081 save_CopyTexImage2D(GLenum target
, GLint level
,
2082 GLenum internalformat
,
2083 GLint x
, GLint y
, GLsizei width
,
2084 GLsizei height
, GLint border
)
2086 GET_CURRENT_CONTEXT(ctx
);
2088 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2089 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_IMAGE2D
, 8);
2093 n
[3].e
= internalformat
;
2100 if (ctx
->ExecuteFlag
) {
2101 CALL_CopyTexImage2D(ctx
->Exec
, (target
, level
, internalformat
,
2102 x
, y
, width
, height
, border
));
2108 static void GLAPIENTRY
2109 save_CopyTexSubImage1D(GLenum target
, GLint level
,
2110 GLint xoffset
, GLint x
, GLint y
, GLsizei width
)
2112 GET_CURRENT_CONTEXT(ctx
);
2114 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2115 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE1D
, 6);
2124 if (ctx
->ExecuteFlag
) {
2125 CALL_CopyTexSubImage1D(ctx
->Exec
,
2126 (target
, level
, xoffset
, x
, y
, width
));
2131 static void GLAPIENTRY
2132 save_CopyTexSubImage2D(GLenum target
, GLint level
,
2133 GLint xoffset
, GLint yoffset
,
2134 GLint x
, GLint y
, GLsizei width
, GLint height
)
2136 GET_CURRENT_CONTEXT(ctx
);
2138 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2139 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE2D
, 8);
2150 if (ctx
->ExecuteFlag
) {
2151 CALL_CopyTexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
2152 x
, y
, width
, height
));
2157 static void GLAPIENTRY
2158 save_CopyTexSubImage3D(GLenum target
, GLint level
,
2159 GLint xoffset
, GLint yoffset
, GLint zoffset
,
2160 GLint x
, GLint y
, GLsizei width
, GLint height
)
2162 GET_CURRENT_CONTEXT(ctx
);
2164 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2165 n
= alloc_instruction(ctx
, OPCODE_COPY_TEX_SUB_IMAGE3D
, 9);
2177 if (ctx
->ExecuteFlag
) {
2178 CALL_CopyTexSubImage3D(ctx
->Exec
, (target
, level
,
2179 xoffset
, yoffset
, zoffset
,
2180 x
, y
, width
, height
));
2185 static void GLAPIENTRY
2186 save_CullFace(GLenum mode
)
2188 GET_CURRENT_CONTEXT(ctx
);
2190 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2191 n
= alloc_instruction(ctx
, OPCODE_CULL_FACE
, 1);
2195 if (ctx
->ExecuteFlag
) {
2196 CALL_CullFace(ctx
->Exec
, (mode
));
2201 static void GLAPIENTRY
2202 save_DepthFunc(GLenum func
)
2204 GET_CURRENT_CONTEXT(ctx
);
2206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2207 n
= alloc_instruction(ctx
, OPCODE_DEPTH_FUNC
, 1);
2211 if (ctx
->ExecuteFlag
) {
2212 CALL_DepthFunc(ctx
->Exec
, (func
));
2217 static void GLAPIENTRY
2218 save_DepthMask(GLboolean mask
)
2220 GET_CURRENT_CONTEXT(ctx
);
2222 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2223 n
= alloc_instruction(ctx
, OPCODE_DEPTH_MASK
, 1);
2227 if (ctx
->ExecuteFlag
) {
2228 CALL_DepthMask(ctx
->Exec
, (mask
));
2233 static void GLAPIENTRY
2234 save_DepthRange(GLclampd nearval
, GLclampd farval
)
2236 GET_CURRENT_CONTEXT(ctx
);
2238 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2239 n
= alloc_instruction(ctx
, OPCODE_DEPTH_RANGE
, 2);
2241 n
[1].f
= (GLfloat
) nearval
;
2242 n
[2].f
= (GLfloat
) farval
;
2244 if (ctx
->ExecuteFlag
) {
2245 CALL_DepthRange(ctx
->Exec
, (nearval
, farval
));
2250 static void GLAPIENTRY
2251 save_Disable(GLenum cap
)
2253 GET_CURRENT_CONTEXT(ctx
);
2255 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2256 n
= alloc_instruction(ctx
, OPCODE_DISABLE
, 1);
2260 if (ctx
->ExecuteFlag
) {
2261 CALL_Disable(ctx
->Exec
, (cap
));
2266 static void GLAPIENTRY
2267 save_DisableIndexed(GLuint index
, GLenum cap
)
2269 GET_CURRENT_CONTEXT(ctx
);
2271 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2272 n
= alloc_instruction(ctx
, OPCODE_DISABLE_INDEXED
, 2);
2277 if (ctx
->ExecuteFlag
) {
2278 CALL_Disablei(ctx
->Exec
, (index
, cap
));
2283 static void GLAPIENTRY
2284 save_DrawBuffer(GLenum mode
)
2286 GET_CURRENT_CONTEXT(ctx
);
2288 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2289 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFER
, 1);
2293 if (ctx
->ExecuteFlag
) {
2294 CALL_DrawBuffer(ctx
->Exec
, (mode
));
2299 static void GLAPIENTRY
2300 save_DrawPixels(GLsizei width
, GLsizei height
,
2301 GLenum format
, GLenum type
, const GLvoid
* pixels
)
2303 GET_CURRENT_CONTEXT(ctx
);
2306 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2308 n
= alloc_instruction(ctx
, OPCODE_DRAW_PIXELS
, 5);
2314 n
[5].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
2315 pixels
, &ctx
->Unpack
);
2317 if (ctx
->ExecuteFlag
) {
2318 CALL_DrawPixels(ctx
->Exec
, (width
, height
, format
, type
, pixels
));
2324 static void GLAPIENTRY
2325 save_Enable(GLenum cap
)
2327 GET_CURRENT_CONTEXT(ctx
);
2329 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2330 n
= alloc_instruction(ctx
, OPCODE_ENABLE
, 1);
2334 if (ctx
->ExecuteFlag
) {
2335 CALL_Enable(ctx
->Exec
, (cap
));
2341 static void GLAPIENTRY
2342 save_EnableIndexed(GLuint index
, GLenum cap
)
2344 GET_CURRENT_CONTEXT(ctx
);
2346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2347 n
= alloc_instruction(ctx
, OPCODE_ENABLE_INDEXED
, 2);
2352 if (ctx
->ExecuteFlag
) {
2353 CALL_Enablei(ctx
->Exec
, (index
, cap
));
2359 static void GLAPIENTRY
2360 save_EvalMesh1(GLenum mode
, GLint i1
, GLint i2
)
2362 GET_CURRENT_CONTEXT(ctx
);
2364 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2365 n
= alloc_instruction(ctx
, OPCODE_EVALMESH1
, 3);
2371 if (ctx
->ExecuteFlag
) {
2372 CALL_EvalMesh1(ctx
->Exec
, (mode
, i1
, i2
));
2377 static void GLAPIENTRY
2378 save_EvalMesh2(GLenum mode
, GLint i1
, GLint i2
, GLint j1
, GLint j2
)
2380 GET_CURRENT_CONTEXT(ctx
);
2382 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2383 n
= alloc_instruction(ctx
, OPCODE_EVALMESH2
, 5);
2391 if (ctx
->ExecuteFlag
) {
2392 CALL_EvalMesh2(ctx
->Exec
, (mode
, i1
, i2
, j1
, j2
));
2399 static void GLAPIENTRY
2400 save_Fogfv(GLenum pname
, const GLfloat
*params
)
2402 GET_CURRENT_CONTEXT(ctx
);
2404 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2405 n
= alloc_instruction(ctx
, OPCODE_FOG
, 5);
2413 if (ctx
->ExecuteFlag
) {
2414 CALL_Fogfv(ctx
->Exec
, (pname
, params
));
2419 static void GLAPIENTRY
2420 save_Fogf(GLenum pname
, GLfloat param
)
2424 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2425 save_Fogfv(pname
, parray
);
2429 static void GLAPIENTRY
2430 save_Fogiv(GLenum pname
, const GLint
*params
)
2435 case GL_FOG_DENSITY
:
2439 p
[0] = (GLfloat
) *params
;
2445 p
[0] = INT_TO_FLOAT(params
[0]);
2446 p
[1] = INT_TO_FLOAT(params
[1]);
2447 p
[2] = INT_TO_FLOAT(params
[2]);
2448 p
[3] = INT_TO_FLOAT(params
[3]);
2451 /* Error will be caught later in gl_Fogfv */
2452 ASSIGN_4V(p
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2454 save_Fogfv(pname
, p
);
2458 static void GLAPIENTRY
2459 save_Fogi(GLenum pname
, GLint param
)
2463 parray
[1] = parray
[2] = parray
[3] = 0;
2464 save_Fogiv(pname
, parray
);
2468 static void GLAPIENTRY
2469 save_FrontFace(GLenum mode
)
2471 GET_CURRENT_CONTEXT(ctx
);
2473 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2474 n
= alloc_instruction(ctx
, OPCODE_FRONT_FACE
, 1);
2478 if (ctx
->ExecuteFlag
) {
2479 CALL_FrontFace(ctx
->Exec
, (mode
));
2484 static void GLAPIENTRY
2485 save_Frustum(GLdouble left
, GLdouble right
,
2486 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
2488 GET_CURRENT_CONTEXT(ctx
);
2490 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2491 n
= alloc_instruction(ctx
, OPCODE_FRUSTUM
, 6);
2493 n
[1].f
= (GLfloat
) left
;
2494 n
[2].f
= (GLfloat
) right
;
2495 n
[3].f
= (GLfloat
) bottom
;
2496 n
[4].f
= (GLfloat
) top
;
2497 n
[5].f
= (GLfloat
) nearval
;
2498 n
[6].f
= (GLfloat
) farval
;
2500 if (ctx
->ExecuteFlag
) {
2501 CALL_Frustum(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
2506 static void GLAPIENTRY
2507 save_Hint(GLenum target
, GLenum mode
)
2509 GET_CURRENT_CONTEXT(ctx
);
2511 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2512 n
= alloc_instruction(ctx
, OPCODE_HINT
, 2);
2517 if (ctx
->ExecuteFlag
) {
2518 CALL_Hint(ctx
->Exec
, (target
, mode
));
2523 static void GLAPIENTRY
2524 save_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
,
2527 GET_CURRENT_CONTEXT(ctx
);
2530 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2531 n
= alloc_instruction(ctx
, OPCODE_HISTOGRAM
, 4);
2535 n
[3].e
= internalFormat
;
2538 if (ctx
->ExecuteFlag
) {
2539 CALL_Histogram(ctx
->Exec
, (target
, width
, internalFormat
, sink
));
2544 static void GLAPIENTRY
2545 save_IndexMask(GLuint mask
)
2547 GET_CURRENT_CONTEXT(ctx
);
2549 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2550 n
= alloc_instruction(ctx
, OPCODE_INDEX_MASK
, 1);
2554 if (ctx
->ExecuteFlag
) {
2555 CALL_IndexMask(ctx
->Exec
, (mask
));
2560 static void GLAPIENTRY
2561 save_InitNames(void)
2563 GET_CURRENT_CONTEXT(ctx
);
2564 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2565 (void) alloc_instruction(ctx
, OPCODE_INIT_NAMES
, 0);
2566 if (ctx
->ExecuteFlag
) {
2567 CALL_InitNames(ctx
->Exec
, ());
2572 static void GLAPIENTRY
2573 save_Lightfv(GLenum light
, GLenum pname
, const GLfloat
*params
)
2575 GET_CURRENT_CONTEXT(ctx
);
2577 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2578 n
= alloc_instruction(ctx
, OPCODE_LIGHT
, 6);
2596 case GL_SPOT_DIRECTION
:
2599 case GL_SPOT_EXPONENT
:
2602 case GL_SPOT_CUTOFF
:
2605 case GL_CONSTANT_ATTENUATION
:
2608 case GL_LINEAR_ATTENUATION
:
2611 case GL_QUADRATIC_ATTENUATION
:
2617 for (i
= 0; i
< nParams
; i
++) {
2618 n
[3 + i
].f
= params
[i
];
2621 if (ctx
->ExecuteFlag
) {
2622 CALL_Lightfv(ctx
->Exec
, (light
, pname
, params
));
2627 static void GLAPIENTRY
2628 save_Lightf(GLenum light
, GLenum pname
, GLfloat param
)
2632 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2633 save_Lightfv(light
, pname
, parray
);
2637 static void GLAPIENTRY
2638 save_Lightiv(GLenum light
, GLenum pname
, const GLint
*params
)
2645 fparam
[0] = INT_TO_FLOAT(params
[0]);
2646 fparam
[1] = INT_TO_FLOAT(params
[1]);
2647 fparam
[2] = INT_TO_FLOAT(params
[2]);
2648 fparam
[3] = INT_TO_FLOAT(params
[3]);
2651 fparam
[0] = (GLfloat
) params
[0];
2652 fparam
[1] = (GLfloat
) params
[1];
2653 fparam
[2] = (GLfloat
) params
[2];
2654 fparam
[3] = (GLfloat
) params
[3];
2656 case GL_SPOT_DIRECTION
:
2657 fparam
[0] = (GLfloat
) params
[0];
2658 fparam
[1] = (GLfloat
) params
[1];
2659 fparam
[2] = (GLfloat
) params
[2];
2661 case GL_SPOT_EXPONENT
:
2662 case GL_SPOT_CUTOFF
:
2663 case GL_CONSTANT_ATTENUATION
:
2664 case GL_LINEAR_ATTENUATION
:
2665 case GL_QUADRATIC_ATTENUATION
:
2666 fparam
[0] = (GLfloat
) params
[0];
2669 /* error will be caught later in gl_Lightfv */
2672 save_Lightfv(light
, pname
, fparam
);
2676 static void GLAPIENTRY
2677 save_Lighti(GLenum light
, GLenum pname
, GLint param
)
2681 parray
[1] = parray
[2] = parray
[3] = 0;
2682 save_Lightiv(light
, pname
, parray
);
2686 static void GLAPIENTRY
2687 save_LightModelfv(GLenum pname
, const GLfloat
*params
)
2689 GET_CURRENT_CONTEXT(ctx
);
2691 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2692 n
= alloc_instruction(ctx
, OPCODE_LIGHT_MODEL
, 5);
2700 if (ctx
->ExecuteFlag
) {
2701 CALL_LightModelfv(ctx
->Exec
, (pname
, params
));
2706 static void GLAPIENTRY
2707 save_LightModelf(GLenum pname
, GLfloat param
)
2711 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
2712 save_LightModelfv(pname
, parray
);
2716 static void GLAPIENTRY
2717 save_LightModeliv(GLenum pname
, const GLint
*params
)
2721 case GL_LIGHT_MODEL_AMBIENT
:
2722 fparam
[0] = INT_TO_FLOAT(params
[0]);
2723 fparam
[1] = INT_TO_FLOAT(params
[1]);
2724 fparam
[2] = INT_TO_FLOAT(params
[2]);
2725 fparam
[3] = INT_TO_FLOAT(params
[3]);
2727 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
2728 case GL_LIGHT_MODEL_TWO_SIDE
:
2729 case GL_LIGHT_MODEL_COLOR_CONTROL
:
2730 fparam
[0] = (GLfloat
) params
[0];
2736 /* Error will be caught later in gl_LightModelfv */
2737 ASSIGN_4V(fparam
, 0.0F
, 0.0F
, 0.0F
, 0.0F
);
2739 save_LightModelfv(pname
, fparam
);
2743 static void GLAPIENTRY
2744 save_LightModeli(GLenum pname
, GLint param
)
2748 parray
[1] = parray
[2] = parray
[3] = 0;
2749 save_LightModeliv(pname
, parray
);
2753 static void GLAPIENTRY
2754 save_LineStipple(GLint factor
, GLushort pattern
)
2756 GET_CURRENT_CONTEXT(ctx
);
2758 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2759 n
= alloc_instruction(ctx
, OPCODE_LINE_STIPPLE
, 2);
2764 if (ctx
->ExecuteFlag
) {
2765 CALL_LineStipple(ctx
->Exec
, (factor
, pattern
));
2770 static void GLAPIENTRY
2771 save_LineWidth(GLfloat width
)
2773 GET_CURRENT_CONTEXT(ctx
);
2775 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2776 n
= alloc_instruction(ctx
, OPCODE_LINE_WIDTH
, 1);
2780 if (ctx
->ExecuteFlag
) {
2781 CALL_LineWidth(ctx
->Exec
, (width
));
2786 static void GLAPIENTRY
2787 save_ListBase(GLuint base
)
2789 GET_CURRENT_CONTEXT(ctx
);
2791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2792 n
= alloc_instruction(ctx
, OPCODE_LIST_BASE
, 1);
2796 if (ctx
->ExecuteFlag
) {
2797 CALL_ListBase(ctx
->Exec
, (base
));
2802 static void GLAPIENTRY
2803 save_LoadIdentity(void)
2805 GET_CURRENT_CONTEXT(ctx
);
2806 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2807 (void) alloc_instruction(ctx
, OPCODE_LOAD_IDENTITY
, 0);
2808 if (ctx
->ExecuteFlag
) {
2809 CALL_LoadIdentity(ctx
->Exec
, ());
2814 static void GLAPIENTRY
2815 save_LoadMatrixf(const GLfloat
* m
)
2817 GET_CURRENT_CONTEXT(ctx
);
2819 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2820 n
= alloc_instruction(ctx
, OPCODE_LOAD_MATRIX
, 16);
2823 for (i
= 0; i
< 16; i
++) {
2827 if (ctx
->ExecuteFlag
) {
2828 CALL_LoadMatrixf(ctx
->Exec
, (m
));
2833 static void GLAPIENTRY
2834 save_LoadMatrixd(const GLdouble
* m
)
2838 for (i
= 0; i
< 16; i
++) {
2839 f
[i
] = (GLfloat
) m
[i
];
2841 save_LoadMatrixf(f
);
2845 static void GLAPIENTRY
2846 save_LoadName(GLuint name
)
2848 GET_CURRENT_CONTEXT(ctx
);
2850 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2851 n
= alloc_instruction(ctx
, OPCODE_LOAD_NAME
, 1);
2855 if (ctx
->ExecuteFlag
) {
2856 CALL_LoadName(ctx
->Exec
, (name
));
2861 static void GLAPIENTRY
2862 save_LogicOp(GLenum opcode
)
2864 GET_CURRENT_CONTEXT(ctx
);
2866 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2867 n
= alloc_instruction(ctx
, OPCODE_LOGIC_OP
, 1);
2871 if (ctx
->ExecuteFlag
) {
2872 CALL_LogicOp(ctx
->Exec
, (opcode
));
2877 static void GLAPIENTRY
2878 save_Map1d(GLenum target
, GLdouble u1
, GLdouble u2
, GLint stride
,
2879 GLint order
, const GLdouble
* points
)
2881 GET_CURRENT_CONTEXT(ctx
);
2883 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2884 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2886 GLfloat
*pnts
= _mesa_copy_map_points1d(target
, stride
, order
, points
);
2888 n
[2].f
= (GLfloat
) u1
;
2889 n
[3].f
= (GLfloat
) u2
;
2890 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2892 n
[6].data
= (void *) pnts
;
2894 if (ctx
->ExecuteFlag
) {
2895 CALL_Map1d(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2899 static void GLAPIENTRY
2900 save_Map1f(GLenum target
, GLfloat u1
, GLfloat u2
, GLint stride
,
2901 GLint order
, const GLfloat
* points
)
2903 GET_CURRENT_CONTEXT(ctx
);
2905 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2906 n
= alloc_instruction(ctx
, OPCODE_MAP1
, 6);
2908 GLfloat
*pnts
= _mesa_copy_map_points1f(target
, stride
, order
, points
);
2912 n
[4].i
= _mesa_evaluator_components(target
); /* stride */
2914 n
[6].data
= (void *) pnts
;
2916 if (ctx
->ExecuteFlag
) {
2917 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, stride
, order
, points
));
2922 static void GLAPIENTRY
2923 save_Map2d(GLenum target
,
2924 GLdouble u1
, GLdouble u2
, GLint ustride
, GLint uorder
,
2925 GLdouble v1
, GLdouble v2
, GLint vstride
, GLint vorder
,
2926 const GLdouble
* points
)
2928 GET_CURRENT_CONTEXT(ctx
);
2930 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2931 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2933 GLfloat
*pnts
= _mesa_copy_map_points2d(target
, ustride
, uorder
,
2934 vstride
, vorder
, points
);
2936 n
[2].f
= (GLfloat
) u1
;
2937 n
[3].f
= (GLfloat
) u2
;
2938 n
[4].f
= (GLfloat
) v1
;
2939 n
[5].f
= (GLfloat
) v2
;
2940 /* XXX verify these strides are correct */
2941 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2942 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2945 n
[10].data
= (void *) pnts
;
2947 if (ctx
->ExecuteFlag
) {
2948 CALL_Map2d(ctx
->Exec
, (target
,
2949 u1
, u2
, ustride
, uorder
,
2950 v1
, v2
, vstride
, vorder
, points
));
2955 static void GLAPIENTRY
2956 save_Map2f(GLenum target
,
2957 GLfloat u1
, GLfloat u2
, GLint ustride
, GLint uorder
,
2958 GLfloat v1
, GLfloat v2
, GLint vstride
, GLint vorder
,
2959 const GLfloat
* points
)
2961 GET_CURRENT_CONTEXT(ctx
);
2963 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2964 n
= alloc_instruction(ctx
, OPCODE_MAP2
, 10);
2966 GLfloat
*pnts
= _mesa_copy_map_points2f(target
, ustride
, uorder
,
2967 vstride
, vorder
, points
);
2973 /* XXX verify these strides are correct */
2974 n
[6].i
= _mesa_evaluator_components(target
) * vorder
; /*ustride */
2975 n
[7].i
= _mesa_evaluator_components(target
); /*vstride */
2978 n
[10].data
= (void *) pnts
;
2980 if (ctx
->ExecuteFlag
) {
2981 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
2982 v1
, v2
, vstride
, vorder
, points
));
2987 static void GLAPIENTRY
2988 save_MapGrid1f(GLint un
, GLfloat u1
, GLfloat u2
)
2990 GET_CURRENT_CONTEXT(ctx
);
2992 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
2993 n
= alloc_instruction(ctx
, OPCODE_MAPGRID1
, 3);
2999 if (ctx
->ExecuteFlag
) {
3000 CALL_MapGrid1f(ctx
->Exec
, (un
, u1
, u2
));
3005 static void GLAPIENTRY
3006 save_MapGrid1d(GLint un
, GLdouble u1
, GLdouble u2
)
3008 save_MapGrid1f(un
, (GLfloat
) u1
, (GLfloat
) u2
);
3012 static void GLAPIENTRY
3013 save_MapGrid2f(GLint un
, GLfloat u1
, GLfloat u2
,
3014 GLint vn
, GLfloat v1
, GLfloat v2
)
3016 GET_CURRENT_CONTEXT(ctx
);
3018 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3019 n
= alloc_instruction(ctx
, OPCODE_MAPGRID2
, 6);
3028 if (ctx
->ExecuteFlag
) {
3029 CALL_MapGrid2f(ctx
->Exec
, (un
, u1
, u2
, vn
, v1
, v2
));
3035 static void GLAPIENTRY
3036 save_MapGrid2d(GLint un
, GLdouble u1
, GLdouble u2
,
3037 GLint vn
, GLdouble v1
, GLdouble v2
)
3039 save_MapGrid2f(un
, (GLfloat
) u1
, (GLfloat
) u2
,
3040 vn
, (GLfloat
) v1
, (GLfloat
) v2
);
3044 static void GLAPIENTRY
3045 save_MatrixMode(GLenum mode
)
3047 GET_CURRENT_CONTEXT(ctx
);
3049 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3050 n
= alloc_instruction(ctx
, OPCODE_MATRIX_MODE
, 1);
3054 if (ctx
->ExecuteFlag
) {
3055 CALL_MatrixMode(ctx
->Exec
, (mode
));
3060 static void GLAPIENTRY
3061 save_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
3063 GET_CURRENT_CONTEXT(ctx
);
3066 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3067 n
= alloc_instruction(ctx
, OPCODE_MIN_MAX
, 3);
3070 n
[2].e
= internalFormat
;
3073 if (ctx
->ExecuteFlag
) {
3074 CALL_Minmax(ctx
->Exec
, (target
, internalFormat
, sink
));
3079 static void GLAPIENTRY
3080 save_MultMatrixf(const GLfloat
* m
)
3082 GET_CURRENT_CONTEXT(ctx
);
3084 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3085 n
= alloc_instruction(ctx
, OPCODE_MULT_MATRIX
, 16);
3088 for (i
= 0; i
< 16; i
++) {
3092 if (ctx
->ExecuteFlag
) {
3093 CALL_MultMatrixf(ctx
->Exec
, (m
));
3098 static void GLAPIENTRY
3099 save_MultMatrixd(const GLdouble
* m
)
3103 for (i
= 0; i
< 16; i
++) {
3104 f
[i
] = (GLfloat
) m
[i
];
3106 save_MultMatrixf(f
);
3110 static void GLAPIENTRY
3111 save_NewList(GLuint name
, GLenum mode
)
3113 GET_CURRENT_CONTEXT(ctx
);
3114 /* It's an error to call this function while building a display list */
3115 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
3122 static void GLAPIENTRY
3123 save_Ortho(GLdouble left
, GLdouble right
,
3124 GLdouble bottom
, GLdouble top
, GLdouble nearval
, GLdouble farval
)
3126 GET_CURRENT_CONTEXT(ctx
);
3128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3129 n
= alloc_instruction(ctx
, OPCODE_ORTHO
, 6);
3131 n
[1].f
= (GLfloat
) left
;
3132 n
[2].f
= (GLfloat
) right
;
3133 n
[3].f
= (GLfloat
) bottom
;
3134 n
[4].f
= (GLfloat
) top
;
3135 n
[5].f
= (GLfloat
) nearval
;
3136 n
[6].f
= (GLfloat
) farval
;
3138 if (ctx
->ExecuteFlag
) {
3139 CALL_Ortho(ctx
->Exec
, (left
, right
, bottom
, top
, nearval
, farval
));
3144 static void GLAPIENTRY
3145 save_PixelMapfv(GLenum map
, GLint mapsize
, const GLfloat
*values
)
3147 GET_CURRENT_CONTEXT(ctx
);
3149 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3150 n
= alloc_instruction(ctx
, OPCODE_PIXEL_MAP
, 3);
3154 n
[3].data
= malloc(mapsize
* sizeof(GLfloat
));
3155 memcpy(n
[3].data
, (void *) values
, mapsize
* sizeof(GLfloat
));
3157 if (ctx
->ExecuteFlag
) {
3158 CALL_PixelMapfv(ctx
->Exec
, (map
, mapsize
, values
));
3163 static void GLAPIENTRY
3164 save_PixelMapuiv(GLenum map
, GLint mapsize
, const GLuint
*values
)
3166 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3168 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3169 for (i
= 0; i
< mapsize
; i
++) {
3170 fvalues
[i
] = (GLfloat
) values
[i
];
3174 for (i
= 0; i
< mapsize
; i
++) {
3175 fvalues
[i
] = UINT_TO_FLOAT(values
[i
]);
3178 save_PixelMapfv(map
, mapsize
, fvalues
);
3182 static void GLAPIENTRY
3183 save_PixelMapusv(GLenum map
, GLint mapsize
, const GLushort
*values
)
3185 GLfloat fvalues
[MAX_PIXEL_MAP_TABLE
];
3187 if (map
== GL_PIXEL_MAP_I_TO_I
|| map
== GL_PIXEL_MAP_S_TO_S
) {
3188 for (i
= 0; i
< mapsize
; i
++) {
3189 fvalues
[i
] = (GLfloat
) values
[i
];
3193 for (i
= 0; i
< mapsize
; i
++) {
3194 fvalues
[i
] = USHORT_TO_FLOAT(values
[i
]);
3197 save_PixelMapfv(map
, mapsize
, fvalues
);
3201 static void GLAPIENTRY
3202 save_PixelTransferf(GLenum pname
, GLfloat param
)
3204 GET_CURRENT_CONTEXT(ctx
);
3206 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3207 n
= alloc_instruction(ctx
, OPCODE_PIXEL_TRANSFER
, 2);
3212 if (ctx
->ExecuteFlag
) {
3213 CALL_PixelTransferf(ctx
->Exec
, (pname
, param
));
3218 static void GLAPIENTRY
3219 save_PixelTransferi(GLenum pname
, GLint param
)
3221 save_PixelTransferf(pname
, (GLfloat
) param
);
3225 static void GLAPIENTRY
3226 save_PixelZoom(GLfloat xfactor
, GLfloat yfactor
)
3228 GET_CURRENT_CONTEXT(ctx
);
3230 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3231 n
= alloc_instruction(ctx
, OPCODE_PIXEL_ZOOM
, 2);
3236 if (ctx
->ExecuteFlag
) {
3237 CALL_PixelZoom(ctx
->Exec
, (xfactor
, yfactor
));
3242 static void GLAPIENTRY
3243 save_PointParameterfvEXT(GLenum pname
, const GLfloat
*params
)
3245 GET_CURRENT_CONTEXT(ctx
);
3247 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3248 n
= alloc_instruction(ctx
, OPCODE_POINT_PARAMETERS
, 4);
3255 if (ctx
->ExecuteFlag
) {
3256 CALL_PointParameterfv(ctx
->Exec
, (pname
, params
));
3261 static void GLAPIENTRY
3262 save_PointParameterfEXT(GLenum pname
, GLfloat param
)
3266 parray
[1] = parray
[2] = 0.0F
;
3267 save_PointParameterfvEXT(pname
, parray
);
3270 static void GLAPIENTRY
3271 save_PointParameteriNV(GLenum pname
, GLint param
)
3274 parray
[0] = (GLfloat
) param
;
3275 parray
[1] = parray
[2] = 0.0F
;
3276 save_PointParameterfvEXT(pname
, parray
);
3279 static void GLAPIENTRY
3280 save_PointParameterivNV(GLenum pname
, const GLint
* param
)
3283 parray
[0] = (GLfloat
) param
[0];
3284 parray
[1] = parray
[2] = 0.0F
;
3285 save_PointParameterfvEXT(pname
, parray
);
3289 static void GLAPIENTRY
3290 save_PointSize(GLfloat size
)
3292 GET_CURRENT_CONTEXT(ctx
);
3294 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3295 n
= alloc_instruction(ctx
, OPCODE_POINT_SIZE
, 1);
3299 if (ctx
->ExecuteFlag
) {
3300 CALL_PointSize(ctx
->Exec
, (size
));
3305 static void GLAPIENTRY
3306 save_PolygonMode(GLenum face
, GLenum mode
)
3308 GET_CURRENT_CONTEXT(ctx
);
3310 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3311 n
= alloc_instruction(ctx
, OPCODE_POLYGON_MODE
, 2);
3316 if (ctx
->ExecuteFlag
) {
3317 CALL_PolygonMode(ctx
->Exec
, (face
, mode
));
3322 static void GLAPIENTRY
3323 save_PolygonStipple(const GLubyte
* pattern
)
3325 GET_CURRENT_CONTEXT(ctx
);
3328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3330 n
= alloc_instruction(ctx
, OPCODE_POLYGON_STIPPLE
, 1);
3332 n
[1].data
= unpack_image(ctx
, 2, 32, 32, 1, GL_COLOR_INDEX
, GL_BITMAP
,
3333 pattern
, &ctx
->Unpack
);
3335 if (ctx
->ExecuteFlag
) {
3336 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) pattern
));
3341 static void GLAPIENTRY
3342 save_PolygonOffset(GLfloat factor
, GLfloat units
)
3344 GET_CURRENT_CONTEXT(ctx
);
3346 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3347 n
= alloc_instruction(ctx
, OPCODE_POLYGON_OFFSET
, 2);
3352 if (ctx
->ExecuteFlag
) {
3353 CALL_PolygonOffset(ctx
->Exec
, (factor
, units
));
3358 static void GLAPIENTRY
3359 save_PolygonOffsetEXT(GLfloat factor
, GLfloat bias
)
3361 GET_CURRENT_CONTEXT(ctx
);
3362 /* XXX mult by DepthMaxF here??? */
3363 save_PolygonOffset(factor
, ctx
->DrawBuffer
->_DepthMaxF
* bias
);
3367 static void GLAPIENTRY
3368 save_PopAttrib(void)
3370 GET_CURRENT_CONTEXT(ctx
);
3371 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3372 (void) alloc_instruction(ctx
, OPCODE_POP_ATTRIB
, 0);
3373 if (ctx
->ExecuteFlag
) {
3374 CALL_PopAttrib(ctx
->Exec
, ());
3379 static void GLAPIENTRY
3380 save_PopMatrix(void)
3382 GET_CURRENT_CONTEXT(ctx
);
3383 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3384 (void) alloc_instruction(ctx
, OPCODE_POP_MATRIX
, 0);
3385 if (ctx
->ExecuteFlag
) {
3386 CALL_PopMatrix(ctx
->Exec
, ());
3391 static void GLAPIENTRY
3394 GET_CURRENT_CONTEXT(ctx
);
3395 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3396 (void) alloc_instruction(ctx
, OPCODE_POP_NAME
, 0);
3397 if (ctx
->ExecuteFlag
) {
3398 CALL_PopName(ctx
->Exec
, ());
3403 static void GLAPIENTRY
3404 save_PrioritizeTextures(GLsizei num
, const GLuint
* textures
,
3405 const GLclampf
* priorities
)
3407 GET_CURRENT_CONTEXT(ctx
);
3409 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3411 for (i
= 0; i
< num
; i
++) {
3413 n
= alloc_instruction(ctx
, OPCODE_PRIORITIZE_TEXTURE
, 2);
3415 n
[1].ui
= textures
[i
];
3416 n
[2].f
= priorities
[i
];
3419 if (ctx
->ExecuteFlag
) {
3420 CALL_PrioritizeTextures(ctx
->Exec
, (num
, textures
, priorities
));
3425 static void GLAPIENTRY
3426 save_PushAttrib(GLbitfield mask
)
3428 GET_CURRENT_CONTEXT(ctx
);
3430 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3431 n
= alloc_instruction(ctx
, OPCODE_PUSH_ATTRIB
, 1);
3435 if (ctx
->ExecuteFlag
) {
3436 CALL_PushAttrib(ctx
->Exec
, (mask
));
3441 static void GLAPIENTRY
3442 save_PushMatrix(void)
3444 GET_CURRENT_CONTEXT(ctx
);
3445 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3446 (void) alloc_instruction(ctx
, OPCODE_PUSH_MATRIX
, 0);
3447 if (ctx
->ExecuteFlag
) {
3448 CALL_PushMatrix(ctx
->Exec
, ());
3453 static void GLAPIENTRY
3454 save_PushName(GLuint name
)
3456 GET_CURRENT_CONTEXT(ctx
);
3458 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3459 n
= alloc_instruction(ctx
, OPCODE_PUSH_NAME
, 1);
3463 if (ctx
->ExecuteFlag
) {
3464 CALL_PushName(ctx
->Exec
, (name
));
3469 static void GLAPIENTRY
3470 save_RasterPos4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
3472 GET_CURRENT_CONTEXT(ctx
);
3474 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3475 n
= alloc_instruction(ctx
, OPCODE_RASTER_POS
, 4);
3482 if (ctx
->ExecuteFlag
) {
3483 CALL_RasterPos4f(ctx
->Exec
, (x
, y
, z
, w
));
3487 static void GLAPIENTRY
3488 save_RasterPos2d(GLdouble x
, GLdouble y
)
3490 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3493 static void GLAPIENTRY
3494 save_RasterPos2f(GLfloat x
, GLfloat y
)
3496 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3499 static void GLAPIENTRY
3500 save_RasterPos2i(GLint x
, GLint y
)
3502 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
3505 static void GLAPIENTRY
3506 save_RasterPos2s(GLshort x
, GLshort y
)
3508 save_RasterPos4f(x
, y
, 0.0F
, 1.0F
);
3511 static void GLAPIENTRY
3512 save_RasterPos3d(GLdouble x
, GLdouble y
, GLdouble z
)
3514 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3517 static void GLAPIENTRY
3518 save_RasterPos3f(GLfloat x
, GLfloat y
, GLfloat z
)
3520 save_RasterPos4f(x
, y
, z
, 1.0F
);
3523 static void GLAPIENTRY
3524 save_RasterPos3i(GLint x
, GLint y
, GLint z
)
3526 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
3529 static void GLAPIENTRY
3530 save_RasterPos3s(GLshort x
, GLshort y
, GLshort z
)
3532 save_RasterPos4f(x
, y
, z
, 1.0F
);
3535 static void GLAPIENTRY
3536 save_RasterPos4d(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
3538 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3541 static void GLAPIENTRY
3542 save_RasterPos4i(GLint x
, GLint y
, GLint z
, GLint w
)
3544 save_RasterPos4f((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
3547 static void GLAPIENTRY
3548 save_RasterPos4s(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
3550 save_RasterPos4f(x
, y
, z
, w
);
3553 static void GLAPIENTRY
3554 save_RasterPos2dv(const GLdouble
* v
)
3556 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3559 static void GLAPIENTRY
3560 save_RasterPos2fv(const GLfloat
* v
)
3562 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3565 static void GLAPIENTRY
3566 save_RasterPos2iv(const GLint
* v
)
3568 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
3571 static void GLAPIENTRY
3572 save_RasterPos2sv(const GLshort
* v
)
3574 save_RasterPos4f(v
[0], v
[1], 0.0F
, 1.0F
);
3577 static void GLAPIENTRY
3578 save_RasterPos3dv(const GLdouble
* v
)
3580 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3583 static void GLAPIENTRY
3584 save_RasterPos3fv(const GLfloat
* v
)
3586 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3589 static void GLAPIENTRY
3590 save_RasterPos3iv(const GLint
* v
)
3592 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
3595 static void GLAPIENTRY
3596 save_RasterPos3sv(const GLshort
* v
)
3598 save_RasterPos4f(v
[0], v
[1], v
[2], 1.0F
);
3601 static void GLAPIENTRY
3602 save_RasterPos4dv(const GLdouble
* v
)
3604 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3605 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3608 static void GLAPIENTRY
3609 save_RasterPos4fv(const GLfloat
* v
)
3611 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3614 static void GLAPIENTRY
3615 save_RasterPos4iv(const GLint
* v
)
3617 save_RasterPos4f((GLfloat
) v
[0], (GLfloat
) v
[1],
3618 (GLfloat
) v
[2], (GLfloat
) v
[3]);
3621 static void GLAPIENTRY
3622 save_RasterPos4sv(const GLshort
* v
)
3624 save_RasterPos4f(v
[0], v
[1], v
[2], v
[3]);
3628 static void GLAPIENTRY
3629 save_PassThrough(GLfloat token
)
3631 GET_CURRENT_CONTEXT(ctx
);
3633 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3634 n
= alloc_instruction(ctx
, OPCODE_PASSTHROUGH
, 1);
3638 if (ctx
->ExecuteFlag
) {
3639 CALL_PassThrough(ctx
->Exec
, (token
));
3644 static void GLAPIENTRY
3645 save_ReadBuffer(GLenum mode
)
3647 GET_CURRENT_CONTEXT(ctx
);
3649 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3650 n
= alloc_instruction(ctx
, OPCODE_READ_BUFFER
, 1);
3654 if (ctx
->ExecuteFlag
) {
3655 CALL_ReadBuffer(ctx
->Exec
, (mode
));
3660 static void GLAPIENTRY
3661 save_ResetHistogram(GLenum target
)
3663 GET_CURRENT_CONTEXT(ctx
);
3665 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3666 n
= alloc_instruction(ctx
, OPCODE_RESET_HISTOGRAM
, 1);
3670 if (ctx
->ExecuteFlag
) {
3671 CALL_ResetHistogram(ctx
->Exec
, (target
));
3676 static void GLAPIENTRY
3677 save_ResetMinmax(GLenum target
)
3679 GET_CURRENT_CONTEXT(ctx
);
3681 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3682 n
= alloc_instruction(ctx
, OPCODE_RESET_MIN_MAX
, 1);
3686 if (ctx
->ExecuteFlag
) {
3687 CALL_ResetMinmax(ctx
->Exec
, (target
));
3692 static void GLAPIENTRY
3693 save_Rotatef(GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
3695 GET_CURRENT_CONTEXT(ctx
);
3697 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3698 n
= alloc_instruction(ctx
, OPCODE_ROTATE
, 4);
3705 if (ctx
->ExecuteFlag
) {
3706 CALL_Rotatef(ctx
->Exec
, (angle
, x
, y
, z
));
3711 static void GLAPIENTRY
3712 save_Rotated(GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
3714 save_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3718 static void GLAPIENTRY
3719 save_Scalef(GLfloat x
, GLfloat y
, GLfloat z
)
3721 GET_CURRENT_CONTEXT(ctx
);
3723 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3724 n
= alloc_instruction(ctx
, OPCODE_SCALE
, 3);
3730 if (ctx
->ExecuteFlag
) {
3731 CALL_Scalef(ctx
->Exec
, (x
, y
, z
));
3736 static void GLAPIENTRY
3737 save_Scaled(GLdouble x
, GLdouble y
, GLdouble z
)
3739 save_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
3743 static void GLAPIENTRY
3744 save_Scissor(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
3746 GET_CURRENT_CONTEXT(ctx
);
3748 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3749 n
= alloc_instruction(ctx
, OPCODE_SCISSOR
, 4);
3756 if (ctx
->ExecuteFlag
) {
3757 CALL_Scissor(ctx
->Exec
, (x
, y
, width
, height
));
3762 static void GLAPIENTRY
3763 save_ShadeModel(GLenum mode
)
3765 GET_CURRENT_CONTEXT(ctx
);
3767 ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx
);
3769 if (ctx
->ExecuteFlag
) {
3770 CALL_ShadeModel(ctx
->Exec
, (mode
));
3773 if (ctx
->ListState
.Current
.ShadeModel
== mode
)
3776 SAVE_FLUSH_VERTICES(ctx
);
3778 /* Only save the value if we know the statechange will take effect:
3780 if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
)
3781 ctx
->ListState
.Current
.ShadeModel
= mode
;
3783 n
= alloc_instruction(ctx
, OPCODE_SHADE_MODEL
, 1);
3790 static void GLAPIENTRY
3791 save_StencilFunc(GLenum func
, GLint ref
, GLuint mask
)
3793 GET_CURRENT_CONTEXT(ctx
);
3795 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3796 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC
, 3);
3802 if (ctx
->ExecuteFlag
) {
3803 CALL_StencilFunc(ctx
->Exec
, (func
, ref
, mask
));
3808 static void GLAPIENTRY
3809 save_StencilMask(GLuint mask
)
3811 GET_CURRENT_CONTEXT(ctx
);
3813 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3814 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK
, 1);
3818 if (ctx
->ExecuteFlag
) {
3819 CALL_StencilMask(ctx
->Exec
, (mask
));
3824 static void GLAPIENTRY
3825 save_StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
)
3827 GET_CURRENT_CONTEXT(ctx
);
3829 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3830 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP
, 3);
3836 if (ctx
->ExecuteFlag
) {
3837 CALL_StencilOp(ctx
->Exec
, (fail
, zfail
, zpass
));
3842 static void GLAPIENTRY
3843 save_StencilFuncSeparate(GLenum face
, GLenum func
, GLint ref
, GLuint mask
)
3845 GET_CURRENT_CONTEXT(ctx
);
3847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3848 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3855 if (ctx
->ExecuteFlag
) {
3856 CALL_StencilFuncSeparate(ctx
->Exec
, (face
, func
, ref
, mask
));
3861 static void GLAPIENTRY
3862 save_StencilFuncSeparateATI(GLenum frontfunc
, GLenum backfunc
, GLint ref
,
3865 GET_CURRENT_CONTEXT(ctx
);
3867 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3869 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3877 n
= alloc_instruction(ctx
, OPCODE_STENCIL_FUNC_SEPARATE
, 4);
3884 if (ctx
->ExecuteFlag
) {
3885 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_FRONT
, frontfunc
, ref
, mask
));
3886 CALL_StencilFuncSeparate(ctx
->Exec
, (GL_BACK
, backfunc
, ref
, mask
));
3891 static void GLAPIENTRY
3892 save_StencilMaskSeparate(GLenum face
, GLuint mask
)
3894 GET_CURRENT_CONTEXT(ctx
);
3896 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3897 n
= alloc_instruction(ctx
, OPCODE_STENCIL_MASK_SEPARATE
, 2);
3902 if (ctx
->ExecuteFlag
) {
3903 CALL_StencilMaskSeparate(ctx
->Exec
, (face
, mask
));
3908 static void GLAPIENTRY
3909 save_StencilOpSeparate(GLenum face
, GLenum fail
, GLenum zfail
, GLenum zpass
)
3911 GET_CURRENT_CONTEXT(ctx
);
3913 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3914 n
= alloc_instruction(ctx
, OPCODE_STENCIL_OP_SEPARATE
, 4);
3921 if (ctx
->ExecuteFlag
) {
3922 CALL_StencilOpSeparate(ctx
->Exec
, (face
, fail
, zfail
, zpass
));
3927 static void GLAPIENTRY
3928 save_TexEnvfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
3930 GET_CURRENT_CONTEXT(ctx
);
3932 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3933 n
= alloc_instruction(ctx
, OPCODE_TEXENV
, 6);
3937 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3945 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
3948 if (ctx
->ExecuteFlag
) {
3949 CALL_TexEnvfv(ctx
->Exec
, (target
, pname
, params
));
3954 static void GLAPIENTRY
3955 save_TexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
3958 parray
[0] = (GLfloat
) param
;
3959 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
3960 save_TexEnvfv(target
, pname
, parray
);
3964 static void GLAPIENTRY
3965 save_TexEnvi(GLenum target
, GLenum pname
, GLint param
)
3968 p
[0] = (GLfloat
) param
;
3969 p
[1] = p
[2] = p
[3] = 0.0F
;
3970 save_TexEnvfv(target
, pname
, p
);
3974 static void GLAPIENTRY
3975 save_TexEnviv(GLenum target
, GLenum pname
, const GLint
* param
)
3978 if (pname
== GL_TEXTURE_ENV_COLOR
) {
3979 p
[0] = INT_TO_FLOAT(param
[0]);
3980 p
[1] = INT_TO_FLOAT(param
[1]);
3981 p
[2] = INT_TO_FLOAT(param
[2]);
3982 p
[3] = INT_TO_FLOAT(param
[3]);
3985 p
[0] = (GLfloat
) param
[0];
3986 p
[1] = p
[2] = p
[3] = 0.0F
;
3988 save_TexEnvfv(target
, pname
, p
);
3992 static void GLAPIENTRY
3993 save_TexGenfv(GLenum coord
, GLenum pname
, const GLfloat
*params
)
3995 GET_CURRENT_CONTEXT(ctx
);
3997 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
3998 n
= alloc_instruction(ctx
, OPCODE_TEXGEN
, 6);
4007 if (ctx
->ExecuteFlag
) {
4008 CALL_TexGenfv(ctx
->Exec
, (coord
, pname
, params
));
4013 static void GLAPIENTRY
4014 save_TexGeniv(GLenum coord
, GLenum pname
, const GLint
*params
)
4017 p
[0] = (GLfloat
) params
[0];
4018 p
[1] = (GLfloat
) params
[1];
4019 p
[2] = (GLfloat
) params
[2];
4020 p
[3] = (GLfloat
) params
[3];
4021 save_TexGenfv(coord
, pname
, p
);
4025 static void GLAPIENTRY
4026 save_TexGend(GLenum coord
, GLenum pname
, GLdouble param
)
4029 parray
[0] = (GLfloat
) param
;
4030 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4031 save_TexGenfv(coord
, pname
, parray
);
4035 static void GLAPIENTRY
4036 save_TexGendv(GLenum coord
, GLenum pname
, const GLdouble
*params
)
4039 p
[0] = (GLfloat
) params
[0];
4040 p
[1] = (GLfloat
) params
[1];
4041 p
[2] = (GLfloat
) params
[2];
4042 p
[3] = (GLfloat
) params
[3];
4043 save_TexGenfv(coord
, pname
, p
);
4047 static void GLAPIENTRY
4048 save_TexGenf(GLenum coord
, GLenum pname
, GLfloat param
)
4052 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4053 save_TexGenfv(coord
, pname
, parray
);
4057 static void GLAPIENTRY
4058 save_TexGeni(GLenum coord
, GLenum pname
, GLint param
)
4062 parray
[1] = parray
[2] = parray
[3] = 0;
4063 save_TexGeniv(coord
, pname
, parray
);
4067 static void GLAPIENTRY
4068 save_TexParameterfv(GLenum target
, GLenum pname
, const GLfloat
*params
)
4070 GET_CURRENT_CONTEXT(ctx
);
4072 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4073 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER
, 6);
4082 if (ctx
->ExecuteFlag
) {
4083 CALL_TexParameterfv(ctx
->Exec
, (target
, pname
, params
));
4088 static void GLAPIENTRY
4089 save_TexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
4093 parray
[1] = parray
[2] = parray
[3] = 0.0F
;
4094 save_TexParameterfv(target
, pname
, parray
);
4098 static void GLAPIENTRY
4099 save_TexParameteri(GLenum target
, GLenum pname
, GLint param
)
4102 fparam
[0] = (GLfloat
) param
;
4103 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4104 save_TexParameterfv(target
, pname
, fparam
);
4108 static void GLAPIENTRY
4109 save_TexParameteriv(GLenum target
, GLenum pname
, const GLint
*params
)
4112 fparam
[0] = (GLfloat
) params
[0];
4113 fparam
[1] = fparam
[2] = fparam
[3] = 0.0F
;
4114 save_TexParameterfv(target
, pname
, fparam
);
4118 static void GLAPIENTRY
4119 save_TexImage1D(GLenum target
,
4120 GLint level
, GLint components
,
4121 GLsizei width
, GLint border
,
4122 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4124 GET_CURRENT_CONTEXT(ctx
);
4125 if (target
== GL_PROXY_TEXTURE_1D
) {
4126 /* don't compile, execute immediately */
4127 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4128 border
, format
, type
, pixels
));
4132 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4133 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE1D
, 8);
4137 n
[3].i
= components
;
4138 n
[4].i
= (GLint
) width
;
4142 n
[8].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4143 pixels
, &ctx
->Unpack
);
4145 if (ctx
->ExecuteFlag
) {
4146 CALL_TexImage1D(ctx
->Exec
, (target
, level
, components
, width
,
4147 border
, format
, type
, pixels
));
4153 static void GLAPIENTRY
4154 save_TexImage2D(GLenum target
,
4155 GLint level
, GLint components
,
4156 GLsizei width
, GLsizei height
, GLint border
,
4157 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4159 GET_CURRENT_CONTEXT(ctx
);
4160 if (target
== GL_PROXY_TEXTURE_2D
) {
4161 /* don't compile, execute immediately */
4162 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4163 height
, border
, format
, type
, pixels
));
4167 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4168 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE2D
, 9);
4172 n
[3].i
= components
;
4173 n
[4].i
= (GLint
) width
;
4174 n
[5].i
= (GLint
) height
;
4178 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4179 pixels
, &ctx
->Unpack
);
4181 if (ctx
->ExecuteFlag
) {
4182 CALL_TexImage2D(ctx
->Exec
, (target
, level
, components
, width
,
4183 height
, border
, format
, type
, pixels
));
4189 static void GLAPIENTRY
4190 save_TexImage3D(GLenum target
,
4191 GLint level
, GLint internalFormat
,
4192 GLsizei width
, GLsizei height
, GLsizei depth
,
4194 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4196 GET_CURRENT_CONTEXT(ctx
);
4197 if (target
== GL_PROXY_TEXTURE_3D
) {
4198 /* don't compile, execute immediately */
4199 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4200 height
, depth
, border
, format
, type
,
4205 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4206 n
= alloc_instruction(ctx
, OPCODE_TEX_IMAGE3D
, 10);
4210 n
[3].i
= (GLint
) internalFormat
;
4211 n
[4].i
= (GLint
) width
;
4212 n
[5].i
= (GLint
) height
;
4213 n
[6].i
= (GLint
) depth
;
4217 n
[10].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4218 pixels
, &ctx
->Unpack
);
4220 if (ctx
->ExecuteFlag
) {
4221 CALL_TexImage3D(ctx
->Exec
, (target
, level
, internalFormat
, width
,
4222 height
, depth
, border
, format
, type
,
4229 static void GLAPIENTRY
4230 save_TexSubImage1D(GLenum target
, GLint level
, GLint xoffset
,
4231 GLsizei width
, GLenum format
, GLenum type
,
4232 const GLvoid
* pixels
)
4234 GET_CURRENT_CONTEXT(ctx
);
4237 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4239 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE1D
, 7);
4244 n
[4].i
= (GLint
) width
;
4247 n
[7].data
= unpack_image(ctx
, 1, width
, 1, 1, format
, type
,
4248 pixels
, &ctx
->Unpack
);
4250 if (ctx
->ExecuteFlag
) {
4251 CALL_TexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
, width
,
4252 format
, type
, pixels
));
4257 static void GLAPIENTRY
4258 save_TexSubImage2D(GLenum target
, GLint level
,
4259 GLint xoffset
, GLint yoffset
,
4260 GLsizei width
, GLsizei height
,
4261 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4263 GET_CURRENT_CONTEXT(ctx
);
4266 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4268 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE2D
, 9);
4274 n
[5].i
= (GLint
) width
;
4275 n
[6].i
= (GLint
) height
;
4278 n
[9].data
= unpack_image(ctx
, 2, width
, height
, 1, format
, type
,
4279 pixels
, &ctx
->Unpack
);
4281 if (ctx
->ExecuteFlag
) {
4282 CALL_TexSubImage2D(ctx
->Exec
, (target
, level
, xoffset
, yoffset
,
4283 width
, height
, format
, type
, pixels
));
4288 static void GLAPIENTRY
4289 save_TexSubImage3D(GLenum target
, GLint level
,
4290 GLint xoffset
, GLint yoffset
, GLint zoffset
,
4291 GLsizei width
, GLsizei height
, GLsizei depth
,
4292 GLenum format
, GLenum type
, const GLvoid
* pixels
)
4294 GET_CURRENT_CONTEXT(ctx
);
4297 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4299 n
= alloc_instruction(ctx
, OPCODE_TEX_SUB_IMAGE3D
, 11);
4306 n
[6].i
= (GLint
) width
;
4307 n
[7].i
= (GLint
) height
;
4308 n
[8].i
= (GLint
) depth
;
4311 n
[11].data
= unpack_image(ctx
, 3, width
, height
, depth
, format
, type
,
4312 pixels
, &ctx
->Unpack
);
4314 if (ctx
->ExecuteFlag
) {
4315 CALL_TexSubImage3D(ctx
->Exec
, (target
, level
,
4316 xoffset
, yoffset
, zoffset
,
4317 width
, height
, depth
, format
, type
,
4323 static void GLAPIENTRY
4324 save_Translatef(GLfloat x
, GLfloat y
, GLfloat z
)
4326 GET_CURRENT_CONTEXT(ctx
);
4328 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4329 n
= alloc_instruction(ctx
, OPCODE_TRANSLATE
, 3);
4335 if (ctx
->ExecuteFlag
) {
4336 CALL_Translatef(ctx
->Exec
, (x
, y
, z
));
4341 static void GLAPIENTRY
4342 save_Translated(GLdouble x
, GLdouble y
, GLdouble z
)
4344 save_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
4349 static void GLAPIENTRY
4350 save_Viewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
4352 GET_CURRENT_CONTEXT(ctx
);
4354 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4355 n
= alloc_instruction(ctx
, OPCODE_VIEWPORT
, 4);
4359 n
[3].i
= (GLint
) width
;
4360 n
[4].i
= (GLint
) height
;
4362 if (ctx
->ExecuteFlag
) {
4363 CALL_Viewport(ctx
->Exec
, (x
, y
, width
, height
));
4368 static void GLAPIENTRY
4369 save_WindowPos4fMESA(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4371 GET_CURRENT_CONTEXT(ctx
);
4373 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4374 n
= alloc_instruction(ctx
, OPCODE_WINDOW_POS
, 4);
4381 if (ctx
->ExecuteFlag
) {
4382 CALL_WindowPos4fMESA(ctx
->Exec
, (x
, y
, z
, w
));
4386 static void GLAPIENTRY
4387 save_WindowPos2dMESA(GLdouble x
, GLdouble y
)
4389 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4392 static void GLAPIENTRY
4393 save_WindowPos2fMESA(GLfloat x
, GLfloat y
)
4395 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4398 static void GLAPIENTRY
4399 save_WindowPos2iMESA(GLint x
, GLint y
)
4401 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, 0.0F
, 1.0F
);
4404 static void GLAPIENTRY
4405 save_WindowPos2sMESA(GLshort x
, GLshort y
)
4407 save_WindowPos4fMESA(x
, y
, 0.0F
, 1.0F
);
4410 static void GLAPIENTRY
4411 save_WindowPos3dMESA(GLdouble x
, GLdouble y
, GLdouble z
)
4413 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4416 static void GLAPIENTRY
4417 save_WindowPos3fMESA(GLfloat x
, GLfloat y
, GLfloat z
)
4419 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4422 static void GLAPIENTRY
4423 save_WindowPos3iMESA(GLint x
, GLint y
, GLint z
)
4425 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, 1.0F
);
4428 static void GLAPIENTRY
4429 save_WindowPos3sMESA(GLshort x
, GLshort y
, GLshort z
)
4431 save_WindowPos4fMESA(x
, y
, z
, 1.0F
);
4434 static void GLAPIENTRY
4435 save_WindowPos4dMESA(GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4437 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4440 static void GLAPIENTRY
4441 save_WindowPos4iMESA(GLint x
, GLint y
, GLint z
, GLint w
)
4443 save_WindowPos4fMESA((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4446 static void GLAPIENTRY
4447 save_WindowPos4sMESA(GLshort x
, GLshort y
, GLshort z
, GLshort w
)
4449 save_WindowPos4fMESA(x
, y
, z
, w
);
4452 static void GLAPIENTRY
4453 save_WindowPos2dvMESA(const GLdouble
* v
)
4455 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4458 static void GLAPIENTRY
4459 save_WindowPos2fvMESA(const GLfloat
* v
)
4461 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4464 static void GLAPIENTRY
4465 save_WindowPos2ivMESA(const GLint
* v
)
4467 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], 0.0F
, 1.0F
);
4470 static void GLAPIENTRY
4471 save_WindowPos2svMESA(const GLshort
* v
)
4473 save_WindowPos4fMESA(v
[0], v
[1], 0.0F
, 1.0F
);
4476 static void GLAPIENTRY
4477 save_WindowPos3dvMESA(const GLdouble
* v
)
4479 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4482 static void GLAPIENTRY
4483 save_WindowPos3fvMESA(const GLfloat
* v
)
4485 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4488 static void GLAPIENTRY
4489 save_WindowPos3ivMESA(const GLint
* v
)
4491 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1], (GLfloat
) v
[2], 1.0F
);
4494 static void GLAPIENTRY
4495 save_WindowPos3svMESA(const GLshort
* v
)
4497 save_WindowPos4fMESA(v
[0], v
[1], v
[2], 1.0F
);
4500 static void GLAPIENTRY
4501 save_WindowPos4dvMESA(const GLdouble
* v
)
4503 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4504 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4507 static void GLAPIENTRY
4508 save_WindowPos4fvMESA(const GLfloat
* v
)
4510 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4513 static void GLAPIENTRY
4514 save_WindowPos4ivMESA(const GLint
* v
)
4516 save_WindowPos4fMESA((GLfloat
) v
[0], (GLfloat
) v
[1],
4517 (GLfloat
) v
[2], (GLfloat
) v
[3]);
4520 static void GLAPIENTRY
4521 save_WindowPos4svMESA(const GLshort
* v
)
4523 save_WindowPos4fMESA(v
[0], v
[1], v
[2], v
[3]);
4528 /* GL_ARB_multitexture */
4529 static void GLAPIENTRY
4530 save_ActiveTextureARB(GLenum target
)
4532 GET_CURRENT_CONTEXT(ctx
);
4534 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4535 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_TEXTURE
, 1);
4539 if (ctx
->ExecuteFlag
) {
4540 CALL_ActiveTexture(ctx
->Exec
, (target
));
4545 /* GL_ARB_transpose_matrix */
4547 static void GLAPIENTRY
4548 save_LoadTransposeMatrixdARB(const GLdouble m
[16])
4551 _math_transposefd(tm
, m
);
4552 save_LoadMatrixf(tm
);
4556 static void GLAPIENTRY
4557 save_LoadTransposeMatrixfARB(const GLfloat m
[16])
4560 _math_transposef(tm
, m
);
4561 save_LoadMatrixf(tm
);
4565 static void GLAPIENTRY
4566 save_MultTransposeMatrixdARB(const GLdouble m
[16])
4569 _math_transposefd(tm
, m
);
4570 save_MultMatrixf(tm
);
4574 static void GLAPIENTRY
4575 save_MultTransposeMatrixfARB(const GLfloat m
[16])
4578 _math_transposef(tm
, m
);
4579 save_MultMatrixf(tm
);
4582 static GLvoid
*copy_data(const GLvoid
*data
, GLsizei size
, const char *func
)
4584 GET_CURRENT_CONTEXT(ctx
);
4590 image
= malloc(size
);
4592 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "%s", func
);
4595 memcpy(image
, data
, size
);
4601 /* GL_ARB_texture_compression */
4602 static void GLAPIENTRY
4603 save_CompressedTexImage1DARB(GLenum target
, GLint level
,
4604 GLenum internalFormat
, GLsizei width
,
4605 GLint border
, GLsizei imageSize
,
4606 const GLvoid
* data
)
4608 GET_CURRENT_CONTEXT(ctx
);
4609 if (target
== GL_PROXY_TEXTURE_1D
) {
4610 /* don't compile, execute immediately */
4611 CALL_CompressedTexImage1D(ctx
->Exec
, (target
, level
, internalFormat
,
4612 width
, border
, imageSize
,
4617 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4619 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_1D
, 7);
4623 n
[3].e
= internalFormat
;
4624 n
[4].i
= (GLint
) width
;
4627 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexImage1DARB");
4629 if (ctx
->ExecuteFlag
) {
4630 CALL_CompressedTexImage1D(ctx
->Exec
,
4631 (target
, level
, internalFormat
, width
,
4632 border
, imageSize
, data
));
4638 static void GLAPIENTRY
4639 save_CompressedTexImage2DARB(GLenum target
, GLint level
,
4640 GLenum internalFormat
, GLsizei width
,
4641 GLsizei height
, GLint border
, GLsizei imageSize
,
4642 const GLvoid
* data
)
4644 GET_CURRENT_CONTEXT(ctx
);
4645 if (target
== GL_PROXY_TEXTURE_2D
) {
4646 /* don't compile, execute immediately */
4647 CALL_CompressedTexImage2D(ctx
->Exec
, (target
, level
, internalFormat
,
4648 width
, height
, border
,
4653 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4655 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_2D
, 8);
4659 n
[3].e
= internalFormat
;
4660 n
[4].i
= (GLint
) width
;
4661 n
[5].i
= (GLint
) height
;
4664 n
[8].data
= copy_data(data
, imageSize
, "glCompressedTexImage2DARB");
4666 if (ctx
->ExecuteFlag
) {
4667 CALL_CompressedTexImage2D(ctx
->Exec
,
4668 (target
, level
, internalFormat
, width
,
4669 height
, border
, imageSize
, data
));
4675 static void GLAPIENTRY
4676 save_CompressedTexImage3DARB(GLenum target
, GLint level
,
4677 GLenum internalFormat
, GLsizei width
,
4678 GLsizei height
, GLsizei depth
, GLint border
,
4679 GLsizei imageSize
, const GLvoid
* data
)
4681 GET_CURRENT_CONTEXT(ctx
);
4682 if (target
== GL_PROXY_TEXTURE_3D
) {
4683 /* don't compile, execute immediately */
4684 CALL_CompressedTexImage3D(ctx
->Exec
, (target
, level
, internalFormat
,
4685 width
, height
, depth
, border
,
4690 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4692 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_IMAGE_3D
, 9);
4696 n
[3].e
= internalFormat
;
4697 n
[4].i
= (GLint
) width
;
4698 n
[5].i
= (GLint
) height
;
4699 n
[6].i
= (GLint
) depth
;
4702 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexImage3DARB");
4704 if (ctx
->ExecuteFlag
) {
4705 CALL_CompressedTexImage3D(ctx
->Exec
,
4706 (target
, level
, internalFormat
, width
,
4707 height
, depth
, border
, imageSize
,
4714 static void GLAPIENTRY
4715 save_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
4716 GLsizei width
, GLenum format
,
4717 GLsizei imageSize
, const GLvoid
* data
)
4720 GET_CURRENT_CONTEXT(ctx
);
4721 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4723 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
, 7);
4728 n
[4].i
= (GLint
) width
;
4731 n
[7].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage1DARB");
4733 if (ctx
->ExecuteFlag
) {
4734 CALL_CompressedTexSubImage1D(ctx
->Exec
, (target
, level
, xoffset
,
4735 width
, format
, imageSize
,
4741 static void GLAPIENTRY
4742 save_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
4743 GLint yoffset
, GLsizei width
, GLsizei height
,
4744 GLenum format
, GLsizei imageSize
,
4745 const GLvoid
* data
)
4748 GET_CURRENT_CONTEXT(ctx
);
4749 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4751 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
, 9);
4757 n
[5].i
= (GLint
) width
;
4758 n
[6].i
= (GLint
) height
;
4761 n
[9].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage2DARB");
4763 if (ctx
->ExecuteFlag
) {
4764 CALL_CompressedTexSubImage2D(ctx
->Exec
,
4765 (target
, level
, xoffset
, yoffset
, width
,
4766 height
, format
, imageSize
, data
));
4771 static void GLAPIENTRY
4772 save_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
4773 GLint yoffset
, GLint zoffset
, GLsizei width
,
4774 GLsizei height
, GLsizei depth
, GLenum format
,
4775 GLsizei imageSize
, const GLvoid
* data
)
4778 GET_CURRENT_CONTEXT(ctx
);
4779 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4781 n
= alloc_instruction(ctx
, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
, 11);
4788 n
[6].i
= (GLint
) width
;
4789 n
[7].i
= (GLint
) height
;
4790 n
[8].i
= (GLint
) depth
;
4792 n
[10].i
= imageSize
;
4793 n
[11].data
= copy_data(data
, imageSize
, "glCompressedTexSubImage3DARB");
4795 if (ctx
->ExecuteFlag
) {
4796 CALL_CompressedTexSubImage3D(ctx
->Exec
,
4797 (target
, level
, xoffset
, yoffset
,
4798 zoffset
, width
, height
, depth
, format
,
4804 /* GL_ARB_multisample */
4805 static void GLAPIENTRY
4806 save_SampleCoverageARB(GLclampf value
, GLboolean invert
)
4808 GET_CURRENT_CONTEXT(ctx
);
4810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4811 n
= alloc_instruction(ctx
, OPCODE_SAMPLE_COVERAGE
, 2);
4816 if (ctx
->ExecuteFlag
) {
4817 CALL_SampleCoverage(ctx
->Exec
, (value
, invert
));
4823 * GL_NV_fragment_program
4825 static void GLAPIENTRY
4826 save_BindProgramNV(GLenum target
, GLuint id
)
4828 GET_CURRENT_CONTEXT(ctx
);
4830 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4831 n
= alloc_instruction(ctx
, OPCODE_BIND_PROGRAM_NV
, 2);
4836 if (ctx
->ExecuteFlag
) {
4837 CALL_BindProgramARB(ctx
->Exec
, (target
, id
));
4841 static void GLAPIENTRY
4842 save_ProgramEnvParameter4fARB(GLenum target
, GLuint index
,
4843 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4845 GET_CURRENT_CONTEXT(ctx
);
4847 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4848 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4857 if (ctx
->ExecuteFlag
) {
4858 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4863 static void GLAPIENTRY
4864 save_ProgramEnvParameter4fvARB(GLenum target
, GLuint index
,
4865 const GLfloat
*params
)
4867 save_ProgramEnvParameter4fARB(target
, index
, params
[0], params
[1],
4868 params
[2], params
[3]);
4872 static void GLAPIENTRY
4873 save_ProgramEnvParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4874 const GLfloat
* params
)
4876 GET_CURRENT_CONTEXT(ctx
);
4878 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4882 const GLfloat
* p
= params
;
4884 for (i
= 0 ; i
< count
; i
++) {
4885 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_ENV_PARAMETER_ARB
, 6);
4898 if (ctx
->ExecuteFlag
) {
4899 CALL_ProgramEnvParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
4904 static void GLAPIENTRY
4905 save_ProgramEnvParameter4dARB(GLenum target
, GLuint index
,
4906 GLdouble x
, GLdouble y
, GLdouble z
, GLdouble w
)
4908 save_ProgramEnvParameter4fARB(target
, index
,
4910 (GLfloat
) y
, (GLfloat
) z
, (GLfloat
) w
);
4914 static void GLAPIENTRY
4915 save_ProgramEnvParameter4dvARB(GLenum target
, GLuint index
,
4916 const GLdouble
*params
)
4918 save_ProgramEnvParameter4fARB(target
, index
,
4919 (GLfloat
) params
[0],
4920 (GLfloat
) params
[1],
4921 (GLfloat
) params
[2], (GLfloat
) params
[3]);
4925 static void GLAPIENTRY
4926 save_ProgramLocalParameter4fARB(GLenum target
, GLuint index
,
4927 GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
4929 GET_CURRENT_CONTEXT(ctx
);
4931 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4932 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4941 if (ctx
->ExecuteFlag
) {
4942 CALL_ProgramLocalParameter4fARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
4947 static void GLAPIENTRY
4948 save_ProgramLocalParameter4fvARB(GLenum target
, GLuint index
,
4949 const GLfloat
*params
)
4951 GET_CURRENT_CONTEXT(ctx
);
4953 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4954 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4963 if (ctx
->ExecuteFlag
) {
4964 CALL_ProgramLocalParameter4fvARB(ctx
->Exec
, (target
, index
, params
));
4969 static void GLAPIENTRY
4970 save_ProgramLocalParameters4fvEXT(GLenum target
, GLuint index
, GLsizei count
,
4971 const GLfloat
*params
)
4973 GET_CURRENT_CONTEXT(ctx
);
4975 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
4979 const GLfloat
* p
= params
;
4981 for (i
= 0 ; i
< count
; i
++) {
4982 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
4995 if (ctx
->ExecuteFlag
) {
4996 CALL_ProgramLocalParameters4fvEXT(ctx
->Exec
, (target
, index
, count
, params
));
5001 static void GLAPIENTRY
5002 save_ProgramLocalParameter4dARB(GLenum target
, GLuint index
,
5003 GLdouble x
, GLdouble y
,
5004 GLdouble z
, GLdouble w
)
5006 GET_CURRENT_CONTEXT(ctx
);
5008 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5009 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5013 n
[3].f
= (GLfloat
) x
;
5014 n
[4].f
= (GLfloat
) y
;
5015 n
[5].f
= (GLfloat
) z
;
5016 n
[6].f
= (GLfloat
) w
;
5018 if (ctx
->ExecuteFlag
) {
5019 CALL_ProgramLocalParameter4dARB(ctx
->Exec
, (target
, index
, x
, y
, z
, w
));
5024 static void GLAPIENTRY
5025 save_ProgramLocalParameter4dvARB(GLenum target
, GLuint index
,
5026 const GLdouble
*params
)
5028 GET_CURRENT_CONTEXT(ctx
);
5030 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5031 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
, 6);
5035 n
[3].f
= (GLfloat
) params
[0];
5036 n
[4].f
= (GLfloat
) params
[1];
5037 n
[5].f
= (GLfloat
) params
[2];
5038 n
[6].f
= (GLfloat
) params
[3];
5040 if (ctx
->ExecuteFlag
) {
5041 CALL_ProgramLocalParameter4dvARB(ctx
->Exec
, (target
, index
, params
));
5046 /* GL_EXT_stencil_two_side */
5047 static void GLAPIENTRY
5048 save_ActiveStencilFaceEXT(GLenum face
)
5050 GET_CURRENT_CONTEXT(ctx
);
5052 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5053 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_STENCIL_FACE_EXT
, 1);
5057 if (ctx
->ExecuteFlag
) {
5058 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (face
));
5063 /* GL_EXT_depth_bounds_test */
5064 static void GLAPIENTRY
5065 save_DepthBoundsEXT(GLclampd zmin
, GLclampd zmax
)
5067 GET_CURRENT_CONTEXT(ctx
);
5069 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5070 n
= alloc_instruction(ctx
, OPCODE_DEPTH_BOUNDS_EXT
, 2);
5072 n
[1].f
= (GLfloat
) zmin
;
5073 n
[2].f
= (GLfloat
) zmax
;
5075 if (ctx
->ExecuteFlag
) {
5076 CALL_DepthBoundsEXT(ctx
->Exec
, (zmin
, zmax
));
5082 static void GLAPIENTRY
5083 save_ProgramStringARB(GLenum target
, GLenum format
, GLsizei len
,
5084 const GLvoid
* string
)
5086 GET_CURRENT_CONTEXT(ctx
);
5089 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5091 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_STRING_ARB
, 4);
5093 GLubyte
*programCopy
= malloc(len
);
5095 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glProgramStringARB");
5098 memcpy(programCopy
, string
, len
);
5102 n
[4].data
= programCopy
;
5104 if (ctx
->ExecuteFlag
) {
5105 CALL_ProgramStringARB(ctx
->Exec
, (target
, format
, len
, string
));
5110 static void GLAPIENTRY
5111 save_BeginQueryARB(GLenum target
, GLuint id
)
5113 GET_CURRENT_CONTEXT(ctx
);
5115 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5116 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_ARB
, 2);
5121 if (ctx
->ExecuteFlag
) {
5122 CALL_BeginQuery(ctx
->Exec
, (target
, id
));
5126 static void GLAPIENTRY
5127 save_EndQueryARB(GLenum target
)
5129 GET_CURRENT_CONTEXT(ctx
);
5131 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5132 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_ARB
, 1);
5136 if (ctx
->ExecuteFlag
) {
5137 CALL_EndQuery(ctx
->Exec
, (target
));
5141 static void GLAPIENTRY
5142 save_QueryCounter(GLuint id
, GLenum target
)
5144 GET_CURRENT_CONTEXT(ctx
);
5146 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5147 n
= alloc_instruction(ctx
, OPCODE_QUERY_COUNTER
, 2);
5152 if (ctx
->ExecuteFlag
) {
5153 CALL_QueryCounter(ctx
->Exec
, (id
, target
));
5157 static void GLAPIENTRY
5158 save_BeginQueryIndexed(GLenum target
, GLuint index
, GLuint id
)
5160 GET_CURRENT_CONTEXT(ctx
);
5162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5163 n
= alloc_instruction(ctx
, OPCODE_BEGIN_QUERY_INDEXED
, 3);
5169 if (ctx
->ExecuteFlag
) {
5170 CALL_BeginQueryIndexed(ctx
->Exec
, (target
, index
, id
));
5174 static void GLAPIENTRY
5175 save_EndQueryIndexed(GLenum target
, GLuint index
)
5177 GET_CURRENT_CONTEXT(ctx
);
5179 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5180 n
= alloc_instruction(ctx
, OPCODE_END_QUERY_INDEXED
, 2);
5185 if (ctx
->ExecuteFlag
) {
5186 CALL_EndQueryIndexed(ctx
->Exec
, (target
, index
));
5191 static void GLAPIENTRY
5192 save_DrawBuffersARB(GLsizei count
, const GLenum
* buffers
)
5194 GET_CURRENT_CONTEXT(ctx
);
5196 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
5197 n
= alloc_instruction(ctx
, OPCODE_DRAW_BUFFERS_ARB
, 1 + MAX_DRAW_BUFFERS
);
5201 if (count
> MAX_DRAW_BUFFERS
)
5202 count
= MAX_DRAW_BUFFERS
;
5203 for (i
= 0; i
< count
; i
++) {
5204 n
[2 + i
].e
= buffers
[i
];
5207 if (ctx
->ExecuteFlag
) {
5208 CALL_DrawBuffers(ctx
->Exec
, (count
, buffers
));
5212 static void GLAPIENTRY
5213 save_TexBumpParameterfvATI(GLenum pname
, const GLfloat
*param
)
5215 GET_CURRENT_CONTEXT(ctx
);
5218 n
= alloc_instruction(ctx
, OPCODE_TEX_BUMP_PARAMETER_ATI
, 5);
5226 if (ctx
->ExecuteFlag
) {
5227 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, param
));
5231 static void GLAPIENTRY
5232 save_TexBumpParameterivATI(GLenum pname
, const GLint
*param
)
5235 p
[0] = INT_TO_FLOAT(param
[0]);
5236 p
[1] = INT_TO_FLOAT(param
[1]);
5237 p
[2] = INT_TO_FLOAT(param
[2]);
5238 p
[3] = INT_TO_FLOAT(param
[3]);
5239 save_TexBumpParameterfvATI(pname
, p
);
5242 static void GLAPIENTRY
5243 save_BindFragmentShaderATI(GLuint id
)
5245 GET_CURRENT_CONTEXT(ctx
);
5248 n
= alloc_instruction(ctx
, OPCODE_BIND_FRAGMENT_SHADER_ATI
, 1);
5252 if (ctx
->ExecuteFlag
) {
5253 CALL_BindFragmentShaderATI(ctx
->Exec
, (id
));
5257 static void GLAPIENTRY
5258 save_SetFragmentShaderConstantATI(GLuint dst
, const GLfloat
*value
)
5260 GET_CURRENT_CONTEXT(ctx
);
5263 n
= alloc_instruction(ctx
, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
, 5);
5271 if (ctx
->ExecuteFlag
) {
5272 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, value
));
5276 static void GLAPIENTRY
5277 save_Attr1fNV(GLenum attr
, GLfloat x
)
5279 GET_CURRENT_CONTEXT(ctx
);
5281 SAVE_FLUSH_VERTICES(ctx
);
5282 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_NV
, 2);
5288 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5289 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5290 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5292 if (ctx
->ExecuteFlag
) {
5293 CALL_VertexAttrib1fNV(ctx
->Exec
, (attr
, x
));
5297 static void GLAPIENTRY
5298 save_Attr2fNV(GLenum attr
, GLfloat x
, GLfloat y
)
5300 GET_CURRENT_CONTEXT(ctx
);
5302 SAVE_FLUSH_VERTICES(ctx
);
5303 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_NV
, 3);
5310 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5311 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5312 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5314 if (ctx
->ExecuteFlag
) {
5315 CALL_VertexAttrib2fNV(ctx
->Exec
, (attr
, x
, y
));
5319 static void GLAPIENTRY
5320 save_Attr3fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5322 GET_CURRENT_CONTEXT(ctx
);
5324 SAVE_FLUSH_VERTICES(ctx
);
5325 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_NV
, 4);
5333 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5334 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5335 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5337 if (ctx
->ExecuteFlag
) {
5338 CALL_VertexAttrib3fNV(ctx
->Exec
, (attr
, x
, y
, z
));
5342 static void GLAPIENTRY
5343 save_Attr4fNV(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5345 GET_CURRENT_CONTEXT(ctx
);
5347 SAVE_FLUSH_VERTICES(ctx
);
5348 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_NV
, 5);
5357 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5358 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5359 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5361 if (ctx
->ExecuteFlag
) {
5362 CALL_VertexAttrib4fNV(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5367 static void GLAPIENTRY
5368 save_Attr1fARB(GLenum attr
, GLfloat x
)
5370 GET_CURRENT_CONTEXT(ctx
);
5372 SAVE_FLUSH_VERTICES(ctx
);
5373 n
= alloc_instruction(ctx
, OPCODE_ATTR_1F_ARB
, 2);
5379 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5380 ctx
->ListState
.ActiveAttribSize
[attr
] = 1;
5381 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, 0, 0, 1);
5383 if (ctx
->ExecuteFlag
) {
5384 CALL_VertexAttrib1fARB(ctx
->Exec
, (attr
, x
));
5388 static void GLAPIENTRY
5389 save_Attr2fARB(GLenum attr
, GLfloat x
, GLfloat y
)
5391 GET_CURRENT_CONTEXT(ctx
);
5393 SAVE_FLUSH_VERTICES(ctx
);
5394 n
= alloc_instruction(ctx
, OPCODE_ATTR_2F_ARB
, 3);
5401 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5402 ctx
->ListState
.ActiveAttribSize
[attr
] = 2;
5403 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, 0, 1);
5405 if (ctx
->ExecuteFlag
) {
5406 CALL_VertexAttrib2fARB(ctx
->Exec
, (attr
, x
, y
));
5410 static void GLAPIENTRY
5411 save_Attr3fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
)
5413 GET_CURRENT_CONTEXT(ctx
);
5415 SAVE_FLUSH_VERTICES(ctx
);
5416 n
= alloc_instruction(ctx
, OPCODE_ATTR_3F_ARB
, 4);
5424 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5425 ctx
->ListState
.ActiveAttribSize
[attr
] = 3;
5426 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, 1);
5428 if (ctx
->ExecuteFlag
) {
5429 CALL_VertexAttrib3fARB(ctx
->Exec
, (attr
, x
, y
, z
));
5433 static void GLAPIENTRY
5434 save_Attr4fARB(GLenum attr
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5436 GET_CURRENT_CONTEXT(ctx
);
5438 SAVE_FLUSH_VERTICES(ctx
);
5439 n
= alloc_instruction(ctx
, OPCODE_ATTR_4F_ARB
, 5);
5448 ASSERT(attr
< MAX_VERTEX_GENERIC_ATTRIBS
);
5449 ctx
->ListState
.ActiveAttribSize
[attr
] = 4;
5450 ASSIGN_4V(ctx
->ListState
.CurrentAttrib
[attr
], x
, y
, z
, w
);
5452 if (ctx
->ExecuteFlag
) {
5453 CALL_VertexAttrib4fARB(ctx
->Exec
, (attr
, x
, y
, z
, w
));
5458 static void GLAPIENTRY
5459 save_EvalCoord1f(GLfloat x
)
5461 GET_CURRENT_CONTEXT(ctx
);
5463 SAVE_FLUSH_VERTICES(ctx
);
5464 n
= alloc_instruction(ctx
, OPCODE_EVAL_C1
, 1);
5468 if (ctx
->ExecuteFlag
) {
5469 CALL_EvalCoord1f(ctx
->Exec
, (x
));
5473 static void GLAPIENTRY
5474 save_EvalCoord1fv(const GLfloat
* v
)
5476 save_EvalCoord1f(v
[0]);
5479 static void GLAPIENTRY
5480 save_EvalCoord2f(GLfloat x
, GLfloat y
)
5482 GET_CURRENT_CONTEXT(ctx
);
5484 SAVE_FLUSH_VERTICES(ctx
);
5485 n
= alloc_instruction(ctx
, OPCODE_EVAL_C2
, 2);
5490 if (ctx
->ExecuteFlag
) {
5491 CALL_EvalCoord2f(ctx
->Exec
, (x
, y
));
5495 static void GLAPIENTRY
5496 save_EvalCoord2fv(const GLfloat
* v
)
5498 save_EvalCoord2f(v
[0], v
[1]);
5502 static void GLAPIENTRY
5503 save_EvalPoint1(GLint x
)
5505 GET_CURRENT_CONTEXT(ctx
);
5507 SAVE_FLUSH_VERTICES(ctx
);
5508 n
= alloc_instruction(ctx
, OPCODE_EVAL_P1
, 1);
5512 if (ctx
->ExecuteFlag
) {
5513 CALL_EvalPoint1(ctx
->Exec
, (x
));
5517 static void GLAPIENTRY
5518 save_EvalPoint2(GLint x
, GLint y
)
5520 GET_CURRENT_CONTEXT(ctx
);
5522 SAVE_FLUSH_VERTICES(ctx
);
5523 n
= alloc_instruction(ctx
, OPCODE_EVAL_P2
, 2);
5528 if (ctx
->ExecuteFlag
) {
5529 CALL_EvalPoint2(ctx
->Exec
, (x
, y
));
5533 static void GLAPIENTRY
5534 save_Indexf(GLfloat x
)
5536 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, x
);
5539 static void GLAPIENTRY
5540 save_Indexfv(const GLfloat
* v
)
5542 save_Attr1fNV(VERT_ATTRIB_COLOR_INDEX
, v
[0]);
5545 static void GLAPIENTRY
5546 save_EdgeFlag(GLboolean x
)
5548 save_Attr1fNV(VERT_ATTRIB_EDGEFLAG
, x
? 1.0f
: 0.0f
);
5553 * Compare 'count' elements of vectors 'a' and 'b'.
5554 * \return GL_TRUE if equal, GL_FALSE if different.
5556 static inline GLboolean
5557 compare_vec(const GLfloat
*a
, const GLfloat
*b
, GLuint count
)
5559 return memcmp( a
, b
, count
* sizeof(GLfloat
) ) == 0;
5564 * This glMaterial function is used for glMaterial calls that are outside
5565 * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
5567 static void GLAPIENTRY
5568 save_Materialfv(GLenum face
, GLenum pname
, const GLfloat
* param
)
5570 GET_CURRENT_CONTEXT(ctx
);
5578 case GL_FRONT_AND_BACK
:
5581 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(face)");
5590 case GL_AMBIENT_AND_DIFFUSE
:
5596 case GL_COLOR_INDEXES
:
5600 _mesa_compile_error(ctx
, GL_INVALID_ENUM
, "glMaterial(pname)");
5604 if (ctx
->ExecuteFlag
) {
5605 CALL_Materialfv(ctx
->Exec
, (face
, pname
, param
));
5608 bitmask
= _mesa_material_bitmask(ctx
, face
, pname
, ~0, NULL
);
5610 /* Try to eliminate redundant statechanges. Because it is legal to
5611 * call glMaterial even inside begin/end calls, don't need to worry
5612 * about ctx->Driver.CurrentSavePrimitive here.
5614 for (i
= 0; i
< MAT_ATTRIB_MAX
; i
++) {
5615 if (bitmask
& (1 << i
)) {
5616 if (ctx
->ListState
.ActiveMaterialSize
[i
] == args
&&
5617 compare_vec(ctx
->ListState
.CurrentMaterial
[i
], param
, args
)) {
5618 /* no change in material value */
5619 bitmask
&= ~(1 << i
);
5622 ctx
->ListState
.ActiveMaterialSize
[i
] = args
;
5623 COPY_SZ_4V(ctx
->ListState
.CurrentMaterial
[i
], args
, param
);
5628 /* If this call has no effect, return early */
5632 SAVE_FLUSH_VERTICES(ctx
);
5634 n
= alloc_instruction(ctx
, OPCODE_MATERIAL
, 6);
5638 for (i
= 0; i
< args
; i
++)
5639 n
[3 + i
].f
= param
[i
];
5643 static void GLAPIENTRY
5644 save_Begin(GLenum mode
)
5646 GET_CURRENT_CONTEXT(ctx
);
5648 GLboolean error
= GL_FALSE
;
5650 if (ctx
->ExecuteFlag
&& !_mesa_valid_prim_mode(ctx
, mode
, "glBegin")) {
5653 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_UNKNOWN
) {
5654 /* Typically the first begin. This may raise an error on
5655 * playback, depending on whether CallList is issued from inside
5656 * a begin/end or not.
5658 ctx
->Driver
.CurrentSavePrimitive
= PRIM_INSIDE_UNKNOWN_PRIM
;
5660 else if (ctx
->Driver
.CurrentSavePrimitive
== PRIM_OUTSIDE_BEGIN_END
) {
5661 ctx
->Driver
.CurrentSavePrimitive
= mode
;
5664 _mesa_compile_error(ctx
, GL_INVALID_OPERATION
, "recursive begin");
5669 /* Give the driver an opportunity to hook in an optimized
5670 * display list compiler.
5672 if (ctx
->Driver
.NotifySaveBegin(ctx
, mode
))
5675 SAVE_FLUSH_VERTICES(ctx
);
5676 n
= alloc_instruction(ctx
, OPCODE_BEGIN
, 1);
5682 if (ctx
->ExecuteFlag
) {
5683 CALL_Begin(ctx
->Exec
, (mode
));
5687 static void GLAPIENTRY
5690 GET_CURRENT_CONTEXT(ctx
);
5691 SAVE_FLUSH_VERTICES(ctx
);
5692 (void) alloc_instruction(ctx
, OPCODE_END
, 0);
5693 ctx
->Driver
.CurrentSavePrimitive
= PRIM_OUTSIDE_BEGIN_END
;
5694 if (ctx
->ExecuteFlag
) {
5695 CALL_End(ctx
->Exec
, ());
5699 static void GLAPIENTRY
5700 save_Rectf(GLfloat a
, GLfloat b
, GLfloat c
, GLfloat d
)
5702 GET_CURRENT_CONTEXT(ctx
);
5704 SAVE_FLUSH_VERTICES(ctx
);
5705 n
= alloc_instruction(ctx
, OPCODE_RECTF
, 4);
5712 if (ctx
->ExecuteFlag
) {
5713 CALL_Rectf(ctx
->Exec
, (a
, b
, c
, d
));
5718 static void GLAPIENTRY
5719 save_Vertex2f(GLfloat x
, GLfloat y
)
5721 save_Attr2fNV(VERT_ATTRIB_POS
, x
, y
);
5724 static void GLAPIENTRY
5725 save_Vertex2fv(const GLfloat
* v
)
5727 save_Attr2fNV(VERT_ATTRIB_POS
, v
[0], v
[1]);
5730 static void GLAPIENTRY
5731 save_Vertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
5733 save_Attr3fNV(VERT_ATTRIB_POS
, x
, y
, z
);
5736 static void GLAPIENTRY
5737 save_Vertex3fv(const GLfloat
* v
)
5739 save_Attr3fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2]);
5742 static void GLAPIENTRY
5743 save_Vertex4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5745 save_Attr4fNV(VERT_ATTRIB_POS
, x
, y
, z
, w
);
5748 static void GLAPIENTRY
5749 save_Vertex4fv(const GLfloat
* v
)
5751 save_Attr4fNV(VERT_ATTRIB_POS
, v
[0], v
[1], v
[2], v
[3]);
5754 static void GLAPIENTRY
5755 save_TexCoord1f(GLfloat x
)
5757 save_Attr1fNV(VERT_ATTRIB_TEX0
, x
);
5760 static void GLAPIENTRY
5761 save_TexCoord1fv(const GLfloat
* v
)
5763 save_Attr1fNV(VERT_ATTRIB_TEX0
, v
[0]);
5766 static void GLAPIENTRY
5767 save_TexCoord2f(GLfloat x
, GLfloat y
)
5769 save_Attr2fNV(VERT_ATTRIB_TEX0
, x
, y
);
5772 static void GLAPIENTRY
5773 save_TexCoord2fv(const GLfloat
* v
)
5775 save_Attr2fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1]);
5778 static void GLAPIENTRY
5779 save_TexCoord3f(GLfloat x
, GLfloat y
, GLfloat z
)
5781 save_Attr3fNV(VERT_ATTRIB_TEX0
, x
, y
, z
);
5784 static void GLAPIENTRY
5785 save_TexCoord3fv(const GLfloat
* v
)
5787 save_Attr3fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2]);
5790 static void GLAPIENTRY
5791 save_TexCoord4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5793 save_Attr4fNV(VERT_ATTRIB_TEX0
, x
, y
, z
, w
);
5796 static void GLAPIENTRY
5797 save_TexCoord4fv(const GLfloat
* v
)
5799 save_Attr4fNV(VERT_ATTRIB_TEX0
, v
[0], v
[1], v
[2], v
[3]);
5802 static void GLAPIENTRY
5803 save_Normal3f(GLfloat x
, GLfloat y
, GLfloat z
)
5805 save_Attr3fNV(VERT_ATTRIB_NORMAL
, x
, y
, z
);
5808 static void GLAPIENTRY
5809 save_Normal3fv(const GLfloat
* v
)
5811 save_Attr3fNV(VERT_ATTRIB_NORMAL
, v
[0], v
[1], v
[2]);
5814 static void GLAPIENTRY
5815 save_FogCoordfEXT(GLfloat x
)
5817 save_Attr1fNV(VERT_ATTRIB_FOG
, x
);
5820 static void GLAPIENTRY
5821 save_FogCoordfvEXT(const GLfloat
* v
)
5823 save_Attr1fNV(VERT_ATTRIB_FOG
, v
[0]);
5826 static void GLAPIENTRY
5827 save_Color3f(GLfloat x
, GLfloat y
, GLfloat z
)
5829 save_Attr3fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
);
5832 static void GLAPIENTRY
5833 save_Color3fv(const GLfloat
* v
)
5835 save_Attr3fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2]);
5838 static void GLAPIENTRY
5839 save_Color4f(GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
5841 save_Attr4fNV(VERT_ATTRIB_COLOR0
, x
, y
, z
, w
);
5844 static void GLAPIENTRY
5845 save_Color4fv(const GLfloat
* v
)
5847 save_Attr4fNV(VERT_ATTRIB_COLOR0
, v
[0], v
[1], v
[2], v
[3]);
5850 static void GLAPIENTRY
5851 save_SecondaryColor3fEXT(GLfloat x
, GLfloat y
, GLfloat z
)
5853 save_Attr3fNV(VERT_ATTRIB_COLOR1
, x
, y
, z
);
5856 static void GLAPIENTRY
5857 save_SecondaryColor3fvEXT(const GLfloat
* v
)
5859 save_Attr3fNV(VERT_ATTRIB_COLOR1
, v
[0], v
[1], v
[2]);
5863 /* Just call the respective ATTR for texcoord
5865 static void GLAPIENTRY
5866 save_MultiTexCoord1f(GLenum target
, GLfloat x
)
5868 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5869 save_Attr1fNV(attr
, x
);
5872 static void GLAPIENTRY
5873 save_MultiTexCoord1fv(GLenum target
, const GLfloat
* v
)
5875 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5876 save_Attr1fNV(attr
, v
[0]);
5879 static void GLAPIENTRY
5880 save_MultiTexCoord2f(GLenum target
, GLfloat x
, GLfloat y
)
5882 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5883 save_Attr2fNV(attr
, x
, y
);
5886 static void GLAPIENTRY
5887 save_MultiTexCoord2fv(GLenum target
, const GLfloat
* v
)
5889 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5890 save_Attr2fNV(attr
, v
[0], v
[1]);
5893 static void GLAPIENTRY
5894 save_MultiTexCoord3f(GLenum target
, GLfloat x
, GLfloat y
, GLfloat z
)
5896 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5897 save_Attr3fNV(attr
, x
, y
, z
);
5900 static void GLAPIENTRY
5901 save_MultiTexCoord3fv(GLenum target
, const GLfloat
* v
)
5903 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5904 save_Attr3fNV(attr
, v
[0], v
[1], v
[2]);
5907 static void GLAPIENTRY
5908 save_MultiTexCoord4f(GLenum target
, GLfloat x
, GLfloat y
,
5909 GLfloat z
, GLfloat w
)
5911 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5912 save_Attr4fNV(attr
, x
, y
, z
, w
);
5915 static void GLAPIENTRY
5916 save_MultiTexCoord4fv(GLenum target
, const GLfloat
* v
)
5918 GLuint attr
= (target
& 0x7) + VERT_ATTRIB_TEX0
;
5919 save_Attr4fNV(attr
, v
[0], v
[1], v
[2], v
[3]);
5924 * Record a GL_INVALID_VALUE error when a invalid vertex attribute
5930 GET_CURRENT_CONTEXT(ctx
);
5931 _mesa_error(ctx
, GL_INVALID_VALUE
, "VertexAttribf(index)");
5936 static void GLAPIENTRY
5937 save_VertexAttrib1fARB(GLuint index
, GLfloat x
)
5939 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5940 save_Attr1fARB(index
, x
);
5945 static void GLAPIENTRY
5946 save_VertexAttrib1fvARB(GLuint index
, const GLfloat
* v
)
5948 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5949 save_Attr1fARB(index
, v
[0]);
5954 static void GLAPIENTRY
5955 save_VertexAttrib2fARB(GLuint index
, GLfloat x
, GLfloat y
)
5957 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5958 save_Attr2fARB(index
, x
, y
);
5963 static void GLAPIENTRY
5964 save_VertexAttrib2fvARB(GLuint index
, const GLfloat
* v
)
5966 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5967 save_Attr2fARB(index
, v
[0], v
[1]);
5972 static void GLAPIENTRY
5973 save_VertexAttrib3fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
)
5975 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5976 save_Attr3fARB(index
, x
, y
, z
);
5981 static void GLAPIENTRY
5982 save_VertexAttrib3fvARB(GLuint index
, const GLfloat
* v
)
5984 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5985 save_Attr3fARB(index
, v
[0], v
[1], v
[2]);
5990 static void GLAPIENTRY
5991 save_VertexAttrib4fARB(GLuint index
, GLfloat x
, GLfloat y
, GLfloat z
,
5994 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
5995 save_Attr4fARB(index
, x
, y
, z
, w
);
6000 static void GLAPIENTRY
6001 save_VertexAttrib4fvARB(GLuint index
, const GLfloat
* v
)
6003 if (index
< MAX_VERTEX_GENERIC_ATTRIBS
)
6004 save_Attr4fARB(index
, v
[0], v
[1], v
[2], v
[3]);
6009 static void GLAPIENTRY
6010 save_BlitFramebufferEXT(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
6011 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
6012 GLbitfield mask
, GLenum filter
)
6014 GET_CURRENT_CONTEXT(ctx
);
6016 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6017 n
= alloc_instruction(ctx
, OPCODE_BLIT_FRAMEBUFFER
, 10);
6030 if (ctx
->ExecuteFlag
) {
6031 CALL_BlitFramebuffer(ctx
->Exec
, (srcX0
, srcY0
, srcX1
, srcY1
,
6032 dstX0
, dstY0
, dstX1
, dstY1
,
6038 /** GL_EXT_provoking_vertex */
6039 static void GLAPIENTRY
6040 save_ProvokingVertexEXT(GLenum mode
)
6042 GET_CURRENT_CONTEXT(ctx
);
6044 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6045 n
= alloc_instruction(ctx
, OPCODE_PROVOKING_VERTEX
, 1);
6049 if (ctx
->ExecuteFlag
) {
6050 /*CALL_ProvokingVertex(ctx->Exec, (mode));*/
6051 _mesa_ProvokingVertex(mode
);
6056 /** GL_EXT_transform_feedback */
6057 static void GLAPIENTRY
6058 save_BeginTransformFeedback(GLenum mode
)
6060 GET_CURRENT_CONTEXT(ctx
);
6062 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6063 n
= alloc_instruction(ctx
, OPCODE_BEGIN_TRANSFORM_FEEDBACK
, 1);
6067 if (ctx
->ExecuteFlag
) {
6068 CALL_BeginTransformFeedback(ctx
->Exec
, (mode
));
6073 /** GL_EXT_transform_feedback */
6074 static void GLAPIENTRY
6075 save_EndTransformFeedback(void)
6077 GET_CURRENT_CONTEXT(ctx
);
6078 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6079 (void) alloc_instruction(ctx
, OPCODE_END_TRANSFORM_FEEDBACK
, 0);
6080 if (ctx
->ExecuteFlag
) {
6081 CALL_EndTransformFeedback(ctx
->Exec
, ());
6085 static void GLAPIENTRY
6086 save_BindTransformFeedback(GLenum target
, GLuint name
)
6088 GET_CURRENT_CONTEXT(ctx
);
6090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6091 n
= alloc_instruction(ctx
, OPCODE_BIND_TRANSFORM_FEEDBACK
, 2);
6096 if (ctx
->ExecuteFlag
) {
6097 CALL_BindTransformFeedback(ctx
->Exec
, (target
, name
));
6101 static void GLAPIENTRY
6102 save_PauseTransformFeedback(void)
6104 GET_CURRENT_CONTEXT(ctx
);
6105 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6106 (void) alloc_instruction(ctx
, OPCODE_PAUSE_TRANSFORM_FEEDBACK
, 0);
6107 if (ctx
->ExecuteFlag
) {
6108 CALL_PauseTransformFeedback(ctx
->Exec
, ());
6112 static void GLAPIENTRY
6113 save_ResumeTransformFeedback(void)
6115 GET_CURRENT_CONTEXT(ctx
);
6116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6117 (void) alloc_instruction(ctx
, OPCODE_RESUME_TRANSFORM_FEEDBACK
, 0);
6118 if (ctx
->ExecuteFlag
) {
6119 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
6123 static void GLAPIENTRY
6124 save_DrawTransformFeedback(GLenum mode
, GLuint name
)
6126 GET_CURRENT_CONTEXT(ctx
);
6128 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6129 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK
, 2);
6134 if (ctx
->ExecuteFlag
) {
6135 CALL_DrawTransformFeedback(ctx
->Exec
, (mode
, name
));
6139 static void GLAPIENTRY
6140 save_DrawTransformFeedbackStream(GLenum mode
, GLuint name
, GLuint stream
)
6142 GET_CURRENT_CONTEXT(ctx
);
6144 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6145 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
, 3);
6151 if (ctx
->ExecuteFlag
) {
6152 CALL_DrawTransformFeedbackStream(ctx
->Exec
, (mode
, name
, stream
));
6156 static void GLAPIENTRY
6157 save_DrawTransformFeedbackInstanced(GLenum mode
, GLuint name
,
6160 GET_CURRENT_CONTEXT(ctx
);
6162 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6163 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
, 3);
6167 n
[3].si
= primcount
;
6169 if (ctx
->ExecuteFlag
) {
6170 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
, (mode
, name
, primcount
));
6174 static void GLAPIENTRY
6175 save_DrawTransformFeedbackStreamInstanced(GLenum mode
, GLuint name
,
6176 GLuint stream
, GLsizei primcount
)
6178 GET_CURRENT_CONTEXT(ctx
);
6180 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6181 n
= alloc_instruction(ctx
, OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
, 4);
6186 n
[4].si
= primcount
;
6188 if (ctx
->ExecuteFlag
) {
6189 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
, (mode
, name
, stream
,
6194 /* aka UseProgram() */
6195 static void GLAPIENTRY
6196 save_UseProgramObjectARB(GLhandleARB program
)
6198 GET_CURRENT_CONTEXT(ctx
);
6200 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6201 n
= alloc_instruction(ctx
, OPCODE_USE_PROGRAM
, 1);
6205 if (ctx
->ExecuteFlag
) {
6206 CALL_UseProgram(ctx
->Exec
, (program
));
6211 static void GLAPIENTRY
6212 save_Uniform1fARB(GLint location
, GLfloat x
)
6214 GET_CURRENT_CONTEXT(ctx
);
6216 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6217 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1F
, 2);
6222 if (ctx
->ExecuteFlag
) {
6223 CALL_Uniform1f(ctx
->Exec
, (location
, x
));
6228 static void GLAPIENTRY
6229 save_Uniform2fARB(GLint location
, GLfloat x
, GLfloat y
)
6231 GET_CURRENT_CONTEXT(ctx
);
6233 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6234 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2F
, 3);
6240 if (ctx
->ExecuteFlag
) {
6241 CALL_Uniform2f(ctx
->Exec
, (location
, x
, y
));
6246 static void GLAPIENTRY
6247 save_Uniform3fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
)
6249 GET_CURRENT_CONTEXT(ctx
);
6251 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6252 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3F
, 4);
6259 if (ctx
->ExecuteFlag
) {
6260 CALL_Uniform3f(ctx
->Exec
, (location
, x
, y
, z
));
6265 static void GLAPIENTRY
6266 save_Uniform4fARB(GLint location
, GLfloat x
, GLfloat y
, GLfloat z
, GLfloat w
)
6268 GET_CURRENT_CONTEXT(ctx
);
6270 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6271 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4F
, 5);
6279 if (ctx
->ExecuteFlag
) {
6280 CALL_Uniform4f(ctx
->Exec
, (location
, x
, y
, z
, w
));
6285 /** Return copy of memory */
6287 memdup(const void *src
, GLsizei bytes
)
6289 void *b
= bytes
>= 0 ? malloc(bytes
) : NULL
;
6291 memcpy(b
, src
, bytes
);
6296 static void GLAPIENTRY
6297 save_Uniform1fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6299 GET_CURRENT_CONTEXT(ctx
);
6301 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6302 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1FV
, 3);
6306 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLfloat
));
6308 if (ctx
->ExecuteFlag
) {
6309 CALL_Uniform1fv(ctx
->Exec
, (location
, count
, v
));
6313 static void GLAPIENTRY
6314 save_Uniform2fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6316 GET_CURRENT_CONTEXT(ctx
);
6318 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6319 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2FV
, 3);
6323 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLfloat
));
6325 if (ctx
->ExecuteFlag
) {
6326 CALL_Uniform2fv(ctx
->Exec
, (location
, count
, v
));
6330 static void GLAPIENTRY
6331 save_Uniform3fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6333 GET_CURRENT_CONTEXT(ctx
);
6335 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6336 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3FV
, 3);
6340 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLfloat
));
6342 if (ctx
->ExecuteFlag
) {
6343 CALL_Uniform3fv(ctx
->Exec
, (location
, count
, v
));
6347 static void GLAPIENTRY
6348 save_Uniform4fvARB(GLint location
, GLsizei count
, const GLfloat
*v
)
6350 GET_CURRENT_CONTEXT(ctx
);
6352 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6353 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4FV
, 3);
6357 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6359 if (ctx
->ExecuteFlag
) {
6360 CALL_Uniform4fv(ctx
->Exec
, (location
, count
, v
));
6365 static void GLAPIENTRY
6366 save_Uniform1iARB(GLint location
, GLint x
)
6368 GET_CURRENT_CONTEXT(ctx
);
6370 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6371 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1I
, 2);
6376 if (ctx
->ExecuteFlag
) {
6377 CALL_Uniform1i(ctx
->Exec
, (location
, x
));
6381 static void GLAPIENTRY
6382 save_Uniform2iARB(GLint location
, GLint x
, GLint y
)
6384 GET_CURRENT_CONTEXT(ctx
);
6386 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6387 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2I
, 3);
6393 if (ctx
->ExecuteFlag
) {
6394 CALL_Uniform2i(ctx
->Exec
, (location
, x
, y
));
6398 static void GLAPIENTRY
6399 save_Uniform3iARB(GLint location
, GLint x
, GLint y
, GLint z
)
6401 GET_CURRENT_CONTEXT(ctx
);
6403 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6404 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3I
, 4);
6411 if (ctx
->ExecuteFlag
) {
6412 CALL_Uniform3i(ctx
->Exec
, (location
, x
, y
, z
));
6416 static void GLAPIENTRY
6417 save_Uniform4iARB(GLint location
, GLint x
, GLint y
, GLint z
, GLint w
)
6419 GET_CURRENT_CONTEXT(ctx
);
6421 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6422 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4I
, 5);
6430 if (ctx
->ExecuteFlag
) {
6431 CALL_Uniform4i(ctx
->Exec
, (location
, x
, y
, z
, w
));
6437 static void GLAPIENTRY
6438 save_Uniform1ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6440 GET_CURRENT_CONTEXT(ctx
);
6442 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6443 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1IV
, 3);
6447 n
[3].data
= memdup(v
, count
* 1 * sizeof(GLint
));
6449 if (ctx
->ExecuteFlag
) {
6450 CALL_Uniform1iv(ctx
->Exec
, (location
, count
, v
));
6454 static void GLAPIENTRY
6455 save_Uniform2ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6457 GET_CURRENT_CONTEXT(ctx
);
6459 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6460 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2IV
, 3);
6464 n
[3].data
= memdup(v
, count
* 2 * sizeof(GLint
));
6466 if (ctx
->ExecuteFlag
) {
6467 CALL_Uniform2iv(ctx
->Exec
, (location
, count
, v
));
6471 static void GLAPIENTRY
6472 save_Uniform3ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6474 GET_CURRENT_CONTEXT(ctx
);
6476 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6477 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3IV
, 3);
6481 n
[3].data
= memdup(v
, count
* 3 * sizeof(GLint
));
6483 if (ctx
->ExecuteFlag
) {
6484 CALL_Uniform3iv(ctx
->Exec
, (location
, count
, v
));
6488 static void GLAPIENTRY
6489 save_Uniform4ivARB(GLint location
, GLsizei count
, const GLint
*v
)
6491 GET_CURRENT_CONTEXT(ctx
);
6493 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6494 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4IV
, 3);
6498 n
[3].data
= memdup(v
, count
* 4 * sizeof(GLfloat
));
6500 if (ctx
->ExecuteFlag
) {
6501 CALL_Uniform4iv(ctx
->Exec
, (location
, count
, v
));
6507 static void GLAPIENTRY
6508 save_Uniform1ui(GLint location
, GLuint x
)
6510 GET_CURRENT_CONTEXT(ctx
);
6512 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6513 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UI
, 2);
6518 if (ctx
->ExecuteFlag
) {
6519 /*CALL_Uniform1ui(ctx->Exec, (location, x));*/
6523 static void GLAPIENTRY
6524 save_Uniform2ui(GLint location
, GLuint x
, GLuint y
)
6526 GET_CURRENT_CONTEXT(ctx
);
6528 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6529 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UI
, 3);
6535 if (ctx
->ExecuteFlag
) {
6536 /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/
6540 static void GLAPIENTRY
6541 save_Uniform3ui(GLint location
, GLuint x
, GLuint y
, GLuint z
)
6543 GET_CURRENT_CONTEXT(ctx
);
6545 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6546 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UI
, 4);
6553 if (ctx
->ExecuteFlag
) {
6554 /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/
6558 static void GLAPIENTRY
6559 save_Uniform4ui(GLint location
, GLuint x
, GLuint y
, GLuint z
, GLuint w
)
6561 GET_CURRENT_CONTEXT(ctx
);
6563 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6564 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UI
, 5);
6572 if (ctx
->ExecuteFlag
) {
6573 /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/
6579 static void GLAPIENTRY
6580 save_Uniform1uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6582 GET_CURRENT_CONTEXT(ctx
);
6584 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6585 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_1UIV
, 3);
6589 n
[3].data
= memdup(v
, count
* 1 * sizeof(*v
));
6591 if (ctx
->ExecuteFlag
) {
6592 /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/
6596 static void GLAPIENTRY
6597 save_Uniform2uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6599 GET_CURRENT_CONTEXT(ctx
);
6601 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6602 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_2UIV
, 3);
6606 n
[3].data
= memdup(v
, count
* 2 * sizeof(*v
));
6608 if (ctx
->ExecuteFlag
) {
6609 /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/
6613 static void GLAPIENTRY
6614 save_Uniform3uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6616 GET_CURRENT_CONTEXT(ctx
);
6618 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6619 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_3UIV
, 3);
6623 n
[3].data
= memdup(v
, count
* 3 * sizeof(*v
));
6625 if (ctx
->ExecuteFlag
) {
6626 /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/
6630 static void GLAPIENTRY
6631 save_Uniform4uiv(GLint location
, GLsizei count
, const GLuint
*v
)
6633 GET_CURRENT_CONTEXT(ctx
);
6635 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6636 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_4UIV
, 3);
6640 n
[3].data
= memdup(v
, count
* 4 * sizeof(*v
));
6642 if (ctx
->ExecuteFlag
) {
6643 /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/
6649 static void GLAPIENTRY
6650 save_UniformMatrix2fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6653 GET_CURRENT_CONTEXT(ctx
);
6655 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6656 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX22
, 4);
6661 n
[4].data
= memdup(m
, count
* 2 * 2 * sizeof(GLfloat
));
6663 if (ctx
->ExecuteFlag
) {
6664 CALL_UniformMatrix2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6668 static void GLAPIENTRY
6669 save_UniformMatrix3fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6672 GET_CURRENT_CONTEXT(ctx
);
6674 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6675 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX33
, 4);
6680 n
[4].data
= memdup(m
, count
* 3 * 3 * sizeof(GLfloat
));
6682 if (ctx
->ExecuteFlag
) {
6683 CALL_UniformMatrix3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6687 static void GLAPIENTRY
6688 save_UniformMatrix4fvARB(GLint location
, GLsizei count
, GLboolean transpose
,
6691 GET_CURRENT_CONTEXT(ctx
);
6693 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6694 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX44
, 4);
6699 n
[4].data
= memdup(m
, count
* 4 * 4 * sizeof(GLfloat
));
6701 if (ctx
->ExecuteFlag
) {
6702 CALL_UniformMatrix4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6707 static void GLAPIENTRY
6708 save_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6711 GET_CURRENT_CONTEXT(ctx
);
6713 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6714 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX23
, 4);
6719 n
[4].data
= memdup(m
, count
* 2 * 3 * sizeof(GLfloat
));
6721 if (ctx
->ExecuteFlag
) {
6722 CALL_UniformMatrix2x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6726 static void GLAPIENTRY
6727 save_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6730 GET_CURRENT_CONTEXT(ctx
);
6732 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6733 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX32
, 4);
6738 n
[4].data
= memdup(m
, count
* 3 * 2 * sizeof(GLfloat
));
6740 if (ctx
->ExecuteFlag
) {
6741 CALL_UniformMatrix3x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6746 static void GLAPIENTRY
6747 save_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6750 GET_CURRENT_CONTEXT(ctx
);
6752 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6753 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX24
, 4);
6758 n
[4].data
= memdup(m
, count
* 2 * 4 * sizeof(GLfloat
));
6760 if (ctx
->ExecuteFlag
) {
6761 CALL_UniformMatrix2x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6765 static void GLAPIENTRY
6766 save_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
6769 GET_CURRENT_CONTEXT(ctx
);
6771 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6772 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX42
, 4);
6777 n
[4].data
= memdup(m
, count
* 4 * 2 * sizeof(GLfloat
));
6779 if (ctx
->ExecuteFlag
) {
6780 CALL_UniformMatrix4x2fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6785 static void GLAPIENTRY
6786 save_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
6789 GET_CURRENT_CONTEXT(ctx
);
6791 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6792 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX34
, 4);
6797 n
[4].data
= memdup(m
, count
* 3 * 4 * sizeof(GLfloat
));
6799 if (ctx
->ExecuteFlag
) {
6800 CALL_UniformMatrix3x4fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6804 static void GLAPIENTRY
6805 save_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
6808 GET_CURRENT_CONTEXT(ctx
);
6810 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6811 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_MATRIX43
, 4);
6816 n
[4].data
= memdup(m
, count
* 4 * 3 * sizeof(GLfloat
));
6818 if (ctx
->ExecuteFlag
) {
6819 CALL_UniformMatrix4x3fv(ctx
->Exec
, (location
, count
, transpose
, m
));
6823 static void GLAPIENTRY
6824 save_ClampColorARB(GLenum target
, GLenum clamp
)
6826 GET_CURRENT_CONTEXT(ctx
);
6828 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6829 n
= alloc_instruction(ctx
, OPCODE_CLAMP_COLOR
, 2);
6834 if (ctx
->ExecuteFlag
) {
6835 CALL_ClampColor(ctx
->Exec
, (target
, clamp
));
6839 static void GLAPIENTRY
6840 save_UseShaderProgramEXT(GLenum type
, GLuint program
)
6842 GET_CURRENT_CONTEXT(ctx
);
6844 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6845 n
= alloc_instruction(ctx
, OPCODE_USE_SHADER_PROGRAM_EXT
, 2);
6850 if (ctx
->ExecuteFlag
) {
6851 CALL_UseShaderProgramEXT(ctx
->Exec
, (type
, program
));
6855 static void GLAPIENTRY
6856 save_ActiveProgramEXT(GLuint program
)
6858 GET_CURRENT_CONTEXT(ctx
);
6860 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6861 n
= alloc_instruction(ctx
, OPCODE_ACTIVE_PROGRAM_EXT
, 1);
6865 if (ctx
->ExecuteFlag
) {
6866 CALL_ActiveProgramEXT(ctx
->Exec
, (program
));
6870 /** GL_EXT_texture_integer */
6871 static void GLAPIENTRY
6872 save_ClearColorIi(GLint red
, GLint green
, GLint blue
, GLint alpha
)
6874 GET_CURRENT_CONTEXT(ctx
);
6876 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6877 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_I
, 4);
6884 if (ctx
->ExecuteFlag
) {
6885 CALL_ClearColorIiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6889 /** GL_EXT_texture_integer */
6890 static void GLAPIENTRY
6891 save_ClearColorIui(GLuint red
, GLuint green
, GLuint blue
, GLuint alpha
)
6893 GET_CURRENT_CONTEXT(ctx
);
6895 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6896 n
= alloc_instruction(ctx
, OPCODE_CLEARCOLOR_UI
, 4);
6903 if (ctx
->ExecuteFlag
) {
6904 CALL_ClearColorIuiEXT(ctx
->Exec
, (red
, green
, blue
, alpha
));
6908 /** GL_EXT_texture_integer */
6909 static void GLAPIENTRY
6910 save_TexParameterIiv(GLenum target
, GLenum pname
, const GLint
*params
)
6912 GET_CURRENT_CONTEXT(ctx
);
6914 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6915 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_I
, 6);
6924 if (ctx
->ExecuteFlag
) {
6925 CALL_TexParameterIiv(ctx
->Exec
, (target
, pname
, params
));
6929 /** GL_EXT_texture_integer */
6930 static void GLAPIENTRY
6931 save_TexParameterIuiv(GLenum target
, GLenum pname
, const GLuint
*params
)
6933 GET_CURRENT_CONTEXT(ctx
);
6935 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6936 n
= alloc_instruction(ctx
, OPCODE_TEXPARAMETER_UI
, 6);
6940 n
[3].ui
= params
[0];
6941 n
[4].ui
= params
[1];
6942 n
[5].ui
= params
[2];
6943 n
[6].ui
= params
[3];
6945 if (ctx
->ExecuteFlag
) {
6946 CALL_TexParameterIuiv(ctx
->Exec
, (target
, pname
, params
));
6950 /* GL_ARB_instanced_arrays */
6951 static void GLAPIENTRY
6952 save_VertexAttribDivisor(GLuint index
, GLuint divisor
)
6954 GET_CURRENT_CONTEXT(ctx
);
6956 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6957 n
= alloc_instruction(ctx
, OPCODE_VERTEX_ATTRIB_DIVISOR
, 2);
6962 if (ctx
->ExecuteFlag
) {
6963 CALL_VertexAttribDivisor(ctx
->Exec
, (index
, divisor
));
6968 /* GL_NV_texture_barrier */
6969 static void GLAPIENTRY
6970 save_TextureBarrierNV(void)
6972 GET_CURRENT_CONTEXT(ctx
);
6973 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6974 alloc_instruction(ctx
, OPCODE_TEXTURE_BARRIER_NV
, 0);
6975 if (ctx
->ExecuteFlag
) {
6976 CALL_TextureBarrierNV(ctx
->Exec
, ());
6981 /* GL_ARB_sampler_objects */
6982 static void GLAPIENTRY
6983 save_BindSampler(GLuint unit
, GLuint sampler
)
6986 GET_CURRENT_CONTEXT(ctx
);
6987 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
6988 n
= alloc_instruction(ctx
, OPCODE_BIND_SAMPLER
, 2);
6993 if (ctx
->ExecuteFlag
) {
6994 CALL_BindSampler(ctx
->Exec
, (unit
, sampler
));
6998 static void GLAPIENTRY
6999 save_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7002 GET_CURRENT_CONTEXT(ctx
);
7003 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7004 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIV
, 6);
7009 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7015 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7018 if (ctx
->ExecuteFlag
) {
7019 CALL_SamplerParameteriv(ctx
->Exec
, (sampler
, pname
, params
));
7023 static void GLAPIENTRY
7024 save_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
7026 save_SamplerParameteriv(sampler
, pname
, ¶m
);
7029 static void GLAPIENTRY
7030 save_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
7033 GET_CURRENT_CONTEXT(ctx
);
7034 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7035 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERFV
, 6);
7040 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7046 n
[4].f
= n
[5].f
= n
[6].f
= 0.0F
;
7049 if (ctx
->ExecuteFlag
) {
7050 CALL_SamplerParameterfv(ctx
->Exec
, (sampler
, pname
, params
));
7054 static void GLAPIENTRY
7055 save_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
7057 save_SamplerParameterfv(sampler
, pname
, ¶m
);
7060 static void GLAPIENTRY
7061 save_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
7064 GET_CURRENT_CONTEXT(ctx
);
7065 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7066 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERIIV
, 6);
7071 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7077 n
[4].i
= n
[5].i
= n
[6].i
= 0;
7080 if (ctx
->ExecuteFlag
) {
7081 CALL_SamplerParameterIiv(ctx
->Exec
, (sampler
, pname
, params
));
7085 static void GLAPIENTRY
7086 save_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
7089 GET_CURRENT_CONTEXT(ctx
);
7090 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7091 n
= alloc_instruction(ctx
, OPCODE_SAMPLER_PARAMETERUIV
, 6);
7095 n
[3].ui
= params
[0];
7096 if (pname
== GL_TEXTURE_BORDER_COLOR
) {
7097 n
[4].ui
= params
[1];
7098 n
[5].ui
= params
[2];
7099 n
[6].ui
= params
[3];
7102 n
[4].ui
= n
[5].ui
= n
[6].ui
= 0;
7105 if (ctx
->ExecuteFlag
) {
7106 CALL_SamplerParameterIuiv(ctx
->Exec
, (sampler
, pname
, params
));
7110 /* GL_ARB_geometry_shader4 */
7111 static void GLAPIENTRY
7112 save_ProgramParameteri(GLuint program
, GLenum pname
, GLint value
)
7115 GET_CURRENT_CONTEXT(ctx
);
7116 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7117 n
= alloc_instruction(ctx
, OPCODE_PROGRAM_PARAMETERI
, 3);
7123 if (ctx
->ExecuteFlag
) {
7124 CALL_ProgramParameteri(ctx
->Exec
, (program
, pname
, value
));
7128 static void GLAPIENTRY
7129 save_FramebufferTexture(GLenum target
, GLenum attachment
,
7130 GLuint texture
, GLint level
)
7133 GET_CURRENT_CONTEXT(ctx
);
7134 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7135 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE
, 4);
7138 n
[2].e
= attachment
;
7142 if (ctx
->ExecuteFlag
) {
7143 CALL_FramebufferTexture(ctx
->Exec
, (target
, attachment
, texture
, level
));
7147 static void GLAPIENTRY
7148 save_FramebufferTextureFace(GLenum target
, GLenum attachment
,
7149 GLuint texture
, GLint level
, GLenum face
)
7152 GET_CURRENT_CONTEXT(ctx
);
7153 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7154 n
= alloc_instruction(ctx
, OPCODE_FRAMEBUFFER_TEXTURE_FACE
, 5);
7157 n
[2].e
= attachment
;
7162 if (ctx
->ExecuteFlag
) {
7163 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (target
, attachment
, texture
,
7170 static void GLAPIENTRY
7171 save_WaitSync(GLsync sync
, GLbitfield flags
, GLuint64 timeout
)
7174 GET_CURRENT_CONTEXT(ctx
);
7175 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7176 n
= alloc_instruction(ctx
, OPCODE_WAIT_SYNC
, 4);
7178 union uint64_pair p
;
7182 n
[3].ui
= p
.uint32
[0];
7183 n
[4].ui
= p
.uint32
[1];
7185 if (ctx
->ExecuteFlag
) {
7186 CALL_WaitSync(ctx
->Exec
, (sync
, flags
, timeout
));
7191 /** GL_NV_conditional_render */
7192 static void GLAPIENTRY
7193 save_BeginConditionalRender(GLuint queryId
, GLenum mode
)
7195 GET_CURRENT_CONTEXT(ctx
);
7197 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7198 n
= alloc_instruction(ctx
, OPCODE_BEGIN_CONDITIONAL_RENDER
, 2);
7203 if (ctx
->ExecuteFlag
) {
7204 CALL_BeginConditionalRender(ctx
->Exec
, (queryId
, mode
));
7208 static void GLAPIENTRY
7209 save_EndConditionalRender(void)
7211 GET_CURRENT_CONTEXT(ctx
);
7212 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7213 alloc_instruction(ctx
, OPCODE_END_CONDITIONAL_RENDER
, 0);
7214 if (ctx
->ExecuteFlag
) {
7215 CALL_EndConditionalRender(ctx
->Exec
, ());
7219 static void GLAPIENTRY
7220 save_UniformBlockBinding(GLuint prog
, GLuint index
, GLuint binding
)
7222 GET_CURRENT_CONTEXT(ctx
);
7224 ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx
);
7225 n
= alloc_instruction(ctx
, OPCODE_UNIFORM_BLOCK_BINDING
, 3);
7231 if (ctx
->ExecuteFlag
) {
7232 CALL_UniformBlockBinding(ctx
->Exec
, (prog
, index
, binding
));
7238 * Save an error-generating command into display list.
7240 * KW: Will appear in the list before the vertex buffer containing the
7241 * command that provoked the error. I don't see this as a problem.
7244 save_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7247 n
= alloc_instruction(ctx
, OPCODE_ERROR
, 2);
7250 n
[2].data
= (void *) s
;
7256 * Compile an error into current display list.
7259 _mesa_compile_error(struct gl_context
*ctx
, GLenum error
, const char *s
)
7261 if (ctx
->CompileFlag
)
7262 save_error(ctx
, error
, s
);
7263 if (ctx
->ExecuteFlag
)
7264 _mesa_error(ctx
, error
, "%s", s
);
7269 * Test if ID names a display list.
7272 islist(struct gl_context
*ctx
, GLuint list
)
7274 if (list
> 0 && lookup_list(ctx
, list
)) {
7284 /**********************************************************************/
7285 /* Display list execution */
7286 /**********************************************************************/
7290 * Execute a display list. Note that the ListBase offset must have already
7291 * been added before calling this function. I.e. the list argument is
7292 * the absolute list number, not relative to ListBase.
7293 * \param list - display list number
7296 execute_list(struct gl_context
*ctx
, GLuint list
)
7298 struct gl_display_list
*dlist
;
7302 if (list
== 0 || !islist(ctx
, list
))
7305 if (ctx
->ListState
.CallDepth
== MAX_LIST_NESTING
) {
7306 /* raise an error? */
7310 dlist
= lookup_list(ctx
, list
);
7314 ctx
->ListState
.CallDepth
++;
7316 if (ctx
->Driver
.BeginCallList
)
7317 ctx
->Driver
.BeginCallList(ctx
, dlist
);
7323 const OpCode opcode
= n
[0].opcode
;
7325 if (is_ext_opcode(opcode
)) {
7326 n
+= ext_opcode_execute(ctx
, n
);
7331 _mesa_error(ctx
, n
[1].e
, "%s", (const char *) n
[2].data
);
7334 CALL_Accum(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7336 case OPCODE_ALPHA_FUNC
:
7337 CALL_AlphaFunc(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7339 case OPCODE_BIND_TEXTURE
:
7340 CALL_BindTexture(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7344 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7345 ctx
->Unpack
= ctx
->DefaultPacking
;
7346 CALL_Bitmap(ctx
->Exec
, ((GLsizei
) n
[1].i
, (GLsizei
) n
[2].i
,
7347 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
,
7348 (const GLubyte
*) n
[7].data
));
7349 ctx
->Unpack
= save
; /* restore */
7352 case OPCODE_BLEND_COLOR
:
7353 CALL_BlendColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7355 case OPCODE_BLEND_EQUATION
:
7356 CALL_BlendEquation(ctx
->Exec
, (n
[1].e
));
7358 case OPCODE_BLEND_EQUATION_SEPARATE
:
7359 CALL_BlendEquationSeparate(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7361 case OPCODE_BLEND_FUNC_SEPARATE
:
7362 CALL_BlendFuncSeparate(ctx
->Exec
,
7363 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7366 case OPCODE_BLEND_FUNC_I
:
7367 /* GL_ARB_draw_buffers_blend */
7368 CALL_BlendFunciARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
));
7370 case OPCODE_BLEND_FUNC_SEPARATE_I
:
7371 /* GL_ARB_draw_buffers_blend */
7372 CALL_BlendFuncSeparateiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].e
,
7375 case OPCODE_BLEND_EQUATION_I
:
7376 /* GL_ARB_draw_buffers_blend */
7377 CALL_BlendEquationiARB(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7379 case OPCODE_BLEND_EQUATION_SEPARATE_I
:
7380 /* GL_ARB_draw_buffers_blend */
7381 CALL_BlendEquationSeparateiARB(ctx
->Exec
,
7382 (n
[1].ui
, n
[2].e
, n
[3].e
));
7385 case OPCODE_CALL_LIST
:
7386 /* Generated by glCallList(), don't add ListBase */
7387 if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7388 execute_list(ctx
, n
[1].ui
);
7391 case OPCODE_CALL_LIST_OFFSET
:
7392 /* Generated by glCallLists() so we must add ListBase */
7394 /* user specified a bad data type at compile time */
7395 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
7397 else if (ctx
->ListState
.CallDepth
< MAX_LIST_NESTING
) {
7398 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ n
[1].i
);
7399 execute_list(ctx
, list
);
7403 CALL_Clear(ctx
->Exec
, (n
[1].bf
));
7405 case OPCODE_CLEAR_BUFFER_IV
:
7412 CALL_ClearBufferiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7415 case OPCODE_CLEAR_BUFFER_UIV
:
7422 CALL_ClearBufferuiv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7425 case OPCODE_CLEAR_BUFFER_FV
:
7432 CALL_ClearBufferfv(ctx
->Exec
, (n
[1].e
, n
[2].i
, value
));
7435 case OPCODE_CLEAR_BUFFER_FI
:
7436 CALL_ClearBufferfi(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].f
, n
[4].i
));
7438 case OPCODE_CLEAR_COLOR
:
7439 CALL_ClearColor(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7441 case OPCODE_CLEAR_ACCUM
:
7442 CALL_ClearAccum(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7444 case OPCODE_CLEAR_DEPTH
:
7445 CALL_ClearDepth(ctx
->Exec
, ((GLclampd
) n
[1].f
));
7447 case OPCODE_CLEAR_INDEX
:
7448 CALL_ClearIndex(ctx
->Exec
, ((GLfloat
) n
[1].ui
));
7450 case OPCODE_CLEAR_STENCIL
:
7451 CALL_ClearStencil(ctx
->Exec
, (n
[1].i
));
7453 case OPCODE_CLIP_PLANE
:
7460 CALL_ClipPlane(ctx
->Exec
, (n
[1].e
, eq
));
7463 case OPCODE_COLOR_MASK
:
7464 CALL_ColorMask(ctx
->Exec
, (n
[1].b
, n
[2].b
, n
[3].b
, n
[4].b
));
7466 case OPCODE_COLOR_MASK_INDEXED
:
7467 CALL_ColorMaski(ctx
->Exec
, (n
[1].ui
, n
[2].b
, n
[3].b
,
7470 case OPCODE_COLOR_MATERIAL
:
7471 CALL_ColorMaterial(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7473 case OPCODE_COLOR_TABLE
:
7475 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7476 ctx
->Unpack
= ctx
->DefaultPacking
;
7477 CALL_ColorTable(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].e
,
7478 n
[5].e
, n
[6].data
));
7479 ctx
->Unpack
= save
; /* restore */
7482 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
7489 CALL_ColorTableParameterfv(ctx
->Exec
,
7490 (n
[1].e
, n
[2].e
, params
));
7493 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
7500 CALL_ColorTableParameteriv(ctx
->Exec
,
7501 (n
[1].e
, n
[2].e
, params
));
7504 case OPCODE_COLOR_SUB_TABLE
:
7506 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7507 ctx
->Unpack
= ctx
->DefaultPacking
;
7508 CALL_ColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7509 n
[4].e
, n
[5].e
, n
[6].data
));
7510 ctx
->Unpack
= save
; /* restore */
7513 case OPCODE_CONVOLUTION_FILTER_1D
:
7515 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7516 ctx
->Unpack
= ctx
->DefaultPacking
;
7517 CALL_ConvolutionFilter1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7520 ctx
->Unpack
= save
; /* restore */
7523 case OPCODE_CONVOLUTION_FILTER_2D
:
7525 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7526 ctx
->Unpack
= ctx
->DefaultPacking
;
7527 CALL_ConvolutionFilter2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7528 n
[4].i
, n
[5].e
, n
[6].e
,
7530 ctx
->Unpack
= save
; /* restore */
7533 case OPCODE_CONVOLUTION_PARAMETER_I
:
7534 CALL_ConvolutionParameteri(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].i
));
7536 case OPCODE_CONVOLUTION_PARAMETER_IV
:
7543 CALL_ConvolutionParameteriv(ctx
->Exec
,
7544 (n
[1].e
, n
[2].e
, params
));
7547 case OPCODE_CONVOLUTION_PARAMETER_F
:
7548 CALL_ConvolutionParameterf(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].f
));
7550 case OPCODE_CONVOLUTION_PARAMETER_FV
:
7557 CALL_ConvolutionParameterfv(ctx
->Exec
,
7558 (n
[1].e
, n
[2].e
, params
));
7561 case OPCODE_COPY_COLOR_SUB_TABLE
:
7562 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7563 n
[3].i
, n
[4].i
, n
[5].i
));
7565 case OPCODE_COPY_COLOR_TABLE
:
7566 CALL_CopyColorSubTable(ctx
->Exec
, (n
[1].e
, n
[2].i
,
7567 n
[3].i
, n
[4].i
, n
[5].i
));
7569 case OPCODE_COPY_PIXELS
:
7570 CALL_CopyPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7571 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
,
7574 case OPCODE_COPY_TEX_IMAGE1D
:
7575 CALL_CopyTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7576 n
[5].i
, n
[6].i
, n
[7].i
));
7578 case OPCODE_COPY_TEX_IMAGE2D
:
7579 CALL_CopyTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].i
,
7580 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
));
7582 case OPCODE_COPY_TEX_SUB_IMAGE1D
:
7583 CALL_CopyTexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7584 n
[4].i
, n
[5].i
, n
[6].i
));
7586 case OPCODE_COPY_TEX_SUB_IMAGE2D
:
7587 CALL_CopyTexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7588 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7591 case OPCODE_COPY_TEX_SUB_IMAGE3D
:
7592 CALL_CopyTexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7593 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7596 case OPCODE_CULL_FACE
:
7597 CALL_CullFace(ctx
->Exec
, (n
[1].e
));
7599 case OPCODE_DEPTH_FUNC
:
7600 CALL_DepthFunc(ctx
->Exec
, (n
[1].e
));
7602 case OPCODE_DEPTH_MASK
:
7603 CALL_DepthMask(ctx
->Exec
, (n
[1].b
));
7605 case OPCODE_DEPTH_RANGE
:
7606 CALL_DepthRange(ctx
->Exec
,
7607 ((GLclampd
) n
[1].f
, (GLclampd
) n
[2].f
));
7609 case OPCODE_DISABLE
:
7610 CALL_Disable(ctx
->Exec
, (n
[1].e
));
7612 case OPCODE_DISABLE_INDEXED
:
7613 CALL_Disablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7615 case OPCODE_DRAW_BUFFER
:
7616 CALL_DrawBuffer(ctx
->Exec
, (n
[1].e
));
7618 case OPCODE_DRAW_PIXELS
:
7620 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7621 ctx
->Unpack
= ctx
->DefaultPacking
;
7622 CALL_DrawPixels(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].e
, n
[4].e
,
7624 ctx
->Unpack
= save
; /* restore */
7628 CALL_Enable(ctx
->Exec
, (n
[1].e
));
7630 case OPCODE_ENABLE_INDEXED
:
7631 CALL_Enablei(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
7633 case OPCODE_EVALMESH1
:
7634 CALL_EvalMesh1(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
));
7636 case OPCODE_EVALMESH2
:
7637 CALL_EvalMesh2(ctx
->Exec
,
7638 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
7647 CALL_Fogfv(ctx
->Exec
, (n
[1].e
, p
));
7650 case OPCODE_FRONT_FACE
:
7651 CALL_FrontFace(ctx
->Exec
, (n
[1].e
));
7653 case OPCODE_FRUSTUM
:
7654 CALL_Frustum(ctx
->Exec
,
7655 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7658 CALL_Hint(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7660 case OPCODE_HISTOGRAM
:
7661 CALL_Histogram(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
, n
[4].b
));
7663 case OPCODE_INDEX_MASK
:
7664 CALL_IndexMask(ctx
->Exec
, (n
[1].ui
));
7666 case OPCODE_INIT_NAMES
:
7667 CALL_InitNames(ctx
->Exec
, ());
7676 CALL_Lightfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, p
));
7679 case OPCODE_LIGHT_MODEL
:
7686 CALL_LightModelfv(ctx
->Exec
, (n
[1].e
, p
));
7689 case OPCODE_LINE_STIPPLE
:
7690 CALL_LineStipple(ctx
->Exec
, (n
[1].i
, n
[2].us
));
7692 case OPCODE_LINE_WIDTH
:
7693 CALL_LineWidth(ctx
->Exec
, (n
[1].f
));
7695 case OPCODE_LIST_BASE
:
7696 CALL_ListBase(ctx
->Exec
, (n
[1].ui
));
7698 case OPCODE_LOAD_IDENTITY
:
7699 CALL_LoadIdentity(ctx
->Exec
, ());
7701 case OPCODE_LOAD_MATRIX
:
7702 if (sizeof(Node
) == sizeof(GLfloat
)) {
7703 CALL_LoadMatrixf(ctx
->Exec
, (&n
[1].f
));
7708 for (i
= 0; i
< 16; i
++) {
7711 CALL_LoadMatrixf(ctx
->Exec
, (m
));
7714 case OPCODE_LOAD_NAME
:
7715 CALL_LoadName(ctx
->Exec
, (n
[1].ui
));
7717 case OPCODE_LOGIC_OP
:
7718 CALL_LogicOp(ctx
->Exec
, (n
[1].e
));
7722 GLenum target
= n
[1].e
;
7723 GLint ustride
= _mesa_evaluator_components(target
);
7724 GLint uorder
= n
[5].i
;
7725 GLfloat u1
= n
[2].f
;
7726 GLfloat u2
= n
[3].f
;
7727 CALL_Map1f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7728 (GLfloat
*) n
[6].data
));
7733 GLenum target
= n
[1].e
;
7734 GLfloat u1
= n
[2].f
;
7735 GLfloat u2
= n
[3].f
;
7736 GLfloat v1
= n
[4].f
;
7737 GLfloat v2
= n
[5].f
;
7738 GLint ustride
= n
[6].i
;
7739 GLint vstride
= n
[7].i
;
7740 GLint uorder
= n
[8].i
;
7741 GLint vorder
= n
[9].i
;
7742 CALL_Map2f(ctx
->Exec
, (target
, u1
, u2
, ustride
, uorder
,
7743 v1
, v2
, vstride
, vorder
,
7744 (GLfloat
*) n
[10].data
));
7747 case OPCODE_MAPGRID1
:
7748 CALL_MapGrid1f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
7750 case OPCODE_MAPGRID2
:
7751 CALL_MapGrid2f(ctx
->Exec
,
7752 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
));
7754 case OPCODE_MATRIX_MODE
:
7755 CALL_MatrixMode(ctx
->Exec
, (n
[1].e
));
7757 case OPCODE_MIN_MAX
:
7758 CALL_Minmax(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].b
));
7760 case OPCODE_MULT_MATRIX
:
7761 if (sizeof(Node
) == sizeof(GLfloat
)) {
7762 CALL_MultMatrixf(ctx
->Exec
, (&n
[1].f
));
7767 for (i
= 0; i
< 16; i
++) {
7770 CALL_MultMatrixf(ctx
->Exec
, (m
));
7774 CALL_Ortho(ctx
->Exec
,
7775 (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
));
7777 case OPCODE_PASSTHROUGH
:
7778 CALL_PassThrough(ctx
->Exec
, (n
[1].f
));
7780 case OPCODE_PIXEL_MAP
:
7781 CALL_PixelMapfv(ctx
->Exec
,
7782 (n
[1].e
, n
[2].i
, (GLfloat
*) n
[3].data
));
7784 case OPCODE_PIXEL_TRANSFER
:
7785 CALL_PixelTransferf(ctx
->Exec
, (n
[1].e
, n
[2].f
));
7787 case OPCODE_PIXEL_ZOOM
:
7788 CALL_PixelZoom(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7790 case OPCODE_POINT_SIZE
:
7791 CALL_PointSize(ctx
->Exec
, (n
[1].f
));
7793 case OPCODE_POINT_PARAMETERS
:
7799 CALL_PointParameterfv(ctx
->Exec
, (n
[1].e
, params
));
7802 case OPCODE_POLYGON_MODE
:
7803 CALL_PolygonMode(ctx
->Exec
, (n
[1].e
, n
[2].e
));
7805 case OPCODE_POLYGON_STIPPLE
:
7807 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7808 ctx
->Unpack
= ctx
->DefaultPacking
;
7809 CALL_PolygonStipple(ctx
->Exec
, ((GLubyte
*) n
[1].data
));
7810 ctx
->Unpack
= save
; /* restore */
7813 case OPCODE_POLYGON_OFFSET
:
7814 CALL_PolygonOffset(ctx
->Exec
, (n
[1].f
, n
[2].f
));
7816 case OPCODE_POP_ATTRIB
:
7817 CALL_PopAttrib(ctx
->Exec
, ());
7819 case OPCODE_POP_MATRIX
:
7820 CALL_PopMatrix(ctx
->Exec
, ());
7822 case OPCODE_POP_NAME
:
7823 CALL_PopName(ctx
->Exec
, ());
7825 case OPCODE_PRIORITIZE_TEXTURE
:
7826 CALL_PrioritizeTextures(ctx
->Exec
, (1, &n
[1].ui
, &n
[2].f
));
7828 case OPCODE_PUSH_ATTRIB
:
7829 CALL_PushAttrib(ctx
->Exec
, (n
[1].bf
));
7831 case OPCODE_PUSH_MATRIX
:
7832 CALL_PushMatrix(ctx
->Exec
, ());
7834 case OPCODE_PUSH_NAME
:
7835 CALL_PushName(ctx
->Exec
, (n
[1].ui
));
7837 case OPCODE_RASTER_POS
:
7838 CALL_RasterPos4f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7840 case OPCODE_READ_BUFFER
:
7841 CALL_ReadBuffer(ctx
->Exec
, (n
[1].e
));
7843 case OPCODE_RESET_HISTOGRAM
:
7844 CALL_ResetHistogram(ctx
->Exec
, (n
[1].e
));
7846 case OPCODE_RESET_MIN_MAX
:
7847 CALL_ResetMinmax(ctx
->Exec
, (n
[1].e
));
7850 CALL_Rotatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
7853 CALL_Scalef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7855 case OPCODE_SCISSOR
:
7856 CALL_Scissor(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
7858 case OPCODE_SHADE_MODEL
:
7859 CALL_ShadeModel(ctx
->Exec
, (n
[1].e
));
7861 case OPCODE_PROVOKING_VERTEX
:
7862 CALL_ProvokingVertex(ctx
->Exec
, (n
[1].e
));
7864 case OPCODE_STENCIL_FUNC
:
7865 CALL_StencilFunc(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].ui
));
7867 case OPCODE_STENCIL_MASK
:
7868 CALL_StencilMask(ctx
->Exec
, (n
[1].ui
));
7870 case OPCODE_STENCIL_OP
:
7871 CALL_StencilOp(ctx
->Exec
, (n
[1].e
, n
[2].e
, n
[3].e
));
7873 case OPCODE_STENCIL_FUNC_SEPARATE
:
7874 CALL_StencilFuncSeparate(ctx
->Exec
,
7875 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].ui
));
7877 case OPCODE_STENCIL_MASK_SEPARATE
:
7878 CALL_StencilMaskSeparate(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
7880 case OPCODE_STENCIL_OP_SEPARATE
:
7881 CALL_StencilOpSeparate(ctx
->Exec
,
7882 (n
[1].e
, n
[2].e
, n
[3].e
, n
[4].e
));
7891 CALL_TexEnvfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7901 CALL_TexGenfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7904 case OPCODE_TEXPARAMETER
:
7911 CALL_TexParameterfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
7914 case OPCODE_TEX_IMAGE1D
:
7916 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7917 ctx
->Unpack
= ctx
->DefaultPacking
;
7918 CALL_TexImage1D(ctx
->Exec
, (n
[1].e
, /* target */
7920 n
[3].i
, /* components */
7922 n
[5].e
, /* border */
7923 n
[6].e
, /* format */
7926 ctx
->Unpack
= save
; /* restore */
7929 case OPCODE_TEX_IMAGE2D
:
7931 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7932 ctx
->Unpack
= ctx
->DefaultPacking
;
7933 CALL_TexImage2D(ctx
->Exec
, (n
[1].e
, /* target */
7935 n
[3].i
, /* components */
7937 n
[5].i
, /* height */
7938 n
[6].e
, /* border */
7939 n
[7].e
, /* format */
7942 ctx
->Unpack
= save
; /* restore */
7945 case OPCODE_TEX_IMAGE3D
:
7947 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7948 ctx
->Unpack
= ctx
->DefaultPacking
;
7949 CALL_TexImage3D(ctx
->Exec
, (n
[1].e
, /* target */
7951 n
[3].i
, /* components */
7953 n
[5].i
, /* height */
7955 n
[7].e
, /* border */
7956 n
[8].e
, /* format */
7959 ctx
->Unpack
= save
; /* restore */
7962 case OPCODE_TEX_SUB_IMAGE1D
:
7964 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7965 ctx
->Unpack
= ctx
->DefaultPacking
;
7966 CALL_TexSubImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7968 n
[6].e
, n
[7].data
));
7969 ctx
->Unpack
= save
; /* restore */
7972 case OPCODE_TEX_SUB_IMAGE2D
:
7974 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7975 ctx
->Unpack
= ctx
->DefaultPacking
;
7976 CALL_TexSubImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7978 n
[6].i
, n
[7].e
, n
[8].e
,
7980 ctx
->Unpack
= save
; /* restore */
7983 case OPCODE_TEX_SUB_IMAGE3D
:
7985 const struct gl_pixelstore_attrib save
= ctx
->Unpack
;
7986 ctx
->Unpack
= ctx
->DefaultPacking
;
7987 CALL_TexSubImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].i
,
7988 n
[4].i
, n
[5].i
, n
[6].i
, n
[7].i
,
7989 n
[8].i
, n
[9].e
, n
[10].e
,
7991 ctx
->Unpack
= save
; /* restore */
7994 case OPCODE_TRANSLATE
:
7995 CALL_Translatef(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
7997 case OPCODE_VIEWPORT
:
7998 CALL_Viewport(ctx
->Exec
, (n
[1].i
, n
[2].i
,
7999 (GLsizei
) n
[3].i
, (GLsizei
) n
[4].i
));
8001 case OPCODE_WINDOW_POS
:
8002 CALL_WindowPos4fMESA(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8004 case OPCODE_ACTIVE_TEXTURE
: /* GL_ARB_multitexture */
8005 CALL_ActiveTexture(ctx
->Exec
, (n
[1].e
));
8007 case OPCODE_COMPRESSED_TEX_IMAGE_1D
: /* GL_ARB_texture_compression */
8008 CALL_CompressedTexImage1D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8009 n
[4].i
, n
[5].i
, n
[6].i
,
8012 case OPCODE_COMPRESSED_TEX_IMAGE_2D
: /* GL_ARB_texture_compression */
8013 CALL_CompressedTexImage2D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8014 n
[4].i
, n
[5].i
, n
[6].i
,
8015 n
[7].i
, n
[8].data
));
8017 case OPCODE_COMPRESSED_TEX_IMAGE_3D
: /* GL_ARB_texture_compression */
8018 CALL_CompressedTexImage3D(ctx
->Exec
, (n
[1].e
, n
[2].i
, n
[3].e
,
8019 n
[4].i
, n
[5].i
, n
[6].i
,
8023 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D
: /* GL_ARB_texture_compress */
8024 CALL_CompressedTexSubImage1D(ctx
->Exec
,
8025 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8026 n
[5].e
, n
[6].i
, n
[7].data
));
8028 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D
: /* GL_ARB_texture_compress */
8029 CALL_CompressedTexSubImage2D(ctx
->Exec
,
8030 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8031 n
[5].i
, n
[6].i
, n
[7].e
, n
[8].i
,
8034 case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D
: /* GL_ARB_texture_compress */
8035 CALL_CompressedTexSubImage3D(ctx
->Exec
,
8036 (n
[1].e
, n
[2].i
, n
[3].i
, n
[4].i
,
8037 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8038 n
[9].e
, n
[10].i
, n
[11].data
));
8040 case OPCODE_SAMPLE_COVERAGE
: /* GL_ARB_multisample */
8041 CALL_SampleCoverage(ctx
->Exec
, (n
[1].f
, n
[2].b
));
8043 case OPCODE_WINDOW_POS_ARB
: /* GL_ARB_window_pos */
8044 CALL_WindowPos3f(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
));
8046 case OPCODE_BIND_PROGRAM_NV
: /* GL_ARB_vertex_program */
8047 CALL_BindProgramARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8049 case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB
:
8050 CALL_ProgramLocalParameter4fARB(ctx
->Exec
,
8051 (n
[1].e
, n
[2].ui
, n
[3].f
, n
[4].f
,
8054 case OPCODE_ACTIVE_STENCIL_FACE_EXT
:
8055 CALL_ActiveStencilFaceEXT(ctx
->Exec
, (n
[1].e
));
8057 case OPCODE_DEPTH_BOUNDS_EXT
:
8058 CALL_DepthBoundsEXT(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8060 case OPCODE_PROGRAM_STRING_ARB
:
8061 CALL_ProgramStringARB(ctx
->Exec
,
8062 (n
[1].e
, n
[2].e
, n
[3].i
, n
[4].data
));
8064 case OPCODE_PROGRAM_ENV_PARAMETER_ARB
:
8065 CALL_ProgramEnvParameter4fARB(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].f
,
8069 case OPCODE_BEGIN_QUERY_ARB
:
8070 CALL_BeginQuery(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8072 case OPCODE_END_QUERY_ARB
:
8073 CALL_EndQuery(ctx
->Exec
, (n
[1].e
));
8075 case OPCODE_QUERY_COUNTER
:
8076 CALL_QueryCounter(ctx
->Exec
, (n
[1].ui
, n
[2].e
));
8078 case OPCODE_BEGIN_QUERY_INDEXED
:
8079 CALL_BeginQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
, n
[3].ui
));
8081 case OPCODE_END_QUERY_INDEXED
:
8082 CALL_EndQueryIndexed(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8084 case OPCODE_DRAW_BUFFERS_ARB
:
8086 GLenum buffers
[MAX_DRAW_BUFFERS
];
8087 GLint i
, count
= MIN2(n
[1].i
, MAX_DRAW_BUFFERS
);
8088 for (i
= 0; i
< count
; i
++)
8089 buffers
[i
] = n
[2 + i
].e
;
8090 CALL_DrawBuffers(ctx
->Exec
, (n
[1].i
, buffers
));
8093 case OPCODE_BLIT_FRAMEBUFFER
:
8094 CALL_BlitFramebuffer(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
,
8095 n
[5].i
, n
[6].i
, n
[7].i
, n
[8].i
,
8098 case OPCODE_USE_PROGRAM
:
8099 CALL_UseProgram(ctx
->Exec
, (n
[1].ui
));
8101 case OPCODE_USE_SHADER_PROGRAM_EXT
:
8102 CALL_UseShaderProgramEXT(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8104 case OPCODE_ACTIVE_PROGRAM_EXT
:
8105 CALL_ActiveProgramEXT(ctx
->Exec
, (n
[1].ui
));
8107 case OPCODE_UNIFORM_1F
:
8108 CALL_Uniform1f(ctx
->Exec
, (n
[1].i
, n
[2].f
));
8110 case OPCODE_UNIFORM_2F
:
8111 CALL_Uniform2f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
));
8113 case OPCODE_UNIFORM_3F
:
8114 CALL_Uniform3f(ctx
->Exec
, (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
));
8116 case OPCODE_UNIFORM_4F
:
8117 CALL_Uniform4f(ctx
->Exec
,
8118 (n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
));
8120 case OPCODE_UNIFORM_1FV
:
8121 CALL_Uniform1fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8123 case OPCODE_UNIFORM_2FV
:
8124 CALL_Uniform2fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8126 case OPCODE_UNIFORM_3FV
:
8127 CALL_Uniform3fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8129 case OPCODE_UNIFORM_4FV
:
8130 CALL_Uniform4fv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8132 case OPCODE_UNIFORM_1I
:
8133 CALL_Uniform1i(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8135 case OPCODE_UNIFORM_2I
:
8136 CALL_Uniform2i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
));
8138 case OPCODE_UNIFORM_3I
:
8139 CALL_Uniform3i(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8141 case OPCODE_UNIFORM_4I
:
8142 CALL_Uniform4i(ctx
->Exec
,
8143 (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
, n
[5].i
));
8145 case OPCODE_UNIFORM_1IV
:
8146 CALL_Uniform1iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8148 case OPCODE_UNIFORM_2IV
:
8149 CALL_Uniform2iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8151 case OPCODE_UNIFORM_3IV
:
8152 CALL_Uniform3iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8154 case OPCODE_UNIFORM_4IV
:
8155 CALL_Uniform4iv(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].data
));
8157 case OPCODE_UNIFORM_1UI
:
8158 /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/
8160 case OPCODE_UNIFORM_2UI
:
8161 /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/
8163 case OPCODE_UNIFORM_3UI
:
8164 /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/
8166 case OPCODE_UNIFORM_4UI
:
8167 /*CALL_Uniform4uiARB(ctx->Exec,
8168 (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i));
8171 case OPCODE_UNIFORM_1UIV
:
8172 /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8174 case OPCODE_UNIFORM_2UIV
:
8175 /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8177 case OPCODE_UNIFORM_3UIV
:
8178 /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8180 case OPCODE_UNIFORM_4UIV
:
8181 /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/
8183 case OPCODE_UNIFORM_MATRIX22
:
8184 CALL_UniformMatrix2fv(ctx
->Exec
,
8185 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8187 case OPCODE_UNIFORM_MATRIX33
:
8188 CALL_UniformMatrix3fv(ctx
->Exec
,
8189 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8191 case OPCODE_UNIFORM_MATRIX44
:
8192 CALL_UniformMatrix4fv(ctx
->Exec
,
8193 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8195 case OPCODE_UNIFORM_MATRIX23
:
8196 CALL_UniformMatrix2x3fv(ctx
->Exec
,
8197 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8199 case OPCODE_UNIFORM_MATRIX32
:
8200 CALL_UniformMatrix3x2fv(ctx
->Exec
,
8201 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8203 case OPCODE_UNIFORM_MATRIX24
:
8204 CALL_UniformMatrix2x4fv(ctx
->Exec
,
8205 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8207 case OPCODE_UNIFORM_MATRIX42
:
8208 CALL_UniformMatrix4x2fv(ctx
->Exec
,
8209 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8211 case OPCODE_UNIFORM_MATRIX34
:
8212 CALL_UniformMatrix3x4fv(ctx
->Exec
,
8213 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8215 case OPCODE_UNIFORM_MATRIX43
:
8216 CALL_UniformMatrix4x3fv(ctx
->Exec
,
8217 (n
[1].i
, n
[2].i
, n
[3].b
, n
[4].data
));
8220 case OPCODE_CLAMP_COLOR
:
8221 CALL_ClampColor(ctx
->Exec
, (n
[1].e
, n
[2].e
));
8224 case OPCODE_TEX_BUMP_PARAMETER_ATI
:
8227 GLuint i
, pname
= n
[1].ui
;
8229 for (i
= 0; i
< 4; i
++)
8230 values
[i
] = n
[1 + i
].f
;
8231 CALL_TexBumpParameterfvATI(ctx
->Exec
, (pname
, values
));
8234 case OPCODE_BIND_FRAGMENT_SHADER_ATI
:
8235 CALL_BindFragmentShaderATI(ctx
->Exec
, (n
[1].i
));
8237 case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI
:
8240 GLuint i
, dst
= n
[1].ui
;
8242 for (i
= 0; i
< 4; i
++)
8243 values
[i
] = n
[1 + i
].f
;
8244 CALL_SetFragmentShaderConstantATI(ctx
->Exec
, (dst
, values
));
8247 case OPCODE_ATTR_1F_NV
:
8248 CALL_VertexAttrib1fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8250 case OPCODE_ATTR_2F_NV
:
8251 /* Really shouldn't have to do this - the Node structure
8252 * is convenient, but it would be better to store the data
8253 * packed appropriately so that it can be sent directly
8254 * on. With x86_64 becoming common, this will start to
8257 if (sizeof(Node
) == sizeof(GLfloat
))
8258 CALL_VertexAttrib2fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8260 CALL_VertexAttrib2fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8262 case OPCODE_ATTR_3F_NV
:
8263 if (sizeof(Node
) == sizeof(GLfloat
))
8264 CALL_VertexAttrib3fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8266 CALL_VertexAttrib3fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8269 case OPCODE_ATTR_4F_NV
:
8270 if (sizeof(Node
) == sizeof(GLfloat
))
8271 CALL_VertexAttrib4fvNV(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8273 CALL_VertexAttrib4fNV(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8276 case OPCODE_ATTR_1F_ARB
:
8277 CALL_VertexAttrib1fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
));
8279 case OPCODE_ATTR_2F_ARB
:
8280 /* Really shouldn't have to do this - the Node structure
8281 * is convenient, but it would be better to store the data
8282 * packed appropriately so that it can be sent directly
8283 * on. With x86_64 becoming common, this will start to
8286 if (sizeof(Node
) == sizeof(GLfloat
))
8287 CALL_VertexAttrib2fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8289 CALL_VertexAttrib2fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
));
8291 case OPCODE_ATTR_3F_ARB
:
8292 if (sizeof(Node
) == sizeof(GLfloat
))
8293 CALL_VertexAttrib3fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8295 CALL_VertexAttrib3fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8298 case OPCODE_ATTR_4F_ARB
:
8299 if (sizeof(Node
) == sizeof(GLfloat
))
8300 CALL_VertexAttrib4fvARB(ctx
->Exec
, (n
[1].e
, &n
[2].f
));
8302 CALL_VertexAttrib4fARB(ctx
->Exec
, (n
[1].e
, n
[2].f
, n
[3].f
,
8305 case OPCODE_MATERIAL
:
8306 if (sizeof(Node
) == sizeof(GLfloat
))
8307 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, &n
[3].f
));
8314 CALL_Materialfv(ctx
->Exec
, (n
[1].e
, n
[2].e
, f
));
8318 CALL_Begin(ctx
->Exec
, (n
[1].e
));
8321 CALL_End(ctx
->Exec
, ());
8324 CALL_Rectf(ctx
->Exec
, (n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
));
8326 case OPCODE_EVAL_C1
:
8327 CALL_EvalCoord1f(ctx
->Exec
, (n
[1].f
));
8329 case OPCODE_EVAL_C2
:
8330 CALL_EvalCoord2f(ctx
->Exec
, (n
[1].f
, n
[2].f
));
8332 case OPCODE_EVAL_P1
:
8333 CALL_EvalPoint1(ctx
->Exec
, (n
[1].i
));
8335 case OPCODE_EVAL_P2
:
8336 CALL_EvalPoint2(ctx
->Exec
, (n
[1].i
, n
[2].i
));
8339 /* GL_EXT_texture_integer */
8340 case OPCODE_CLEARCOLOR_I
:
8341 CALL_ClearColorIiEXT(ctx
->Exec
, (n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
));
8343 case OPCODE_CLEARCOLOR_UI
:
8344 CALL_ClearColorIuiEXT(ctx
->Exec
,
8345 (n
[1].ui
, n
[2].ui
, n
[3].ui
, n
[4].ui
));
8347 case OPCODE_TEXPARAMETER_I
:
8354 CALL_TexParameterIiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8357 case OPCODE_TEXPARAMETER_UI
:
8360 params
[0] = n
[3].ui
;
8361 params
[1] = n
[4].ui
;
8362 params
[2] = n
[5].ui
;
8363 params
[3] = n
[6].ui
;
8364 CALL_TexParameterIuiv(ctx
->Exec
, (n
[1].e
, n
[2].e
, params
));
8368 case OPCODE_VERTEX_ATTRIB_DIVISOR
:
8369 /* GL_ARB_instanced_arrays */
8370 CALL_VertexAttribDivisor(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8373 case OPCODE_TEXTURE_BARRIER_NV
:
8374 CALL_TextureBarrierNV(ctx
->Exec
, ());
8377 /* GL_EXT/ARB_transform_feedback */
8378 case OPCODE_BEGIN_TRANSFORM_FEEDBACK
:
8379 CALL_BeginTransformFeedback(ctx
->Exec
, (n
[1].e
));
8381 case OPCODE_END_TRANSFORM_FEEDBACK
:
8382 CALL_EndTransformFeedback(ctx
->Exec
, ());
8384 case OPCODE_BIND_TRANSFORM_FEEDBACK
:
8385 CALL_BindTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8387 case OPCODE_PAUSE_TRANSFORM_FEEDBACK
:
8388 CALL_PauseTransformFeedback(ctx
->Exec
, ());
8390 case OPCODE_RESUME_TRANSFORM_FEEDBACK
:
8391 CALL_ResumeTransformFeedback(ctx
->Exec
, ());
8393 case OPCODE_DRAW_TRANSFORM_FEEDBACK
:
8394 CALL_DrawTransformFeedback(ctx
->Exec
, (n
[1].e
, n
[2].ui
));
8396 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM
:
8397 CALL_DrawTransformFeedbackStream(ctx
->Exec
,
8398 (n
[1].e
, n
[2].ui
, n
[3].ui
));
8400 case OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED
:
8401 CALL_DrawTransformFeedbackInstanced(ctx
->Exec
,
8402 (n
[1].e
, n
[2].ui
, n
[3].si
));
8404 case OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED
:
8405 CALL_DrawTransformFeedbackStreamInstanced(ctx
->Exec
,
8406 (n
[1].e
, n
[2].ui
, n
[3].ui
, n
[4].si
));
8410 case OPCODE_BIND_SAMPLER
:
8411 CALL_BindSampler(ctx
->Exec
, (n
[1].ui
, n
[2].ui
));
8413 case OPCODE_SAMPLER_PARAMETERIV
:
8420 CALL_SamplerParameteriv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8423 case OPCODE_SAMPLER_PARAMETERFV
:
8430 CALL_SamplerParameterfv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8433 case OPCODE_SAMPLER_PARAMETERIIV
:
8440 CALL_SamplerParameterIiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8443 case OPCODE_SAMPLER_PARAMETERUIV
:
8446 params
[0] = n
[3].ui
;
8447 params
[1] = n
[4].ui
;
8448 params
[2] = n
[5].ui
;
8449 params
[3] = n
[6].ui
;
8450 CALL_SamplerParameterIuiv(ctx
->Exec
, (n
[1].ui
, n
[2].e
, params
));
8454 /* GL_ARB_geometry_shader4 */
8455 case OPCODE_PROGRAM_PARAMETERI
:
8456 CALL_ProgramParameteri(ctx
->Exec
, (n
[1].ui
, n
[2].e
, n
[3].i
));
8458 case OPCODE_FRAMEBUFFER_TEXTURE
:
8459 CALL_FramebufferTexture(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8462 case OPCODE_FRAMEBUFFER_TEXTURE_FACE
:
8463 CALL_FramebufferTextureFaceARB(ctx
->Exec
, (n
[1].e
, n
[2].e
,
8464 n
[3].ui
, n
[4].i
, n
[5].e
));
8468 case OPCODE_WAIT_SYNC
:
8470 union uint64_pair p
;
8471 p
.uint32
[0] = n
[3].ui
;
8472 p
.uint32
[1] = n
[4].ui
;
8473 CALL_WaitSync(ctx
->Exec
, (n
[1].data
, n
[2].bf
, p
.uint64
));
8477 /* GL_NV_conditional_render */
8478 case OPCODE_BEGIN_CONDITIONAL_RENDER
:
8479 CALL_BeginConditionalRender(ctx
->Exec
, (n
[1].i
, n
[2].e
));
8481 case OPCODE_END_CONDITIONAL_RENDER
:
8482 CALL_EndConditionalRender(ctx
->Exec
, ());
8485 case OPCODE_UNIFORM_BLOCK_BINDING
:
8486 CALL_UniformBlockBinding(ctx
->Exec
, (n
[1].ui
, n
[2].ui
, n
[3].ui
));
8489 case OPCODE_CONTINUE
:
8490 n
= (Node
*) n
[1].next
;
8492 case OPCODE_END_OF_LIST
:
8498 _mesa_snprintf(msg
, sizeof(msg
), "Error in execute_list: opcode=%d",
8500 _mesa_problem(ctx
, "%s", msg
);
8505 /* increment n to point to next compiled command */
8506 if (opcode
!= OPCODE_CONTINUE
) {
8507 n
+= InstSize
[opcode
];
8512 if (ctx
->Driver
.EndCallList
)
8513 ctx
->Driver
.EndCallList(ctx
);
8515 ctx
->ListState
.CallDepth
--;
8520 /**********************************************************************/
8522 /**********************************************************************/
8525 * Test if a display list number is valid.
8527 GLboolean GLAPIENTRY
8528 _mesa_IsList(GLuint list
)
8530 GET_CURRENT_CONTEXT(ctx
);
8531 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8532 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
8533 return islist(ctx
, list
);
8538 * Delete a sequence of consecutive display lists.
8541 _mesa_DeleteLists(GLuint list
, GLsizei range
)
8543 GET_CURRENT_CONTEXT(ctx
);
8545 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8546 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8549 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteLists");
8552 for (i
= list
; i
< list
+ range
; i
++) {
8553 destroy_list(ctx
, i
);
8559 * Return a display list number, n, such that lists n through n+range-1
8563 _mesa_GenLists(GLsizei range
)
8565 GET_CURRENT_CONTEXT(ctx
);
8567 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8568 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, 0);
8571 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenLists");
8579 * Make this an atomic operation
8581 _glthread_LOCK_MUTEX(ctx
->Shared
->Mutex
);
8583 base
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->DisplayList
, range
);
8585 /* reserve the list IDs by with empty/dummy lists */
8587 for (i
= 0; i
< range
; i
++) {
8588 _mesa_HashInsert(ctx
->Shared
->DisplayList
, base
+ i
,
8589 make_list(base
+ i
, 1));
8593 _glthread_UNLOCK_MUTEX(ctx
->Shared
->Mutex
);
8600 * Begin a new display list.
8603 _mesa_NewList(GLuint name
, GLenum mode
)
8605 GET_CURRENT_CONTEXT(ctx
);
8607 FLUSH_CURRENT(ctx
, 0); /* must be called before assert */
8608 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8610 if (MESA_VERBOSE
& VERBOSE_API
)
8611 _mesa_debug(ctx
, "glNewList %u %s\n", name
,
8612 _mesa_lookup_enum_by_nr(mode
));
8615 _mesa_error(ctx
, GL_INVALID_VALUE
, "glNewList");
8619 if (mode
!= GL_COMPILE
&& mode
!= GL_COMPILE_AND_EXECUTE
) {
8620 _mesa_error(ctx
, GL_INVALID_ENUM
, "glNewList");
8624 if (ctx
->ListState
.CurrentList
) {
8625 /* already compiling a display list */
8626 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glNewList");
8630 ctx
->CompileFlag
= GL_TRUE
;
8631 ctx
->ExecuteFlag
= (mode
== GL_COMPILE_AND_EXECUTE
);
8633 /* Reset acumulated list state:
8635 invalidate_saved_current_state( ctx
);
8637 /* Allocate new display list */
8638 ctx
->ListState
.CurrentList
= make_list(name
, BLOCK_SIZE
);
8639 ctx
->ListState
.CurrentBlock
= ctx
->ListState
.CurrentList
->Head
;
8640 ctx
->ListState
.CurrentPos
= 0;
8642 ctx
->Driver
.NewList(ctx
, name
, mode
);
8644 ctx
->CurrentDispatch
= ctx
->Save
;
8645 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8650 * End definition of current display list.
8655 GET_CURRENT_CONTEXT(ctx
);
8656 SAVE_FLUSH_VERTICES(ctx
);
8657 FLUSH_VERTICES(ctx
, 0);
8659 if (MESA_VERBOSE
& VERBOSE_API
)
8660 _mesa_debug(ctx
, "glEndList\n");
8662 /* Check that a list is under construction */
8663 if (!ctx
->ListState
.CurrentList
) {
8664 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glEndList");
8668 /* Call before emitting END_OF_LIST, in case the driver wants to
8669 * emit opcodes itself.
8671 ctx
->Driver
.EndList(ctx
);
8673 (void) alloc_instruction(ctx
, OPCODE_END_OF_LIST
, 0);
8675 /* Destroy old list, if any */
8676 destroy_list(ctx
, ctx
->ListState
.CurrentList
->Name
);
8678 /* Install the new list */
8679 _mesa_HashInsert(ctx
->Shared
->DisplayList
,
8680 ctx
->ListState
.CurrentList
->Name
,
8681 ctx
->ListState
.CurrentList
);
8684 if (MESA_VERBOSE
& VERBOSE_DISPLAY_LIST
)
8685 mesa_print_display_list(ctx
->ListState
.CurrentList
->Name
);
8687 ctx
->ListState
.CurrentList
= NULL
;
8688 ctx
->ExecuteFlag
= GL_TRUE
;
8689 ctx
->CompileFlag
= GL_FALSE
;
8691 ctx
->CurrentDispatch
= ctx
->Exec
;
8692 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8697 _mesa_CallList(GLuint list
)
8699 GLboolean save_compile_flag
;
8700 GET_CURRENT_CONTEXT(ctx
);
8701 FLUSH_CURRENT(ctx
, 0);
8703 if (MESA_VERBOSE
& VERBOSE_API
)
8704 _mesa_debug(ctx
, "glCallList %d\n", list
);
8707 _mesa_error(ctx
, GL_INVALID_VALUE
, "glCallList(list==0)");
8712 mesa_print_display_list( list
);
8714 /* VERY IMPORTANT: Save the CompileFlag status, turn it off,
8715 * execute the display list, and restore the CompileFlag.
8717 save_compile_flag
= ctx
->CompileFlag
;
8718 if (save_compile_flag
) {
8719 ctx
->CompileFlag
= GL_FALSE
;
8722 execute_list(ctx
, list
);
8723 ctx
->CompileFlag
= save_compile_flag
;
8725 /* also restore API function pointers to point to "save" versions */
8726 if (save_compile_flag
) {
8727 ctx
->CurrentDispatch
= ctx
->Save
;
8728 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8734 * Execute glCallLists: call multiple display lists.
8737 _mesa_CallLists(GLsizei n
, GLenum type
, const GLvoid
* lists
)
8739 GET_CURRENT_CONTEXT(ctx
);
8741 GLboolean save_compile_flag
;
8743 if (MESA_VERBOSE
& VERBOSE_API
)
8744 _mesa_debug(ctx
, "glCallLists %d\n", n
);
8748 case GL_UNSIGNED_BYTE
:
8750 case GL_UNSIGNED_SHORT
:
8752 case GL_UNSIGNED_INT
:
8760 _mesa_error(ctx
, GL_INVALID_ENUM
, "glCallLists(type)");
8764 /* Save the CompileFlag status, turn it off, execute display list,
8765 * and restore the CompileFlag.
8767 save_compile_flag
= ctx
->CompileFlag
;
8768 ctx
->CompileFlag
= GL_FALSE
;
8770 for (i
= 0; i
< n
; i
++) {
8771 GLuint list
= (GLuint
) (ctx
->List
.ListBase
+ translate_id(i
, type
, lists
));
8772 execute_list(ctx
, list
);
8775 ctx
->CompileFlag
= save_compile_flag
;
8777 /* also restore API function pointers to point to "save" versions */
8778 if (save_compile_flag
) {
8779 ctx
->CurrentDispatch
= ctx
->Save
;
8780 _glapi_set_dispatch(ctx
->CurrentDispatch
);
8786 * Set the offset added to list numbers in glCallLists.
8789 _mesa_ListBase(GLuint base
)
8791 GET_CURRENT_CONTEXT(ctx
);
8792 FLUSH_VERTICES(ctx
, 0); /* must be called before assert */
8793 ASSERT_OUTSIDE_BEGIN_END(ctx
);
8794 ctx
->List
.ListBase
= base
;
8798 * Setup the given dispatch table to point to Mesa's display list
8799 * building functions.
8801 * This does not include any of the tnl functions - they are
8802 * initialized from _mesa_init_api_defaults and from the active vtxfmt
8806 _mesa_initialize_save_table(const struct gl_context
*ctx
)
8808 struct _glapi_table
*table
= ctx
->Save
;
8809 int numEntries
= MAX2(_gloffset_COUNT
, _glapi_get_dispatch_table_size());
8811 /* Initially populate the dispatch table with the contents of the
8812 * normal-execution dispatch table. This lets us skip populating functions
8813 * that should be called directly instead of compiled into display lists.
8815 memcpy(table
, ctx
->Exec
, numEntries
* sizeof(_glapi_proc
));
8817 _mesa_loopback_init_api_table(ctx
, table
);
8820 SET_Accum(table
, save_Accum
);
8821 SET_AlphaFunc(table
, save_AlphaFunc
);
8822 SET_Bitmap(table
, save_Bitmap
);
8823 SET_BlendFunc(table
, save_BlendFunc
);
8824 SET_CallList(table
, save_CallList
);
8825 SET_CallLists(table
, save_CallLists
);
8826 SET_Clear(table
, save_Clear
);
8827 SET_ClearAccum(table
, save_ClearAccum
);
8828 SET_ClearColor(table
, save_ClearColor
);
8829 SET_ClearDepth(table
, save_ClearDepth
);
8830 SET_ClearIndex(table
, save_ClearIndex
);
8831 SET_ClearStencil(table
, save_ClearStencil
);
8832 SET_ClipPlane(table
, save_ClipPlane
);
8833 SET_ColorMask(table
, save_ColorMask
);
8834 SET_ColorMaski(table
, save_ColorMaskIndexed
);
8835 SET_ColorMaterial(table
, save_ColorMaterial
);
8836 SET_CopyPixels(table
, save_CopyPixels
);
8837 SET_CullFace(table
, save_CullFace
);
8838 SET_DepthFunc(table
, save_DepthFunc
);
8839 SET_DepthMask(table
, save_DepthMask
);
8840 SET_DepthRange(table
, save_DepthRange
);
8841 SET_Disable(table
, save_Disable
);
8842 SET_Disablei(table
, save_DisableIndexed
);
8843 SET_DrawBuffer(table
, save_DrawBuffer
);
8844 SET_DrawPixels(table
, save_DrawPixels
);
8845 SET_Enable(table
, save_Enable
);
8846 SET_Enablei(table
, save_EnableIndexed
);
8847 SET_EvalMesh1(table
, save_EvalMesh1
);
8848 SET_EvalMesh2(table
, save_EvalMesh2
);
8849 SET_Fogf(table
, save_Fogf
);
8850 SET_Fogfv(table
, save_Fogfv
);
8851 SET_Fogi(table
, save_Fogi
);
8852 SET_Fogiv(table
, save_Fogiv
);
8853 SET_FrontFace(table
, save_FrontFace
);
8854 SET_Frustum(table
, save_Frustum
);
8855 SET_Hint(table
, save_Hint
);
8856 SET_IndexMask(table
, save_IndexMask
);
8857 SET_InitNames(table
, save_InitNames
);
8858 SET_LightModelf(table
, save_LightModelf
);
8859 SET_LightModelfv(table
, save_LightModelfv
);
8860 SET_LightModeli(table
, save_LightModeli
);
8861 SET_LightModeliv(table
, save_LightModeliv
);
8862 SET_Lightf(table
, save_Lightf
);
8863 SET_Lightfv(table
, save_Lightfv
);
8864 SET_Lighti(table
, save_Lighti
);
8865 SET_Lightiv(table
, save_Lightiv
);
8866 SET_LineStipple(table
, save_LineStipple
);
8867 SET_LineWidth(table
, save_LineWidth
);
8868 SET_ListBase(table
, save_ListBase
);
8869 SET_LoadIdentity(table
, save_LoadIdentity
);
8870 SET_LoadMatrixd(table
, save_LoadMatrixd
);
8871 SET_LoadMatrixf(table
, save_LoadMatrixf
);
8872 SET_LoadName(table
, save_LoadName
);
8873 SET_LogicOp(table
, save_LogicOp
);
8874 SET_Map1d(table
, save_Map1d
);
8875 SET_Map1f(table
, save_Map1f
);
8876 SET_Map2d(table
, save_Map2d
);
8877 SET_Map2f(table
, save_Map2f
);
8878 SET_MapGrid1d(table
, save_MapGrid1d
);
8879 SET_MapGrid1f(table
, save_MapGrid1f
);
8880 SET_MapGrid2d(table
, save_MapGrid2d
);
8881 SET_MapGrid2f(table
, save_MapGrid2f
);
8882 SET_MatrixMode(table
, save_MatrixMode
);
8883 SET_MultMatrixd(table
, save_MultMatrixd
);
8884 SET_MultMatrixf(table
, save_MultMatrixf
);
8885 SET_NewList(table
, save_NewList
);
8886 SET_Ortho(table
, save_Ortho
);
8887 SET_PassThrough(table
, save_PassThrough
);
8888 SET_PixelMapfv(table
, save_PixelMapfv
);
8889 SET_PixelMapuiv(table
, save_PixelMapuiv
);
8890 SET_PixelMapusv(table
, save_PixelMapusv
);
8891 SET_PixelTransferf(table
, save_PixelTransferf
);
8892 SET_PixelTransferi(table
, save_PixelTransferi
);
8893 SET_PixelZoom(table
, save_PixelZoom
);
8894 SET_PointSize(table
, save_PointSize
);
8895 SET_PolygonMode(table
, save_PolygonMode
);
8896 SET_PolygonOffset(table
, save_PolygonOffset
);
8897 SET_PolygonStipple(table
, save_PolygonStipple
);
8898 SET_PopAttrib(table
, save_PopAttrib
);
8899 SET_PopMatrix(table
, save_PopMatrix
);
8900 SET_PopName(table
, save_PopName
);
8901 SET_PushAttrib(table
, save_PushAttrib
);
8902 SET_PushMatrix(table
, save_PushMatrix
);
8903 SET_PushName(table
, save_PushName
);
8904 SET_RasterPos2d(table
, save_RasterPos2d
);
8905 SET_RasterPos2dv(table
, save_RasterPos2dv
);
8906 SET_RasterPos2f(table
, save_RasterPos2f
);
8907 SET_RasterPos2fv(table
, save_RasterPos2fv
);
8908 SET_RasterPos2i(table
, save_RasterPos2i
);
8909 SET_RasterPos2iv(table
, save_RasterPos2iv
);
8910 SET_RasterPos2s(table
, save_RasterPos2s
);
8911 SET_RasterPos2sv(table
, save_RasterPos2sv
);
8912 SET_RasterPos3d(table
, save_RasterPos3d
);
8913 SET_RasterPos3dv(table
, save_RasterPos3dv
);
8914 SET_RasterPos3f(table
, save_RasterPos3f
);
8915 SET_RasterPos3fv(table
, save_RasterPos3fv
);
8916 SET_RasterPos3i(table
, save_RasterPos3i
);
8917 SET_RasterPos3iv(table
, save_RasterPos3iv
);
8918 SET_RasterPos3s(table
, save_RasterPos3s
);
8919 SET_RasterPos3sv(table
, save_RasterPos3sv
);
8920 SET_RasterPos4d(table
, save_RasterPos4d
);
8921 SET_RasterPos4dv(table
, save_RasterPos4dv
);
8922 SET_RasterPos4f(table
, save_RasterPos4f
);
8923 SET_RasterPos4fv(table
, save_RasterPos4fv
);
8924 SET_RasterPos4i(table
, save_RasterPos4i
);
8925 SET_RasterPos4iv(table
, save_RasterPos4iv
);
8926 SET_RasterPos4s(table
, save_RasterPos4s
);
8927 SET_RasterPos4sv(table
, save_RasterPos4sv
);
8928 SET_ReadBuffer(table
, save_ReadBuffer
);
8929 SET_Rotated(table
, save_Rotated
);
8930 SET_Rotatef(table
, save_Rotatef
);
8931 SET_Scaled(table
, save_Scaled
);
8932 SET_Scalef(table
, save_Scalef
);
8933 SET_Scissor(table
, save_Scissor
);
8934 SET_ShadeModel(table
, save_ShadeModel
);
8935 SET_StencilFunc(table
, save_StencilFunc
);
8936 SET_StencilMask(table
, save_StencilMask
);
8937 SET_StencilOp(table
, save_StencilOp
);
8938 SET_TexEnvf(table
, save_TexEnvf
);
8939 SET_TexEnvfv(table
, save_TexEnvfv
);
8940 SET_TexEnvi(table
, save_TexEnvi
);
8941 SET_TexEnviv(table
, save_TexEnviv
);
8942 SET_TexGend(table
, save_TexGend
);
8943 SET_TexGendv(table
, save_TexGendv
);
8944 SET_TexGenf(table
, save_TexGenf
);
8945 SET_TexGenfv(table
, save_TexGenfv
);
8946 SET_TexGeni(table
, save_TexGeni
);
8947 SET_TexGeniv(table
, save_TexGeniv
);
8948 SET_TexImage1D(table
, save_TexImage1D
);
8949 SET_TexImage2D(table
, save_TexImage2D
);
8950 SET_TexParameterf(table
, save_TexParameterf
);
8951 SET_TexParameterfv(table
, save_TexParameterfv
);
8952 SET_TexParameteri(table
, save_TexParameteri
);
8953 SET_TexParameteriv(table
, save_TexParameteriv
);
8954 SET_Translated(table
, save_Translated
);
8955 SET_Translatef(table
, save_Translatef
);
8956 SET_Viewport(table
, save_Viewport
);
8959 SET_BindTexture(table
, save_BindTexture
);
8960 SET_CopyTexImage1D(table
, save_CopyTexImage1D
);
8961 SET_CopyTexImage2D(table
, save_CopyTexImage2D
);
8962 SET_CopyTexSubImage1D(table
, save_CopyTexSubImage1D
);
8963 SET_CopyTexSubImage2D(table
, save_CopyTexSubImage2D
);
8964 SET_PrioritizeTextures(table
, save_PrioritizeTextures
);
8965 SET_TexSubImage1D(table
, save_TexSubImage1D
);
8966 SET_TexSubImage2D(table
, save_TexSubImage2D
);
8969 SET_CopyTexSubImage3D(table
, save_CopyTexSubImage3D
);
8970 SET_TexImage3D(table
, save_TexImage3D
);
8971 SET_TexSubImage3D(table
, save_TexSubImage3D
);
8974 SET_StencilFuncSeparate(table
, save_StencilFuncSeparate
);
8975 SET_StencilMaskSeparate(table
, save_StencilMaskSeparate
);
8976 SET_StencilOpSeparate(table
, save_StencilOpSeparate
);
8978 /* ATI_separate_stencil */
8979 SET_StencilFuncSeparateATI(table
, save_StencilFuncSeparateATI
);
8981 /* GL_ARB_imaging */
8982 /* Not all are supported */
8983 SET_BlendColor(table
, save_BlendColor
);
8984 SET_BlendEquation(table
, save_BlendEquation
);
8985 SET_ColorSubTable(table
, save_ColorSubTable
);
8986 SET_ColorTable(table
, save_ColorTable
);
8987 SET_ColorTableParameterfv(table
, save_ColorTableParameterfv
);
8988 SET_ColorTableParameteriv(table
, save_ColorTableParameteriv
);
8989 SET_ConvolutionFilter1D(table
, save_ConvolutionFilter1D
);
8990 SET_ConvolutionFilter2D(table
, save_ConvolutionFilter2D
);
8991 SET_ConvolutionParameterf(table
, save_ConvolutionParameterf
);
8992 SET_ConvolutionParameterfv(table
, save_ConvolutionParameterfv
);
8993 SET_ConvolutionParameteri(table
, save_ConvolutionParameteri
);
8994 SET_ConvolutionParameteriv(table
, save_ConvolutionParameteriv
);
8995 SET_CopyColorSubTable(table
, save_CopyColorSubTable
);
8996 SET_CopyColorTable(table
, save_CopyColorTable
);
8997 SET_Histogram(table
, save_Histogram
);
8998 SET_Minmax(table
, save_Minmax
);
8999 SET_ResetHistogram(table
, save_ResetHistogram
);
9000 SET_ResetMinmax(table
, save_ResetMinmax
);
9002 /* 2. GL_EXT_blend_color */
9004 SET_BlendColorEXT(table
, save_BlendColorEXT
);
9007 /* 3. GL_EXT_polygon_offset */
9008 SET_PolygonOffsetEXT(table
, save_PolygonOffsetEXT
);
9010 /* 6. GL_EXT_texture3d */
9012 SET_CopyTexSubImage3DEXT(table
, save_CopyTexSubImage3D
);
9013 SET_TexImage3DEXT(table
, save_TexImage3DEXT
);
9014 SET_TexSubImage3DEXT(table
, save_TexSubImage3D
);
9017 /* 14. GL_SGI_color_table */
9019 SET_ColorTableSGI(table
, save_ColorTable
);
9020 SET_ColorSubTableSGI(table
, save_ColorSubTable
);
9023 /* 37. GL_EXT_blend_minmax */
9025 SET_BlendEquationEXT(table
, save_BlendEquationEXT
);
9028 /* 54. GL_EXT_point_parameters */
9029 SET_PointParameterf(table
, save_PointParameterfEXT
);
9030 SET_PointParameterfv(table
, save_PointParameterfvEXT
);
9032 /* 173. GL_EXT_blend_func_separate */
9033 SET_BlendFuncSeparate(table
, save_BlendFuncSeparateEXT
);
9035 /* 197. GL_MESA_window_pos */
9036 SET_WindowPos2d(table
, save_WindowPos2dMESA
);
9037 SET_WindowPos2dv(table
, save_WindowPos2dvMESA
);
9038 SET_WindowPos2f(table
, save_WindowPos2fMESA
);
9039 SET_WindowPos2fv(table
, save_WindowPos2fvMESA
);
9040 SET_WindowPos2i(table
, save_WindowPos2iMESA
);
9041 SET_WindowPos2iv(table
, save_WindowPos2ivMESA
);
9042 SET_WindowPos2s(table
, save_WindowPos2sMESA
);
9043 SET_WindowPos2sv(table
, save_WindowPos2svMESA
);
9044 SET_WindowPos3d(table
, save_WindowPos3dMESA
);
9045 SET_WindowPos3dv(table
, save_WindowPos3dvMESA
);
9046 SET_WindowPos3f(table
, save_WindowPos3fMESA
);
9047 SET_WindowPos3fv(table
, save_WindowPos3fvMESA
);
9048 SET_WindowPos3i(table
, save_WindowPos3iMESA
);
9049 SET_WindowPos3iv(table
, save_WindowPos3ivMESA
);
9050 SET_WindowPos3s(table
, save_WindowPos3sMESA
);
9051 SET_WindowPos3sv(table
, save_WindowPos3svMESA
);
9052 SET_WindowPos4dMESA(table
, save_WindowPos4dMESA
);
9053 SET_WindowPos4dvMESA(table
, save_WindowPos4dvMESA
);
9054 SET_WindowPos4fMESA(table
, save_WindowPos4fMESA
);
9055 SET_WindowPos4fvMESA(table
, save_WindowPos4fvMESA
);
9056 SET_WindowPos4iMESA(table
, save_WindowPos4iMESA
);
9057 SET_WindowPos4ivMESA(table
, save_WindowPos4ivMESA
);
9058 SET_WindowPos4sMESA(table
, save_WindowPos4sMESA
);
9059 SET_WindowPos4svMESA(table
, save_WindowPos4svMESA
);
9061 /* 233. GL_NV_vertex_program */
9062 /* The following commands DO NOT go into display lists:
9063 * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
9064 * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
9066 SET_BindProgramARB(table
, save_BindProgramNV
);
9068 /* 244. GL_ATI_envmap_bumpmap */
9069 SET_TexBumpParameterivATI(table
, save_TexBumpParameterivATI
);
9070 SET_TexBumpParameterfvATI(table
, save_TexBumpParameterfvATI
);
9072 /* 245. GL_ATI_fragment_shader */
9073 SET_BindFragmentShaderATI(table
, save_BindFragmentShaderATI
);
9074 SET_SetFragmentShaderConstantATI(table
, save_SetFragmentShaderConstantATI
);
9076 /* 262. GL_NV_point_sprite */
9077 SET_PointParameteri(table
, save_PointParameteriNV
);
9078 SET_PointParameteriv(table
, save_PointParameterivNV
);
9080 /* 268. GL_EXT_stencil_two_side */
9081 SET_ActiveStencilFaceEXT(table
, save_ActiveStencilFaceEXT
);
9083 /* ???. GL_EXT_depth_bounds_test */
9084 SET_DepthBoundsEXT(table
, save_DepthBoundsEXT
);
9086 /* ARB 1. GL_ARB_multitexture */
9087 SET_ActiveTexture(table
, save_ActiveTextureARB
);
9089 /* ARB 3. GL_ARB_transpose_matrix */
9090 SET_LoadTransposeMatrixd(table
, save_LoadTransposeMatrixdARB
);
9091 SET_LoadTransposeMatrixf(table
, save_LoadTransposeMatrixfARB
);
9092 SET_MultTransposeMatrixd(table
, save_MultTransposeMatrixdARB
);
9093 SET_MultTransposeMatrixf(table
, save_MultTransposeMatrixfARB
);
9095 /* ARB 5. GL_ARB_multisample */
9096 SET_SampleCoverage(table
, save_SampleCoverageARB
);
9098 /* ARB 12. GL_ARB_texture_compression */
9099 SET_CompressedTexImage3D(table
, save_CompressedTexImage3DARB
);
9100 SET_CompressedTexImage2D(table
, save_CompressedTexImage2DARB
);
9101 SET_CompressedTexImage1D(table
, save_CompressedTexImage1DARB
);
9102 SET_CompressedTexSubImage3D(table
, save_CompressedTexSubImage3DARB
);
9103 SET_CompressedTexSubImage2D(table
, save_CompressedTexSubImage2DARB
);
9104 SET_CompressedTexSubImage1D(table
, save_CompressedTexSubImage1DARB
);
9106 /* ARB 14. GL_ARB_point_parameters */
9107 /* aliased with EXT_point_parameters functions */
9109 /* ARB 25. GL_ARB_window_pos */
9110 /* aliased with MESA_window_pos functions */
9112 /* ARB 26. GL_ARB_vertex_program */
9113 /* ARB 27. GL_ARB_fragment_program */
9114 /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
9115 SET_ProgramStringARB(table
, save_ProgramStringARB
);
9116 SET_BindProgramARB(table
, save_BindProgramNV
);
9117 SET_ProgramEnvParameter4dARB(table
, save_ProgramEnvParameter4dARB
);
9118 SET_ProgramEnvParameter4dvARB(table
, save_ProgramEnvParameter4dvARB
);
9119 SET_ProgramEnvParameter4fARB(table
, save_ProgramEnvParameter4fARB
);
9120 SET_ProgramEnvParameter4fvARB(table
, save_ProgramEnvParameter4fvARB
);
9121 SET_ProgramLocalParameter4dARB(table
, save_ProgramLocalParameter4dARB
);
9122 SET_ProgramLocalParameter4dvARB(table
, save_ProgramLocalParameter4dvARB
);
9123 SET_ProgramLocalParameter4fARB(table
, save_ProgramLocalParameter4fARB
);
9124 SET_ProgramLocalParameter4fvARB(table
, save_ProgramLocalParameter4fvARB
);
9126 SET_BeginQuery(table
, save_BeginQueryARB
);
9127 SET_EndQuery(table
, save_EndQueryARB
);
9128 SET_QueryCounter(table
, save_QueryCounter
);
9130 SET_DrawBuffers(table
, save_DrawBuffersARB
);
9132 SET_BlitFramebuffer(table
, save_BlitFramebufferEXT
);
9134 SET_UseProgram(table
, save_UseProgramObjectARB
);
9135 SET_Uniform1f(table
, save_Uniform1fARB
);
9136 SET_Uniform2f(table
, save_Uniform2fARB
);
9137 SET_Uniform3f(table
, save_Uniform3fARB
);
9138 SET_Uniform4f(table
, save_Uniform4fARB
);
9139 SET_Uniform1fv(table
, save_Uniform1fvARB
);
9140 SET_Uniform2fv(table
, save_Uniform2fvARB
);
9141 SET_Uniform3fv(table
, save_Uniform3fvARB
);
9142 SET_Uniform4fv(table
, save_Uniform4fvARB
);
9143 SET_Uniform1i(table
, save_Uniform1iARB
);
9144 SET_Uniform2i(table
, save_Uniform2iARB
);
9145 SET_Uniform3i(table
, save_Uniform3iARB
);
9146 SET_Uniform4i(table
, save_Uniform4iARB
);
9147 SET_Uniform1iv(table
, save_Uniform1ivARB
);
9148 SET_Uniform2iv(table
, save_Uniform2ivARB
);
9149 SET_Uniform3iv(table
, save_Uniform3ivARB
);
9150 SET_Uniform4iv(table
, save_Uniform4ivARB
);
9151 SET_UniformMatrix2fv(table
, save_UniformMatrix2fvARB
);
9152 SET_UniformMatrix3fv(table
, save_UniformMatrix3fvARB
);
9153 SET_UniformMatrix4fv(table
, save_UniformMatrix4fvARB
);
9154 SET_UniformMatrix2x3fv(table
, save_UniformMatrix2x3fv
);
9155 SET_UniformMatrix3x2fv(table
, save_UniformMatrix3x2fv
);
9156 SET_UniformMatrix2x4fv(table
, save_UniformMatrix2x4fv
);
9157 SET_UniformMatrix4x2fv(table
, save_UniformMatrix4x2fv
);
9158 SET_UniformMatrix3x4fv(table
, save_UniformMatrix3x4fv
);
9159 SET_UniformMatrix4x3fv(table
, save_UniformMatrix4x3fv
);
9161 /* 299. GL_EXT_blend_equation_separate */
9162 SET_BlendEquationSeparate(table
, save_BlendEquationSeparateEXT
);
9164 /* GL_EXT_gpu_program_parameters */
9165 SET_ProgramEnvParameters4fvEXT(table
, save_ProgramEnvParameters4fvEXT
);
9166 SET_ProgramLocalParameters4fvEXT(table
, save_ProgramLocalParameters4fvEXT
);
9168 /* 364. GL_EXT_provoking_vertex */
9169 SET_ProvokingVertex(table
, save_ProvokingVertexEXT
);
9171 /* GL_EXT_texture_integer */
9172 SET_ClearColorIiEXT(table
, save_ClearColorIi
);
9173 SET_ClearColorIuiEXT(table
, save_ClearColorIui
);
9174 SET_TexParameterIiv(table
, save_TexParameterIiv
);
9175 SET_TexParameterIuiv(table
, save_TexParameterIuiv
);
9177 /* 377. GL_EXT_separate_shader_objects */
9178 SET_UseShaderProgramEXT(table
, save_UseShaderProgramEXT
);
9179 SET_ActiveProgramEXT(table
, save_ActiveProgramEXT
);
9181 /* GL_ARB_color_buffer_float */
9182 SET_ClampColor(table
, save_ClampColorARB
);
9185 SET_ClearBufferiv(table
, save_ClearBufferiv
);
9186 SET_ClearBufferuiv(table
, save_ClearBufferuiv
);
9187 SET_ClearBufferfv(table
, save_ClearBufferfv
);
9188 SET_ClearBufferfi(table
, save_ClearBufferfi
);
9190 SET_Uniform1ui(table
, save_Uniform1ui
);
9191 SET_Uniform2ui(table
, save_Uniform2ui
);
9192 SET_Uniform3ui(table
, save_Uniform3ui
);
9193 SET_Uniform4ui(table
, save_Uniform4ui
);
9194 SET_Uniform1uiv(table
, save_Uniform1uiv
);
9195 SET_Uniform2uiv(table
, save_Uniform2uiv
);
9196 SET_Uniform3uiv(table
, save_Uniform3uiv
);
9197 SET_Uniform4uiv(table
, save_Uniform4uiv
);
9199 (void) save_Uniform1ui
;
9200 (void) save_Uniform2ui
;
9201 (void) save_Uniform3ui
;
9202 (void) save_Uniform4ui
;
9203 (void) save_Uniform1uiv
;
9204 (void) save_Uniform2uiv
;
9205 (void) save_Uniform3uiv
;
9206 (void) save_Uniform4uiv
;
9210 SET_BeginTransformFeedback(table
, save_BeginTransformFeedback
);
9211 SET_EndTransformFeedback(table
, save_EndTransformFeedback
);
9212 SET_BindTransformFeedback(table
, save_BindTransformFeedback
);
9213 SET_PauseTransformFeedback(table
, save_PauseTransformFeedback
);
9214 SET_ResumeTransformFeedback(table
, save_ResumeTransformFeedback
);
9215 SET_DrawTransformFeedback(table
, save_DrawTransformFeedback
);
9216 SET_DrawTransformFeedbackStream(table
, save_DrawTransformFeedbackStream
);
9217 SET_DrawTransformFeedbackInstanced(table
,
9218 save_DrawTransformFeedbackInstanced
);
9219 SET_DrawTransformFeedbackStreamInstanced(table
,
9220 save_DrawTransformFeedbackStreamInstanced
);
9221 SET_BeginQueryIndexed(table
, save_BeginQueryIndexed
);
9222 SET_EndQueryIndexed(table
, save_EndQueryIndexed
);
9224 /* GL_ARB_instanced_arrays */
9225 SET_VertexAttribDivisor(table
, save_VertexAttribDivisor
);
9227 /* GL_NV_texture_barrier */
9228 SET_TextureBarrierNV(table
, save_TextureBarrierNV
);
9230 SET_BindSampler(table
, save_BindSampler
);
9231 SET_SamplerParameteri(table
, save_SamplerParameteri
);
9232 SET_SamplerParameterf(table
, save_SamplerParameterf
);
9233 SET_SamplerParameteriv(table
, save_SamplerParameteriv
);
9234 SET_SamplerParameterfv(table
, save_SamplerParameterfv
);
9235 SET_SamplerParameterIiv(table
, save_SamplerParameterIiv
);
9236 SET_SamplerParameterIuiv(table
, save_SamplerParameterIuiv
);
9238 /* GL_ARB_draw_buffer_blend */
9239 SET_BlendFunciARB(table
, save_BlendFunci
);
9240 SET_BlendFuncSeparateiARB(table
, save_BlendFuncSeparatei
);
9241 SET_BlendEquationiARB(table
, save_BlendEquationi
);
9242 SET_BlendEquationSeparateiARB(table
, save_BlendEquationSeparatei
);
9244 /* GL_ARB_geometry_shader4 */
9245 SET_ProgramParameteri(table
, save_ProgramParameteri
);
9246 SET_FramebufferTexture(table
, save_FramebufferTexture
);
9247 SET_FramebufferTextureFaceARB(table
, save_FramebufferTextureFace
);
9249 /* GL_NV_conditional_render */
9250 SET_BeginConditionalRender(table
, save_BeginConditionalRender
);
9251 SET_EndConditionalRender(table
, save_EndConditionalRender
);
9254 SET_WaitSync(table
, save_WaitSync
);
9256 /* GL_ARB_uniform_buffer_object */
9257 SET_UniformBlockBinding(table
, save_UniformBlockBinding
);
9263 enum_string(GLenum k
)
9265 return _mesa_lookup_enum_by_nr(k
);
9270 * Print the commands in a display list. For debugging only.
9271 * TODO: many commands aren't handled yet.
9273 static void GLAPIENTRY
9274 print_list(struct gl_context
*ctx
, GLuint list
)
9276 struct gl_display_list
*dlist
;
9280 if (!islist(ctx
, list
)) {
9281 printf("%u is not a display list ID\n", list
);
9285 dlist
= lookup_list(ctx
, list
);
9291 printf("START-LIST %u, address %p\n", list
, (void *) n
);
9293 done
= n
? GL_FALSE
: GL_TRUE
;
9295 const OpCode opcode
= n
[0].opcode
;
9297 if (is_ext_opcode(opcode
)) {
9298 n
+= ext_opcode_print(ctx
, n
);
9303 printf("Accum %s %g\n", enum_string(n
[1].e
), n
[2].f
);
9306 printf("Bitmap %d %d %g %g %g %g %p\n", n
[1].i
, n
[2].i
,
9307 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
, (void *) n
[7].data
);
9309 case OPCODE_CALL_LIST
:
9310 printf("CallList %d\n", (int) n
[1].ui
);
9312 case OPCODE_CALL_LIST_OFFSET
:
9313 printf("CallList %d + offset %u = %u\n", (int) n
[1].ui
,
9314 ctx
->List
.ListBase
, ctx
->List
.ListBase
+ n
[1].ui
);
9316 case OPCODE_COLOR_TABLE_PARAMETER_FV
:
9317 printf("ColorTableParameterfv %s %s %f %f %f %f\n",
9318 enum_string(n
[1].e
), enum_string(n
[2].e
),
9319 n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9321 case OPCODE_COLOR_TABLE_PARAMETER_IV
:
9322 printf("ColorTableParameteriv %s %s %d %d %d %d\n",
9323 enum_string(n
[1].e
), enum_string(n
[2].e
),
9324 n
[3].i
, n
[4].i
, n
[5].i
, n
[6].i
);
9326 case OPCODE_DISABLE
:
9327 printf("Disable %s\n", enum_string(n
[1].e
));
9330 printf("Enable %s\n", enum_string(n
[1].e
));
9332 case OPCODE_FRUSTUM
:
9333 printf("Frustum %g %g %g %g %g %g\n",
9334 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9336 case OPCODE_LINE_STIPPLE
:
9337 printf("LineStipple %d %x\n", n
[1].i
, (int) n
[2].us
);
9339 case OPCODE_LOAD_IDENTITY
:
9340 printf("LoadIdentity\n");
9342 case OPCODE_LOAD_MATRIX
:
9343 printf("LoadMatrix\n");
9344 printf(" %8f %8f %8f %8f\n",
9345 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9346 printf(" %8f %8f %8f %8f\n",
9347 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9348 printf(" %8f %8f %8f %8f\n",
9349 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9350 printf(" %8f %8f %8f %8f\n",
9351 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9353 case OPCODE_MULT_MATRIX
:
9354 printf("MultMatrix (or Rotate)\n");
9355 printf(" %8f %8f %8f %8f\n",
9356 n
[1].f
, n
[5].f
, n
[9].f
, n
[13].f
);
9357 printf(" %8f %8f %8f %8f\n",
9358 n
[2].f
, n
[6].f
, n
[10].f
, n
[14].f
);
9359 printf(" %8f %8f %8f %8f\n",
9360 n
[3].f
, n
[7].f
, n
[11].f
, n
[15].f
);
9361 printf(" %8f %8f %8f %8f\n",
9362 n
[4].f
, n
[8].f
, n
[12].f
, n
[16].f
);
9365 printf("Ortho %g %g %g %g %g %g\n",
9366 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9368 case OPCODE_POP_ATTRIB
:
9369 printf("PopAttrib\n");
9371 case OPCODE_POP_MATRIX
:
9372 printf("PopMatrix\n");
9374 case OPCODE_POP_NAME
:
9375 printf("PopName\n");
9377 case OPCODE_PUSH_ATTRIB
:
9378 printf("PushAttrib %x\n", n
[1].bf
);
9380 case OPCODE_PUSH_MATRIX
:
9381 printf("PushMatrix\n");
9383 case OPCODE_PUSH_NAME
:
9384 printf("PushName %d\n", (int) n
[1].ui
);
9386 case OPCODE_RASTER_POS
:
9387 printf("RasterPos %g %g %g %g\n",
9388 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9391 printf("Rotate %g %g %g %g\n",
9392 n
[1].f
, n
[2].f
, n
[3].f
, n
[4].f
);
9395 printf("Scale %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9397 case OPCODE_TRANSLATE
:
9398 printf("Translate %g %g %g\n", n
[1].f
, n
[2].f
, n
[3].f
);
9400 case OPCODE_BIND_TEXTURE
:
9401 printf("BindTexture %s %d\n",
9402 _mesa_lookup_enum_by_nr(n
[1].ui
), n
[2].ui
);
9404 case OPCODE_SHADE_MODEL
:
9405 printf("ShadeModel %s\n", _mesa_lookup_enum_by_nr(n
[1].ui
));
9408 printf("Map1 %s %.3f %.3f %d %d\n",
9409 _mesa_lookup_enum_by_nr(n
[1].ui
),
9410 n
[2].f
, n
[3].f
, n
[4].i
, n
[5].i
);
9413 printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
9414 _mesa_lookup_enum_by_nr(n
[1].ui
),
9415 n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
,
9416 n
[6].i
, n
[7].i
, n
[8].i
, n
[9].i
);
9418 case OPCODE_MAPGRID1
:
9419 printf("MapGrid1 %d %.3f %.3f\n", n
[1].i
, n
[2].f
, n
[3].f
);
9421 case OPCODE_MAPGRID2
:
9422 printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
9423 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].i
, n
[5].f
, n
[6].f
);
9425 case OPCODE_EVALMESH1
:
9426 printf("EvalMesh1 %d %d\n", n
[1].i
, n
[2].i
);
9428 case OPCODE_EVALMESH2
:
9429 printf("EvalMesh2 %d %d %d %d\n",
9430 n
[1].i
, n
[2].i
, n
[3].i
, n
[4].i
);
9433 case OPCODE_ATTR_1F_NV
:
9434 printf("ATTR_1F_NV attr %d: %f\n", n
[1].i
, n
[2].f
);
9436 case OPCODE_ATTR_2F_NV
:
9437 printf("ATTR_2F_NV attr %d: %f %f\n",
9438 n
[1].i
, n
[2].f
, n
[3].f
);
9440 case OPCODE_ATTR_3F_NV
:
9441 printf("ATTR_3F_NV attr %d: %f %f %f\n",
9442 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9444 case OPCODE_ATTR_4F_NV
:
9445 printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
9446 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9448 case OPCODE_ATTR_1F_ARB
:
9449 printf("ATTR_1F_ARB attr %d: %f\n", n
[1].i
, n
[2].f
);
9451 case OPCODE_ATTR_2F_ARB
:
9452 printf("ATTR_2F_ARB attr %d: %f %f\n",
9453 n
[1].i
, n
[2].f
, n
[3].f
);
9455 case OPCODE_ATTR_3F_ARB
:
9456 printf("ATTR_3F_ARB attr %d: %f %f %f\n",
9457 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
);
9459 case OPCODE_ATTR_4F_ARB
:
9460 printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
9461 n
[1].i
, n
[2].f
, n
[3].f
, n
[4].f
, n
[5].f
);
9464 case OPCODE_MATERIAL
:
9465 printf("MATERIAL %x %x: %f %f %f %f\n",
9466 n
[1].i
, n
[2].i
, n
[3].f
, n
[4].f
, n
[5].f
, n
[6].f
);
9469 printf("BEGIN %x\n", n
[1].i
);
9475 printf("RECTF %f %f %f %f\n", n
[1].f
, n
[2].f
, n
[3].f
,
9478 case OPCODE_EVAL_C1
:
9479 printf("EVAL_C1 %f\n", n
[1].f
);
9481 case OPCODE_EVAL_C2
:
9482 printf("EVAL_C2 %f %f\n", n
[1].f
, n
[2].f
);
9484 case OPCODE_EVAL_P1
:
9485 printf("EVAL_P1 %d\n", n
[1].i
);
9487 case OPCODE_EVAL_P2
:
9488 printf("EVAL_P2 %d %d\n", n
[1].i
, n
[2].i
);
9491 case OPCODE_PROVOKING_VERTEX
:
9492 printf("ProvokingVertex %s\n",
9493 _mesa_lookup_enum_by_nr(n
[1].ui
));
9497 * meta opcodes/commands
9500 printf("Error: %s %s\n",
9501 enum_string(n
[1].e
), (const char *) n
[2].data
);
9503 case OPCODE_CONTINUE
:
9504 printf("DISPLAY-LIST-CONTINUE\n");
9505 n
= (Node
*) n
[1].next
;
9507 case OPCODE_END_OF_LIST
:
9508 printf("END-LIST %u\n", list
);
9512 if (opcode
< 0 || opcode
> OPCODE_END_OF_LIST
) {
9514 ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
9515 opcode
, (void *) n
);
9519 printf("command %d, %u operands\n", opcode
,
9523 /* increment n to point to next compiled command */
9524 if (opcode
!= OPCODE_CONTINUE
) {
9525 n
+= InstSize
[opcode
];
9534 * Clients may call this function to help debug display list problems.
9535 * This function is _ONLY_FOR_DEBUGGING_PURPOSES_. It may be removed,
9536 * changed, or break in the future without notice.
9539 mesa_print_display_list(GLuint list
)
9541 GET_CURRENT_CONTEXT(ctx
);
9542 print_list(ctx
, list
);
9546 /**********************************************************************/
9547 /***** Initialization *****/
9548 /**********************************************************************/
9551 _mesa_save_vtxfmt_init(GLvertexformat
* vfmt
)
9553 _MESA_INIT_ARRAYELT_VTXFMT(vfmt
, _ae_
);
9555 vfmt
->Begin
= save_Begin
;
9557 _MESA_INIT_DLIST_VTXFMT(vfmt
, save_
);
9559 vfmt
->Color3f
= save_Color3f
;
9560 vfmt
->Color3fv
= save_Color3fv
;
9561 vfmt
->Color4f
= save_Color4f
;
9562 vfmt
->Color4fv
= save_Color4fv
;
9563 vfmt
->EdgeFlag
= save_EdgeFlag
;
9564 vfmt
->End
= save_End
;
9566 _MESA_INIT_EVAL_VTXFMT(vfmt
, save_
);
9568 vfmt
->FogCoordfEXT
= save_FogCoordfEXT
;
9569 vfmt
->FogCoordfvEXT
= save_FogCoordfvEXT
;
9570 vfmt
->Indexf
= save_Indexf
;
9571 vfmt
->Indexfv
= save_Indexfv
;
9572 vfmt
->Materialfv
= save_Materialfv
;
9573 vfmt
->MultiTexCoord1fARB
= save_MultiTexCoord1f
;
9574 vfmt
->MultiTexCoord1fvARB
= save_MultiTexCoord1fv
;
9575 vfmt
->MultiTexCoord2fARB
= save_MultiTexCoord2f
;
9576 vfmt
->MultiTexCoord2fvARB
= save_MultiTexCoord2fv
;
9577 vfmt
->MultiTexCoord3fARB
= save_MultiTexCoord3f
;
9578 vfmt
->MultiTexCoord3fvARB
= save_MultiTexCoord3fv
;
9579 vfmt
->MultiTexCoord4fARB
= save_MultiTexCoord4f
;
9580 vfmt
->MultiTexCoord4fvARB
= save_MultiTexCoord4fv
;
9581 vfmt
->Normal3f
= save_Normal3f
;
9582 vfmt
->Normal3fv
= save_Normal3fv
;
9583 vfmt
->SecondaryColor3fEXT
= save_SecondaryColor3fEXT
;
9584 vfmt
->SecondaryColor3fvEXT
= save_SecondaryColor3fvEXT
;
9585 vfmt
->TexCoord1f
= save_TexCoord1f
;
9586 vfmt
->TexCoord1fv
= save_TexCoord1fv
;
9587 vfmt
->TexCoord2f
= save_TexCoord2f
;
9588 vfmt
->TexCoord2fv
= save_TexCoord2fv
;
9589 vfmt
->TexCoord3f
= save_TexCoord3f
;
9590 vfmt
->TexCoord3fv
= save_TexCoord3fv
;
9591 vfmt
->TexCoord4f
= save_TexCoord4f
;
9592 vfmt
->TexCoord4fv
= save_TexCoord4fv
;
9593 vfmt
->Vertex2f
= save_Vertex2f
;
9594 vfmt
->Vertex2fv
= save_Vertex2fv
;
9595 vfmt
->Vertex3f
= save_Vertex3f
;
9596 vfmt
->Vertex3fv
= save_Vertex3fv
;
9597 vfmt
->Vertex4f
= save_Vertex4f
;
9598 vfmt
->Vertex4fv
= save_Vertex4fv
;
9599 vfmt
->VertexAttrib1fARB
= save_VertexAttrib1fARB
;
9600 vfmt
->VertexAttrib1fvARB
= save_VertexAttrib1fvARB
;
9601 vfmt
->VertexAttrib2fARB
= save_VertexAttrib2fARB
;
9602 vfmt
->VertexAttrib2fvARB
= save_VertexAttrib2fvARB
;
9603 vfmt
->VertexAttrib3fARB
= save_VertexAttrib3fARB
;
9604 vfmt
->VertexAttrib3fvARB
= save_VertexAttrib3fvARB
;
9605 vfmt
->VertexAttrib4fARB
= save_VertexAttrib4fARB
;
9606 vfmt
->VertexAttrib4fvARB
= save_VertexAttrib4fvARB
;
9608 vfmt
->Rectf
= save_Rectf
;
9610 /* GL_ARB_draw_instanced */
9611 vfmt
->DrawArraysInstanced
= save_DrawArraysInstancedARB
;
9612 vfmt
->DrawElementsInstanced
= save_DrawElementsInstancedARB
;
9614 /* GL_ARB_draw_elements_base_vertex */
9615 vfmt
->DrawElementsInstancedBaseVertex
= save_DrawElementsInstancedBaseVertexARB
;
9617 /* GL_ARB_base_instance */
9618 vfmt
->DrawArraysInstancedBaseInstance
= save_DrawArraysInstancedBaseInstance
;
9619 vfmt
->DrawElementsInstancedBaseInstance
= save_DrawElementsInstancedBaseInstance
;
9620 vfmt
->DrawElementsInstancedBaseVertexBaseInstance
= save_DrawElementsInstancedBaseVertexBaseInstance
;
9622 /* The driver is required to implement these as
9623 * 1) They can probably do a better job.
9624 * 2) A lot of new mechanisms would have to be added to this module
9625 * to support it. That code would probably never get used,
9629 vfmt
->DrawArrays
= 0;
9630 vfmt
->DrawElements
= 0;
9631 vfmt
->DrawRangeElements
= 0;
9632 vfmt
->MultiDrawElemementsEXT
= 0;
9633 vfmt
->DrawElementsBaseVertex
= 0;
9634 vfmt
->DrawRangeElementsBaseVertex
= 0;
9635 vfmt
->MultiDrawElemementsBaseVertex
= 0;
9641 _mesa_install_dlist_vtxfmt(struct _glapi_table
*disp
,
9642 const GLvertexformat
*vfmt
)
9644 SET_CallList(disp
, vfmt
->CallList
);
9645 SET_CallLists(disp
, vfmt
->CallLists
);
9650 * Initialize display list state for given context.
9653 _mesa_init_display_list(struct gl_context
*ctx
)
9655 static GLboolean tableInitialized
= GL_FALSE
;
9657 /* zero-out the instruction size table, just once */
9658 if (!tableInitialized
) {
9659 memset(InstSize
, 0, sizeof(InstSize
));
9660 tableInitialized
= GL_TRUE
;
9663 /* extension info */
9664 ctx
->ListExt
= CALLOC_STRUCT(gl_list_extensions
);
9667 ctx
->ListState
.CallDepth
= 0;
9668 ctx
->ExecuteFlag
= GL_TRUE
;
9669 ctx
->CompileFlag
= GL_FALSE
;
9670 ctx
->ListState
.CurrentBlock
= NULL
;
9671 ctx
->ListState
.CurrentPos
= 0;
9673 /* Display List group */
9674 ctx
->List
.ListBase
= 0;
9676 _mesa_save_vtxfmt_init(&ctx
->ListState
.ListVtxfmt
);
9681 _mesa_free_display_list_data(struct gl_context
*ctx
)
9684 ctx
->ListExt
= NULL
;