mesa/version: only enable GL4.1 with correct limits.
[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 /**
375 * Called to notify that texture is removed from ctx->Shared->TexObjects
376 */
377 void (*TextureRemovedFromShared)(struct gl_context *ctx,
378 struct gl_texture_object *texObj);
379
380 /** Called to allocate a new texture image object. */
381 struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
382
383 /** Called to free a texture image object returned by NewTextureImage() */
384 void (*DeleteTextureImage)(struct gl_context *ctx,
385 struct gl_texture_image *);
386
387 /** Called to allocate memory for a single texture image */
388 GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
389 struct gl_texture_image *texImage);
390
391 /** Free the memory for a single texture image */
392 void (*FreeTextureImageBuffer)(struct gl_context *ctx,
393 struct gl_texture_image *texImage);
394
395 /** Map a slice of a texture image into user space.
396 * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
397 * indicates the 1D array index.
398 * \param texImage the texture image
399 * \param slice the 3D image slice or array texture slice
400 * \param x, y, w, h region of interest
401 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
402 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
403 * \param mapOut returns start of mapping of region of interest
404 * \param rowStrideOut returns row stride (in bytes). In the case of a
405 * compressed texture, this is the byte stride between one row of blocks
406 * and another.
407 */
408 void (*MapTextureImage)(struct gl_context *ctx,
409 struct gl_texture_image *texImage,
410 GLuint slice,
411 GLuint x, GLuint y, GLuint w, GLuint h,
412 GLbitfield mode,
413 GLubyte **mapOut, GLint *rowStrideOut);
414
415 void (*UnmapTextureImage)(struct gl_context *ctx,
416 struct gl_texture_image *texImage,
417 GLuint slice);
418
419 /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack.
420 * All the gl_texture_images in the texture object will have their
421 * dimensions, format, etc. initialized already.
422 */
423 GLboolean (*AllocTextureStorage)(struct gl_context *ctx,
424 struct gl_texture_object *texObj,
425 GLsizei levels, GLsizei width,
426 GLsizei height, GLsizei depth);
427
428 /** Called as part of glTextureView to add views to origTexObj */
429 GLboolean (*TextureView)(struct gl_context *ctx,
430 struct gl_texture_object *texObj,
431 struct gl_texture_object *origTexObj);
432
433 /**
434 * Map a renderbuffer into user space.
435 * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
436 * GL_MAP_INVALIDATE_RANGE_BIT (if writing)
437 */
438 void (*MapRenderbuffer)(struct gl_context *ctx,
439 struct gl_renderbuffer *rb,
440 GLuint x, GLuint y, GLuint w, GLuint h,
441 GLbitfield mode,
442 GLubyte **mapOut, GLint *rowStrideOut,
443 bool flip_y);
444
445 void (*UnmapRenderbuffer)(struct gl_context *ctx,
446 struct gl_renderbuffer *rb);
447
448 /**
449 * Optional driver entrypoint that binds a non-texture renderbuffer's
450 * contents to a texture image.
451 */
452 GLboolean (*BindRenderbufferTexImage)(struct gl_context *ctx,
453 struct gl_renderbuffer *rb,
454 struct gl_texture_image *texImage);
455 /*@}*/
456
457
458 /**
459 * \name Vertex/fragment program functions
460 */
461 /*@{*/
462 /** Allocate a new program */
463 struct gl_program * (*NewProgram)(struct gl_context *ctx,
464 gl_shader_stage stage,
465 GLuint id, bool is_arb_asm);
466 /** Delete a program */
467 void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
468 /**
469 * Allocate a program to associate with the new ATI fragment shader (optional)
470 */
471 struct gl_program * (*NewATIfs)(struct gl_context *ctx,
472 struct ati_fragment_shader *curProg);
473 /**
474 * Notify driver that a program string (and GPU code) has been specified
475 * or modified. Return GL_TRUE or GL_FALSE to indicate if the program is
476 * supported by the driver.
477 */
478 GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
479 struct gl_program *prog);
480
481 /**
482 * Notify driver that the sampler uniforms for the current program have
483 * changed. On some drivers, this may require shader recompiles.
484 */
485 void (*SamplerUniformChange)(struct gl_context *ctx, GLenum target,
486 struct gl_program *prog);
487
488 /** Query if program can be loaded onto hardware */
489 GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
490 struct gl_program *prog);
491
492 /*@}*/
493
494 /**
495 * \name GLSL shader/program functions.
496 */
497 /*@{*/
498 /**
499 * Called when a shader program is linked.
500 *
501 * This gives drivers an opportunity to clone the IR and make their
502 * own transformations on it for the purposes of code generation.
503 */
504 GLboolean (*LinkShader)(struct gl_context *ctx,
505 struct gl_shader_program *shader);
506 /*@}*/
507
508
509 /**
510 * \name Draw functions.
511 */
512 /*@{*/
513 /**
514 * For indirect array drawing:
515 *
516 * typedef struct {
517 * GLuint count;
518 * GLuint primCount;
519 * GLuint first;
520 * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
521 * } DrawArraysIndirectCommand;
522 *
523 * For indirect indexed drawing:
524 *
525 * typedef struct {
526 * GLuint count;
527 * GLuint primCount;
528 * GLuint firstIndex;
529 * GLint baseVertex;
530 * GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
531 * } DrawElementsIndirectCommand;
532 */
533
534 /**
535 * Draw a number of primitives.
536 * \param prims array [nr_prims] describing what to draw (prim type,
537 * vertex count, first index, instance count, etc).
538 * \param ib index buffer for indexed drawing, NULL for array drawing
539 * \param index_bounds_valid are min_index and max_index valid?
540 * \param min_index lowest vertex index used
541 * \param max_index highest vertex index used
542 * \param num_instances instance count from ARB_draw_instanced
543 * \param base_instance base instance from ARB_base_instance
544 * \param tfb_vertcount if non-null, indicates which transform feedback
545 * object has the vertex count.
546 * \param tfb_stream If called via DrawTransformFeedbackStream, specifies
547 * the vertex stream buffer from which to get the vertex
548 * count.
549 * \param indirect If any prims are indirect, this specifies the buffer
550 * to find the "DrawArrays/ElementsIndirectCommand" data.
551 * This may be deprecated in the future
552 */
553 void (*Draw)(struct gl_context *ctx,
554 const struct _mesa_prim *prims, GLuint nr_prims,
555 const struct _mesa_index_buffer *ib,
556 GLboolean index_bounds_valid,
557 GLuint min_index, GLuint max_index,
558 GLuint num_instances, GLuint base_instance,
559 struct gl_transform_feedback_object *tfb_vertcount,
560 unsigned tfb_stream);
561
562
563 /**
564 * Draw a primitive, getting the vertex count, instance count, start
565 * vertex, etc. from a buffer object.
566 * \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
567 * \param indirect_data buffer to get "DrawArrays/ElementsIndirectCommand"
568 * data
569 * \param indirect_offset offset of first primitive in indrect_data buffer
570 * \param draw_count number of primitives to draw
571 * \param stride stride, in bytes, between
572 * "DrawArrays/ElementsIndirectCommand" objects
573 * \param indirect_draw_count_buffer if non-NULL specifies a buffer to get
574 * the real draw_count value. Used for
575 * GL_ARB_indirect_parameters.
576 * \param indirect_draw_count_offset offset to the draw_count value in
577 * indirect_draw_count_buffer
578 * \param ib index buffer for indexed drawing, NULL otherwise.
579 */
580 void (*DrawIndirect)(struct gl_context *ctx, GLuint mode,
581 struct gl_buffer_object *indirect_data,
582 GLsizeiptr indirect_offset, unsigned draw_count,
583 unsigned stride,
584 struct gl_buffer_object *indirect_draw_count_buffer,
585 GLsizeiptr indirect_draw_count_offset,
586 const struct _mesa_index_buffer *ib);
587 /*@}*/
588
589
590 /**
591 * \name State-changing functions.
592 *
593 * \note drawing functions are above.
594 *
595 * These functions are called by their corresponding OpenGL API functions.
596 * They are \e also called by the gl_PopAttrib() function!!!
597 * May add more functions like these to the device driver in the future.
598 */
599 /*@{*/
600 /** Specify the alpha test function */
601 void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
602 /** Set the blend color */
603 void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
604 /** Set the blend equation */
605 void (*BlendEquationSeparate)(struct gl_context *ctx,
606 GLenum modeRGB, GLenum modeA);
607 /** Specify pixel arithmetic */
608 void (*BlendFuncSeparate)(struct gl_context *ctx,
609 GLenum sfactorRGB, GLenum dfactorRGB,
610 GLenum sfactorA, GLenum dfactorA);
611 /** Specify a plane against which all geometry is clipped */
612 void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *eq);
613 /** Enable and disable writing of frame buffer color components */
614 void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
615 GLboolean bmask, GLboolean amask );
616 /** Cause a material color to track the current color */
617 void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
618 /** Specify whether front- or back-facing facets can be culled */
619 void (*CullFace)(struct gl_context *ctx, GLenum mode);
620 /** Define front- and back-facing polygons */
621 void (*FrontFace)(struct gl_context *ctx, GLenum mode);
622 /** Specify the value used for depth buffer comparisons */
623 void (*DepthFunc)(struct gl_context *ctx, GLenum func);
624 /** Enable or disable writing into the depth buffer */
625 void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
626 /** Specify mapping of depth values from NDC to window coordinates */
627 void (*DepthRange)(struct gl_context *ctx);
628 /** Specify the current buffer for writing */
629 void (*DrawBuffer)(struct gl_context *ctx);
630 /** Used to allocated any buffers with on-demand creation */
631 void (*DrawBufferAllocate)(struct gl_context *ctx);
632 /** Enable or disable server-side gl capabilities */
633 void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
634 /** Specify fog parameters */
635 void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
636 /** Set light source parameters.
637 * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
638 * been transformed to eye-space.
639 */
640 void (*Lightfv)(struct gl_context *ctx, GLenum light,
641 GLenum pname, const GLfloat *params );
642 /** Set the lighting model parameters */
643 void (*LightModelfv)(struct gl_context *ctx, GLenum pname,
644 const GLfloat *params);
645 /** Specify the line stipple pattern */
646 void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
647 /** Specify the width of rasterized lines */
648 void (*LineWidth)(struct gl_context *ctx, GLfloat width);
649 /** Specify a logical pixel operation for color index rendering */
650 void (*LogicOpcode)(struct gl_context *ctx, enum gl_logicop_mode opcode);
651 void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
652 const GLfloat *params);
653 /** Specify the diameter of rasterized points */
654 void (*PointSize)(struct gl_context *ctx, GLfloat size);
655 /** Select a polygon rasterization mode */
656 void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
657 /** Set the scale and units used to calculate depth values */
658 void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units, GLfloat clamp);
659 /** Set the polygon stippling pattern */
660 void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
661 /* Specifies the current buffer for reading */
662 void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
663 /** Set rasterization mode */
664 void (*RenderMode)(struct gl_context *ctx, GLenum mode );
665 /** Define the scissor box */
666 void (*Scissor)(struct gl_context *ctx);
667 /** Select flat or smooth shading */
668 void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
669 /** OpenGL 2.0 two-sided StencilFunc */
670 void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
671 GLint ref, GLuint mask);
672 /** OpenGL 2.0 two-sided StencilMask */
673 void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
674 /** OpenGL 2.0 two-sided StencilOp */
675 void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
676 GLenum zfail, GLenum zpass);
677 /** Control the generation of texture coordinates */
678 void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
679 const GLfloat *params);
680 /** Set texture environment parameters */
681 void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
682 const GLfloat *param);
683 /** Set texture parameter (callee gets param value from the texObj) */
684 void (*TexParameter)(struct gl_context *ctx,
685 struct gl_texture_object *texObj, GLenum pname);
686 /** Set the viewport */
687 void (*Viewport)(struct gl_context *ctx);
688 /*@}*/
689
690
691 /**
692 * \name Vertex/pixel buffer object functions
693 */
694 /*@{*/
695 struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx,
696 GLuint buffer);
697
698 void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
699
700 GLboolean (*BufferData)(struct gl_context *ctx, GLenum target,
701 GLsizeiptrARB size, const GLvoid *data, GLenum usage,
702 GLenum storageFlags, struct gl_buffer_object *obj);
703
704 void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset,
705 GLsizeiptrARB size, const GLvoid *data,
706 struct gl_buffer_object *obj );
707
708 void (*GetBufferSubData)( struct gl_context *ctx,
709 GLintptrARB offset, GLsizeiptrARB size,
710 GLvoid *data, struct gl_buffer_object *obj );
711
712 void (*ClearBufferSubData)( struct gl_context *ctx,
713 GLintptr offset, GLsizeiptr size,
714 const GLvoid *clearValue,
715 GLsizeiptr clearValueSize,
716 struct gl_buffer_object *obj );
717
718 void (*CopyBufferSubData)( struct gl_context *ctx,
719 struct gl_buffer_object *src,
720 struct gl_buffer_object *dst,
721 GLintptr readOffset, GLintptr writeOffset,
722 GLsizeiptr size );
723
724 void (*InvalidateBufferSubData)( struct gl_context *ctx,
725 struct gl_buffer_object *obj,
726 GLintptr offset,
727 GLsizeiptr length );
728
729 /* Returns pointer to the start of the mapped range.
730 * May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
731 */
732 void * (*MapBufferRange)( struct gl_context *ctx, GLintptr offset,
733 GLsizeiptr length, GLbitfield access,
734 struct gl_buffer_object *obj,
735 gl_map_buffer_index index);
736
737 void (*FlushMappedBufferRange)(struct gl_context *ctx,
738 GLintptr offset, GLsizeiptr length,
739 struct gl_buffer_object *obj,
740 gl_map_buffer_index index);
741
742 GLboolean (*UnmapBuffer)( struct gl_context *ctx,
743 struct gl_buffer_object *obj,
744 gl_map_buffer_index index);
745 /*@}*/
746
747 /**
748 * \name Functions for GL_APPLE_object_purgeable
749 */
750 /*@{*/
751 /* variations on ObjectPurgeable */
752 GLenum (*BufferObjectPurgeable)(struct gl_context *ctx,
753 struct gl_buffer_object *obj, GLenum option);
754 GLenum (*RenderObjectPurgeable)(struct gl_context *ctx,
755 struct gl_renderbuffer *obj, GLenum option);
756 GLenum (*TextureObjectPurgeable)(struct gl_context *ctx,
757 struct gl_texture_object *obj,
758 GLenum option);
759
760 /* variations on ObjectUnpurgeable */
761 GLenum (*BufferObjectUnpurgeable)(struct gl_context *ctx,
762 struct gl_buffer_object *obj,
763 GLenum option);
764 GLenum (*RenderObjectUnpurgeable)(struct gl_context *ctx,
765 struct gl_renderbuffer *obj,
766 GLenum option);
767 GLenum (*TextureObjectUnpurgeable)(struct gl_context *ctx,
768 struct gl_texture_object *obj,
769 GLenum option);
770 /*@}*/
771
772 /**
773 * \name Functions for GL_EXT_framebuffer_{object,blit,discard}.
774 */
775 /*@{*/
776 struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx,
777 GLuint name);
778 struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx,
779 GLuint name);
780 void (*BindFramebuffer)(struct gl_context *ctx, GLenum target,
781 struct gl_framebuffer *drawFb,
782 struct gl_framebuffer *readFb);
783 void (*FramebufferRenderbuffer)(struct gl_context *ctx,
784 struct gl_framebuffer *fb,
785 GLenum attachment,
786 struct gl_renderbuffer *rb);
787 void (*RenderTexture)(struct gl_context *ctx,
788 struct gl_framebuffer *fb,
789 struct gl_renderbuffer_attachment *att);
790 void (*FinishRenderTexture)(struct gl_context *ctx,
791 struct gl_renderbuffer *rb);
792 void (*ValidateFramebuffer)(struct gl_context *ctx,
793 struct gl_framebuffer *fb);
794 /*@}*/
795 void (*BlitFramebuffer)(struct gl_context *ctx,
796 struct gl_framebuffer *readFb,
797 struct gl_framebuffer *drawFb,
798 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
799 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
800 GLbitfield mask, GLenum filter);
801 void (*DiscardFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb,
802 struct gl_renderbuffer_attachment *att);
803
804 /**
805 * \name Functions for GL_ARB_sample_locations
806 */
807 void (*GetProgrammableSampleCaps)(struct gl_context *ctx,
808 const struct gl_framebuffer *fb,
809 GLuint *bits, GLuint *width, GLuint *height);
810 void (*EvaluateDepthValues)(struct gl_context *ctx);
811
812 /**
813 * \name Query objects
814 */
815 /*@{*/
816 struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id);
817 void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q);
818 void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q);
819 void (*QueryCounter)(struct gl_context *ctx, struct gl_query_object *q);
820 void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q);
821 void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q);
822 void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q);
823 /*
824 * \pname the value requested to be written (GL_QUERY_RESULT, etc)
825 * \ptype the type of the value requested to be written:
826 * GL_UNSIGNED_INT, GL_UNSIGNED_INT64_ARB,
827 * GL_INT, GL_INT64_ARB
828 */
829 void (*StoreQueryResult)(struct gl_context *ctx, struct gl_query_object *q,
830 struct gl_buffer_object *buf, intptr_t offset,
831 GLenum pname, GLenum ptype);
832 /*@}*/
833
834 /**
835 * \name Performance monitors
836 */
837 /*@{*/
838 void (*InitPerfMonitorGroups)(struct gl_context *ctx);
839 struct gl_perf_monitor_object * (*NewPerfMonitor)(struct gl_context *ctx);
840 void (*DeletePerfMonitor)(struct gl_context *ctx,
841 struct gl_perf_monitor_object *m);
842 GLboolean (*BeginPerfMonitor)(struct gl_context *ctx,
843 struct gl_perf_monitor_object *m);
844
845 /** Stop an active performance monitor, discarding results. */
846 void (*ResetPerfMonitor)(struct gl_context *ctx,
847 struct gl_perf_monitor_object *m);
848 void (*EndPerfMonitor)(struct gl_context *ctx,
849 struct gl_perf_monitor_object *m);
850 GLboolean (*IsPerfMonitorResultAvailable)(struct gl_context *ctx,
851 struct gl_perf_monitor_object *m);
852 void (*GetPerfMonitorResult)(struct gl_context *ctx,
853 struct gl_perf_monitor_object *m,
854 GLsizei dataSize,
855 GLuint *data,
856 GLint *bytesWritten);
857 /*@}*/
858
859 /**
860 * \name Performance Query objects
861 */
862 /*@{*/
863 unsigned (*InitPerfQueryInfo)(struct gl_context *ctx);
864 void (*GetPerfQueryInfo)(struct gl_context *ctx,
865 unsigned queryIndex,
866 const char **name,
867 GLuint *dataSize,
868 GLuint *numCounters,
869 GLuint *numActive);
870 void (*GetPerfCounterInfo)(struct gl_context *ctx,
871 unsigned queryIndex,
872 unsigned counterIndex,
873 const char **name,
874 const char **desc,
875 GLuint *offset,
876 GLuint *data_size,
877 GLuint *type_enum,
878 GLuint *data_type_enum,
879 GLuint64 *raw_max);
880 struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context *ctx,
881 unsigned queryIndex);
882 void (*DeletePerfQuery)(struct gl_context *ctx,
883 struct gl_perf_query_object *obj);
884 bool (*BeginPerfQuery)(struct gl_context *ctx,
885 struct gl_perf_query_object *obj);
886 void (*EndPerfQuery)(struct gl_context *ctx,
887 struct gl_perf_query_object *obj);
888 void (*WaitPerfQuery)(struct gl_context *ctx,
889 struct gl_perf_query_object *obj);
890 bool (*IsPerfQueryReady)(struct gl_context *ctx,
891 struct gl_perf_query_object *obj);
892 void (*GetPerfQueryData)(struct gl_context *ctx,
893 struct gl_perf_query_object *obj,
894 GLsizei dataSize,
895 GLuint *data,
896 GLuint *bytesWritten);
897 /*@}*/
898
899
900 /**
901 * \name GREMEDY debug/marker functions
902 */
903 /*@{*/
904 void (*EmitStringMarker)(struct gl_context *ctx, const GLchar *string, GLsizei len);
905 /*@}*/
906
907 /**
908 * \name Support for multiple T&L engines
909 */
910 /*@{*/
911
912 /**
913 * Set by the driver-supplied T&L engine.
914 *
915 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
916 */
917 GLuint CurrentExecPrimitive;
918
919 /**
920 * Current glBegin state of an in-progress compilation. May be
921 * GL_POINTS, GL_TRIANGLE_STRIP, etc. or PRIM_OUTSIDE_BEGIN_END
922 * or PRIM_UNKNOWN.
923 */
924 GLuint CurrentSavePrimitive;
925
926
927 #define FLUSH_STORED_VERTICES 0x1
928 #define FLUSH_UPDATE_CURRENT 0x2
929 /**
930 * Set by the driver-supplied T&L engine whenever vertices are buffered
931 * between glBegin()/glEnd() objects or __struct gl_contextRec::Current
932 * is not updated. A bitmask of the FLUSH_x values above.
933 *
934 * The dd_function_table::FlushVertices call below may be used to resolve
935 * these conditions.
936 */
937 GLbitfield NeedFlush;
938
939 /** Need to call vbo_save_SaveFlushVertices() upon state change? */
940 GLboolean SaveNeedFlush;
941
942 /**
943 * Notify driver that the special derived value _NeedEyeCoords has
944 * changed.
945 */
946 void (*LightingSpaceChange)( struct gl_context *ctx );
947
948 /**@}*/
949
950 /**
951 * \name GL_ARB_sync interfaces
952 */
953 /*@{*/
954 struct gl_sync_object * (*NewSyncObject)(struct gl_context *);
955 void (*FenceSync)(struct gl_context *, struct gl_sync_object *,
956 GLenum, GLbitfield);
957 void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
958 void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
959 void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
960 GLbitfield, GLuint64);
961 void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
962 GLbitfield, GLuint64);
963 /*@}*/
964
965 /** GL_NV_conditional_render */
966 void (*BeginConditionalRender)(struct gl_context *ctx,
967 struct gl_query_object *q,
968 GLenum mode);
969 void (*EndConditionalRender)(struct gl_context *ctx,
970 struct gl_query_object *q);
971
972 /**
973 * \name GL_OES_draw_texture interface
974 */
975 /*@{*/
976 void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
977 GLfloat width, GLfloat height);
978 /*@}*/
979
980 /**
981 * \name GL_OES_EGL_image interface
982 */
983 void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
984 struct gl_texture_object *texObj,
985 struct gl_texture_image *texImage,
986 GLeglImageOES image_handle);
987 void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
988 struct gl_renderbuffer *rb,
989 void *image_handle);
990
991 /**
992 * \name GL_EXT_EGL_image_storage interface
993 */
994 void (*EGLImageTargetTexStorage)(struct gl_context *ctx, GLenum target,
995 struct gl_texture_object *texObj,
996 struct gl_texture_image *texImage,
997 GLeglImageOES image_handle);
998 /**
999 * \name GL_EXT_transform_feedback interface
1000 */
1001 struct gl_transform_feedback_object *
1002 (*NewTransformFeedback)(struct gl_context *ctx, GLuint name);
1003 void (*DeleteTransformFeedback)(struct gl_context *ctx,
1004 struct gl_transform_feedback_object *obj);
1005 void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode,
1006 struct gl_transform_feedback_object *obj);
1007 void (*EndTransformFeedback)(struct gl_context *ctx,
1008 struct gl_transform_feedback_object *obj);
1009 void (*PauseTransformFeedback)(struct gl_context *ctx,
1010 struct gl_transform_feedback_object *obj);
1011 void (*ResumeTransformFeedback)(struct gl_context *ctx,
1012 struct gl_transform_feedback_object *obj);
1013
1014 /**
1015 * Return the number of vertices written to a stream during the last
1016 * Begin/EndTransformFeedback block.
1017 */
1018 GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx,
1019 struct gl_transform_feedback_object *obj,
1020 GLuint stream);
1021
1022 /**
1023 * \name GL_NV_texture_barrier interface
1024 */
1025 void (*TextureBarrier)(struct gl_context *ctx);
1026
1027 /**
1028 * \name GL_ARB_sampler_objects
1029 */
1030 struct gl_sampler_object * (*NewSamplerObject)(struct gl_context *ctx,
1031 GLuint name);
1032
1033 /**
1034 * \name Return a timestamp in nanoseconds as defined by GL_ARB_timer_query.
1035 * This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
1036 */
1037 uint64_t (*GetTimestamp)(struct gl_context *ctx);
1038
1039 /**
1040 * \name GL_ARB_texture_multisample
1041 */
1042 void (*GetSamplePosition)(struct gl_context *ctx,
1043 struct gl_framebuffer *fb,
1044 GLuint index,
1045 GLfloat *outValue);
1046
1047 /**
1048 * \name NV_vdpau_interop interface
1049 */
1050 void (*VDPAUMapSurface)(struct gl_context *ctx, GLenum target,
1051 GLenum access, GLboolean output,
1052 struct gl_texture_object *texObj,
1053 struct gl_texture_image *texImage,
1054 const GLvoid *vdpSurface, GLuint index);
1055 void (*VDPAUUnmapSurface)(struct gl_context *ctx, GLenum target,
1056 GLenum access, GLboolean output,
1057 struct gl_texture_object *texObj,
1058 struct gl_texture_image *texImage,
1059 const GLvoid *vdpSurface, GLuint index);
1060
1061 /**
1062 * Query reset status for GL_ARB_robustness
1063 *
1064 * Per \c glGetGraphicsResetStatusARB, this function should return a
1065 * non-zero value once after a reset. If a reset is non-atomic, the
1066 * non-zero status should be returned for the duration of the reset.
1067 */
1068 GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx);
1069
1070 /**
1071 * \name GL_ARB_shader_image_load_store interface.
1072 */
1073 /** @{ */
1074 void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
1075 /** @} */
1076
1077 /**
1078 * GL_EXT_shader_framebuffer_fetch_non_coherent rendering barrier.
1079 *
1080 * On return from this function any framebuffer contents written by
1081 * previous draw commands are guaranteed to be visible from subsequent
1082 * fragment shader invocations using the
1083 * EXT_shader_framebuffer_fetch_non_coherent interface.
1084 */
1085 /** @{ */
1086 void (*FramebufferFetchBarrier)(struct gl_context *ctx);
1087 /** @} */
1088
1089 /**
1090 * \name GL_ARB_compute_shader interface
1091 */
1092 /*@{*/
1093 void (*DispatchCompute)(struct gl_context *ctx, const GLuint *num_groups);
1094 void (*DispatchComputeIndirect)(struct gl_context *ctx, GLintptr indirect);
1095 /*@}*/
1096
1097 /**
1098 * \name GL_ARB_compute_variable_group_size interface
1099 */
1100 /*@{*/
1101 void (*DispatchComputeGroupSize)(struct gl_context *ctx,
1102 const GLuint *num_groups,
1103 const GLuint *group_size);
1104 /*@}*/
1105
1106 /**
1107 * Query information about memory. Device memory is e.g. VRAM. Staging
1108 * memory is e.g. GART. All sizes are in kilobytes.
1109 */
1110 void (*QueryMemoryInfo)(struct gl_context *ctx,
1111 struct gl_memory_info *info);
1112
1113 /**
1114 * Indicate that this thread is being used by Mesa as a background drawing
1115 * thread for the given GL context.
1116 *
1117 * If this function is called more than once from any given thread, each
1118 * subsequent call overrides the context that was passed in the previous
1119 * call. Mesa takes advantage of this to re-use a background thread to
1120 * perform drawing on behalf of multiple contexts.
1121 *
1122 * Mesa may sometimes call this function from a non-background thread
1123 * (i.e. a thread that has already been bound to a context using
1124 * __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to
1125 * the context that is bound to this thread.
1126 *
1127 * Mesa will only call this function if GL multithreading is enabled.
1128 */
1129 void (*SetBackgroundContext)(struct gl_context *ctx,
1130 struct util_queue_monitoring *queue_info);
1131
1132 /**
1133 * \name GL_ARB_sparse_buffer interface
1134 */
1135 /*@{*/
1136 void (*BufferPageCommitment)(struct gl_context *ctx,
1137 struct gl_buffer_object *bufferObj,
1138 GLintptr offset, GLsizeiptr size,
1139 GLboolean commit);
1140 /*@}*/
1141
1142 /**
1143 * \name GL_ARB_bindless_texture interface
1144 */
1145 /*@{*/
1146 GLuint64 (*NewTextureHandle)(struct gl_context *ctx,
1147 struct gl_texture_object *texObj,
1148 struct gl_sampler_object *sampObj);
1149 void (*DeleteTextureHandle)(struct gl_context *ctx, GLuint64 handle);
1150 void (*MakeTextureHandleResident)(struct gl_context *ctx, GLuint64 handle,
1151 bool resident);
1152 GLuint64 (*NewImageHandle)(struct gl_context *ctx,
1153 struct gl_image_unit *imgObj);
1154 void (*DeleteImageHandle)(struct gl_context *ctx, GLuint64 handle);
1155 void (*MakeImageHandleResident)(struct gl_context *ctx, GLuint64 handle,
1156 GLenum access, bool resident);
1157 /*@}*/
1158
1159
1160 /**
1161 * \name GL_EXT_external_objects interface
1162 */
1163 /*@{*/
1164 /**
1165 * Called to allocate a new memory object. Drivers will usually
1166 * allocate/return a subclass of gl_memory_object.
1167 */
1168 struct gl_memory_object * (*NewMemoryObject)(struct gl_context *ctx,
1169 GLuint name);
1170 /**
1171 * Called to delete/free a memory object. Drivers should free the
1172 * object and any image data it contains.
1173 */
1174 void (*DeleteMemoryObject)(struct gl_context *ctx,
1175 struct gl_memory_object *memObj);
1176
1177 /**
1178 * Set the given memory object as the texture's storage.
1179 */
1180 GLboolean (*SetTextureStorageForMemoryObject)(struct gl_context *ctx,
1181 struct gl_texture_object *tex_obj,
1182 struct gl_memory_object *mem_obj,
1183 GLsizei levels, GLsizei width,
1184 GLsizei height, GLsizei depth,
1185 GLuint64 offset);
1186
1187 /**
1188 * Use a memory object as the backing data for a buffer object
1189 */
1190 GLboolean (*BufferDataMem)(struct gl_context *ctx,
1191 GLenum target,
1192 GLsizeiptrARB size,
1193 struct gl_memory_object *memObj,
1194 GLuint64 offset,
1195 GLenum usage,
1196 struct gl_buffer_object *bufObj);
1197
1198 /**
1199 * Fill uuid with an unique identifier for this driver
1200 *
1201 * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1202 */
1203 void (*GetDriverUuid)(struct gl_context *ctx, char *uuid);
1204
1205 /**
1206 * Fill uuid with an unique identifier for the device associated
1207 * to this driver
1208 *
1209 * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1210 */
1211 void (*GetDeviceUuid)(struct gl_context *ctx, char *uuid);
1212
1213 /*@}*/
1214
1215 /**
1216 * \name GL_EXT_external_objects_fd interface
1217 */
1218 /*@{*/
1219 /**
1220 * Called to import a memory object. The caller relinquishes ownership
1221 * of fd after the call returns.
1222 *
1223 * Accessing fd after ImportMemoryObjectFd returns results in undefined
1224 * behaviour. This is consistent with EXT_external_object_fd.
1225 */
1226 void (*ImportMemoryObjectFd)(struct gl_context *ctx,
1227 struct gl_memory_object *memObj,
1228 GLuint64 size,
1229 int fd);
1230 /*@}*/
1231
1232 /**
1233 * \name GL_ARB_get_program_binary
1234 */
1235 /*@{*/
1236 /**
1237 * Calls to retrieve/store a binary serialized copy of the current program.
1238 */
1239 void (*GetProgramBinaryDriverSHA1)(struct gl_context *ctx, uint8_t *sha1);
1240
1241 void (*ProgramBinarySerializeDriverBlob)(struct gl_context *ctx,
1242 struct gl_shader_program *shProg,
1243 struct gl_program *prog);
1244
1245 void (*ProgramBinaryDeserializeDriverBlob)(struct gl_context *ctx,
1246 struct gl_shader_program *shProg,
1247 struct gl_program *prog);
1248 /*@}*/
1249
1250 /**
1251 * \name GL_EXT_semaphore interface
1252 */
1253 /*@{*/
1254 /**
1255 * Called to allocate a new semaphore object. Drivers will usually
1256 * allocate/return a subclass of gl_semaphore_object.
1257 */
1258 struct gl_semaphore_object * (*NewSemaphoreObject)(struct gl_context *ctx,
1259 GLuint name);
1260 /**
1261 * Called to delete/free a semaphore object. Drivers should free the
1262 * object and any associated resources.
1263 */
1264 void (*DeleteSemaphoreObject)(struct gl_context *ctx,
1265 struct gl_semaphore_object *semObj);
1266
1267 /**
1268 * Introduce an operation to wait for the semaphore object in the GL
1269 * server's command stream
1270 */
1271 void (*ServerWaitSemaphoreObject)(struct gl_context *ctx,
1272 struct gl_semaphore_object *semObj,
1273 GLuint numBufferBarriers,
1274 struct gl_buffer_object **bufObjs,
1275 GLuint numTextureBarriers,
1276 struct gl_texture_object **texObjs,
1277 const GLenum *srcLayouts);
1278
1279 /**
1280 * Introduce an operation to signal the semaphore object in the GL
1281 * server's command stream
1282 */
1283 void (*ServerSignalSemaphoreObject)(struct gl_context *ctx,
1284 struct gl_semaphore_object *semObj,
1285 GLuint numBufferBarriers,
1286 struct gl_buffer_object **bufObjs,
1287 GLuint numTextureBarriers,
1288 struct gl_texture_object **texObjs,
1289 const GLenum *dstLayouts);
1290 /*@}*/
1291
1292 /**
1293 * \name GL_EXT_semaphore_fd interface
1294 */
1295 /*@{*/
1296 /**
1297 * Called to import a semaphore object. The caller relinquishes ownership
1298 * of fd after the call returns.
1299 *
1300 * Accessing fd after ImportSemaphoreFd returns results in undefined
1301 * behaviour. This is consistent with EXT_semaphore_fd.
1302 */
1303 void (*ImportSemaphoreFd)(struct gl_context *ctx,
1304 struct gl_semaphore_object *semObj,
1305 int fd);
1306 /*@}*/
1307
1308 /**
1309 * \name Disk shader cache functions
1310 */
1311 /*@{*/
1312 /**
1313 * Called to initialize gl_program::driver_cache_blob (and size) with a
1314 * ralloc allocated buffer.
1315 *
1316 * This buffer will be saved and restored as part of the gl_program
1317 * serialization and deserialization.
1318 */
1319 void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
1320 struct gl_program *prog);
1321 /*@}*/
1322
1323 /**
1324 * \name Set the number of compiler threads for ARB_parallel_shader_compile
1325 */
1326 void (*SetMaxShaderCompilerThreads)(struct gl_context *ctx, unsigned count);
1327 bool (*GetShaderProgramCompletionStatus)(struct gl_context *ctx,
1328 struct gl_shader_program *shprog);
1329 };
1330
1331
1332 /**
1333 * Per-vertex functions.
1334 *
1335 * These are the functions which can appear between glBegin and glEnd.
1336 * Depending on whether we're inside or outside a glBegin/End pair
1337 * and whether we're in immediate mode or building a display list, these
1338 * functions behave differently. This structure allows us to switch
1339 * between those modes more easily.
1340 *
1341 * Generally, these pointers point to functions in the VBO module.
1342 */
1343 typedef struct {
1344 void (GLAPIENTRYP ArrayElement)( GLint );
1345 void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
1346 void (GLAPIENTRYP Color3fv)( const GLfloat * );
1347 void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1348 void (GLAPIENTRYP Color4fv)( const GLfloat * );
1349 void (GLAPIENTRYP EdgeFlag)( GLboolean );
1350 void (GLAPIENTRYP EvalCoord1f)( GLfloat );
1351 void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * );
1352 void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat );
1353 void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * );
1354 void (GLAPIENTRYP EvalPoint1)( GLint );
1355 void (GLAPIENTRYP EvalPoint2)( GLint, GLint );
1356 void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
1357 void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
1358 void (GLAPIENTRYP Indexf)( GLfloat );
1359 void (GLAPIENTRYP Indexfv)( const GLfloat * );
1360 void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * );
1361 void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
1362 void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
1363 void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
1364 void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
1365 void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
1366 void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
1367 void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
1368 void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
1369 void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
1370 void (GLAPIENTRYP Normal3fv)( const GLfloat * );
1371 void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
1372 void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
1373 void (GLAPIENTRYP TexCoord1f)( GLfloat );
1374 void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
1375 void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
1376 void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
1377 void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
1378 void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
1379 void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1380 void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
1381 void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
1382 void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
1383 void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
1384 void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
1385 void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1386 void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
1387 void (GLAPIENTRYP CallList)( GLuint );
1388 void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
1389 void (GLAPIENTRYP Begin)( GLenum );
1390 void (GLAPIENTRYP End)( void );
1391 void (GLAPIENTRYP PrimitiveRestartNV)( void );
1392 /* Originally for GL_NV_vertex_program, now used only dlist.c and friends */
1393 void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
1394 void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
1395 void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
1396 void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
1397 void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1398 void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
1399 void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1400 void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
1401 /* GL_ARB_vertex_program */
1402 void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
1403 void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
1404 void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
1405 void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
1406 void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1407 void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
1408 void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1409 void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
1410
1411 /* GL_EXT_gpu_shader4 / GL 3.0 */
1412 void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x);
1413 void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y);
1414 void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z);
1415 void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w);
1416 void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v);
1417 void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v);
1418 void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v);
1419
1420 void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x);
1421 void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y);
1422 void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z);
1423 void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1424 void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v);
1425 void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v);
1426 void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v);
1427
1428 /* GL_ARB_vertex_type_10_10_10_2_rev / GL3.3 */
1429 void (GLAPIENTRYP VertexP2ui)( GLenum type, GLuint value );
1430 void (GLAPIENTRYP VertexP2uiv)( GLenum type, const GLuint *value);
1431
1432 void (GLAPIENTRYP VertexP3ui)( GLenum type, GLuint value );
1433 void (GLAPIENTRYP VertexP3uiv)( GLenum type, const GLuint *value);
1434
1435 void (GLAPIENTRYP VertexP4ui)( GLenum type, GLuint value );
1436 void (GLAPIENTRYP VertexP4uiv)( GLenum type, const GLuint *value);
1437
1438 void (GLAPIENTRYP TexCoordP1ui)( GLenum type, GLuint coords );
1439 void (GLAPIENTRYP TexCoordP1uiv)( GLenum type, const GLuint *coords );
1440
1441 void (GLAPIENTRYP TexCoordP2ui)( GLenum type, GLuint coords );
1442 void (GLAPIENTRYP TexCoordP2uiv)( GLenum type, const GLuint *coords );
1443
1444 void (GLAPIENTRYP TexCoordP3ui)( GLenum type, GLuint coords );
1445 void (GLAPIENTRYP TexCoordP3uiv)( GLenum type, const GLuint *coords );
1446
1447 void (GLAPIENTRYP TexCoordP4ui)( GLenum type, GLuint coords );
1448 void (GLAPIENTRYP TexCoordP4uiv)( GLenum type, const GLuint *coords );
1449
1450 void (GLAPIENTRYP MultiTexCoordP1ui)( GLenum texture, GLenum type, GLuint coords );
1451 void (GLAPIENTRYP MultiTexCoordP1uiv)( GLenum texture, GLenum type, const GLuint *coords );
1452 void (GLAPIENTRYP MultiTexCoordP2ui)( GLenum texture, GLenum type, GLuint coords );
1453 void (GLAPIENTRYP MultiTexCoordP2uiv)( GLenum texture, GLenum type, const GLuint *coords );
1454 void (GLAPIENTRYP MultiTexCoordP3ui)( GLenum texture, GLenum type, GLuint coords );
1455 void (GLAPIENTRYP MultiTexCoordP3uiv)( GLenum texture, GLenum type, const GLuint *coords );
1456 void (GLAPIENTRYP MultiTexCoordP4ui)( GLenum texture, GLenum type, GLuint coords );
1457 void (GLAPIENTRYP MultiTexCoordP4uiv)( GLenum texture, GLenum type, const GLuint *coords );
1458
1459 void (GLAPIENTRYP NormalP3ui)( GLenum type, GLuint coords );
1460 void (GLAPIENTRYP NormalP3uiv)( GLenum type, const GLuint *coords );
1461
1462 void (GLAPIENTRYP ColorP3ui)( GLenum type, GLuint color );
1463 void (GLAPIENTRYP ColorP3uiv)( GLenum type, const GLuint *color );
1464
1465 void (GLAPIENTRYP ColorP4ui)( GLenum type, GLuint color );
1466 void (GLAPIENTRYP ColorP4uiv)( GLenum type, const GLuint *color );
1467
1468 void (GLAPIENTRYP SecondaryColorP3ui)( GLenum type, GLuint color );
1469 void (GLAPIENTRYP SecondaryColorP3uiv)( GLenum type, const GLuint *color );
1470
1471 void (GLAPIENTRYP VertexAttribP1ui)( GLuint index, GLenum type,
1472 GLboolean normalized, GLuint value);
1473 void (GLAPIENTRYP VertexAttribP2ui)( GLuint index, GLenum type,
1474 GLboolean normalized, GLuint value);
1475 void (GLAPIENTRYP VertexAttribP3ui)( GLuint index, GLenum type,
1476 GLboolean normalized, GLuint value);
1477 void (GLAPIENTRYP VertexAttribP4ui)( GLuint index, GLenum type,
1478 GLboolean normalized, GLuint value);
1479 void (GLAPIENTRYP VertexAttribP1uiv)( GLuint index, GLenum type,
1480 GLboolean normalized,
1481 const GLuint *value);
1482 void (GLAPIENTRYP VertexAttribP2uiv)( GLuint index, GLenum type,
1483 GLboolean normalized,
1484 const GLuint *value);
1485 void (GLAPIENTRYP VertexAttribP3uiv)( GLuint index, GLenum type,
1486 GLboolean normalized,
1487 const GLuint *value);
1488 void (GLAPIENTRYP VertexAttribP4uiv)( GLuint index, GLenum type,
1489 GLboolean normalized,
1490 const GLuint *value);
1491
1492 /* GL_ARB_vertex_attrib_64bit / GL 4.1 */
1493 void (GLAPIENTRYP VertexAttribL1d)( GLuint index, GLdouble x);
1494 void (GLAPIENTRYP VertexAttribL2d)( GLuint index, GLdouble x, GLdouble y);
1495 void (GLAPIENTRYP VertexAttribL3d)( GLuint index, GLdouble x, GLdouble y, GLdouble z);
1496 void (GLAPIENTRYP VertexAttribL4d)( GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1497
1498
1499 void (GLAPIENTRYP VertexAttribL1dv)( GLuint index, const GLdouble *v);
1500 void (GLAPIENTRYP VertexAttribL2dv)( GLuint index, const GLdouble *v);
1501 void (GLAPIENTRYP VertexAttribL3dv)( GLuint index, const GLdouble *v);
1502 void (GLAPIENTRYP VertexAttribL4dv)( GLuint index, const GLdouble *v);
1503
1504 void (GLAPIENTRYP VertexAttribL1ui64ARB)( GLuint index, GLuint64EXT x);
1505 void (GLAPIENTRYP VertexAttribL1ui64vARB)( GLuint index, const GLuint64EXT *v);
1506 } GLvertexformat;
1507
1508
1509 #endif /* DD_INCLUDED */