1848b8605Smrg/**
2848b8605Smrg * \file dd.h
3848b8605Smrg * Device driver interfaces.
4848b8605Smrg */
5848b8605Smrg
6848b8605Smrg/*
7848b8605Smrg * Mesa 3-D graphics library
8848b8605Smrg *
9848b8605Smrg * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
10848b8605Smrg *
11848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
12848b8605Smrg * copy of this software and associated documentation files (the "Software"),
13848b8605Smrg * to deal in the Software without restriction, including without limitation
14848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the
16848b8605Smrg * Software is furnished to do so, subject to the following conditions:
17848b8605Smrg *
18848b8605Smrg * The above copyright notice and this permission notice shall be included
19848b8605Smrg * in all copies or substantial portions of the Software.
20848b8605Smrg *
21848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE.
28848b8605Smrg */
29848b8605Smrg
30848b8605Smrg
31848b8605Smrg#ifndef DD_INCLUDED
32848b8605Smrg#define DD_INCLUDED
33848b8605Smrg
34848b8605Smrg#include "glheader.h"
35b8e80941Smrg#include "formats.h"
36b8e80941Smrg#include "menums.h"
37848b8605Smrg
38b8e80941Smrgstruct gl_bitmap_atlas;
39848b8605Smrgstruct gl_buffer_object;
40848b8605Smrgstruct gl_context;
41848b8605Smrgstruct gl_display_list;
42848b8605Smrgstruct gl_framebuffer;
43848b8605Smrgstruct gl_image_unit;
44848b8605Smrgstruct gl_pixelstore_attrib;
45848b8605Smrgstruct gl_program;
46848b8605Smrgstruct gl_renderbuffer;
47848b8605Smrgstruct gl_renderbuffer_attachment;
48848b8605Smrgstruct gl_shader;
49848b8605Smrgstruct gl_shader_program;
50848b8605Smrgstruct gl_texture_image;
51848b8605Smrgstruct gl_texture_object;
52b8e80941Smrgstruct gl_memory_info;
53b8e80941Smrgstruct gl_transform_feedback_object;
54b8e80941Smrgstruct ati_fragment_shader;
55b8e80941Smrgstruct util_queue_monitoring;
56b8e80941Smrgstruct _mesa_prim;
57b8e80941Smrgstruct _mesa_index_buffer;
58848b8605Smrg
59848b8605Smrg/* GL_ARB_vertex_buffer_object */
60848b8605Smrg/* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return
61848b8605Smrg * NULL) if buffer is unavailable for immediate mapping.
62848b8605Smrg *
63848b8605Smrg * Does GL_MAP_INVALIDATE_RANGE_BIT do this?  It seems so, but it
64848b8605Smrg * would require more book-keeping in the driver than seems necessary
65848b8605Smrg * at this point.
66848b8605Smrg *
67848b8605Smrg * Does GL_MAP_INVALDIATE_BUFFER_BIT do this?  Not really -- we don't
68848b8605Smrg * want to provoke the driver to throw away the old storage, we will
69848b8605Smrg * respect the contents of already referenced data.
70848b8605Smrg */
71b8e80941Smrg#define MESA_MAP_NOWAIT_BIT       0x4000
72848b8605Smrg
73848b8605Smrg
74848b8605Smrg/**
75848b8605Smrg * Device driver function table.
76848b8605Smrg * Core Mesa uses these function pointers to call into device drivers.
77848b8605Smrg * Most of these functions directly correspond to OpenGL state commands.
78848b8605Smrg * Core Mesa will call these functions after error checking has been done
79848b8605Smrg * so that the drivers don't have to worry about error testing.
80848b8605Smrg *
81848b8605Smrg * Vertex transformation/clipping/lighting is patched into the T&L module.
82848b8605Smrg * Rasterization functions are patched into the swrast module.
83848b8605Smrg *
84848b8605Smrg * Note: when new functions are added here, the drivers/common/driverfuncs.c
85848b8605Smrg * file should be updated too!!!
86848b8605Smrg */
87848b8605Smrgstruct dd_function_table {
88848b8605Smrg   /**
89848b8605Smrg    * Return a string as needed by glGetString().
90848b8605Smrg    * Only the GL_RENDERER query must be implemented.  Otherwise, NULL can be
91848b8605Smrg    * returned.
92848b8605Smrg    */
93848b8605Smrg   const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name );
94848b8605Smrg
95848b8605Smrg   /**
96848b8605Smrg    * Notify the driver after Mesa has made some internal state changes.
97848b8605Smrg    *
98848b8605Smrg    * This is in addition to any state change callbacks Mesa may already have
99848b8605Smrg    * made.
100848b8605Smrg    */
101b8e80941Smrg   void (*UpdateState)(struct gl_context *ctx);
102848b8605Smrg
103848b8605Smrg   /**
104848b8605Smrg    * This is called whenever glFinish() is called.
105848b8605Smrg    */
106848b8605Smrg   void (*Finish)( struct gl_context *ctx );
107848b8605Smrg
108848b8605Smrg   /**
109848b8605Smrg    * This is called whenever glFlush() is called.
110848b8605Smrg    */
111848b8605Smrg   void (*Flush)( struct gl_context *ctx );
112848b8605Smrg
113848b8605Smrg   /**
114848b8605Smrg    * Clear the color/depth/stencil/accum buffer(s).
115848b8605Smrg    * \param buffers  a bitmask of BUFFER_BIT_* flags indicating which
116848b8605Smrg    *                 renderbuffers need to be cleared.
117848b8605Smrg    */
118848b8605Smrg   void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
119848b8605Smrg
120848b8605Smrg   /**
121848b8605Smrg    * Execute glRasterPos, updating the ctx->Current.Raster fields
122848b8605Smrg    */
123848b8605Smrg   void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
124848b8605Smrg
125848b8605Smrg   /**
126848b8605Smrg    * \name Image-related functions
127848b8605Smrg    */
128848b8605Smrg   /*@{*/
129848b8605Smrg
130848b8605Smrg   /**
131848b8605Smrg    * Called by glDrawPixels().
132848b8605Smrg    * \p unpack describes how to unpack the source image data.
133848b8605Smrg    */
134848b8605Smrg   void (*DrawPixels)( struct gl_context *ctx,
135848b8605Smrg		       GLint x, GLint y, GLsizei width, GLsizei height,
136848b8605Smrg		       GLenum format, GLenum type,
137848b8605Smrg		       const struct gl_pixelstore_attrib *unpack,
138848b8605Smrg		       const GLvoid *pixels );
139848b8605Smrg
140848b8605Smrg   /**
141848b8605Smrg    * Called by glReadPixels().
142848b8605Smrg    */
143848b8605Smrg   void (*ReadPixels)( struct gl_context *ctx,
144848b8605Smrg		       GLint x, GLint y, GLsizei width, GLsizei height,
145848b8605Smrg		       GLenum format, GLenum type,
146848b8605Smrg		       const struct gl_pixelstore_attrib *unpack,
147848b8605Smrg		       GLvoid *dest );
148848b8605Smrg
149848b8605Smrg   /**
150848b8605Smrg    * Called by glCopyPixels().
151848b8605Smrg    */
152848b8605Smrg   void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
153848b8605Smrg                       GLsizei width, GLsizei height,
154848b8605Smrg                       GLint dstx, GLint dsty, GLenum type );
155848b8605Smrg
156848b8605Smrg   /**
157848b8605Smrg    * Called by glBitmap().
158848b8605Smrg    */
159848b8605Smrg   void (*Bitmap)( struct gl_context *ctx,
160848b8605Smrg		   GLint x, GLint y, GLsizei width, GLsizei height,
161848b8605Smrg		   const struct gl_pixelstore_attrib *unpack,
162848b8605Smrg		   const GLubyte *bitmap );
163b8e80941Smrg
164b8e80941Smrg   /**
165b8e80941Smrg    * Called by display list code for optimized glCallLists/glBitmap rendering
166b8e80941Smrg    * The driver must support texture rectangles of width 1024 or more.
167b8e80941Smrg    */
168b8e80941Smrg   void (*DrawAtlasBitmaps)(struct gl_context *ctx,
169b8e80941Smrg                            const struct gl_bitmap_atlas *atlas,
170b8e80941Smrg                            GLuint count, const GLubyte *ids);
171848b8605Smrg   /*@}*/
172848b8605Smrg
173848b8605Smrg
174848b8605Smrg   /**
175848b8605Smrg    * \name Texture image functions
176848b8605Smrg    */
177848b8605Smrg   /*@{*/
178848b8605Smrg
179848b8605Smrg   /**
180848b8605Smrg    * Choose actual hardware texture format given the texture target, the
181848b8605Smrg    * user-provided source image format and type and the desired internal
182848b8605Smrg    * format.  In some cases, srcFormat and srcType can be GL_NONE.
183848b8605Smrg    * Note:  target may be GL_TEXTURE_CUBE_MAP, but never
184848b8605Smrg    * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ].
185848b8605Smrg    * Called by glTexImage(), etc.
186848b8605Smrg    */
187848b8605Smrg   mesa_format (*ChooseTextureFormat)(struct gl_context *ctx,
188848b8605Smrg                                      GLenum target, GLint internalFormat,
189848b8605Smrg                                      GLenum srcFormat, GLenum srcType );
190848b8605Smrg
191848b8605Smrg   /**
192b8e80941Smrg    * Queries different driver parameters for a particular target and format.
193b8e80941Smrg    * Since ARB_internalformat_query2 introduced several new query parameters
194b8e80941Smrg    * over ARB_internalformat_query, having one driver hook for each parameter
195b8e80941Smrg    * is no longer feasible. So this is the generic entry-point for calls
196b8e80941Smrg    * to glGetInternalFormativ and glGetInternalFormati64v, after Mesa has
197b8e80941Smrg    * checked errors and default values.
198848b8605Smrg    *
199848b8605Smrg    * \param ctx            GL context
200848b8605Smrg    * \param target         GL target enum
201848b8605Smrg    * \param internalFormat GL format enum
202b8e80941Smrg    * \param pname          GL enum that specifies the info to query.
203b8e80941Smrg    * \param params         Buffer to hold the result of the query.
204848b8605Smrg    */
205b8e80941Smrg   void (*QueryInternalFormat)(struct gl_context *ctx,
206b8e80941Smrg                               GLenum target,
207b8e80941Smrg                               GLenum internalFormat,
208b8e80941Smrg                               GLenum pname,
209b8e80941Smrg                               GLint *params);
210848b8605Smrg
211848b8605Smrg   /**
212848b8605Smrg    * Called by glTexImage[123]D() and glCopyTexImage[12]D()
213848b8605Smrg    * Allocate texture memory and copy the user's image to the buffer.
214848b8605Smrg    * The gl_texture_image fields, etc. will be fully initialized.
215848b8605Smrg    * The parameters are the same as glTexImage3D(), plus:
216848b8605Smrg    * \param dims  1, 2, or 3 indicating glTexImage1/2/3D()
217848b8605Smrg    * \param packing describes how to unpack the source data.
218848b8605Smrg    * \param texImage is the destination texture image.
219848b8605Smrg    */
220848b8605Smrg   void (*TexImage)(struct gl_context *ctx, GLuint dims,
221848b8605Smrg                    struct gl_texture_image *texImage,
222848b8605Smrg                    GLenum format, GLenum type, const GLvoid *pixels,
223848b8605Smrg                    const struct gl_pixelstore_attrib *packing);
224848b8605Smrg
225848b8605Smrg   /**
226848b8605Smrg    * Called by glTexSubImage[123]D().
227848b8605Smrg    * Replace a subset of the target texture with new texel data.
228848b8605Smrg    */
229848b8605Smrg   void (*TexSubImage)(struct gl_context *ctx, GLuint dims,
230848b8605Smrg                       struct gl_texture_image *texImage,
231848b8605Smrg                       GLint xoffset, GLint yoffset, GLint zoffset,
232848b8605Smrg                       GLsizei width, GLsizei height, GLint depth,
233848b8605Smrg                       GLenum format, GLenum type,
234848b8605Smrg                       const GLvoid *pixels,
235848b8605Smrg                       const struct gl_pixelstore_attrib *packing);
236848b8605Smrg
237848b8605Smrg
238848b8605Smrg   /**
239b8e80941Smrg    * Called by glGetTexImage(), glGetTextureSubImage().
240848b8605Smrg    */
241b8e80941Smrg   void (*GetTexSubImage)(struct gl_context *ctx,
242b8e80941Smrg                          GLint xoffset, GLint yoffset, GLint zoffset,
243b8e80941Smrg                          GLsizei width, GLsizei height, GLsizei depth,
244b8e80941Smrg                          GLenum format, GLenum type, GLvoid *pixels,
245b8e80941Smrg                          struct gl_texture_image *texImage);
246848b8605Smrg
247848b8605Smrg   /**
248848b8605Smrg    * Called by glClearTex[Sub]Image
249848b8605Smrg    *
250848b8605Smrg    * Clears a rectangular region of the image to a given value. The
251848b8605Smrg    * clearValue argument is either NULL or points to a single texel to use as
252848b8605Smrg    * the clear value in the same internal format as the texture image. If it
253848b8605Smrg    * is NULL then the texture should be cleared to zeroes.
254848b8605Smrg    */
255848b8605Smrg   void (*ClearTexSubImage)(struct gl_context *ctx,
256848b8605Smrg                            struct gl_texture_image *texImage,
257848b8605Smrg                            GLint xoffset, GLint yoffset, GLint zoffset,
258848b8605Smrg                            GLsizei width, GLsizei height, GLsizei depth,
259848b8605Smrg                            const GLvoid *clearValue);
260848b8605Smrg
261848b8605Smrg   /**
262848b8605Smrg    * Called by glCopyTex[Sub]Image[123]D().
263848b8605Smrg    *
264848b8605Smrg    * This function should copy a rectangular region in the rb to a single
265848b8605Smrg    * destination slice, specified by @slice.  In the case of 1D array
266848b8605Smrg    * textures (where one GL call can potentially affect multiple destination
267848b8605Smrg    * slices), core mesa takes care of calling this function multiple times,
268848b8605Smrg    * once for each scanline to be copied.
269848b8605Smrg    */
270848b8605Smrg   void (*CopyTexSubImage)(struct gl_context *ctx, GLuint dims,
271848b8605Smrg                           struct gl_texture_image *texImage,
272848b8605Smrg                           GLint xoffset, GLint yoffset, GLint slice,
273848b8605Smrg                           struct gl_renderbuffer *rb,
274848b8605Smrg                           GLint x, GLint y,
275848b8605Smrg                           GLsizei width, GLsizei height);
276848b8605Smrg   /**
277848b8605Smrg    * Called by glCopyImageSubData().
278848b8605Smrg    *
279b8e80941Smrg    * This function should copy one 2-D slice from src_teximage or
280b8e80941Smrg    * src_renderbuffer to dst_teximage or dst_renderbuffer.  Either the
281b8e80941Smrg    * teximage or renderbuffer pointer will be non-null to indicate which
282b8e80941Smrg    * is the real src/dst.
283b8e80941Smrg    *
284b8e80941Smrg    * If one of the textures is 3-D or is a 1-D or 2-D array
285848b8605Smrg    * texture, this function will be called multiple times: once for each
286848b8605Smrg    * slice.  If one of the textures is a cube map, this function will be
287848b8605Smrg    * called once for each face to be copied.
288848b8605Smrg    */
289848b8605Smrg   void (*CopyImageSubData)(struct gl_context *ctx,
290b8e80941Smrg                            struct gl_texture_image *src_teximage,
291b8e80941Smrg                            struct gl_renderbuffer *src_renderbuffer,
292848b8605Smrg                            int src_x, int src_y, int src_z,
293b8e80941Smrg                            struct gl_texture_image *dst_teximage,
294b8e80941Smrg                            struct gl_renderbuffer *dst_renderbuffer,
295848b8605Smrg                            int dst_x, int dst_y, int dst_z,
296848b8605Smrg                            int src_width, int src_height);
297848b8605Smrg
298848b8605Smrg   /**
299848b8605Smrg    * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
300848b8605Smrg    * Note that if the texture is a cube map, the <target> parameter will
301848b8605Smrg    * indicate which cube face to generate (GL_POSITIVE/NEGATIVE_X/Y/Z).
302848b8605Smrg    * texObj->BaseLevel is the level from which to generate the remaining
303848b8605Smrg    * mipmap levels.
304848b8605Smrg    */
305848b8605Smrg   void (*GenerateMipmap)(struct gl_context *ctx, GLenum target,
306848b8605Smrg                          struct gl_texture_object *texObj);
307848b8605Smrg
308848b8605Smrg   /**
309848b8605Smrg    * Called by glTexImage, glCompressedTexImage, glCopyTexImage
310848b8605Smrg    * and glTexStorage to check if the dimensions of the texture image
311848b8605Smrg    * are too large.
312848b8605Smrg    * \param target  any GL_PROXY_TEXTURE_x target
313848b8605Smrg    * \return GL_TRUE if the image is OK, GL_FALSE if too large
314848b8605Smrg    */
315848b8605Smrg   GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target,
316b8e80941Smrg                                  GLuint numLevels, GLint level,
317b8e80941Smrg                                  mesa_format format, GLuint numSamples,
318848b8605Smrg                                  GLint width, GLint height,
319b8e80941Smrg                                  GLint depth);
320848b8605Smrg   /*@}*/
321848b8605Smrg
322848b8605Smrg
323848b8605Smrg   /**
324848b8605Smrg    * \name Compressed texture functions
325848b8605Smrg    */
326848b8605Smrg   /*@{*/
327848b8605Smrg
328848b8605Smrg   /**
329848b8605Smrg    * Called by glCompressedTexImage[123]D().
330848b8605Smrg    */
331848b8605Smrg   void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims,
332848b8605Smrg                              struct gl_texture_image *texImage,
333848b8605Smrg                              GLsizei imageSize, const GLvoid *data);
334848b8605Smrg
335848b8605Smrg   /**
336848b8605Smrg    * Called by glCompressedTexSubImage[123]D().
337848b8605Smrg    */
338848b8605Smrg   void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims,
339848b8605Smrg                                 struct gl_texture_image *texImage,
340848b8605Smrg                                 GLint xoffset, GLint yoffset, GLint zoffset,
341b8e80941Smrg                                 GLsizei width, GLsizei height, GLsizei depth,
342848b8605Smrg                                 GLenum format,
343848b8605Smrg                                 GLsizei imageSize, const GLvoid *data);
344848b8605Smrg   /*@}*/
345848b8605Smrg
346848b8605Smrg   /**
347848b8605Smrg    * \name Texture object / image functions
348848b8605Smrg    */
349848b8605Smrg   /*@{*/
350848b8605Smrg
351848b8605Smrg   /**
352848b8605Smrg    * Called by glBindTexture() and glBindTextures().
353848b8605Smrg    */
354848b8605Smrg   void (*BindTexture)( struct gl_context *ctx, GLuint texUnit,
355848b8605Smrg                        GLenum target, struct gl_texture_object *tObj );
356848b8605Smrg
357848b8605Smrg   /**
358848b8605Smrg    * Called to allocate a new texture object.  Drivers will usually
359848b8605Smrg    * allocate/return a subclass of gl_texture_object.
360848b8605Smrg    */
361848b8605Smrg   struct gl_texture_object * (*NewTextureObject)(struct gl_context *ctx,
362848b8605Smrg                                                  GLuint name, GLenum target);
363848b8605Smrg   /**
364848b8605Smrg    * Called to delete/free a texture object.  Drivers should free the
365848b8605Smrg    * object and any image data it contains.
366848b8605Smrg    */
367848b8605Smrg   void (*DeleteTexture)(struct gl_context *ctx,
368848b8605Smrg                         struct gl_texture_object *texObj);
369848b8605Smrg
370848b8605Smrg   /** Called to allocate a new texture image object. */
371848b8605Smrg   struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx);
372848b8605Smrg
373848b8605Smrg   /** Called to free a texture image object returned by NewTextureImage() */
374848b8605Smrg   void (*DeleteTextureImage)(struct gl_context *ctx,
375848b8605Smrg                              struct gl_texture_image *);
376848b8605Smrg
377848b8605Smrg   /** Called to allocate memory for a single texture image */
378848b8605Smrg   GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
379848b8605Smrg                                        struct gl_texture_image *texImage);
380848b8605Smrg
381848b8605Smrg   /** Free the memory for a single texture image */
382848b8605Smrg   void (*FreeTextureImageBuffer)(struct gl_context *ctx,
383848b8605Smrg                                  struct gl_texture_image *texImage);
384848b8605Smrg
385848b8605Smrg   /** Map a slice of a texture image into user space.
386848b8605Smrg    * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice
387848b8605Smrg    * indicates the 1D array index.
388848b8605Smrg    * \param texImage  the texture image
389848b8605Smrg    * \param slice  the 3D image slice or array texture slice
390848b8605Smrg    * \param x, y, w, h  region of interest
391848b8605Smrg    * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
392848b8605Smrg    *              GL_MAP_INVALIDATE_RANGE_BIT (if writing)
393848b8605Smrg    * \param mapOut  returns start of mapping of region of interest
394848b8605Smrg    * \param rowStrideOut returns row stride (in bytes).  In the case of a
395848b8605Smrg    * compressed texture, this is the byte stride between one row of blocks
396848b8605Smrg    * and another.
397848b8605Smrg    */
398848b8605Smrg   void (*MapTextureImage)(struct gl_context *ctx,
399848b8605Smrg			   struct gl_texture_image *texImage,
400848b8605Smrg			   GLuint slice,
401848b8605Smrg			   GLuint x, GLuint y, GLuint w, GLuint h,
402848b8605Smrg			   GLbitfield mode,
403848b8605Smrg			   GLubyte **mapOut, GLint *rowStrideOut);
404848b8605Smrg
405848b8605Smrg   void (*UnmapTextureImage)(struct gl_context *ctx,
406848b8605Smrg			     struct gl_texture_image *texImage,
407848b8605Smrg			     GLuint slice);
408848b8605Smrg
409848b8605Smrg   /** For GL_ARB_texture_storage.  Allocate memory for whole mipmap stack.
410848b8605Smrg    * All the gl_texture_images in the texture object will have their
411848b8605Smrg    * dimensions, format, etc. initialized already.
412848b8605Smrg    */
413848b8605Smrg   GLboolean (*AllocTextureStorage)(struct gl_context *ctx,
414848b8605Smrg                                    struct gl_texture_object *texObj,
415848b8605Smrg                                    GLsizei levels, GLsizei width,
416848b8605Smrg                                    GLsizei height, GLsizei depth);
417848b8605Smrg
418848b8605Smrg   /** Called as part of glTextureView to add views to origTexObj */
419848b8605Smrg   GLboolean (*TextureView)(struct gl_context *ctx,
420848b8605Smrg                            struct gl_texture_object *texObj,
421848b8605Smrg                            struct gl_texture_object *origTexObj);
422848b8605Smrg
423848b8605Smrg   /**
424848b8605Smrg    * Map a renderbuffer into user space.
425848b8605Smrg    * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
426848b8605Smrg    *              GL_MAP_INVALIDATE_RANGE_BIT (if writing)
427848b8605Smrg    */
428848b8605Smrg   void (*MapRenderbuffer)(struct gl_context *ctx,
429848b8605Smrg			   struct gl_renderbuffer *rb,
430848b8605Smrg			   GLuint x, GLuint y, GLuint w, GLuint h,
431848b8605Smrg			   GLbitfield mode,
432b8e80941Smrg			   GLubyte **mapOut, GLint *rowStrideOut,
433b8e80941Smrg			   bool flip_y);
434848b8605Smrg
435848b8605Smrg   void (*UnmapRenderbuffer)(struct gl_context *ctx,
436848b8605Smrg			     struct gl_renderbuffer *rb);
437848b8605Smrg
438848b8605Smrg   /**
439848b8605Smrg    * Optional driver entrypoint that binds a non-texture renderbuffer's
440848b8605Smrg    * contents to a texture image.
441848b8605Smrg    */
442848b8605Smrg   GLboolean (*BindRenderbufferTexImage)(struct gl_context *ctx,
443848b8605Smrg                                         struct gl_renderbuffer *rb,
444848b8605Smrg                                         struct gl_texture_image *texImage);
445848b8605Smrg   /*@}*/
446848b8605Smrg
447848b8605Smrg
448848b8605Smrg   /**
449848b8605Smrg    * \name Vertex/fragment program functions
450848b8605Smrg    */
451848b8605Smrg   /*@{*/
452848b8605Smrg   /** Allocate a new program */
453848b8605Smrg   struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target,
454b8e80941Smrg                                     GLuint id, bool is_arb_asm);
455848b8605Smrg   /** Delete a program */
456848b8605Smrg   void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
457b8e80941Smrg   /**
458b8e80941Smrg    * Allocate a program to associate with the new ATI fragment shader (optional)
459b8e80941Smrg    */
460b8e80941Smrg   struct gl_program * (*NewATIfs)(struct gl_context *ctx,
461b8e80941Smrg                                   struct ati_fragment_shader *curProg);
462848b8605Smrg   /**
463848b8605Smrg    * Notify driver that a program string (and GPU code) has been specified
464848b8605Smrg    * or modified.  Return GL_TRUE or GL_FALSE to indicate if the program is
465848b8605Smrg    * supported by the driver.
466848b8605Smrg    */
467848b8605Smrg   GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
468848b8605Smrg                                    struct gl_program *prog);
469848b8605Smrg
470848b8605Smrg   /**
471848b8605Smrg    * Notify driver that the sampler uniforms for the current program have
472848b8605Smrg    * changed.  On some drivers, this may require shader recompiles.
473848b8605Smrg    */
474848b8605Smrg   void (*SamplerUniformChange)(struct gl_context *ctx, GLenum target,
475848b8605Smrg                                struct gl_program *prog);
476848b8605Smrg
477848b8605Smrg   /** Query if program can be loaded onto hardware */
478848b8605Smrg   GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
479848b8605Smrg				struct gl_program *prog);
480848b8605Smrg
481848b8605Smrg   /*@}*/
482848b8605Smrg
483848b8605Smrg   /**
484848b8605Smrg    * \name GLSL shader/program functions.
485848b8605Smrg    */
486848b8605Smrg   /*@{*/
487848b8605Smrg   /**
488848b8605Smrg    * Called when a shader program is linked.
489848b8605Smrg    *
490848b8605Smrg    * This gives drivers an opportunity to clone the IR and make their
491848b8605Smrg    * own transformations on it for the purposes of code generation.
492848b8605Smrg    */
493848b8605Smrg   GLboolean (*LinkShader)(struct gl_context *ctx,
494848b8605Smrg                           struct gl_shader_program *shader);
495848b8605Smrg   /*@}*/
496848b8605Smrg
497b8e80941Smrg
498b8e80941Smrg   /**
499b8e80941Smrg    * \name Draw functions.
500b8e80941Smrg    */
501b8e80941Smrg   /*@{*/
502b8e80941Smrg   /**
503b8e80941Smrg    * For indirect array drawing:
504b8e80941Smrg    *
505b8e80941Smrg    *    typedef struct {
506b8e80941Smrg    *       GLuint count;
507b8e80941Smrg    *       GLuint primCount;
508b8e80941Smrg    *       GLuint first;
509b8e80941Smrg    *       GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
510b8e80941Smrg    *    } DrawArraysIndirectCommand;
511b8e80941Smrg    *
512b8e80941Smrg    * For indirect indexed drawing:
513b8e80941Smrg    *
514b8e80941Smrg    *    typedef struct {
515b8e80941Smrg    *       GLuint count;
516b8e80941Smrg    *       GLuint primCount;
517b8e80941Smrg    *       GLuint firstIndex;
518b8e80941Smrg    *       GLint  baseVertex;
519b8e80941Smrg    *       GLuint baseInstance; // in GL 4.2 and later, must be zero otherwise
520b8e80941Smrg    *    } DrawElementsIndirectCommand;
521b8e80941Smrg    */
522b8e80941Smrg
523b8e80941Smrg   /**
524b8e80941Smrg    * Draw a number of primitives.
525b8e80941Smrg    * \param prims  array [nr_prims] describing what to draw (prim type,
526b8e80941Smrg    *               vertex count, first index, instance count, etc).
527b8e80941Smrg    * \param ib  index buffer for indexed drawing, NULL for array drawing
528b8e80941Smrg    * \param index_bounds_valid  are min_index and max_index valid?
529b8e80941Smrg    * \param min_index  lowest vertex index used
530b8e80941Smrg    * \param max_index  highest vertex index used
531b8e80941Smrg    * \param tfb_vertcount  if non-null, indicates which transform feedback
532b8e80941Smrg    *                       object has the vertex count.
533b8e80941Smrg    * \param tfb_stream  If called via DrawTransformFeedbackStream, specifies
534b8e80941Smrg    *                    the vertex stream buffer from which to get the vertex
535b8e80941Smrg    *                    count.
536b8e80941Smrg    * \param indirect  If any prims are indirect, this specifies the buffer
537b8e80941Smrg    *                  to find the "DrawArrays/ElementsIndirectCommand" data.
538b8e80941Smrg    *                  This may be deprecated in the future
539b8e80941Smrg    */
540b8e80941Smrg   void (*Draw)(struct gl_context *ctx,
541b8e80941Smrg                const struct _mesa_prim *prims, GLuint nr_prims,
542b8e80941Smrg                const struct _mesa_index_buffer *ib,
543b8e80941Smrg                GLboolean index_bounds_valid,
544b8e80941Smrg                GLuint min_index, GLuint max_index,
545b8e80941Smrg                struct gl_transform_feedback_object *tfb_vertcount,
546b8e80941Smrg                unsigned tfb_stream, struct gl_buffer_object *indirect);
547b8e80941Smrg
548b8e80941Smrg
549b8e80941Smrg   /**
550b8e80941Smrg    * Draw a primitive, getting the vertex count, instance count, start
551b8e80941Smrg    * vertex, etc. from a buffer object.
552b8e80941Smrg    * \param mode  GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
553b8e80941Smrg    * \param indirect_data  buffer to get "DrawArrays/ElementsIndirectCommand"
554b8e80941Smrg    *                       data
555b8e80941Smrg    * \param indirect_offset  offset of first primitive in indrect_data buffer
556b8e80941Smrg    * \param draw_count  number of primitives to draw
557b8e80941Smrg    * \param stride  stride, in bytes, between
558b8e80941Smrg    *                "DrawArrays/ElementsIndirectCommand" objects
559b8e80941Smrg    * \param indirect_draw_count_buffer  if non-NULL specifies a buffer to get
560b8e80941Smrg    *                                    the real draw_count value.  Used for
561b8e80941Smrg    *                                    GL_ARB_indirect_parameters.
562b8e80941Smrg    * \param indirect_draw_count_offset  offset to the draw_count value in
563b8e80941Smrg    *                                    indirect_draw_count_buffer
564b8e80941Smrg    * \param ib  index buffer for indexed drawing, NULL otherwise.
565b8e80941Smrg    */
566b8e80941Smrg   void (*DrawIndirect)(struct gl_context *ctx, GLuint mode,
567b8e80941Smrg                        struct gl_buffer_object *indirect_data,
568b8e80941Smrg                        GLsizeiptr indirect_offset, unsigned draw_count,
569b8e80941Smrg                        unsigned stride,
570b8e80941Smrg                        struct gl_buffer_object *indirect_draw_count_buffer,
571b8e80941Smrg                        GLsizeiptr indirect_draw_count_offset,
572b8e80941Smrg                        const struct _mesa_index_buffer *ib);
573b8e80941Smrg   /*@}*/
574b8e80941Smrg
575b8e80941Smrg
576848b8605Smrg   /**
577848b8605Smrg    * \name State-changing functions.
578848b8605Smrg    *
579848b8605Smrg    * \note drawing functions are above.
580848b8605Smrg    *
581848b8605Smrg    * These functions are called by their corresponding OpenGL API functions.
582848b8605Smrg    * They are \e also called by the gl_PopAttrib() function!!!
583848b8605Smrg    * May add more functions like these to the device driver in the future.
584848b8605Smrg    */
585848b8605Smrg   /*@{*/
586848b8605Smrg   /** Specify the alpha test function */
587848b8605Smrg   void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
588848b8605Smrg   /** Set the blend color */
589848b8605Smrg   void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
590848b8605Smrg   /** Set the blend equation */
591848b8605Smrg   void (*BlendEquationSeparate)(struct gl_context *ctx,
592848b8605Smrg                                 GLenum modeRGB, GLenum modeA);
593848b8605Smrg   /** Specify pixel arithmetic */
594848b8605Smrg   void (*BlendFuncSeparate)(struct gl_context *ctx,
595848b8605Smrg                             GLenum sfactorRGB, GLenum dfactorRGB,
596848b8605Smrg                             GLenum sfactorA, GLenum dfactorA);
597848b8605Smrg   /** Specify a plane against which all geometry is clipped */
598848b8605Smrg   void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *eq);
599848b8605Smrg   /** Enable and disable writing of frame buffer color components */
600848b8605Smrg   void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
601848b8605Smrg                     GLboolean bmask, GLboolean amask );
602848b8605Smrg   /** Cause a material color to track the current color */
603848b8605Smrg   void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
604848b8605Smrg   /** Specify whether front- or back-facing facets can be culled */
605848b8605Smrg   void (*CullFace)(struct gl_context *ctx, GLenum mode);
606848b8605Smrg   /** Define front- and back-facing polygons */
607848b8605Smrg   void (*FrontFace)(struct gl_context *ctx, GLenum mode);
608848b8605Smrg   /** Specify the value used for depth buffer comparisons */
609848b8605Smrg   void (*DepthFunc)(struct gl_context *ctx, GLenum func);
610848b8605Smrg   /** Enable or disable writing into the depth buffer */
611848b8605Smrg   void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
612848b8605Smrg   /** Specify mapping of depth values from NDC to window coordinates */
613848b8605Smrg   void (*DepthRange)(struct gl_context *ctx);
614848b8605Smrg   /** Specify the current buffer for writing */
615b8e80941Smrg   void (*DrawBuffer)(struct gl_context *ctx);
616b8e80941Smrg   /** Used to allocated any buffers with on-demand creation */
617b8e80941Smrg   void (*DrawBufferAllocate)(struct gl_context *ctx);
618848b8605Smrg   /** Enable or disable server-side gl capabilities */
619848b8605Smrg   void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
620848b8605Smrg   /** Specify fog parameters */
621848b8605Smrg   void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
622848b8605Smrg   /** Set light source parameters.
623848b8605Smrg    * Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
624848b8605Smrg    * been transformed to eye-space.
625848b8605Smrg    */
626848b8605Smrg   void (*Lightfv)(struct gl_context *ctx, GLenum light,
627848b8605Smrg		   GLenum pname, const GLfloat *params );
628848b8605Smrg   /** Set the lighting model parameters */
629848b8605Smrg   void (*LightModelfv)(struct gl_context *ctx, GLenum pname,
630848b8605Smrg                        const GLfloat *params);
631848b8605Smrg   /** Specify the line stipple pattern */
632848b8605Smrg   void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
633848b8605Smrg   /** Specify the width of rasterized lines */
634848b8605Smrg   void (*LineWidth)(struct gl_context *ctx, GLfloat width);
635848b8605Smrg   /** Specify a logical pixel operation for color index rendering */
636b8e80941Smrg   void (*LogicOpcode)(struct gl_context *ctx, enum gl_logicop_mode opcode);
637848b8605Smrg   void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
638848b8605Smrg                            const GLfloat *params);
639848b8605Smrg   /** Specify the diameter of rasterized points */
640848b8605Smrg   void (*PointSize)(struct gl_context *ctx, GLfloat size);
641848b8605Smrg   /** Select a polygon rasterization mode */
642848b8605Smrg   void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
643848b8605Smrg   /** Set the scale and units used to calculate depth values */
644b8e80941Smrg   void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units, GLfloat clamp);
645848b8605Smrg   /** Set the polygon stippling pattern */
646848b8605Smrg   void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
647848b8605Smrg   /* Specifies the current buffer for reading */
648848b8605Smrg   void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
649848b8605Smrg   /** Set rasterization mode */
650848b8605Smrg   void (*RenderMode)(struct gl_context *ctx, GLenum mode );
651848b8605Smrg   /** Define the scissor box */
652848b8605Smrg   void (*Scissor)(struct gl_context *ctx);
653848b8605Smrg   /** Select flat or smooth shading */
654848b8605Smrg   void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
655848b8605Smrg   /** OpenGL 2.0 two-sided StencilFunc */
656848b8605Smrg   void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
657848b8605Smrg                               GLint ref, GLuint mask);
658848b8605Smrg   /** OpenGL 2.0 two-sided StencilMask */
659848b8605Smrg   void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
660848b8605Smrg   /** OpenGL 2.0 two-sided StencilOp */
661848b8605Smrg   void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
662848b8605Smrg                             GLenum zfail, GLenum zpass);
663848b8605Smrg   /** Control the generation of texture coordinates */
664848b8605Smrg   void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
665848b8605Smrg		  const GLfloat *params);
666848b8605Smrg   /** Set texture environment parameters */
667848b8605Smrg   void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
668848b8605Smrg                  const GLfloat *param);
669b8e80941Smrg   /** Set texture parameter (callee gets param value from the texObj) */
670848b8605Smrg   void (*TexParameter)(struct gl_context *ctx,
671b8e80941Smrg                        struct gl_texture_object *texObj, GLenum pname);
672848b8605Smrg   /** Set the viewport */
673848b8605Smrg   void (*Viewport)(struct gl_context *ctx);
674848b8605Smrg   /*@}*/
675848b8605Smrg
676848b8605Smrg
677848b8605Smrg   /**
678848b8605Smrg    * \name Vertex/pixel buffer object functions
679848b8605Smrg    */
680848b8605Smrg   /*@{*/
681848b8605Smrg   struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx,
682b8e80941Smrg                                                GLuint buffer);
683848b8605Smrg
684848b8605Smrg   void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
685848b8605Smrg
686848b8605Smrg   GLboolean (*BufferData)(struct gl_context *ctx, GLenum target,
687848b8605Smrg                           GLsizeiptrARB size, const GLvoid *data, GLenum usage,
688848b8605Smrg                           GLenum storageFlags, struct gl_buffer_object *obj);
689848b8605Smrg
690848b8605Smrg   void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset,
691848b8605Smrg			  GLsizeiptrARB size, const GLvoid *data,
692848b8605Smrg			  struct gl_buffer_object *obj );
693848b8605Smrg
694848b8605Smrg   void (*GetBufferSubData)( struct gl_context *ctx,
695848b8605Smrg			     GLintptrARB offset, GLsizeiptrARB size,
696848b8605Smrg			     GLvoid *data, struct gl_buffer_object *obj );
697848b8605Smrg
698848b8605Smrg   void (*ClearBufferSubData)( struct gl_context *ctx,
699848b8605Smrg                               GLintptr offset, GLsizeiptr size,
700848b8605Smrg                               const GLvoid *clearValue,
701848b8605Smrg                               GLsizeiptr clearValueSize,
702848b8605Smrg                               struct gl_buffer_object *obj );
703848b8605Smrg
704848b8605Smrg   void (*CopyBufferSubData)( struct gl_context *ctx,
705848b8605Smrg                              struct gl_buffer_object *src,
706848b8605Smrg                              struct gl_buffer_object *dst,
707848b8605Smrg                              GLintptr readOffset, GLintptr writeOffset,
708848b8605Smrg                              GLsizeiptr size );
709848b8605Smrg
710b8e80941Smrg   void (*InvalidateBufferSubData)( struct gl_context *ctx,
711b8e80941Smrg                                    struct gl_buffer_object *obj,
712b8e80941Smrg                                    GLintptr offset,
713b8e80941Smrg                                    GLsizeiptr length );
714b8e80941Smrg
715848b8605Smrg   /* Returns pointer to the start of the mapped range.
716848b8605Smrg    * May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
717848b8605Smrg    */
718848b8605Smrg   void * (*MapBufferRange)( struct gl_context *ctx, GLintptr offset,
719848b8605Smrg                             GLsizeiptr length, GLbitfield access,
720848b8605Smrg                             struct gl_buffer_object *obj,
721848b8605Smrg                             gl_map_buffer_index index);
722848b8605Smrg
723848b8605Smrg   void (*FlushMappedBufferRange)(struct gl_context *ctx,
724848b8605Smrg                                  GLintptr offset, GLsizeiptr length,
725848b8605Smrg                                  struct gl_buffer_object *obj,
726848b8605Smrg                                  gl_map_buffer_index index);
727848b8605Smrg
728848b8605Smrg   GLboolean (*UnmapBuffer)( struct gl_context *ctx,
729848b8605Smrg			     struct gl_buffer_object *obj,
730848b8605Smrg                             gl_map_buffer_index index);
731848b8605Smrg   /*@}*/
732848b8605Smrg
733848b8605Smrg   /**
734848b8605Smrg    * \name Functions for GL_APPLE_object_purgeable
735848b8605Smrg    */
736848b8605Smrg   /*@{*/
737848b8605Smrg   /* variations on ObjectPurgeable */
738848b8605Smrg   GLenum (*BufferObjectPurgeable)(struct gl_context *ctx,
739848b8605Smrg                                   struct gl_buffer_object *obj, GLenum option);
740848b8605Smrg   GLenum (*RenderObjectPurgeable)(struct gl_context *ctx,
741848b8605Smrg                                   struct gl_renderbuffer *obj, GLenum option);
742848b8605Smrg   GLenum (*TextureObjectPurgeable)(struct gl_context *ctx,
743848b8605Smrg                                    struct gl_texture_object *obj,
744848b8605Smrg                                    GLenum option);
745848b8605Smrg
746848b8605Smrg   /* variations on ObjectUnpurgeable */
747848b8605Smrg   GLenum (*BufferObjectUnpurgeable)(struct gl_context *ctx,
748848b8605Smrg                                     struct gl_buffer_object *obj,
749848b8605Smrg                                     GLenum option);
750848b8605Smrg   GLenum (*RenderObjectUnpurgeable)(struct gl_context *ctx,
751848b8605Smrg                                     struct gl_renderbuffer *obj,
752848b8605Smrg                                     GLenum option);
753848b8605Smrg   GLenum (*TextureObjectUnpurgeable)(struct gl_context *ctx,
754848b8605Smrg                                      struct gl_texture_object *obj,
755848b8605Smrg                                      GLenum option);
756848b8605Smrg   /*@}*/
757848b8605Smrg
758848b8605Smrg   /**
759848b8605Smrg    * \name Functions for GL_EXT_framebuffer_{object,blit,discard}.
760848b8605Smrg    */
761848b8605Smrg   /*@{*/
762848b8605Smrg   struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx,
763848b8605Smrg                                             GLuint name);
764848b8605Smrg   struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx,
765848b8605Smrg                                               GLuint name);
766848b8605Smrg   void (*BindFramebuffer)(struct gl_context *ctx, GLenum target,
767848b8605Smrg                           struct gl_framebuffer *drawFb,
768848b8605Smrg                           struct gl_framebuffer *readFb);
769848b8605Smrg   void (*FramebufferRenderbuffer)(struct gl_context *ctx,
770848b8605Smrg                                   struct gl_framebuffer *fb,
771848b8605Smrg                                   GLenum attachment,
772848b8605Smrg                                   struct gl_renderbuffer *rb);
773848b8605Smrg   void (*RenderTexture)(struct gl_context *ctx,
774848b8605Smrg                         struct gl_framebuffer *fb,
775848b8605Smrg                         struct gl_renderbuffer_attachment *att);
776848b8605Smrg   void (*FinishRenderTexture)(struct gl_context *ctx,
777848b8605Smrg                               struct gl_renderbuffer *rb);
778848b8605Smrg   void (*ValidateFramebuffer)(struct gl_context *ctx,
779848b8605Smrg                               struct gl_framebuffer *fb);
780848b8605Smrg   /*@}*/
781848b8605Smrg   void (*BlitFramebuffer)(struct gl_context *ctx,
782b8e80941Smrg                           struct gl_framebuffer *readFb,
783b8e80941Smrg                           struct gl_framebuffer *drawFb,
784848b8605Smrg                           GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
785848b8605Smrg                           GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
786848b8605Smrg                           GLbitfield mask, GLenum filter);
787b8e80941Smrg   void (*DiscardFramebuffer)(struct gl_context *ctx, struct gl_framebuffer *fb,
788b8e80941Smrg                              struct gl_renderbuffer_attachment *att);
789b8e80941Smrg
790b8e80941Smrg   /**
791b8e80941Smrg    * \name Functions for GL_ARB_sample_locations
792b8e80941Smrg    */
793b8e80941Smrg   void (*GetProgrammableSampleCaps)(struct gl_context *ctx,
794b8e80941Smrg                                     const struct gl_framebuffer *fb,
795b8e80941Smrg                                     GLuint *bits, GLuint *width, GLuint *height);
796b8e80941Smrg   void (*EvaluateDepthValues)(struct gl_context *ctx);
797848b8605Smrg
798848b8605Smrg   /**
799848b8605Smrg    * \name Query objects
800848b8605Smrg    */
801848b8605Smrg   /*@{*/
802848b8605Smrg   struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id);
803848b8605Smrg   void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q);
804848b8605Smrg   void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q);
805848b8605Smrg   void (*QueryCounter)(struct gl_context *ctx, struct gl_query_object *q);
806848b8605Smrg   void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q);
807848b8605Smrg   void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q);
808848b8605Smrg   void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q);
809b8e80941Smrg   /*
810b8e80941Smrg    * \pname the value requested to be written (GL_QUERY_RESULT, etc)
811b8e80941Smrg    * \ptype the type of the value requested to be written:
812b8e80941Smrg    *    GL_UNSIGNED_INT, GL_UNSIGNED_INT64_ARB,
813b8e80941Smrg    *    GL_INT, GL_INT64_ARB
814b8e80941Smrg    */
815b8e80941Smrg   void (*StoreQueryResult)(struct gl_context *ctx, struct gl_query_object *q,
816b8e80941Smrg                            struct gl_buffer_object *buf, intptr_t offset,
817b8e80941Smrg                            GLenum pname, GLenum ptype);
818848b8605Smrg   /*@}*/
819848b8605Smrg
820848b8605Smrg   /**
821848b8605Smrg    * \name Performance monitors
822848b8605Smrg    */
823848b8605Smrg   /*@{*/
824b8e80941Smrg   void (*InitPerfMonitorGroups)(struct gl_context *ctx);
825848b8605Smrg   struct gl_perf_monitor_object * (*NewPerfMonitor)(struct gl_context *ctx);
826848b8605Smrg   void (*DeletePerfMonitor)(struct gl_context *ctx,
827848b8605Smrg                             struct gl_perf_monitor_object *m);
828848b8605Smrg   GLboolean (*BeginPerfMonitor)(struct gl_context *ctx,
829848b8605Smrg                                 struct gl_perf_monitor_object *m);
830848b8605Smrg
831848b8605Smrg   /** Stop an active performance monitor, discarding results. */
832848b8605Smrg   void (*ResetPerfMonitor)(struct gl_context *ctx,
833848b8605Smrg                            struct gl_perf_monitor_object *m);
834848b8605Smrg   void (*EndPerfMonitor)(struct gl_context *ctx,
835848b8605Smrg                          struct gl_perf_monitor_object *m);
836848b8605Smrg   GLboolean (*IsPerfMonitorResultAvailable)(struct gl_context *ctx,
837848b8605Smrg                                             struct gl_perf_monitor_object *m);
838848b8605Smrg   void (*GetPerfMonitorResult)(struct gl_context *ctx,
839848b8605Smrg                                struct gl_perf_monitor_object *m,
840848b8605Smrg                                GLsizei dataSize,
841848b8605Smrg                                GLuint *data,
842848b8605Smrg                                GLint *bytesWritten);
843848b8605Smrg   /*@}*/
844848b8605Smrg
845848b8605Smrg   /**
846b8e80941Smrg    * \name Performance Query objects
847848b8605Smrg    */
848848b8605Smrg   /*@{*/
849b8e80941Smrg   unsigned (*InitPerfQueryInfo)(struct gl_context *ctx);
850b8e80941Smrg   void (*GetPerfQueryInfo)(struct gl_context *ctx,
851b8e80941Smrg                            unsigned queryIndex,
852b8e80941Smrg                            const char **name,
853b8e80941Smrg                            GLuint *dataSize,
854b8e80941Smrg                            GLuint *numCounters,
855b8e80941Smrg                            GLuint *numActive);
856b8e80941Smrg   void (*GetPerfCounterInfo)(struct gl_context *ctx,
857b8e80941Smrg                              unsigned queryIndex,
858b8e80941Smrg                              unsigned counterIndex,
859b8e80941Smrg                              const char **name,
860b8e80941Smrg                              const char **desc,
861b8e80941Smrg                              GLuint *offset,
862b8e80941Smrg                              GLuint *data_size,
863b8e80941Smrg                              GLuint *type_enum,
864b8e80941Smrg                              GLuint *data_type_enum,
865b8e80941Smrg                              GLuint64 *raw_max);
866b8e80941Smrg   struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context *ctx,
867b8e80941Smrg                                                       unsigned queryIndex);
868b8e80941Smrg   void (*DeletePerfQuery)(struct gl_context *ctx,
869b8e80941Smrg                           struct gl_perf_query_object *obj);
870b8e80941Smrg   bool (*BeginPerfQuery)(struct gl_context *ctx,
871b8e80941Smrg                          struct gl_perf_query_object *obj);
872b8e80941Smrg   void (*EndPerfQuery)(struct gl_context *ctx,
873b8e80941Smrg                        struct gl_perf_query_object *obj);
874b8e80941Smrg   void (*WaitPerfQuery)(struct gl_context *ctx,
875b8e80941Smrg                         struct gl_perf_query_object *obj);
876b8e80941Smrg   bool (*IsPerfQueryReady)(struct gl_context *ctx,
877b8e80941Smrg                            struct gl_perf_query_object *obj);
878b8e80941Smrg   void (*GetPerfQueryData)(struct gl_context *ctx,
879b8e80941Smrg                            struct gl_perf_query_object *obj,
880b8e80941Smrg                            GLsizei dataSize,
881b8e80941Smrg                            GLuint *data,
882b8e80941Smrg                            GLuint *bytesWritten);
883848b8605Smrg   /*@}*/
884848b8605Smrg
885b8e80941Smrg
886848b8605Smrg   /**
887b8e80941Smrg    * \name GREMEDY debug/marker functions
888848b8605Smrg    */
889848b8605Smrg   /*@{*/
890b8e80941Smrg   void (*EmitStringMarker)(struct gl_context *ctx, const GLchar *string, GLsizei len);
891848b8605Smrg   /*@}*/
892848b8605Smrg
893848b8605Smrg   /**
894848b8605Smrg    * \name Support for multiple T&L engines
895848b8605Smrg    */
896848b8605Smrg   /*@{*/
897848b8605Smrg
898848b8605Smrg   /**
899848b8605Smrg    * Set by the driver-supplied T&L engine.
900848b8605Smrg    *
901848b8605Smrg    * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
902848b8605Smrg    */
903848b8605Smrg   GLuint CurrentExecPrimitive;
904848b8605Smrg
905848b8605Smrg   /**
906848b8605Smrg    * Current glBegin state of an in-progress compilation.  May be
907848b8605Smrg    * GL_POINTS, GL_TRIANGLE_STRIP, etc. or PRIM_OUTSIDE_BEGIN_END
908848b8605Smrg    * or PRIM_UNKNOWN.
909848b8605Smrg    */
910848b8605Smrg   GLuint CurrentSavePrimitive;
911848b8605Smrg
912848b8605Smrg
913848b8605Smrg#define FLUSH_STORED_VERTICES 0x1
914848b8605Smrg#define FLUSH_UPDATE_CURRENT  0x2
915848b8605Smrg   /**
916848b8605Smrg    * Set by the driver-supplied T&L engine whenever vertices are buffered
917848b8605Smrg    * between glBegin()/glEnd() objects or __struct gl_contextRec::Current
918848b8605Smrg    * is not updated.  A bitmask of the FLUSH_x values above.
919848b8605Smrg    *
920848b8605Smrg    * The dd_function_table::FlushVertices call below may be used to resolve
921848b8605Smrg    * these conditions.
922848b8605Smrg    */
923848b8605Smrg   GLbitfield NeedFlush;
924848b8605Smrg
925b8e80941Smrg   /** Need to call vbo_save_SaveFlushVertices() upon state change? */
926848b8605Smrg   GLboolean SaveNeedFlush;
927848b8605Smrg
928848b8605Smrg   /**
929848b8605Smrg    * Notify driver that the special derived value _NeedEyeCoords has
930848b8605Smrg    * changed.
931848b8605Smrg    */
932848b8605Smrg   void (*LightingSpaceChange)( struct gl_context *ctx );
933848b8605Smrg
934848b8605Smrg   /**@}*/
935848b8605Smrg
936848b8605Smrg   /**
937848b8605Smrg    * \name GL_ARB_sync interfaces
938848b8605Smrg    */
939848b8605Smrg   /*@{*/
940b8e80941Smrg   struct gl_sync_object * (*NewSyncObject)(struct gl_context *);
941848b8605Smrg   void (*FenceSync)(struct gl_context *, struct gl_sync_object *,
942848b8605Smrg                     GLenum, GLbitfield);
943848b8605Smrg   void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
944848b8605Smrg   void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
945848b8605Smrg   void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
946848b8605Smrg			  GLbitfield, GLuint64);
947848b8605Smrg   void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
948848b8605Smrg			  GLbitfield, GLuint64);
949848b8605Smrg   /*@}*/
950848b8605Smrg
951848b8605Smrg   /** GL_NV_conditional_render */
952848b8605Smrg   void (*BeginConditionalRender)(struct gl_context *ctx,
953848b8605Smrg                                  struct gl_query_object *q,
954848b8605Smrg                                  GLenum mode);
955848b8605Smrg   void (*EndConditionalRender)(struct gl_context *ctx,
956848b8605Smrg                                struct gl_query_object *q);
957848b8605Smrg
958848b8605Smrg   /**
959848b8605Smrg    * \name GL_OES_draw_texture interface
960848b8605Smrg    */
961848b8605Smrg   /*@{*/
962848b8605Smrg   void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
963848b8605Smrg                   GLfloat width, GLfloat height);
964848b8605Smrg   /*@}*/
965848b8605Smrg
966848b8605Smrg   /**
967848b8605Smrg    * \name GL_OES_EGL_image interface
968848b8605Smrg    */
969848b8605Smrg   void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
970848b8605Smrg				   struct gl_texture_object *texObj,
971848b8605Smrg				   struct gl_texture_image *texImage,
972848b8605Smrg				   GLeglImageOES image_handle);
973848b8605Smrg   void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
974848b8605Smrg					     struct gl_renderbuffer *rb,
975848b8605Smrg					     void *image_handle);
976848b8605Smrg
977848b8605Smrg   /**
978848b8605Smrg    * \name GL_EXT_transform_feedback interface
979848b8605Smrg    */
980848b8605Smrg   struct gl_transform_feedback_object *
981848b8605Smrg        (*NewTransformFeedback)(struct gl_context *ctx, GLuint name);
982848b8605Smrg   void (*DeleteTransformFeedback)(struct gl_context *ctx,
983848b8605Smrg                                   struct gl_transform_feedback_object *obj);
984848b8605Smrg   void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode,
985848b8605Smrg                                  struct gl_transform_feedback_object *obj);
986848b8605Smrg   void (*EndTransformFeedback)(struct gl_context *ctx,
987848b8605Smrg                                struct gl_transform_feedback_object *obj);
988848b8605Smrg   void (*PauseTransformFeedback)(struct gl_context *ctx,
989848b8605Smrg                                  struct gl_transform_feedback_object *obj);
990848b8605Smrg   void (*ResumeTransformFeedback)(struct gl_context *ctx,
991848b8605Smrg                                   struct gl_transform_feedback_object *obj);
992848b8605Smrg
993848b8605Smrg   /**
994848b8605Smrg    * Return the number of vertices written to a stream during the last
995848b8605Smrg    * Begin/EndTransformFeedback block.
996848b8605Smrg    */
997848b8605Smrg   GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx,
998848b8605Smrg                                       struct gl_transform_feedback_object *obj,
999848b8605Smrg                                       GLuint stream);
1000848b8605Smrg
1001848b8605Smrg   /**
1002848b8605Smrg    * \name GL_NV_texture_barrier interface
1003848b8605Smrg    */
1004848b8605Smrg   void (*TextureBarrier)(struct gl_context *ctx);
1005848b8605Smrg
1006848b8605Smrg   /**
1007848b8605Smrg    * \name GL_ARB_sampler_objects
1008848b8605Smrg    */
1009848b8605Smrg   struct gl_sampler_object * (*NewSamplerObject)(struct gl_context *ctx,
1010848b8605Smrg                                                  GLuint name);
1011848b8605Smrg
1012848b8605Smrg   /**
1013848b8605Smrg    * \name Return a timestamp in nanoseconds as defined by GL_ARB_timer_query.
1014848b8605Smrg    * This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
1015848b8605Smrg    */
1016848b8605Smrg   uint64_t (*GetTimestamp)(struct gl_context *ctx);
1017848b8605Smrg
1018848b8605Smrg   /**
1019848b8605Smrg    * \name GL_ARB_texture_multisample
1020848b8605Smrg    */
1021848b8605Smrg   void (*GetSamplePosition)(struct gl_context *ctx,
1022848b8605Smrg                             struct gl_framebuffer *fb,
1023848b8605Smrg                             GLuint index,
1024848b8605Smrg                             GLfloat *outValue);
1025848b8605Smrg
1026848b8605Smrg   /**
1027848b8605Smrg    * \name NV_vdpau_interop interface
1028848b8605Smrg    */
1029848b8605Smrg   void (*VDPAUMapSurface)(struct gl_context *ctx, GLenum target,
1030848b8605Smrg                           GLenum access, GLboolean output,
1031848b8605Smrg                           struct gl_texture_object *texObj,
1032848b8605Smrg                           struct gl_texture_image *texImage,
1033848b8605Smrg                           const GLvoid *vdpSurface, GLuint index);
1034848b8605Smrg   void (*VDPAUUnmapSurface)(struct gl_context *ctx, GLenum target,
1035848b8605Smrg                             GLenum access, GLboolean output,
1036848b8605Smrg                             struct gl_texture_object *texObj,
1037848b8605Smrg                             struct gl_texture_image *texImage,
1038848b8605Smrg                             const GLvoid *vdpSurface, GLuint index);
1039848b8605Smrg
1040848b8605Smrg   /**
1041848b8605Smrg    * Query reset status for GL_ARB_robustness
1042848b8605Smrg    *
1043848b8605Smrg    * Per \c glGetGraphicsResetStatusARB, this function should return a
1044848b8605Smrg    * non-zero value once after a reset.  If a reset is non-atomic, the
1045848b8605Smrg    * non-zero status should be returned for the duration of the reset.
1046848b8605Smrg    */
1047848b8605Smrg   GLenum (*GetGraphicsResetStatus)(struct gl_context *ctx);
1048848b8605Smrg
1049848b8605Smrg   /**
1050848b8605Smrg    * \name GL_ARB_shader_image_load_store interface.
1051848b8605Smrg    */
1052848b8605Smrg   /** @{ */
1053848b8605Smrg   void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
1054848b8605Smrg   /** @} */
1055b8e80941Smrg
1056b8e80941Smrg   /**
1057b8e80941Smrg    * GL_EXT_shader_framebuffer_fetch_non_coherent rendering barrier.
1058b8e80941Smrg    *
1059b8e80941Smrg    * On return from this function any framebuffer contents written by
1060b8e80941Smrg    * previous draw commands are guaranteed to be visible from subsequent
1061b8e80941Smrg    * fragment shader invocations using the
1062b8e80941Smrg    * EXT_shader_framebuffer_fetch_non_coherent interface.
1063b8e80941Smrg    */
1064b8e80941Smrg   /** @{ */
1065b8e80941Smrg   void (*FramebufferFetchBarrier)(struct gl_context *ctx);
1066b8e80941Smrg   /** @} */
1067b8e80941Smrg
1068b8e80941Smrg   /**
1069b8e80941Smrg    * \name GL_ARB_compute_shader interface
1070b8e80941Smrg    */
1071b8e80941Smrg   /*@{*/
1072b8e80941Smrg   void (*DispatchCompute)(struct gl_context *ctx, const GLuint *num_groups);
1073b8e80941Smrg   void (*DispatchComputeIndirect)(struct gl_context *ctx, GLintptr indirect);
1074b8e80941Smrg   /*@}*/
1075b8e80941Smrg
1076b8e80941Smrg   /**
1077b8e80941Smrg    * \name GL_ARB_compute_variable_group_size interface
1078b8e80941Smrg    */
1079b8e80941Smrg   /*@{*/
1080b8e80941Smrg   void (*DispatchComputeGroupSize)(struct gl_context *ctx,
1081b8e80941Smrg                                    const GLuint *num_groups,
1082b8e80941Smrg                                    const GLuint *group_size);
1083b8e80941Smrg   /*@}*/
1084b8e80941Smrg
1085b8e80941Smrg   /**
1086b8e80941Smrg    * Query information about memory. Device memory is e.g. VRAM. Staging
1087b8e80941Smrg    * memory is e.g. GART. All sizes are in kilobytes.
1088b8e80941Smrg    */
1089b8e80941Smrg   void (*QueryMemoryInfo)(struct gl_context *ctx,
1090b8e80941Smrg                           struct gl_memory_info *info);
1091b8e80941Smrg
1092b8e80941Smrg   /**
1093b8e80941Smrg    * Indicate that this thread is being used by Mesa as a background drawing
1094b8e80941Smrg    * thread for the given GL context.
1095b8e80941Smrg    *
1096b8e80941Smrg    * If this function is called more than once from any given thread, each
1097b8e80941Smrg    * subsequent call overrides the context that was passed in the previous
1098b8e80941Smrg    * call.  Mesa takes advantage of this to re-use a background thread to
1099b8e80941Smrg    * perform drawing on behalf of multiple contexts.
1100b8e80941Smrg    *
1101b8e80941Smrg    * Mesa may sometimes call this function from a non-background thread
1102b8e80941Smrg    * (i.e. a thread that has already been bound to a context using
1103b8e80941Smrg    * __DriverAPIRec::MakeCurrent()); when this happens, ctx will be equal to
1104b8e80941Smrg    * the context that is bound to this thread.
1105b8e80941Smrg    *
1106b8e80941Smrg    * Mesa will only call this function if GL multithreading is enabled.
1107b8e80941Smrg    */
1108b8e80941Smrg   void (*SetBackgroundContext)(struct gl_context *ctx,
1109b8e80941Smrg                                struct util_queue_monitoring *queue_info);
1110b8e80941Smrg
1111b8e80941Smrg   /**
1112b8e80941Smrg    * \name GL_ARB_sparse_buffer interface
1113b8e80941Smrg    */
1114b8e80941Smrg   /*@{*/
1115b8e80941Smrg   void (*BufferPageCommitment)(struct gl_context *ctx,
1116b8e80941Smrg                                struct gl_buffer_object *bufferObj,
1117b8e80941Smrg                                GLintptr offset, GLsizeiptr size,
1118b8e80941Smrg                                GLboolean commit);
1119b8e80941Smrg   /*@}*/
1120b8e80941Smrg
1121b8e80941Smrg   /**
1122b8e80941Smrg    * \name GL_ARB_bindless_texture interface
1123b8e80941Smrg    */
1124b8e80941Smrg   /*@{*/
1125b8e80941Smrg   GLuint64 (*NewTextureHandle)(struct gl_context *ctx,
1126b8e80941Smrg                                struct gl_texture_object *texObj,
1127b8e80941Smrg                                struct gl_sampler_object *sampObj);
1128b8e80941Smrg   void (*DeleteTextureHandle)(struct gl_context *ctx, GLuint64 handle);
1129b8e80941Smrg   void (*MakeTextureHandleResident)(struct gl_context *ctx, GLuint64 handle,
1130b8e80941Smrg                                     bool resident);
1131b8e80941Smrg   GLuint64 (*NewImageHandle)(struct gl_context *ctx,
1132b8e80941Smrg                              struct gl_image_unit *imgObj);
1133b8e80941Smrg   void (*DeleteImageHandle)(struct gl_context *ctx, GLuint64 handle);
1134b8e80941Smrg   void (*MakeImageHandleResident)(struct gl_context *ctx, GLuint64 handle,
1135b8e80941Smrg                                   GLenum access, bool resident);
1136b8e80941Smrg   /*@}*/
1137b8e80941Smrg
1138b8e80941Smrg
1139b8e80941Smrg   /**
1140b8e80941Smrg    * \name GL_EXT_external_objects interface
1141b8e80941Smrg    */
1142b8e80941Smrg   /*@{*/
1143b8e80941Smrg  /**
1144b8e80941Smrg    * Called to allocate a new memory object.  Drivers will usually
1145b8e80941Smrg    * allocate/return a subclass of gl_memory_object.
1146b8e80941Smrg    */
1147b8e80941Smrg   struct gl_memory_object * (*NewMemoryObject)(struct gl_context *ctx,
1148b8e80941Smrg                                                GLuint name);
1149b8e80941Smrg   /**
1150b8e80941Smrg    * Called to delete/free a memory object.  Drivers should free the
1151b8e80941Smrg    * object and any image data it contains.
1152b8e80941Smrg    */
1153b8e80941Smrg   void (*DeleteMemoryObject)(struct gl_context *ctx,
1154b8e80941Smrg                              struct gl_memory_object *memObj);
1155b8e80941Smrg
1156b8e80941Smrg   /**
1157b8e80941Smrg    * Set the given memory object as the texture's storage.
1158b8e80941Smrg    */
1159b8e80941Smrg   GLboolean (*SetTextureStorageForMemoryObject)(struct gl_context *ctx,
1160b8e80941Smrg                                                 struct gl_texture_object *tex_obj,
1161b8e80941Smrg                                                 struct gl_memory_object *mem_obj,
1162b8e80941Smrg                                                 GLsizei levels, GLsizei width,
1163b8e80941Smrg                                                 GLsizei height, GLsizei depth,
1164b8e80941Smrg                                                 GLuint64 offset);
1165b8e80941Smrg
1166b8e80941Smrg   /**
1167b8e80941Smrg    * Use a memory object as the backing data for a buffer object
1168b8e80941Smrg    */
1169b8e80941Smrg   GLboolean (*BufferDataMem)(struct gl_context *ctx,
1170b8e80941Smrg                              GLenum target,
1171b8e80941Smrg                              GLsizeiptrARB size,
1172b8e80941Smrg                              struct gl_memory_object *memObj,
1173b8e80941Smrg                              GLuint64 offset,
1174b8e80941Smrg                              GLenum usage,
1175b8e80941Smrg                              struct gl_buffer_object *bufObj);
1176b8e80941Smrg
1177b8e80941Smrg   /**
1178b8e80941Smrg    * Fill uuid with an unique identifier for this driver
1179b8e80941Smrg    *
1180b8e80941Smrg    * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1181b8e80941Smrg    */
1182b8e80941Smrg   void (*GetDriverUuid)(struct gl_context *ctx, char *uuid);
1183b8e80941Smrg
1184b8e80941Smrg   /**
1185b8e80941Smrg    * Fill uuid with an unique identifier for the device associated
1186b8e80941Smrg    * to this driver
1187b8e80941Smrg    *
1188b8e80941Smrg    * uuid must point to GL_UUID_SIZE_EXT bytes of available memory
1189b8e80941Smrg    */
1190b8e80941Smrg   void (*GetDeviceUuid)(struct gl_context *ctx, char *uuid);
1191b8e80941Smrg
1192b8e80941Smrg   /*@}*/
1193b8e80941Smrg
1194b8e80941Smrg   /**
1195b8e80941Smrg    * \name GL_EXT_external_objects_fd interface
1196b8e80941Smrg    */
1197b8e80941Smrg   /*@{*/
1198b8e80941Smrg   /**
1199b8e80941Smrg    * Called to import a memory object. The caller relinquishes ownership
1200b8e80941Smrg    * of fd after the call returns.
1201b8e80941Smrg    *
1202b8e80941Smrg    * Accessing fd after ImportMemoryObjectFd returns results in undefined
1203b8e80941Smrg    * behaviour. This is consistent with EXT_external_object_fd.
1204b8e80941Smrg    */
1205b8e80941Smrg   void (*ImportMemoryObjectFd)(struct gl_context *ctx,
1206b8e80941Smrg                                struct gl_memory_object *memObj,
1207b8e80941Smrg                                GLuint64 size,
1208b8e80941Smrg                                int fd);
1209b8e80941Smrg   /*@}*/
1210b8e80941Smrg
1211b8e80941Smrg   /**
1212b8e80941Smrg    * \name GL_ARB_get_program_binary
1213b8e80941Smrg    */
1214b8e80941Smrg   /*@{*/
1215b8e80941Smrg   /**
1216b8e80941Smrg    * Calls to retrieve/store a binary serialized copy of the current program.
1217b8e80941Smrg    */
1218b8e80941Smrg   void (*GetProgramBinaryDriverSHA1)(struct gl_context *ctx, uint8_t *sha1);
1219b8e80941Smrg
1220b8e80941Smrg   void (*ProgramBinarySerializeDriverBlob)(struct gl_context *ctx,
1221b8e80941Smrg                                            struct gl_shader_program *shProg,
1222b8e80941Smrg                                            struct gl_program *prog);
1223b8e80941Smrg
1224b8e80941Smrg   void (*ProgramBinaryDeserializeDriverBlob)(struct gl_context *ctx,
1225b8e80941Smrg                                              struct gl_shader_program *shProg,
1226b8e80941Smrg                                              struct gl_program *prog);
1227b8e80941Smrg   /*@}*/
1228b8e80941Smrg
1229b8e80941Smrg   /**
1230b8e80941Smrg    * \name GL_EXT_semaphore interface
1231b8e80941Smrg    */
1232b8e80941Smrg   /*@{*/
1233b8e80941Smrg  /**
1234b8e80941Smrg    * Called to allocate a new semaphore object. Drivers will usually
1235b8e80941Smrg    * allocate/return a subclass of gl_semaphore_object.
1236b8e80941Smrg    */
1237b8e80941Smrg   struct gl_semaphore_object * (*NewSemaphoreObject)(struct gl_context *ctx,
1238b8e80941Smrg                                                      GLuint name);
1239b8e80941Smrg   /**
1240b8e80941Smrg    * Called to delete/free a semaphore object. Drivers should free the
1241b8e80941Smrg    * object and any associated resources.
1242b8e80941Smrg    */
1243b8e80941Smrg   void (*DeleteSemaphoreObject)(struct gl_context *ctx,
1244b8e80941Smrg                                 struct gl_semaphore_object *semObj);
1245b8e80941Smrg
1246b8e80941Smrg   /**
1247b8e80941Smrg    * Introduce an operation to wait for the semaphore object in the GL
1248b8e80941Smrg    * server's command stream
1249b8e80941Smrg    */
1250b8e80941Smrg   void (*ServerWaitSemaphoreObject)(struct gl_context *ctx,
1251b8e80941Smrg                                     struct gl_semaphore_object *semObj,
1252b8e80941Smrg                                     GLuint numBufferBarriers,
1253b8e80941Smrg                                     struct gl_buffer_object **bufObjs,
1254b8e80941Smrg                                     GLuint numTextureBarriers,
1255b8e80941Smrg                                     struct gl_texture_object **texObjs,
1256b8e80941Smrg                                     const GLenum *srcLayouts);
1257b8e80941Smrg
1258b8e80941Smrg   /**
1259b8e80941Smrg    * Introduce an operation to signal the semaphore object in the GL
1260b8e80941Smrg    * server's command stream
1261b8e80941Smrg    */
1262b8e80941Smrg   void (*ServerSignalSemaphoreObject)(struct gl_context *ctx,
1263b8e80941Smrg                                       struct gl_semaphore_object *semObj,
1264b8e80941Smrg                                       GLuint numBufferBarriers,
1265b8e80941Smrg                                       struct gl_buffer_object **bufObjs,
1266b8e80941Smrg                                       GLuint numTextureBarriers,
1267b8e80941Smrg                                       struct gl_texture_object **texObjs,
1268b8e80941Smrg                                       const GLenum *dstLayouts);
1269b8e80941Smrg   /*@}*/
1270b8e80941Smrg
1271b8e80941Smrg   /**
1272b8e80941Smrg    * \name GL_EXT_semaphore_fd interface
1273b8e80941Smrg    */
1274b8e80941Smrg   /*@{*/
1275b8e80941Smrg   /**
1276b8e80941Smrg    * Called to import a semaphore object. The caller relinquishes ownership
1277b8e80941Smrg    * of fd after the call returns.
1278b8e80941Smrg    *
1279b8e80941Smrg    * Accessing fd after ImportSemaphoreFd returns results in undefined
1280b8e80941Smrg    * behaviour. This is consistent with EXT_semaphore_fd.
1281b8e80941Smrg    */
1282b8e80941Smrg   void (*ImportSemaphoreFd)(struct gl_context *ctx,
1283b8e80941Smrg                                struct gl_semaphore_object *semObj,
1284b8e80941Smrg                                int fd);
1285b8e80941Smrg   /*@}*/
1286b8e80941Smrg
1287b8e80941Smrg   /**
1288b8e80941Smrg    * \name Disk shader cache functions
1289b8e80941Smrg    */
1290b8e80941Smrg   /*@{*/
1291b8e80941Smrg   /**
1292b8e80941Smrg    * Called to initialize gl_program::driver_cache_blob (and size) with a
1293b8e80941Smrg    * ralloc allocated buffer.
1294b8e80941Smrg    *
1295b8e80941Smrg    * This buffer will be saved and restored as part of the gl_program
1296b8e80941Smrg    * serialization and deserialization.
1297b8e80941Smrg    */
1298b8e80941Smrg   void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
1299b8e80941Smrg                                          struct gl_program *prog);
1300b8e80941Smrg   /*@}*/
1301b8e80941Smrg
1302b8e80941Smrg   /**
1303b8e80941Smrg    * \name Set the number of compiler threads for ARB_parallel_shader_compile
1304b8e80941Smrg    */
1305b8e80941Smrg   void (*SetMaxShaderCompilerThreads)(struct gl_context *ctx, unsigned count);
1306b8e80941Smrg   bool (*GetShaderProgramCompletionStatus)(struct gl_context *ctx,
1307b8e80941Smrg                                            struct gl_shader_program *shprog);
1308848b8605Smrg};
1309848b8605Smrg
1310848b8605Smrg
1311848b8605Smrg/**
1312848b8605Smrg * Per-vertex functions.
1313848b8605Smrg *
1314848b8605Smrg * These are the functions which can appear between glBegin and glEnd.
1315848b8605Smrg * Depending on whether we're inside or outside a glBegin/End pair
1316848b8605Smrg * and whether we're in immediate mode or building a display list, these
1317848b8605Smrg * functions behave differently.  This structure allows us to switch
1318848b8605Smrg * between those modes more easily.
1319848b8605Smrg *
1320848b8605Smrg * Generally, these pointers point to functions in the VBO module.
1321848b8605Smrg */
1322848b8605Smrgtypedef struct {
1323848b8605Smrg   void (GLAPIENTRYP ArrayElement)( GLint );
1324848b8605Smrg   void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat );
1325848b8605Smrg   void (GLAPIENTRYP Color3fv)( const GLfloat * );
1326848b8605Smrg   void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1327848b8605Smrg   void (GLAPIENTRYP Color4fv)( const GLfloat * );
1328848b8605Smrg   void (GLAPIENTRYP EdgeFlag)( GLboolean );
1329848b8605Smrg   void (GLAPIENTRYP EvalCoord1f)( GLfloat );
1330848b8605Smrg   void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * );
1331848b8605Smrg   void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat );
1332848b8605Smrg   void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * );
1333848b8605Smrg   void (GLAPIENTRYP EvalPoint1)( GLint );
1334848b8605Smrg   void (GLAPIENTRYP EvalPoint2)( GLint, GLint );
1335848b8605Smrg   void (GLAPIENTRYP FogCoordfEXT)( GLfloat );
1336848b8605Smrg   void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * );
1337848b8605Smrg   void (GLAPIENTRYP Indexf)( GLfloat );
1338848b8605Smrg   void (GLAPIENTRYP Indexfv)( const GLfloat * );
1339848b8605Smrg   void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * );
1340848b8605Smrg   void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat );
1341848b8605Smrg   void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * );
1342848b8605Smrg   void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat );
1343848b8605Smrg   void (GLAPIENTRYP MultiTexCoord2fvARB)( GLenum, const GLfloat * );
1344848b8605Smrg   void (GLAPIENTRYP MultiTexCoord3fARB)( GLenum, GLfloat, GLfloat, GLfloat );
1345848b8605Smrg   void (GLAPIENTRYP MultiTexCoord3fvARB)( GLenum, const GLfloat * );
1346848b8605Smrg   void (GLAPIENTRYP MultiTexCoord4fARB)( GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
1347848b8605Smrg   void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
1348848b8605Smrg   void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
1349848b8605Smrg   void (GLAPIENTRYP Normal3fv)( const GLfloat * );
1350848b8605Smrg   void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
1351848b8605Smrg   void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
1352848b8605Smrg   void (GLAPIENTRYP TexCoord1f)( GLfloat );
1353848b8605Smrg   void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
1354848b8605Smrg   void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
1355848b8605Smrg   void (GLAPIENTRYP TexCoord2fv)( const GLfloat * );
1356848b8605Smrg   void (GLAPIENTRYP TexCoord3f)( GLfloat, GLfloat, GLfloat );
1357848b8605Smrg   void (GLAPIENTRYP TexCoord3fv)( const GLfloat * );
1358848b8605Smrg   void (GLAPIENTRYP TexCoord4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1359848b8605Smrg   void (GLAPIENTRYP TexCoord4fv)( const GLfloat * );
1360848b8605Smrg   void (GLAPIENTRYP Vertex2f)( GLfloat, GLfloat );
1361848b8605Smrg   void (GLAPIENTRYP Vertex2fv)( const GLfloat * );
1362848b8605Smrg   void (GLAPIENTRYP Vertex3f)( GLfloat, GLfloat, GLfloat );
1363848b8605Smrg   void (GLAPIENTRYP Vertex3fv)( const GLfloat * );
1364848b8605Smrg   void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat );
1365848b8605Smrg   void (GLAPIENTRYP Vertex4fv)( const GLfloat * );
1366848b8605Smrg   void (GLAPIENTRYP CallList)( GLuint );
1367848b8605Smrg   void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
1368848b8605Smrg   void (GLAPIENTRYP Begin)( GLenum );
1369848b8605Smrg   void (GLAPIENTRYP End)( void );
1370848b8605Smrg   void (GLAPIENTRYP PrimitiveRestartNV)( void );
1371848b8605Smrg   /* Originally for GL_NV_vertex_program, now used only dlist.c and friends */
1372848b8605Smrg   void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
1373848b8605Smrg   void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
1374848b8605Smrg   void (GLAPIENTRYP VertexAttrib2fNV)( GLuint index, GLfloat x, GLfloat y );
1375848b8605Smrg   void (GLAPIENTRYP VertexAttrib2fvNV)( GLuint index, const GLfloat *v );
1376848b8605Smrg   void (GLAPIENTRYP VertexAttrib3fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1377848b8605Smrg   void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v );
1378848b8605Smrg   void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1379848b8605Smrg   void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
1380848b8605Smrg   /* GL_ARB_vertex_program */
1381848b8605Smrg   void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x );
1382848b8605Smrg   void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v );
1383848b8605Smrg   void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y );
1384848b8605Smrg   void (GLAPIENTRYP VertexAttrib2fvARB)( GLuint index, const GLfloat *v );
1385848b8605Smrg   void (GLAPIENTRYP VertexAttrib3fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z );
1386848b8605Smrg   void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v );
1387848b8605Smrg   void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
1388848b8605Smrg   void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v );
1389848b8605Smrg
1390848b8605Smrg   /* GL_EXT_gpu_shader4 / GL 3.0 */
1391848b8605Smrg   void (GLAPIENTRYP VertexAttribI1i)( GLuint index, GLint x);
1392848b8605Smrg   void (GLAPIENTRYP VertexAttribI2i)( GLuint index, GLint x, GLint y);
1393848b8605Smrg   void (GLAPIENTRYP VertexAttribI3i)( GLuint index, GLint x, GLint y, GLint z);
1394848b8605Smrg   void (GLAPIENTRYP VertexAttribI4i)( GLuint index, GLint x, GLint y, GLint z, GLint w);
1395848b8605Smrg   void (GLAPIENTRYP VertexAttribI2iv)( GLuint index, const GLint *v);
1396848b8605Smrg   void (GLAPIENTRYP VertexAttribI3iv)( GLuint index, const GLint *v);
1397848b8605Smrg   void (GLAPIENTRYP VertexAttribI4iv)( GLuint index, const GLint *v);
1398848b8605Smrg
1399848b8605Smrg   void (GLAPIENTRYP VertexAttribI1ui)( GLuint index, GLuint x);
1400848b8605Smrg   void (GLAPIENTRYP VertexAttribI2ui)( GLuint index, GLuint x, GLuint y);
1401848b8605Smrg   void (GLAPIENTRYP VertexAttribI3ui)( GLuint index, GLuint x, GLuint y, GLuint z);
1402848b8605Smrg   void (GLAPIENTRYP VertexAttribI4ui)( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1403848b8605Smrg   void (GLAPIENTRYP VertexAttribI2uiv)( GLuint index, const GLuint *v);
1404848b8605Smrg   void (GLAPIENTRYP VertexAttribI3uiv)( GLuint index, const GLuint *v);
1405848b8605Smrg   void (GLAPIENTRYP VertexAttribI4uiv)( GLuint index, const GLuint *v);
1406848b8605Smrg
1407848b8605Smrg   /* GL_ARB_vertex_type_10_10_10_2_rev / GL3.3 */
1408848b8605Smrg   void (GLAPIENTRYP VertexP2ui)( GLenum type, GLuint value );
1409848b8605Smrg   void (GLAPIENTRYP VertexP2uiv)( GLenum type, const GLuint *value);
1410848b8605Smrg
1411848b8605Smrg   void (GLAPIENTRYP VertexP3ui)( GLenum type, GLuint value );
1412848b8605Smrg   void (GLAPIENTRYP VertexP3uiv)( GLenum type, const GLuint *value);
1413848b8605Smrg
1414848b8605Smrg   void (GLAPIENTRYP VertexP4ui)( GLenum type, GLuint value );
1415848b8605Smrg   void (GLAPIENTRYP VertexP4uiv)( GLenum type, const GLuint *value);
1416848b8605Smrg
1417848b8605Smrg   void (GLAPIENTRYP TexCoordP1ui)( GLenum type, GLuint coords );
1418848b8605Smrg   void (GLAPIENTRYP TexCoordP1uiv)( GLenum type, const GLuint *coords );
1419848b8605Smrg
1420848b8605Smrg   void (GLAPIENTRYP TexCoordP2ui)( GLenum type, GLuint coords );
1421848b8605Smrg   void (GLAPIENTRYP TexCoordP2uiv)( GLenum type, const GLuint *coords );
1422848b8605Smrg
1423848b8605Smrg   void (GLAPIENTRYP TexCoordP3ui)( GLenum type, GLuint coords );
1424848b8605Smrg   void (GLAPIENTRYP TexCoordP3uiv)( GLenum type, const GLuint *coords );
1425848b8605Smrg
1426848b8605Smrg   void (GLAPIENTRYP TexCoordP4ui)( GLenum type, GLuint coords );
1427848b8605Smrg   void (GLAPIENTRYP TexCoordP4uiv)( GLenum type, const GLuint *coords );
1428848b8605Smrg
1429848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP1ui)( GLenum texture, GLenum type, GLuint coords );
1430848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP1uiv)( GLenum texture, GLenum type, const GLuint *coords );
1431848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP2ui)( GLenum texture, GLenum type, GLuint coords );
1432848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP2uiv)( GLenum texture, GLenum type, const GLuint *coords );
1433848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP3ui)( GLenum texture, GLenum type, GLuint coords );
1434848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP3uiv)( GLenum texture, GLenum type, const GLuint *coords );
1435848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP4ui)( GLenum texture, GLenum type, GLuint coords );
1436848b8605Smrg   void (GLAPIENTRYP MultiTexCoordP4uiv)( GLenum texture, GLenum type, const GLuint *coords );
1437848b8605Smrg
1438848b8605Smrg   void (GLAPIENTRYP NormalP3ui)( GLenum type, GLuint coords );
1439848b8605Smrg   void (GLAPIENTRYP NormalP3uiv)( GLenum type, const GLuint *coords );
1440848b8605Smrg
1441848b8605Smrg   void (GLAPIENTRYP ColorP3ui)( GLenum type, GLuint color );
1442848b8605Smrg   void (GLAPIENTRYP ColorP3uiv)( GLenum type, const GLuint *color );
1443848b8605Smrg
1444848b8605Smrg   void (GLAPIENTRYP ColorP4ui)( GLenum type, GLuint color );
1445848b8605Smrg   void (GLAPIENTRYP ColorP4uiv)( GLenum type, const GLuint *color );
1446848b8605Smrg
1447848b8605Smrg   void (GLAPIENTRYP SecondaryColorP3ui)( GLenum type, GLuint color );
1448848b8605Smrg   void (GLAPIENTRYP SecondaryColorP3uiv)( GLenum type, const GLuint *color );
1449848b8605Smrg
1450848b8605Smrg   void (GLAPIENTRYP VertexAttribP1ui)( GLuint index, GLenum type,
1451848b8605Smrg					GLboolean normalized, GLuint value);
1452848b8605Smrg   void (GLAPIENTRYP VertexAttribP2ui)( GLuint index, GLenum type,
1453848b8605Smrg					GLboolean normalized, GLuint value);
1454848b8605Smrg   void (GLAPIENTRYP VertexAttribP3ui)( GLuint index, GLenum type,
1455848b8605Smrg					GLboolean normalized, GLuint value);
1456848b8605Smrg   void (GLAPIENTRYP VertexAttribP4ui)( GLuint index, GLenum type,
1457848b8605Smrg					GLboolean normalized, GLuint value);
1458848b8605Smrg   void (GLAPIENTRYP VertexAttribP1uiv)( GLuint index, GLenum type,
1459848b8605Smrg					GLboolean normalized,
1460848b8605Smrg					 const GLuint *value);
1461848b8605Smrg   void (GLAPIENTRYP VertexAttribP2uiv)( GLuint index, GLenum type,
1462848b8605Smrg					GLboolean normalized,
1463848b8605Smrg					 const GLuint *value);
1464848b8605Smrg   void (GLAPIENTRYP VertexAttribP3uiv)( GLuint index, GLenum type,
1465848b8605Smrg					GLboolean normalized,
1466848b8605Smrg					 const GLuint *value);
1467848b8605Smrg   void (GLAPIENTRYP VertexAttribP4uiv)( GLuint index, GLenum type,
1468848b8605Smrg					 GLboolean normalized,
1469848b8605Smrg					 const GLuint *value);
1470b8e80941Smrg
1471b8e80941Smrg   /* GL_ARB_vertex_attrib_64bit / GL 4.1 */
1472b8e80941Smrg   void (GLAPIENTRYP VertexAttribL1d)( GLuint index, GLdouble x);
1473b8e80941Smrg   void (GLAPIENTRYP VertexAttribL2d)( GLuint index, GLdouble x, GLdouble y);
1474b8e80941Smrg   void (GLAPIENTRYP VertexAttribL3d)( GLuint index, GLdouble x, GLdouble y, GLdouble z);
1475b8e80941Smrg   void (GLAPIENTRYP VertexAttribL4d)( GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1476b8e80941Smrg
1477b8e80941Smrg
1478b8e80941Smrg   void (GLAPIENTRYP VertexAttribL1dv)( GLuint index, const GLdouble *v);
1479b8e80941Smrg   void (GLAPIENTRYP VertexAttribL2dv)( GLuint index, const GLdouble *v);
1480b8e80941Smrg   void (GLAPIENTRYP VertexAttribL3dv)( GLuint index, const GLdouble *v);
1481b8e80941Smrg   void (GLAPIENTRYP VertexAttribL4dv)( GLuint index, const GLdouble *v);
1482b8e80941Smrg
1483b8e80941Smrg   void (GLAPIENTRYP VertexAttribL1ui64ARB)( GLuint index, GLuint64EXT x);
1484b8e80941Smrg   void (GLAPIENTRYP VertexAttribL1ui64vARB)( GLuint index, const GLuint64EXT *v);
1485848b8605Smrg} GLvertexformat;
1486848b8605Smrg
1487848b8605Smrg
1488848b8605Smrg#endif /* DD_INCLUDED */
1489