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