mesa,st/mesa: add a fast path for non-static VAOs
[mesa.git] / src / mesa / main / dd.h
1 /**
2 * \file dd.h
3 * Device driver interfaces.
4 */
5
6 /*
7 * Mesa 3-D graphics library
8 *
9 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30
31 #ifndef DD_INCLUDED
32 #define DD_INCLUDED
33
34 #include "glheader.h"
35 #include "formats.h"
36 #include "menums.h"
37 #include "compiler/shader_enums.h"
38
39 struct gl_bitmap_atlas;
40 struct gl_buffer_object;
41 struct gl_context;
42 struct gl_display_list;
43 struct gl_framebuffer;
44 struct gl_image_unit;
45 struct gl_pixelstore_attrib;
46 struct gl_program;
47 struct gl_renderbuffer;
48 struct gl_renderbuffer_attachment;
49 struct gl_shader;
50 struct gl_shader_program;
51 struct gl_texture_image;
52 struct gl_texture_object;
53 struct gl_memory_info;
54 struct gl_transform_feedback_object;
55 struct ati_fragment_shader;
56 struct util_queue_monitoring;
57 struct _mesa_prim;
58 struct _mesa_index_buffer;
59
60 /* GL_ARB_vertex_buffer_object */
61 /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
62 * NULL) if buffer is unavailable for immediate mapping.
63 *
64 * Does GL_MAP_INVALIDATE_RANGE_BIT do this? It seems so, but it
65 * would require more book-keeping in the driver than seems necessary
66 * at this point.
67 *
68 * Does GL_MAP_INVALDIATE_BUFFER_BIT do this? Not really -- we don't
69 * want to provoke the driver to throw away the old storage, we will
70 * respect the contents of already referenced data.
71 */
72 #define MESA_MAP_NOWAIT_BIT 0x4000
73
74 /* Mapping a buffer is allowed from any thread. */
75 #define MESA_MAP_THREAD_SAFE_BIT 0x8000
76
77
78 /**
79 * Device driver function table.
80 * Core Mesa uses these function pointers to call into device drivers.
81 * Most of these functions directly correspond to OpenGL state commands.
82 * Core Mesa will call these functions after error checking has been done
83 * so that the drivers don't have to worry about error testing.
84 *
85 * Vertex transformation/clipping/lighting is patched into the T&L module.
86 * Rasterization functions are patched into the swrast module.
87 *
88 * Note: when new functions are added here, the drivers/common/driverfuncs.c
89 * file should be updated too!!!
90 */
91 struct dd_function_table {
92 /**
93 * Return a string as needed by glGetString().
94 * Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
95 * returned.
96 */
97 const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name );
98
99 /**
100 * Notify the driver after Mesa has made some internal state changes.
101 *
102 * This is in addition to any state change callbacks Mesa may already have
103 * made.
104 */
105 void (*UpdateState)(struct gl_context *ctx);
106
107 /**
108 * This is called whenever glFinish() is called.
109 */
110 void (*Finish)( struct gl_context *ctx );
111
112 /**
113 * This is called whenever glFlush() is called.
114 */
115 void (*Flush)( struct gl_context *ctx );
116
117 /**
118 * Clear the color/depth/stencil/accum buffer(s).
119 * \param buffers a bitmask of BUFFER_BIT_* flags indicating which
120 * renderbuffers need to be cleared.
121 */
122 void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
123
124 /**
125 * Execute glRasterPos, updating the ctx->Current.Raster fields
126 */
127 void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
128
129 /**
130 * \name Image-related functions
131 */
132 /*@{*/
133
134 /**
135 * Called by glDrawPixels().
136 * \p unpack describes how to unpack the source image data.
137 */
138 void (*DrawPixels)( struct gl_context *ctx,
139 GLint x, GLint y, GLsizei width, GLsizei height,
140 GLenum format, GLenum type,
141 const struct gl_pixelstore_attrib *unpack,
142 const GLvoid *pixels );
143
144 /**
145 * Called by glReadPixels().
146 */
147 void (*ReadPixels)( struct gl_context *ctx,
148 GLint x, GLint y, GLsizei width, GLsizei height,
149 GLenum format, GLenum type,
150 const struct gl_pixelstore_attrib *unpack,
151 GLvoid *dest );
152
153 /**
154 * Called by glCopyPixels().
155 */
156 void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
157 GLsizei width, GLsizei height,
158 GLint dstx, GLint dsty, GLenum type );
159
160 /**
161 * Called by glBitmap().
162 */
163 void (*Bitmap)( struct gl_context *ctx,
164 GLint x, GLint y, GLsizei width, GLsizei height,
165 const struct gl_pixelstore_attrib *unpack,
166 const GLubyte *bitmap );
167
168 /**
169 * Called by display list code for optimized glCallLists/glBitmap rendering
170 * The driver must support texture rectangles of width 1024 or more.
171 */
172 void (*DrawAtlasBitmaps)(struct gl_context *ctx,
173 const struct gl_bitmap_atlas *atlas,
174 GLuint count, const GLubyte *ids);
175 /*@}*/
176
177
178 /**
179 * \name Texture image functions
180 */
181 /*@{*/
182
183 /**
184 * Choose actual hardware texture format given the texture target, the
185 * user-provided source image format and type and the desired internal
186 * format. In some cases, srcFormat and srcType can be GL_NONE.
187 * Note: target may be GL_TEXTURE_CUBE_MAP, but never
188 * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ].
189 * Called by glTexImage(), etc.
190 */
191 mesa_format (*ChooseTextureFormat)(struct gl_context *ctx,
192 GLenum target, GLint internalFormat,
193 GLenum srcFormat, GLenum srcType );
194
195 /**
196 * Queries different driver parameters for a particular target and format.
197 * Since ARB_internalformat_query2 introduced several new query parameters
198 * over ARB_internalformat_query, having one driver hook for each parameter
199 * is no longer feasible. So this is the generic entry-point for calls
200 * to glGetInternalFormativ and glGetInternalFormati64v, after Mesa has
201 * checked errors and default values.
202 *
203 * \param ctx GL context
204 * \param target GL target enum
205 * \param internalFormat GL format enum
206 * \param pname GL enum that specifies the info to query.
207 * \param params Buffer to hold the result of the query.
208 */
209 void (*QueryInternalFormat)(struct gl_context *ctx,
210 GLenum target,
211 GLenum internalFormat,
212 GLenum pname,
213 GLint *params);
214
215 /**
216 * Called by glTexImage[123]D() and glCopyTexImage[12]D()
217 * Allocate texture memory and copy the user's image to the buffer.
218 * The gl_texture_image fields, etc. will be fully initialized.
219 * The parameters are the same as glTexImage3D(), plus:
220 * \param dims 1, 2, or 3 indicating glTexImage1/2/3D()
221 * \param packing describes how to unpack the source data.
222 * \param texImage is the destination texture image.
223 */
224 void (*TexImage)(struct gl_context *ctx, GLuint dims,
225 struct gl_texture_image *texImage,
226 GLenum format, GLenum type, const GLvoid *pixels,
227 const struct gl_pixelstore_attrib *packing);
228
229 /**
230 * Called by glTexSubImage[123]D().
231 * Replace a subset of the target texture with new texel data.
232 */
233 void (*TexSubImage)(struct gl_context *ctx, GLuint dims,
234 struct gl_texture_image *texImage,
235 GLint xoffset, GLint yoffset, GLint zoffset,
236 GLsizei width, GLsizei height, GLint depth,
237 GLenum format, GLenum type,
238 const GLvoid *pixels,
239 const struct gl_pixelstore_attrib *packing);
240
241
242 /**
243 * Called by glGetTexImage(), glGetTextureSubImage().
244 */
245 void (*GetTexSubImage)(struct gl_context *ctx,
246 GLint xoffset, GLint yoffset, GLint zoffset,
247 GLsizei width, GLsizei height, GLsizei depth,
248 GLenum format, GLenum type, GLvoid *pixels,
249 struct gl_texture_image *texImage);
250
251 /**
252 * Called by glClearTex[Sub]Image
253 *
254 * Clears a rectangular region of the image to a given value. The
255 * clearValue argument is either NULL or points to a single texel to use as
256 * the clear value in the same internal format as the texture image. If it
257 * is NULL then the texture should be cleared to zeroes.
258 */
259 void (*ClearTexSubImage)(struct gl_context *ctx,
260 struct gl_texture_image *texImage,
261 GLint xoffset, GLint yoffset, GLint zoffset,
262 GLsizei width, GLsizei height, GLsizei depth,
263 const GLvoid *clearValue);
264
265 /**
266 * Called by glCopyTex[Sub]Image[123]D().
267 *
268 * This function should copy a rectangular region in the rb to a single
269 * destination slice, specified by @slice. In the case of 1D array
270 * textures (where one GL call can potentially affect multiple destination
271 * slices), core mesa takes care of calling this function multiple times,
272 * once for each scanline to be copied.
273 */
274 void (*CopyTexSubImage)(struct gl_context *ctx, GLuint dims,
275 struct gl_texture_image *texImage,
276 GLint xoffset, GLint yoffset, GLint slice,
277 struct gl_renderbuffer *rb,
278 GLint x, GLint y,
279 GLsizei width, GLsizei height);
280 /**
281 * Called by glCopyImageSubData().
282 *
283 * This function should copy one 2-D slice from src_teximage or
284 * src_renderbuffer to dst_teximage or dst_renderbuffer. Either the
285 * teximage or renderbuffer pointer will be non-null to indicate which
286 * is the real src/dst.
287 *
288 * If one of the textures is 3-D or is a 1-D or 2-D array
289 * texture, this function will be called multiple times: once for each
290 * slice. If one of the textures is a cube map, this function will be
291 * called once for each face to be copied.
292 */
293 void (*CopyImageSubData)(struct gl_context *ctx,
294 struct gl_texture_image *src_teximage,
295 struct gl_renderbuffer *src_renderbuffer,
296 int src_x, int src_y, int src_z,
297 struct gl_texture_image *dst_teximage,
298 struct gl_renderbuffer *dst_renderbuffer,
299 int dst_x, int dst_y, int dst_z,
300 int src_width, int src_height);
301
302 /**
303 * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
304 * Note that if the texture is a cube map, the <target> parameter will
305 * indicate which cube face to generate (GL_POSITIVE/NEGATIVE_X/Y/Z).
306 * texObj->BaseLevel is the level from which to generate the remaining
307 * mipmap levels.
308 */
309 void (*GenerateMipmap)(struct gl_context *ctx, GLenum target,
310 struct gl_texture_object *texObj);
311
312 /**
313 * Called by glTexImage, glCompressedTexImage, glCopyTexImage
314 * and glTexStorage to check if the dimensions of the texture image
315 * are too large.
316 * \param target any GL_PROXY_TEXTURE_x target
317 * \return GL_TRUE if the image is OK, GL_FALSE if too large
318 */
319 GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target,
320 GLuint numLevels, GLint level,
321 mesa_format format, GLuint numSamples,
322 GLint width, GLint height,
323 GLint depth);
324 /*@}*/
325
326
327 /**
328 * \name Compressed texture functions
329 */
330 /*@{*/
331
332 /**
333 * Called by glCompressedTexImage[123]D().
334 */
335 void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims,
336 struct gl_texture_image *texImage,
337 GLsizei imageSize, const GLvoid *data);
338
339 /**
340 * Called by glCompressedTexSubImage[123]D().
341 */
342 void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims,
343 struct gl_texture_image *texImage,
344 GLint xoffset, GLint yoffset, GLint zoffset,
345 GLsizei width, GLsizei height, GLsizei depth,
346 GLenum format,
347 GLsizei imageSize, const GLvoid *data);
348 /*@}*/
349
350 /**
351 * \name Texture object / image functions
352 */
353 /*@{*/
354
355 /**
356 * Called by glBindTexture() and glBindTextures().
357 */
358 void (*BindTexture)( struct gl_context *ctx, GLuint texUnit,
359 GLenum target, struct gl_texture_object *tObj );
360
361 /**
362 * Called to allocate a new texture object. Drivers will usually
363 * allocate/return a subclass of gl_texture_object.
364 */
365 struct gl_texture_object * (*NewTextureObject)(struct gl_context *ctx,
366 GLuint name, GLenum target);
367 /**
368 * Called to delete/free a texture object. Drivers should free the
369 * object and any image data it contains.
370 */
371 void (*DeleteTexture)(struct gl_context *ctx,
372 struct gl_texture_object *texObj);
373
374 /** Called to allocate a new texture image object. */
375 struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
376
377 /** Called to free a texture image object returned by NewTextureImage() */
378 void (*DeleteTextureImage)(struct gl_context *ctx,
379 struct gl_texture_image *);
380
381 /** Called to allocate memory for a single texture image */
382 GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
383 struct gl_texture_image *texImage);
384
385 /** Free the memory for a single texture image */
386 void (*FreeTextureImageBuffer)(struct gl_context *ctx,
387 struct gl_texture_image *texImage);
388
389 /** Map a slice of a texture image into user space.
390 * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
391 * indicates the 1D array index.
392 * \param texImage the texture image
393 * \param slice the 3D image slice or array texture slice
394 * \param x, y, w, h region of interest
395 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
396 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
397 * \param mapOut returns start of mapping of region of interest
398 * \param rowStrideOut returns row stride (in bytes). In the case of a
399 * compressed texture, this is the byte stride between one row of blocks
400 * and another.
401 */
402 void (*MapTextureImage)(struct gl_context *ctx,
403 struct gl_texture_image *texImage,
404 GLuint slice,
405 GLuint x, GLuint y, GLuint w, GLuint h,
406 GLbitfield mode,
407 GLubyte **mapOut, GLint *rowStrideOut);
408
409 void (*UnmapTextureImage)(struct gl_context *ctx,
410 struct gl_texture_image *texImage,
411 GLuint slice);
412
413 /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack.
414 * All the gl_texture_images in the texture object will have their
415 * dimensions, format, etc. initialized already.
416 */
417 GLboolean (*AllocTextureStorage)(struct gl_context *ctx,
418 struct gl_texture_object *texObj,
419 GLsizei levels, GLsizei width,
420 GLsizei height, GLsizei depth);
421
422 /** Called as part of glTextureView to add views to origTexObj */
423 GLboolean (*TextureView)(struct gl_context *ctx,
424 struct gl_texture_object *texObj,
425 struct gl_texture_object *origTexObj);
426
427 /**
428 * Map a renderbuffer into user space.
429 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
430 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
431 */
432 void (*MapRenderbuffer)(struct gl_context *ctx,
433 struct gl_renderbuffer *rb,
434 GLuint x, GLuint y, GLuint w, GLuint h,
435 GLbitfield mode,
436 GLubyte **mapOut, GLint *rowStrideOut,
437 bool flip_y);
438
439 void (*UnmapRenderbuffer)(struct gl_context *ctx,
440 struct gl_renderbuffer *rb);
441
442 /**
443 * Optional driver entrypoint that binds a non-texture renderbuffer's
444 * contents to a texture image.
445 */
446 GLboolean (*BindRenderbufferTexImage)(struct gl_context *ctx,
447 struct gl_renderbuffer *rb,
448 struct gl_texture_image *texImage);
449 /*@}*/
450
451
452 /**
453 * \name Vertex/fragment program functions
454 */
455 /*@{*/
456 /** Allocate a new program */
457 struct gl_program * (*NewProgram)(struct gl_context *ctx,
458 gl_shader_stage stage,
459 GLuint id, bool is_arb_asm);
460 /** Delete a program */
461 void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
462 /**
463 * Allocate a program to associate with the new ATI fragment shader (optional)
464 */
465 struct gl_program * (*NewATIfs)(struct gl_context *ctx,
466 struct ati_fragment_shader *curProg);
467 /**
468 * Notify driver that a program string (and GPU code) has been specified
469 * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is
470 * supported by the driver.
471 */
472 GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
473 struct gl_program *prog);
474
475 /**
476 * Notify driver that the sampler uniforms for the current program have
477 * changed. On some drivers, this may require shader recompiles.
478 */
479 void (*SamplerUniformChange)(struct gl_context *ctx, GLenum target,
480 struct gl_program *prog);
481
482 /** Query if program can be loaded onto hardware */
483 GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
484 struct gl_program *prog);
485
486 /*@}*/
487
488 /**
489 * \name GLSL shader/program functions.
490 */
491 /*@{*/
492 /**
493 * Called when a shader program is linked.
494 *
495 * This gives drivers an opportunity to clone the IR and make their
496 * own transformations on it for the purposes of code generation.
497 */
498 GLboolean (*LinkShader)(struct gl_context *ctx,
499 struct gl_shader_program *shader);
500 /*@}*/
501
502
503 /**
504 * \name Draw functions.
505 */
506 /*@{*/
507 /**
508 * For indirect array drawing:
509 *
510 * typedef struct {
511 * GLuint count;
512 * GLuint primCount;
513 * GLuint first;
514 * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
515 * } DrawArraysIndirectCommand;
516 *
517 * For indirect indexed drawing:
518 *
519 * typedef struct {
520 * GLuint count;
521 * GLuint primCount;
522 * GLuint firstIndex;
523 * GLint baseVertex;
524 * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
525 * } DrawElementsIndirectCommand;
526 */
527
528 /**
529 * Draw a number of primitives.
530 * \param prims array [nr_prims] describing what to draw (prim type,
531 * vertex count, first index, instance count, etc).
532 * \param ib index buffer for indexed drawing, NULL for array drawing
533 * \param index_bounds_valid are min_index and max_index valid?
534 * \param min_index lowest vertex index used
535 * \param max_index highest vertex index used
536 * \param num_instances instance count from ARB_draw_instanced
537 * \param base_instance base instance from ARB_base_instance
538 * \param tfb_vertcount if non-null, indicates which transform feedback
539 * object has the vertex count.
540 * \param tfb_stream If called via DrawTransformFeedbackStream, specifies
541 * the vertex stream buffer from which to get the vertex
542 * count.
543 * \param indirect If any prims are indirect, this specifies the buffer
544 * to find the "DrawArrays/ElementsIndirectCommand" data.
545 * This may be deprecated in the future
546 */
547 void (*Draw)(struct gl_context *ctx,
548 const struct _mesa_prim *prims, GLuint nr_prims,
549 const struct _mesa_index_buffer *ib,
550 GLboolean index_bounds_valid,
551 GLuint min_index, GLuint max_index,
552 GLuint num_instances, GLuint base_instance,
553 struct gl_transform_feedback_object *tfb_vertcount,
554 unsigned tfb_stream);
555
556
557 /**
558 * Draw a primitive, getting the vertex count, instance count, start
559 * vertex, etc. from a buffer object.
560 * \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
561 * \param indirect_data buffer to get "DrawArrays/ElementsIndirectCommand"
562 * data
563 * \param indirect_offset offset of first primitive in indrect_data buffer
564 * \param draw_count number of primitives to draw
565 * \param stride stride, in bytes, between
566 * "DrawArrays/ElementsIndirectCommand" objects
567 * \param indirect_draw_count_buffer if non-NULL specifies a buffer to get
568 * the real draw_count value. Used for
569 * GL_ARB_indirect_parameters.
570 * \param indirect_draw_count_offset offset to the draw_count value in
571 * indirect_draw_count_buffer
572 * \param ib index buffer for indexed drawing, NULL otherwise.
573 */
574 void (*DrawIndirect)(struct gl_context *ctx, GLuint mode,
575 struct gl_buffer_object *indirect_data,
576 GLsizeiptr indirect_offset, unsigned draw_count,
577 unsigned stride,
578 struct gl_buffer_object *indirect_draw_count_buffer,
579 GLsizeiptr indirect_draw_count_offset,
580 const struct _mesa_index_buffer *ib);
581 /*@}*/
582
583
584 /**
585 * \name State-changing functions.
586 *
587 * \note drawing functions are above.
588 *
589 * These functions are called by their corresponding OpenGL API functions.
590 * They are \e also called by the gl_PopAttrib() function!!!
591 * May add more functions like these to the device driver in the future.
592 */
593 /*@{*/
594 /** Specify the alpha test function */
595 void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
596 /** Set the blend color */
597 void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
598 /** Set the blend equation */
599 void (*BlendEquationSeparate)(struct gl_context *ctx,
600 GLenum modeRGB, GLenum modeA);
601 /** Specify pixel arithmetic */
602 void (*BlendFuncSeparate)(struct gl_context *ctx,
603 GLenum sfactorRGB, GLenum dfactorRGB,
604 GLenum sfactorA, GLenum dfactorA);
605 /** Specify a plane against which all geometry is clipped */
606 void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *eq);
607 /** Enable and disable writing of frame buffer color components */
608 void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
609 GLboolean bmask, GLboolean amask );
610 /** Cause a material color to track the current color */
611 void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
612 /** Specify whether front- or back-facing facets can be culled */
613 void (*CullFace)(struct gl_context *ctx, GLenum mode);
614 /** Define front- and back-facing polygons */
615 void (*FrontFace)(struct gl_context *ctx, GLenum mode);
616 /** Specify the value used for depth buffer comparisons */
617 void (*DepthFunc)(struct gl_context *ctx, GLenum func);
618 /** Enable or disable writing into the depth buffer */
619 void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
620 /** Specify mapping of depth values from NDC to window coordinates */
621 void (*DepthRange)(struct gl_context *ctx);
622 /** Specify the current buffer for writing */
623 void (*DrawBuffer)(struct gl_context *ctx);
624 /** Used to allocated any buffers with on-demand creation */
625 void (*DrawBufferAllocate)(struct gl_context *ctx);
626 /** Enable or disable server-side gl capabilities */
627 void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
628 /** Specify fog parameters */
629 void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
630 /** Set light source parameters.
631 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
632 * been transformed to eye-space.
633 */
634 void (*Lightfv)(struct gl_context *ctx, GLenum light,
635 GLenum pname, const GLfloat *params );
636 /** Set the lighting model parameters */
637 void (*LightModelfv)(struct gl_context *ctx, GLenum pname,
638 const GLfloat *params);
639 /** Specify the line stipple pattern */
640 void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
641 /** Specify the width of rasterized lines */
642 void (*LineWidth)(struct gl_context *ctx, GLfloat width);
643 /** Specify a logical pixel operation for color index rendering */
644 void (*LogicOpcode)(struct gl_context *ctx, enum gl_logicop_mode opcode);
645 void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
646 const GLfloat *params);
647 /** Specify the diameter of rasterized points */
648 void (*PointSize)(struct gl_context *ctx, GLfloat size);
649 /** Select a polygon rasterization mode */
650 void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
651 /** Set the scale and units used to calculate depth values */
652 void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units, GLfloat clamp);
653 /** Set the polygon stippling pattern */
654 void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
655 /* Specifies the current buffer for reading */
656 void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
657 /** Set rasterization mode */
658 void (*RenderMode)(struct gl_context *ctx, GLenum mode );
659 /** Define the scissor box */
660 void (*Scissor)(struct gl_context *ctx);
661 /** Select flat or smooth shading */
662 void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
663 /** OpenGL 2.0 two-sided StencilFunc */
664 void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
665 GLint ref, GLuint mask);
666 /** OpenGL 2.0 two-sided StencilMask */
667 void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
668 /** OpenGL 2.0 two-sided StencilOp */
669 void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
670 GLenum zfail, GLenum zpass);
671 /** Control the generation of texture coordinates */
672 void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
673 const GLfloat *params);
674 /** Set texture environment parameters */
675 void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
676 const GLfloat *param);
677 /** Set texture parameter (callee gets param value from the texObj) */
678 void (*TexParameter)(struct gl_context *ctx,
679 struct gl_texture_object *texObj, GLenum pname);
680 /** Set the viewport */
681 void (*Viewport)(struct gl_context *ctx);
682 /*@}*/
683
684
685 /**
686 * \name Vertex/pixel buffer object functions
687 */
688 /*@{*/
689 struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx,
690 GLuint buffer);
691
692 void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
693
694 GLboolean (*BufferData)(struct gl_context *ctx, GLenum target,
695 GLsizeiptrARB size, const GLvoid *data, GLenum usage,
696 GLenum storageFlags, struct gl_buffer_object *obj);
697
698 void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset,
699 GLsizeiptrARB size, const GLvoid *data,
700 struct gl_buffer_object *obj );
701
702 void (*GetBufferSubData)( struct gl_context *ctx,
703 GLintptrARB offset, GLsizeiptrARB size,
704 GLvoid *data, struct gl_buffer_object *obj );
705
706 void (*ClearBufferSubData)( struct gl_context *ctx,
707 GLintptr offset, GLsizeiptr size,
708 const GLvoid *clearValue,
709 GLsizeiptr clearValueSize,
710 struct gl_buffer_object *obj );
711
712 void (*CopyBufferSubData)( struct gl_context *ctx,
713 struct gl_buffer_object *src,
714 struct gl_buffer_object *dst,
715 GLintptr readOffset, GLintptr writeOffset,
716 GLsizeiptr size );
717
718 void (*InvalidateBufferSubData)( struct gl_context *ctx,
719 struct gl_buffer_object *obj,
720 GLintptr offset,
721 GLsizeiptr length );
722
723 /* Returns pointer to the start of the mapped range.
724 * May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
725 */
726 void * (*MapBufferRange)( struct gl_context *ctx, GLintptr offset,
727 GLsizeiptr length, GLbitfield access,
728 struct gl_buffer_object *obj,
729 gl_map_buffer_index index);
730
731 void (*FlushMappedBufferRange)(struct gl_context *ctx,
732 GLintptr offset, GLsizeiptr length,
733 struct gl_buffer_object *obj,
734 gl_map_buffer_index index);
735
736 GLboolean (*UnmapBuffer)( struct gl_context *ctx,
737 struct gl_buffer_object *obj,
738 gl_map_buffer_index index);
739 /*@}*/
740
741 /**
742 * \name Functions for GL_APPLE_object_purgeable
743 */
744 /*@{*/
745 /* variations on ObjectPurgeable */
746 GLenum (*BufferObjectPurgeable)(struct gl_context *ctx,
747 struct gl_buffer_object *obj, GLenum option);
748 GLenum (*RenderObjectPurgeable)(struct gl_context *ctx,
749 struct gl_renderbuffer *obj, GLenum option);
750 GLenum (*TextureObjectPurgeable)(struct gl_context *ctx,
751 struct gl_texture_object *obj,
752 GLenum option);
753
754 /* variations on ObjectUnpurgeable */
755 GLenum (*BufferObjectUnpurgeable)(struct gl_context *ctx,
756 struct gl_buffer_object *obj,
757 GLenum option);
758 GLenum (*RenderObjectUnpurgeable)(struct gl_context *ctx,
759 struct gl_renderbuffer *obj,
760 GLenum option);
761 GLenum (*TextureObjectUnpurgeable)(struct gl_context *ctx,
762 struct gl_texture_object *obj,
763 GLenum option);
764 /*@}*/
765
766 /**
767 * \name Functions for GL_EXT_framebuffer_{object,blit,discard}.
768 */
769 /*@{*/
770 struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx,
771 GLuint name);
772 struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx,
773 GLuint name);
774 void (*BindFramebuffer)(struct gl_context *ctx, GLenum target,
775 struct gl_framebuffer *drawFb,
776 struct gl_framebuffer *readFb);
777 void (*FramebufferRenderbuffer)(struct gl_context *ctx,
778 struct gl_framebuffer *fb,
779 GLenum attachment,
780 struct gl_renderbuffer *rb);
781 void (*RenderTexture)(struct gl_context *ctx,
782 struct gl_framebuffer *fb,
783 struct gl_renderbuffer_attachment *att);
784 void (*FinishRenderTexture)(struct gl_context *ctx,
785 struct gl_renderbuffer *rb);
786 void (*ValidateFramebuffer)(struct gl_context *ctx,
787 struct gl_framebuffer *fb);
788 /*@}*/
789 void (*BlitFramebuffer)(struct gl_context *ctx,
790 struct gl_framebuffer *readFb,
791 struct gl_framebuffer *drawFb,
792 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
793 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
794 GLbitfield mask, GLenum filter);
795 void (*DiscardFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb,
796 struct gl_renderbuffer_attachment *att);
797
798 /**
799 * \name Functions for GL_ARB_sample_locations
800 */
801 void (*GetProgrammableSampleCaps)(struct gl_context *ctx,
802 const struct gl_framebuffer *fb,
803 GLuint *bits, GLuint *width, GLuint *height);
804 void (*EvaluateDepthValues)(struct gl_context *ctx);
805
806 /**
807 * \name Query objects
808 */
809 /*@{*/
810 struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id);
811 void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q);
812 void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q);
813 void (*QueryCounter)(struct gl_context *ctx, struct gl_query_object *q);
814 void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q);
815 void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q);
816 void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q);
817 /*
818 * \pname the value requested to be written (GL_QUERY_RESULT, etc)
819 * \ptype the type of the value requested to be written:
820 * GL_UNSIGNED_INT, GL_UNSIGNED_INT64_ARB,
821 * GL_INT, GL_INT64_ARB
822 */
823 void (*StoreQueryResult)(struct gl_context *ctx, struct gl_query_object *q,
824 struct gl_buffer_object *buf, intptr_t offset,
825 GLenum pname, GLenum ptype);
826 /*@}*/
827
828 /**
829 * \name Performance monitors
830 */
831 /*@{*/
832 void (*InitPerfMonitorGroups)(struct gl_context *ctx);
833 struct gl_perf_monitor_object * (*NewPerfMonitor)(struct gl_context *ctx);
834 void (*DeletePerfMonitor)(struct gl_context *ctx,
835 struct gl_perf_monitor_object *m);
836 GLboolean (*BeginPerfMonitor)(struct gl_context *ctx,
837 struct gl_perf_monitor_object *m);
838
839 /** Stop an active performance monitor, discarding results. */
840 void (*ResetPerfMonitor)(struct gl_context *ctx,
841 struct gl_perf_monitor_object *m);
842 void (*EndPerfMonitor)(struct gl_context *ctx,
843 struct gl_perf_monitor_object *m);
844 GLboolean (*IsPerfMonitorResultAvailable)(struct gl_context *ctx,
845 struct gl_perf_monitor_object *m);
846 void (*GetPerfMonitorResult)(struct gl_context *ctx,
847 struct gl_perf_monitor_object *m,
848 GLsizei dataSize,
849 GLuint *data,
850 GLint *bytesWritten);
851 /*@}*/
852
853 /**
854 * \name Performance Query objects
855 */
856 /*@{*/
857 unsigned (*InitPerfQueryInfo)(struct gl_context *ctx);
858 void (*GetPerfQueryInfo)(struct gl_context *ctx,
859 unsigned queryIndex,
860 const char **name,
861 GLuint *dataSize,
862 GLuint *numCounters,
863 GLuint *numActive);
864 void (*GetPerfCounterInfo)(struct gl_context *ctx,
865 unsigned queryIndex,
866 unsigned counterIndex,
867 const char **name,
868 const char **desc,
869 GLuint *offset,
870 GLuint *data_size,
871 GLuint *type_enum,
872 GLuint *data_type_enum,
873 GLuint64 *raw_max);
874 struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context *ctx,
875 unsigned queryIndex);
876 void (*DeletePerfQuery)(struct gl_context *ctx,
877 struct gl_perf_query_object *obj);
878 bool (*BeginPerfQuery)(struct gl_context *ctx,
879 struct gl_perf_query_object *obj);
880 void (*EndPerfQuery)(struct gl_context *ctx,
881 struct gl_perf_query_object *obj);
882 void (*WaitPerfQuery)(struct gl_context *ctx,
883 struct gl_perf_query_object *obj);
884 bool (*IsPerfQueryReady)(struct gl_context *ctx,
885 struct gl_perf_query_object *obj);
886 void (*GetPerfQueryData)(struct gl_context *ctx,
887 struct gl_perf_query_object *obj,
888 GLsizei dataSize,
889 GLuint *data,
890 GLuint *bytesWritten);
891 /*@}*/
892
893
894 /**
895 * \name GREMEDY debug/marker functions
896 */
897 /*@{*/
898 void (*EmitStringMarker)(struct gl_context *ctx, const GLchar *string, GLsizei len);
899 /*@}*/
900
901 /**
902 * \name Support for multiple T&L engines
903 */
904 /*@{*/
905
906 /**
907 * Set by the driver-supplied T&L engine.
908 *
909 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
910 */
911 GLuint CurrentExecPrimitive;
912
913 /**
914 * Current glBegin state of an in-progress compilation. May be
915 * GL_POINTS, GL_TRIANGLE_STRIP, etc. or PRIM_OUTSIDE_BEGIN_END
916 * or PRIM_UNKNOWN.
917 */
918 GLuint CurrentSavePrimitive;
919
920
921 #define FLUSH_STORED_VERTICES 0x1
922 #define FLUSH_UPDATE_CURRENT 0x2
923 /**
924 * Set by the driver-supplied T&L engine whenever vertices are buffered
925 * between glBegin()/glEnd() objects or __struct gl_contextRec::Current
926 * is not updated. A bitmask of the FLUSH_x values above.
927 *
928 * The dd_function_table::FlushVertices call below may be used to resolve
929 * these conditions.
930 */
931 GLbitfield NeedFlush;
932
933 /** Need to call vbo_save_SaveFlushVertices() upon state change? */
934 GLboolean SaveNeedFlush;
935
936 /**
937 * Notify driver that the special derived value _NeedEyeCoords has
938 * changed.
939 */
940 void (*LightingSpaceChange)( struct gl_context *ctx );
941
942 /**@}*/
943
944 /**
945 * \name GL_ARB_sync interfaces
946 */
947 /*@{*/
948 struct gl_sync_object * (*NewSyncObject)(struct gl_context *);
949 void (*FenceSync)(struct gl_context *, struct gl_sync_object *,
950 GLenum, GLbitfield);
951 void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
952 void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
953 void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
954 GLbitfield, GLuint64);
955 void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
956 GLbitfield, GLuint64);
957 /*@}*/
958
959 /** GL_NV_conditional_render */
960 void (*BeginConditionalRender)(struct gl_context *ctx,
961 struct gl_query_object *q,
962 GLenum mode);
963 void (*EndConditionalRender)(struct gl_context *ctx,
964 struct gl_query_object *q);
965
966 /**
967 * \name GL_OES_draw_texture interface
968 */
969 /*@{*/
970 void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
971 GLfloat width, GLfloat height);
972 /*@}*/
973
974 /**
975 * \name GL_OES_EGL_image interface
976 */
977 void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
978 struct gl_texture_object *texObj,
979 struct gl_texture_image *texImage,
980 GLeglImageOES image_handle);
981 void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
982 struct gl_renderbuffer *rb,
983 void *image_handle);
984
985 /**
986 * \name GL_EXT_EGL_image_storage interface
987 */
988 void (*EGLImageTargetTexStorage)(struct gl_context *ctx, GLenum target,
989 struct gl_texture_object *texObj,
990 struct gl_texture_image *texImage,
991 GLeglImageOES image_handle);
992 /**
993 * \name GL_EXT_transform_feedback interface
994 */
995 struct gl_transform_feedback_object *
996 (*NewTransformFeedback)(struct gl_context *ctx, GLuint name);
997 void (*DeleteTransformFeedback)(struct gl_context *ctx,
998 struct gl_transform_feedback_object *obj);
999 void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode,
1000 struct gl_transform_feedback_object *obj);
1001 void (*EndTransformFeedback)(struct gl_context *ctx,
1002 struct gl_transform_feedback_object *obj);
1003 void (*PauseTransformFeedback)(struct gl_context *ctx,
1004 struct gl_transform_feedback_object *obj);
1005 void (*ResumeTransformFeedback)(struct gl_context *ctx,
1006 struct gl_transform_feedback_object *obj);
1007
1008 /**
1009 * Return the number of vertices written to a stream during the last
1010 * Begin/EndTransformFeedback block.
1011 */
1012 GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx,
1013 struct gl_transform_feedback_object *obj,
1014 GLuint stream);
1015
1016 /**
1017 * \name GL_NV_texture_barrier interface
1018 */
1019 void (*TextureBarrier)(struct gl_context *ctx);
1020
1021 /**
1022 * \name GL_ARB_sampler_objects
1023 */
1024 struct gl_sampler_object * (*NewSamplerObject)(struct gl_context *ctx,
1025 GLuint name);
1026
1027 /**
1028 * \name Return a timestamp in nanoseconds as defined by GL_ARB_timer_query.
1029 * This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
1030 */
1031 uint64_t (*GetTimestamp)(struct gl_context *ctx);
1032
1033 /**
1034 * \name GL_ARB_texture_multisample
1035 */
1036 void (*GetSamplePosition)(struct gl_context *ctx,
1037 struct gl_framebuffer *fb,
1038 GLuint index,
1039 GLfloat *outValue);
1040
1041 /**
1042 * \name NV_vdpau_interop interface
1043 */
1044 void (*VDPAUMapSurface)(struct gl_context *ctx, GLenum target,
1045 GLenum access, GLboolean output,
1046 struct gl_texture_object *texObj,
1047 struct gl_texture_image *texImage,
1048 const GLvoid *vdpSurface, GLuint index);
1049 void (*VDPAUUnmapSurface)(struct gl_context *ctx, GLenum target,
1050 GLenum access, GLboolean output,
1051 struct gl_texture_object *texObj,
1052 struct gl_texture_image *texImage,
1053 const GLvoid *vdpSurface, GLuint index);
1054
1055 /**
1056 * Query reset status for GL_ARB_robustness
1057 *
1058 * Per \c glGetGraphicsResetStatusARB, this function should return a
1059 * non-zero value once after a reset. If a reset is non-atomic, the
1060 * non-zero status should be returned for the duration of the reset.
1061 */
1062 GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx);
1063
1064 /**
1065 * \name GL_ARB_shader_image_load_store interface.
1066 */
1067 /** @{ */
1068 void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
1069 /** @} */
1070
1071 /**
1072 * GL_EXT_shader_framebuffer_fetch_non_coherent rendering barrier.
1073 *
1074 * On return from this function any framebuffer contents written by
1075 * previous draw commands are guaranteed to be visible from subsequent
1076 * fragment shader invocations using the
1077 * EXT_shader_framebuffer_fetch_non_coherent interface.
1078 */
1079 /** @{ */
1080 void (*FramebufferFetchBarrier)(struct gl_context *ctx);
1081 /** @} */
1082
1083 /**
1084 * \name GL_ARB_compute_shader interface
1085 */
1086 /*@{*/
1087 void (*DispatchCompute)(struct gl_context *ctx, const GLuint *num_groups);
1088 void (*DispatchComputeIndirect)(struct gl_context *ctx, GLintptr indirect);
1089 /*@}*/
1090
1091 /**
1092 * \name GL_ARB_compute_variable_group_size interface
1093 */
1094 /*@{*/
1095 void (*DispatchComputeGroupSize)(struct gl_context *ctx,
1096 const GLuint *num_groups,
1097 const GLuint *group_size);
1098 /*@}*/
1099
1100 /**
1101 * Query information about memory. Device memory is e.g. VRAM. Staging
1102 * memory is e.g. GART. All sizes are in kilobytes.
1103 */
1104 void (*QueryMemoryInfo)(struct gl_context *ctx,
1105 struct gl_memory_info *info);
1106
1107 /**
1108 * Indicate that this thread is being used by Mesa as a background drawing
1109 * thread for the given GL context.
1110 *
1111 * If this function is called more than once from any given thread, each
1112 * subsequent call overrides the context that was passed in the previous
1113 * call. Mesa takes advantage of this to re-use a background thread to
1114 * perform drawing on behalf of multiple contexts.
1115 *
1116 * Mesa may sometimes call this function from a non-background thread
1117 * (i.e. a thread that has already been bound to a context using
1118 * __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to
1119 * the context that is bound to this thread.
1120 *
1121 * Mesa will only call this function if GL multithreading is enabled.
1122 */
1123 void (*SetBackgroundContext)(struct gl_context *ctx,
1124 struct util_queue_monitoring *queue_info);
1125
1126 /**
1127 * \name GL_ARB_sparse_buffer interface
1128 */
1129 /*@{*/
1130 void (*BufferPageCommitment)(struct gl_context *ctx,
1131 struct gl_buffer_object *bufferObj,
1132 GLintptr offset, GLsizeiptr size,
1133 GLboolean commit);
1134 /*@}*/
1135
1136 /**
1137 * \name GL_ARB_bindless_texture interface
1138 */
1139 /*@{*/
1140 GLuint64 (*NewTextureHandle)(struct gl_context *ctx,
1141 struct gl_texture_object *texObj,
1142 struct gl_sampler_object *sampObj);
1143 void (*DeleteTextureHandle)(struct gl_context *ctx, GLuint64 handle);
1144 void (*MakeTextureHandleResident)(struct gl_context *ctx, GLuint64 handle,
1145 bool resident);
1146 GLuint64 (*NewImageHandle)(struct gl_context *ctx,
1147 struct gl_image_unit *imgObj);
1148 void (*DeleteImageHandle)(struct gl_context *ctx, GLuint64 handle);
1149 void (*MakeImageHandleResident)(struct gl_context *ctx, GLuint64 handle,
1150 GLenum access, bool resident);
1151 /*@}*/
1152
1153
1154 /**
1155 * \name GL_EXT_external_objects interface
1156 */
1157 /*@{*/
1158 /**
1159 * Called to allocate a new memory object. Drivers will usually
1160 * allocate/return a subclass of gl_memory_object.
1161 */
1162 struct gl_memory_object * (*NewMemoryObject)(struct gl_context *ctx,
1163 GLuint name);
1164 /**
1165 * Called to delete/free a memory object. Drivers should free the
1166 * object and any image data it contains.
1167 */
1168 void (*DeleteMemoryObject)(struct gl_context *ctx,
1169 struct gl_memory_object *memObj);
1170
1171 /**
1172 * Set the given memory object as the texture's storage.
1173 */
1174 GLboolean (*SetTextureStorageForMemoryObject)(struct gl_context *ctx,
1175 struct gl_texture_object *tex_obj,
1176 struct gl_memory_object *mem_obj,
1177 GLsizei levels, GLsizei width,
1178 GLsizei height, GLsizei depth,
1179 GLuint64 offset);
1180
1181 /**
1182 * Use a memory object as the backing data for a buffer object
1183 */
1184 GLboolean (*BufferDataMem)(struct gl_context *ctx,
1185 GLenum target,
1186 GLsizeiptrARB size,
1187 struct gl_memory_object *memObj,
1188 GLuint64 offset,
1189 GLenum usage,
1190 struct gl_buffer_object *bufObj);
1191
1192 /**
1193 * Fill uuid with an unique identifier for this driver
1194 *
1195 * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1196 */
1197 void (*GetDriverUuid)(struct gl_context *ctx, char *uuid);
1198
1199 /**
1200 * Fill uuid with an unique identifier for the device associated
1201 * to this driver
1202 *
1203 * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1204 */
1205 void (*GetDeviceUuid)(struct gl_context *ctx, char *uuid);
1206
1207 /*@}*/
1208
1209 /**
1210 * \name GL_EXT_external_objects_fd interface
1211 */
1212 /*@{*/
1213 /**
1214 * Called to import a memory object. The caller relinquishes ownership
1215 * of fd after the call returns.
1216 *
1217 * Accessing fd after ImportMemoryObjectFd returns results in undefined
1218 * behaviour. This is consistent with EXT_external_object_fd.
1219 */
1220 void (*ImportMemoryObjectFd)(struct gl_context *ctx,
1221 struct gl_memory_object *memObj,
1222 GLuint64 size,
1223 int fd);
1224 /*@}*/
1225
1226 /**
1227 * \name GL_ARB_get_program_binary
1228 */
1229 /*@{*/
1230 /**
1231 * Calls to retrieve/store a binary serialized copy of the current program.
1232 */
1233 void (*GetProgramBinaryDriverSHA1)(struct gl_context *ctx, uint8_t *sha1);
1234
1235 void (*ProgramBinarySerializeDriverBlob)(struct gl_context *ctx,
1236 struct gl_shader_program *shProg,
1237 struct gl_program *prog);
1238
1239 void (*ProgramBinaryDeserializeDriverBlob)(struct gl_context *ctx,
1240 struct gl_shader_program *shProg,
1241 struct gl_program *prog);
1242 /*@}*/
1243
1244 /**
1245 * \name GL_EXT_semaphore interface
1246 */
1247 /*@{*/
1248 /**
1249 * Called to allocate a new semaphore object. Drivers will usually
1250 * allocate/return a subclass of gl_semaphore_object.
1251 */
1252 struct gl_semaphore_object * (*NewSemaphoreObject)(struct gl_context *ctx,
1253 GLuint name);
1254 /**
1255 * Called to delete/free a semaphore object. Drivers should free the
1256 * object and any associated resources.
1257 */
1258 void (*DeleteSemaphoreObject)(struct gl_context *ctx,
1259 struct gl_semaphore_object *semObj);
1260
1261 /**
1262 * Introduce an operation to wait for the semaphore object in the GL
1263 * server's command stream
1264 */
1265 void (*ServerWaitSemaphoreObject)(struct gl_context *ctx,
1266 struct gl_semaphore_object *semObj,
1267 GLuint numBufferBarriers,
1268 struct gl_buffer_object **bufObjs,
1269 GLuint numTextureBarriers,
1270 struct gl_texture_object **texObjs,
1271 const GLenum *srcLayouts);
1272
1273 /**
1274 * Introduce an operation to signal the semaphore object in the GL
1275 * server's command stream
1276 */
1277 void (*ServerSignalSemaphoreObject)(struct gl_context *ctx,
1278 struct gl_semaphore_object *semObj,
1279 GLuint numBufferBarriers,
1280 struct gl_buffer_object **bufObjs,
1281 GLuint numTextureBarriers,
1282 struct gl_texture_object **texObjs,
1283 const GLenum *dstLayouts);
1284 /*@}*/
1285
1286 /**
1287 * \name GL_EXT_semaphore_fd interface
1288 */
1289 /*@{*/
1290 /**
1291 * Called to import a semaphore object. The caller relinquishes ownership
1292 * of fd after the call returns.
1293 *
1294 * Accessing fd after ImportSemaphoreFd returns results in undefined
1295 * behaviour. This is consistent with EXT_semaphore_fd.
1296 */
1297 void (*ImportSemaphoreFd)(struct gl_context *ctx,
1298 struct gl_semaphore_object *semObj,
1299 int fd);
1300 /*@}*/
1301
1302 /**
1303 * \name Disk shader cache functions
1304 */
1305 /*@{*/
1306 /**
1307 * Called to initialize gl_program::driver_cache_blob (and size) with a
1308 * ralloc allocated buffer.
1309 *
1310 * This buffer will be saved and restored as part of the gl_program
1311 * serialization and deserialization.
1312 */
1313 void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
1314 struct gl_program *prog);
1315 /*@}*/
1316
1317 /**
1318 * \name Set the number of compiler threads for ARB_parallel_shader_compile
1319 */
1320 void (*SetMaxShaderCompilerThreads)(struct gl_context *ctx, unsigned count);
1321 bool (*GetShaderProgramCompletionStatus)(struct gl_context *ctx,
1322 struct gl_shader_program *shprog);
1323 };
1324
1325
1326 /**
1327 * Per-vertex functions.
1328 *
1329 * These are the functions which can appear between glBegin and glEnd.
1330 * Depending on whether we're inside or outside a glBegin/End pair
1331 * and whether we're in immediate mode or building a display list, these
1332 * functions behave differently. This structure allows us to switch
1333 * between those modes more easily.
1334 *
1335 * Generally, these pointers point to functions in the VBO module.
1336 */
1337 typedef struct {
1338 void (GLAPIENTRYP ArrayElement)( GLint );
1339 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
1340 void (GLAPIENTRYP Color3fv)( const GLfloat * );
1341 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1342 void (GLAPIENTRYP Color4fv)( const GLfloat * );
1343 void (GLAPIENTRYP EdgeFlag)( GLboolean );
1344 void (GLAPIENTRYP EvalCoord1f)( GLfloat );
1345 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * );
1346 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat );
1347 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * );
1348 void (GLAPIENTRYP EvalPoint1)( GLint );
1349 void (GLAPIENTRYP EvalPoint2)( GLint, GLint );
1350 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
1351 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
1352 void (GLAPIENTRYP Indexf)( GLfloat );
1353 void (GLAPIENTRYP Indexfv)( const GLfloat * );
1354 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * );
1355 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
1356 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
1357 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
1358 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
1359 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
1360 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
1361 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
1362 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
1363 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
1364 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
1365 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
1366 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
1367 void (GLAPIENTRYP TexCoord1f)( GLfloat );
1368 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
1369 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
1370 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
1371 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
1372 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
1373 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1374 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
1375 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
1376 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
1377 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
1378 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
1379 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1380 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
1381 void (GLAPIENTRYP CallList)( GLuint );
1382 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
1383 void (GLAPIENTRYP Begin)( GLenum );
1384 void (GLAPIENTRYP End)( void );
1385 void (GLAPIENTRYP PrimitiveRestartNV)( void );
1386 /* Originally for GL_NV_vertex_program, now used only dlist.c and friends */
1387 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
1388 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
1389 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
1390 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
1391 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1392 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
1393 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1394 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
1395 /* GL_ARB_vertex_program */
1396 void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
1397 void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
1398 void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
1399 void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
1400 void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1401 void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
1402 void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1403 void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
1404
1405 /* GL_EXT_gpu_shader4 / GL 3.0 */
1406 void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x);
1407 void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y);
1408 void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z);
1409 void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w);
1410 void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v);
1411 void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v);
1412 void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v);
1413
1414 void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x);
1415 void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y);
1416 void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z);
1417 void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1418 void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v);
1419 void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v);
1420 void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v);
1421
1422 /* GL_ARB_vertex_type_10_10_10_2_rev / GL3.3 */
1423 void (GLAPIENTRYP VertexP2ui)( GLenum type, GLuint value );
1424 void (GLAPIENTRYP VertexP2uiv)( GLenum type, const GLuint *value);
1425
1426 void (GLAPIENTRYP VertexP3ui)( GLenum type, GLuint value );
1427 void (GLAPIENTRYP VertexP3uiv)( GLenum type, const GLuint *value);
1428
1429 void (GLAPIENTRYP VertexP4ui)( GLenum type, GLuint value );
1430 void (GLAPIENTRYP VertexP4uiv)( GLenum type, const GLuint *value);
1431
1432 void (GLAPIENTRYP TexCoordP1ui)( GLenum type, GLuint coords );
1433 void (GLAPIENTRYP TexCoordP1uiv)( GLenum type, const GLuint *coords );
1434
1435 void (GLAPIENTRYP TexCoordP2ui)( GLenum type, GLuint coords );
1436 void (GLAPIENTRYP TexCoordP2uiv)( GLenum type, const GLuint *coords );
1437
1438 void (GLAPIENTRYP TexCoordP3ui)( GLenum type, GLuint coords );
1439 void (GLAPIENTRYP TexCoordP3uiv)( GLenum type, const GLuint *coords );
1440
1441 void (GLAPIENTRYP TexCoordP4ui)( GLenum type, GLuint coords );
1442 void (GLAPIENTRYP TexCoordP4uiv)( GLenum type, const GLuint *coords );
1443
1444 void (GLAPIENTRYP MultiTexCoordP1ui)( GLenum texture, GLenum type, GLuint coords );
1445 void (GLAPIENTRYP MultiTexCoordP1uiv)( GLenum texture, GLenum type, const GLuint *coords );
1446 void (GLAPIENTRYP MultiTexCoordP2ui)( GLenum texture, GLenum type, GLuint coords );
1447 void (GLAPIENTRYP MultiTexCoordP2uiv)( GLenum texture, GLenum type, const GLuint *coords );
1448 void (GLAPIENTRYP MultiTexCoordP3ui)( GLenum texture, GLenum type, GLuint coords );
1449 void (GLAPIENTRYP MultiTexCoordP3uiv)( GLenum texture, GLenum type, const GLuint *coords );
1450 void (GLAPIENTRYP MultiTexCoordP4ui)( GLenum texture, GLenum type, GLuint coords );
1451 void (GLAPIENTRYP MultiTexCoordP4uiv)( GLenum texture, GLenum type, const GLuint *coords );
1452
1453 void (GLAPIENTRYP NormalP3ui)( GLenum type, GLuint coords );
1454 void (GLAPIENTRYP NormalP3uiv)( GLenum type, const GLuint *coords );
1455
1456 void (GLAPIENTRYP ColorP3ui)( GLenum type, GLuint color );
1457 void (GLAPIENTRYP ColorP3uiv)( GLenum type, const GLuint *color );
1458
1459 void (GLAPIENTRYP ColorP4ui)( GLenum type, GLuint color );
1460 void (GLAPIENTRYP ColorP4uiv)( GLenum type, const GLuint *color );
1461
1462 void (GLAPIENTRYP SecondaryColorP3ui)( GLenum type, GLuint color );
1463 void (GLAPIENTRYP SecondaryColorP3uiv)( GLenum type, const GLuint *color );
1464
1465 void (GLAPIENTRYP VertexAttribP1ui)( GLuint index, GLenum type,
1466 GLboolean normalized, GLuint value);
1467 void (GLAPIENTRYP VertexAttribP2ui)( GLuint index, GLenum type,
1468 GLboolean normalized, GLuint value);
1469 void (GLAPIENTRYP VertexAttribP3ui)( GLuint index, GLenum type,
1470 GLboolean normalized, GLuint value);
1471 void (GLAPIENTRYP VertexAttribP4ui)( GLuint index, GLenum type,
1472 GLboolean normalized, GLuint value);
1473 void (GLAPIENTRYP VertexAttribP1uiv)( GLuint index, GLenum type,
1474 GLboolean normalized,
1475 const GLuint *value);
1476 void (GLAPIENTRYP VertexAttribP2uiv)( GLuint index, GLenum type,
1477 GLboolean normalized,
1478 const GLuint *value);
1479 void (GLAPIENTRYP VertexAttribP3uiv)( GLuint index, GLenum type,
1480 GLboolean normalized,
1481 const GLuint *value);
1482 void (GLAPIENTRYP VertexAttribP4uiv)( GLuint index, GLenum type,
1483 GLboolean normalized,
1484 const GLuint *value);
1485
1486 /* GL_ARB_vertex_attrib_64bit / GL 4.1 */
1487 void (GLAPIENTRYP VertexAttribL1d)( GLuint index, GLdouble x);
1488 void (GLAPIENTRYP VertexAttribL2d)( GLuint index, GLdouble x, GLdouble y);
1489 void (GLAPIENTRYP VertexAttribL3d)( GLuint index, GLdouble x, GLdouble y, GLdouble z);
1490 void (GLAPIENTRYP VertexAttribL4d)( GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1491
1492
1493 void (GLAPIENTRYP VertexAttribL1dv)( GLuint index, const GLdouble *v);
1494 void (GLAPIENTRYP VertexAttribL2dv)( GLuint index, const GLdouble *v);
1495 void (GLAPIENTRYP VertexAttribL3dv)( GLuint index, const GLdouble *v);
1496 void (GLAPIENTRYP VertexAttribL4dv)( GLuint index, const GLdouble *v);
1497
1498 void (GLAPIENTRYP VertexAttribL1ui64ARB)( GLuint index, GLuint64EXT x);
1499 void (GLAPIENTRYP VertexAttribL1ui64vARB)( GLuint index, const GLuint64EXT *v);
1500 } GLvertexformat;
1501
1502
1503 #endif /* DD_INCLUDED */