osmesa: add new OSMesaCreateContextAttribs function
[mesa.git] / include / GL / osmesa.h
index ac66e77e854613cdd3ad7291b723f38200523a56..39cd54ef9b7e72f0daa9ccab195312cb6312df7f 100644 (file)
@@ -1,10 +1,7 @@
-/* $Id: osmesa.h,v 1.4 2000/01/18 17:29:18 brianp Exp $ */
-
 /*
  * Mesa 3-D graphics library
- * Version:  3.3
  * 
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
  *   OSMesaGetIntegerv - return OSMesa state parameters
  *
  *
- * The limits on the width and height of an image buffer are MAX_WIDTH and
- * MAX_HEIGHT as defined in Mesa/src/config.h.  Defaults are 1280 and 1024.
- * You can increase them as needed but beware that many temporary arrays in
- * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
+ * The limits on the width and height of an image buffer can be retrieved
+ * via OSMesaGetIntegerv(OSMESA_MAX_WIDTH/OSMESA_MAX_HEIGHT).
  */
 
 
@@ -59,11 +55,12 @@ extern "C" {
 #endif
 
 
-#include "GL/gl.h"
+#include <GL/gl.h>
 
 
-#define OSMESA_MAJOR_VERSION 3
-#define OSMESA_MINOR_VERSION 3
+#define OSMESA_MAJOR_VERSION 11
+#define OSMESA_MINOR_VERSION 2
+#define OSMESA_PATCH_VERSION 0
 
 
 
@@ -77,6 +74,7 @@ extern "C" {
 #define OSMESA_ARGB            0x2
 #define OSMESA_RGB             GL_RGB
 #define OSMESA_BGR             0x4
+#define OSMESA_RGB_565         0x5
 
 
 /*
@@ -94,25 +92,25 @@ extern "C" {
 #define OSMESA_HEIGHT          0x21
 #define OSMESA_FORMAT          0x22
 #define OSMESA_TYPE            0x23
-
+#define OSMESA_MAX_WIDTH       0x24  /* new in 4.0 */
+#define OSMESA_MAX_HEIGHT      0x25  /* new in 4.0 */
 
 /*
- * Accepted by OSMesaGetBooleanv:
- * New in version 3.3
+ * Accepted in OSMesaCreateContextAttrib's attribute list.
  */
-/* This is based on the HP proposed extension */
-#define OSMESA_OCCLUSION_TEST_RESULT_HP        0x30
-
+#define OSMESA_DEPTH_BITS            0x30
+#define OSMESA_STENCIL_BITS          0x31
+#define OSMESA_ACCUM_BITS            0x32
+#define OSMESA_PROFILE               0x33
+#define OSMESA_CORE_PROFILE          0x34
+#define OSMESA_COMPAT_PROFILE        0x35
+#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
+#define OSMESA_CONTEXT_MINOR_VERSION 0x37
 
 
 typedef struct osmesa_context *OSMesaContext;
 
 
-#if defined(__BEOS__) || defined(__QUICKDRAW__)
-#pragma export on
-#endif
-
-
 /*
  * Create an Off-Screen Mesa rendering context.  The only attribute needed is
  * an RGBA vs Color-Index mode flag.
@@ -123,18 +121,60 @@ typedef struct osmesa_context *OSMesaContext;
  *                     display lists.  NULL indicates no sharing.
  * Return:  an OSMesaContext or 0 if error
  */
-GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format,
-                                                    OSMesaContext sharelist );
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
 
 
 
+/*
+ * Create an Off-Screen Mesa rendering context and specify desired
+ * size of depth buffer, stencil buffer and accumulation buffer.
+ * If you specify zero for depthBits, stencilBits, accumBits you
+ * can save some memory.
+ *
+ * New in Mesa 3.5
+ */
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
+                        GLint accumBits, OSMesaContext sharelist);
+
+
+/*
+ * Create an Off-Screen Mesa rendering context with attribute list.
+ * The list is composed of (attribute, value) pairs and terminated with
+ * attribute==0.  Supported Attributes:
+ *
+ * Attributes                    Values
+ * --------------------------------------------------------------------------
+ * OSMESA_FORMAT                 OSMESA_RGBA*, OSMESA_BGRA, OSMESA_ARGB, etc.
+ * OSMESA_DEPTH_BITS             0*, 16, 24, 32
+ * OSMESA_STENCIL_BITS           0*, 8
+ * OSMESA_ACCUM_BITS             0*, 16
+ * OSMESA_PROFILE                OSMESA_COMPAT_PROFILE*, OSMESA_CORE_PROFILE
+ * OSMESA_CONTEXT_MAJOR_VERSION  1*, 2, 3
+ * OSMESA_CONTEXT_MINOR_VERSION  0+
+ *
+ * Note: * = default value
+ *
+ * We return a context version >= what's specified by OSMESA_CONTEXT_MAJOR/
+ * MINOR_VERSION for the given profile.  For example, if you request a GL 1.4
+ * compat profile, you might get a GL 3.0 compat profile.
+ * Otherwise, null is returned if the version/profile is not supported.
+ *
+ * New in Mesa 11.2
+ */
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaCreateContextAttribs( const int *attribList, OSMesaContext sharelist );
+
+
 
 /*
  * Destroy an Off-Screen Mesa rendering context.
  *
  * Input:  ctx - the context to destroy
  */
-GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
+GLAPI void GLAPIENTRY
+OSMesaDestroyContext( OSMesaContext ctx );
 
 
 
@@ -165,9 +205,9 @@ GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
  *          invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
  *          width>internal limit or height>internal limit.
  */
-GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
-                                              void *buffer, GLenum type,
-                                              GLsizei width, GLsizei height );
+GLAPI GLboolean GLAPIENTRY
+OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
+                   GLsizei width, GLsizei height );
 
 
 
@@ -175,7 +215,8 @@ GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
 /*
  * Return the current Off-Screen Mesa rendering context handle.
  */
-GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaGetCurrentContext( void );
 
 
 
@@ -192,7 +233,8 @@ GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
  *
  * New in version 2.0.
  */
-GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
+GLAPI void GLAPIENTRY
+OSMesaPixelStore( GLint pname, GLint value );
 
 
 
@@ -207,41 +249,79 @@ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
  *                 OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
  *         value - pointer to integer in which to return result.
  */
-GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
+GLAPI void GLAPIENTRY
+OSMesaGetIntegerv( GLint pname, GLint *value );
 
 
 
 /*
- * Return a boolean value like glGetBooleanv.
- * Input:  pname -
- *                 OSMESA_OCCLUSION_TEST_RESULT_HP  return current test result
- *         value - pointer to boolean in which to return result.
+ * Return the depth buffer associated with an OSMesa context.
+ * Input:  c - the OSMesa context
+ * Output:  width, height - size of buffer in pixels
+ *          bytesPerValue - bytes per depth value (2 or 4)
+ *          buffer - pointer to depth buffer values
+ * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
+ *
+ * New in Mesa 2.4.
  */
-GLAPI void GLAPIENTRY OSMesaGetBooleanv( GLint pname, GLboolean *value );
+GLAPI GLboolean GLAPIENTRY
+OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
+                      GLint *bytesPerValue, void **buffer );
 
 
 
 /*
- * Return the depth buffer associated with an OSMesa context.
+ * Return the color buffer associated with an OSMesa context.
  * Input:  c - the OSMesa context
  * Output:  width, height - size of buffer in pixels
- *          bytesPerValue - bytes per depth value (2 or 4)
+ *          format - buffer format (OSMESA_FORMAT)
  *          buffer - pointer to depth buffer values
  * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
  *
- * New in Mesa 2.4.
+ * New in Mesa 3.3.
  */
-GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
-                                                 GLint *width, GLint *height,
-                                                 GLint *bytesPerValue,
-                                                 void **buffer );
+GLAPI GLboolean GLAPIENTRY
+OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
+                      GLint *format, void **buffer );
 
 
 
+/**
+ * This typedef is new in Mesa 6.3.
+ */
+typedef void (*OSMESAproc)();
 
-#if defined(__BEOS__) || defined(__QUICKDRAW__)
-#pragma export off
-#endif
+
+/*
+ * Return pointer to the named function.
+ * New in Mesa 4.1
+ * Return OSMESAproc in 6.3.
+ */
+GLAPI OSMESAproc GLAPIENTRY
+OSMesaGetProcAddress( const char *funcName );
+
+
+
+/**
+ * Enable/disable color clamping, off by default.
+ * New in Mesa 6.4.2
+ */
+GLAPI void GLAPIENTRY
+OSMesaColorClamp(GLboolean enable);
+
+
+/**
+ * Enable/disable Gallium post-process filters.
+ * This should be called after a context is created, but before it is
+ * made current for the first time.  After a context has been made
+ * current, this function has no effect.
+ * If the enable_value param is zero, the filter is disabled.  Otherwise
+ * the filter is enabled, and the value may control the filter's quality.
+ * New in Mesa 10.0
+ */
+GLAPI void GLAPIENTRY
+OSMesaPostprocess(OSMesaContext osmesa, const char *filter,
+                  unsigned enable_value);
 
 
 #ifdef __cplusplus