Commit 209657f6 authored by Mike Gabriel's avatar Mike Gabriel Committed by ftrapero

nx-X11/extras/Mesa: Drop bundled Mesa, place a symlink to imported Git subtree…

nx-X11/extras/Mesa: Drop bundled Mesa, place a symlink to imported Git subtree of Mesa_6.4.1 instead.
parent 459021c1
Mesa_6.4.1
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2003 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
/*
* Mesa Off-Screen rendering interface.
*
* This is an operating system and window system independent interface to
* Mesa which allows one to render images into a client-supplied buffer in
* main memory. Such images may manipulated or saved in whatever way the
* client wants.
*
* These are the API functions:
* OSMesaCreateContext - create a new Off-Screen Mesa rendering context
* OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
* and make the specified context the current one.
* OSMesaDestroyContext - destroy an OSMesaContext
* OSMesaGetCurrentContext - return thread's current context ID
* OSMesaPixelStore - controls how pixels are stored in image buffer
* 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.
*/
#ifndef OSMESA_H
#define OSMESA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <GL/gl.h>
#define OSMESA_MAJOR_VERSION 6
#define OSMESA_MINOR_VERSION 3
#define OSMESA_PATCH_VERSION 0
/*
* Values for the format parameter of OSMesaCreateContext()
* New in version 2.0.
*/
#define OSMESA_COLOR_INDEX GL_COLOR_INDEX
#define OSMESA_RGBA GL_RGBA
#define OSMESA_BGRA 0x1
#define OSMESA_ARGB 0x2
#define OSMESA_RGB GL_RGB
#define OSMESA_BGR 0x4
#define OSMESA_RGB_565 0x5
/*
* OSMesaPixelStore() parameters:
* New in version 2.0.
*/
#define OSMESA_ROW_LENGTH 0x10
#define OSMESA_Y_UP 0x11
/*
* Accepted by OSMesaGetIntegerv:
*/
#define OSMESA_WIDTH 0x20
#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 */
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.
*
* Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
* OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
* sharelist - specifies another OSMesaContext with which to share
* display lists. NULL indicates no sharing.
* Return: an OSMesaContext or 0 if error
*/
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);
/*
* Destroy an Off-Screen Mesa rendering context.
*
* Input: ctx - the context to destroy
*/
GLAPI void GLAPIENTRY
OSMesaDestroyContext( OSMesaContext ctx );
/*
* Bind an OSMesaContext to an image buffer. The image buffer is just a
* block of memory which the client provides. Its size must be at least
* as large as width*height*sizeof(type). Its address should be a multiple
* of 4 if using RGBA mode.
*
* Image data is stored in the order of glDrawPixels: row-major order
* with the lower-left image pixel stored in the first array position
* (ie. bottom-to-top).
*
* Since the only type initially supported is GL_UNSIGNED_BYTE, if the
* context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
* value. If the context is in color indexed mode, each pixel will be
* stored as a 1-byte value.
*
* If the context's viewport hasn't been initialized yet, it will now be
* initialized to (0,0,width,height).
*
* Input: ctx - the rendering context
* buffer - the image buffer memory
* type - data type for pixel components, only GL_UNSIGNED_BYTE
* supported now
* width, height - size of image buffer in pixels, at least 1
* Return: GL_TRUE if success, GL_FALSE if error because of invalid 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 );
/*
* Return the current Off-Screen Mesa rendering context handle.
*/
GLAPI OSMesaContext GLAPIENTRY
OSMesaGetCurrentContext( void );
/*
* Set pixel store/packing parameters for the current context.
* This is similar to glPixelStore.
* Input: pname - OSMESA_ROW_LENGTH
* specify actual pixels per row in image buffer
* 0 = same as image width (default)
* OSMESA_Y_UP
* zero = Y coordinates increase downward
* non-zero = Y coordinates increase upward (default)
* value - the value for the parameter pname
*
* New in version 2.0.
*/
GLAPI void GLAPIENTRY
OSMesaPixelStore( GLint pname, GLint value );
/*
* Return an integer value like glGetIntegerv.
* Input: pname -
* OSMESA_WIDTH return current image width
* OSMESA_HEIGHT return current image height
* OSMESA_FORMAT return image format
* OSMESA_TYPE return color component data type
* OSMESA_ROW_LENGTH return row length in pixels
* 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 );
/*
* 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 GLboolean GLAPIENTRY
OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
GLint *bytesPerValue, void **buffer );
/*
* Return the color buffer associated with an OSMesa context.
* Input: c - the OSMesa context
* Output: width, height - size of buffer in pixels
* 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 3.3.
*/
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)();
/*
* Return pointer to the named function.
* New in Mesa 4.1
* Return OSMESAproc in 6.3.
*/
GLAPI OSMESAproc GLAPIENTRY
OSMesaGetProcAddress( const char *funcName );
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif
#ifdef __cplusplus
}
#endif
#endif
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
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"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of 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 NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
* When we're building the XMesa driver for use in the X server (as the
* indirect render) we include this file when building the xm_*.c files.
* We need to define some types and macros differently when building
* in the Xserver vs. stand-alone Mesa.
*/
#ifndef _XMESA_XF86_H_
#define _XMESA_XF86_H_
#include "scrnintstr.h"
#include "pixmapstr.h"
typedef struct _XMesaImageRec XMesaImage;
typedef ScreenRec XMesaDisplay;
typedef PixmapPtr XMesaPixmap;
typedef ColormapPtr XMesaColormap;
typedef DrawablePtr XMesaDrawable;
typedef WindowPtr XMesaWindow;
typedef GCPtr XMesaGC;
typedef VisualPtr XMesaVisualInfo;
typedef DDXPointRec XMesaPoint;
typedef xColorItem XMesaColor;
#define XMesaSetGeneric(__d,__gc,__val,__mask) \
do { \
CARD32 __v[1]; \
(void) __d; \
__v[0] = __val; \
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
} while (0)
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
do { \
ChangeGCVal __v[1]; \
(void) __d; \
__v[0].ptr = __pval; \
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
} while (0)
#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
#define XMesaSetPlaneMask(d,gc,v) XMesaSetGeneric(d,gc,v,GCPlaneMask)
#define XMesaSetFunction(d,gc,v) XMesaSetGeneric(d,gc,v,GCFunction)
#define XMesaSetFillStyle(d,gc,v) XMesaSetGeneric(d,gc,v,GCFillStyle)
#define XMesaSetTile(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCTile)
#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
do { \
XMesaPoint __p[1]; \
(void) __d; \
__p[0].x = __x; \
__p[0].y = __y; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
} while (0)
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
do { \
(void) __d; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
} while (0)
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
do { \
xRectangle __r[1]; \
(void) __d; \
ValidateGC((DrawablePtr)__b, __gc); \
__r[0].x = __x; \
__r[0].y = __y; \
__r[0].width = __w; \
__r[0].height = __h; \
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
} while (0)
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
do { \
/* Assumes: Images are always in ZPixmap format */ \
(void) __d; \
if (__sx || __sy) /* The non-trivial case */ \
XMesaPutImageHelper(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h); \
ValidateGC(__b, __gc); \
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
__x, __y, __w, __h, 0, ZPixmap, \
((XMesaImage *)(__i))->data); \
} while (0)
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
do { \
(void) __d; \
ValidateGC(__db, __gc); \
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
__sx, __sy, __w, __h, __x, __y); \
} while (0)
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
(*__d->CreatePixmap)(__d, __w, __h, __depth)
#define XMesaFreePixmap(__d,__b) \
(*__d->DestroyPixmap)(__b)
#define XMesaFreeGC(__d,__gc) \
do { \
(void) __d; \
FreeScratchGC(__gc); \
} while (0)
#define GET_COLORMAP_SIZE(__v) __v->ColormapEntries
#define GET_REDMASK(__v) __v->mesa_visual.redMask
#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
#define GET_VISUAL_DEPTH(__v) __v->nplanes
#define GET_BLACK_PIXEL(__v) __v->display->blackPixel
#define CHECK_BYTE_ORDER(__v) GL_TRUE
#define CHECK_FOR_HPCR(__v) GL_FALSE
#endif
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
**
*/
#include <GL/gl.h>
#include "indirect_size.h"
/*
** Return the number of elements per group of a specified format
*/
GLint __glElementsPerGroup(GLenum format, GLenum type)
{
/*
** To make row length computation valid for image extraction,
** packed pixel types assume elements per group equals one.
*/
switch(type) {
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_SHORT_8_8_APPLE:
case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
case GL_UNSIGNED_SHORT_15_1_MESA:
case GL_UNSIGNED_SHORT_1_15_REV_MESA:
case GL_UNSIGNED_INT_8_8_8_8:
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_24_8_NV:
case GL_UNSIGNED_INT_24_8_MESA:
case GL_UNSIGNED_INT_8_24_REV_MESA:
return 1;
default:
break;
}
switch(format) {
case GL_RGB:
case GL_BGR:
return 3;
case GL_422_EXT:
case GL_422_REV_EXT:
case GL_422_AVERAGE_EXT:
case GL_422_REV_AVERAGE_EXT:
case GL_YCBCR_422_APPLE:
case GL_LUMINANCE_ALPHA:
return 2;
case GL_RGBA:
case GL_BGRA:
case GL_ABGR_EXT:
return 4;
case GL_COLOR_INDEX:
case GL_STENCIL_INDEX:
case GL_DEPTH_COMPONENT:
case GL_RED:
case GL_GREEN:
case GL_BLUE:
case GL_ALPHA:
case GL_LUMINANCE:
case GL_INTENSITY:
return 1;
default:
return 0;
}
}
/*
** Return the number of bytes per element, based on the element type (other
** than GL_BITMAP).
*/
GLint __glBytesPerElement(GLenum type)
{
switch(type) {
case GL_UNSIGNED_SHORT:
case GL_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
case GL_UNSIGNED_SHORT_8_8_APPLE:
case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
case GL_UNSIGNED_SHORT_15_1_MESA:
case GL_UNSIGNED_SHORT_1_15_REV_MESA:
return 2;
case GL_UNSIGNED_BYTE:
case GL_BYTE:
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
return 1;
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
case GL_UNSIGNED_INT_8_8_8_8:
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_24_8_NV:
case GL_UNSIGNED_INT_24_8_MESA:
case GL_UNSIGNED_INT_8_24_REV_MESA:
return 4;
default:
return 0;
}
}
/*
** Compute memory required for internal packed array of data of given type
** and format.
*/
GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, GLenum target)
{
int bytes_per_row;
int components;
switch( target ) {
case GL_PROXY_TEXTURE_1D:
case GL_PROXY_TEXTURE_2D:
case GL_PROXY_TEXTURE_3D:
case GL_PROXY_TEXTURE_4D_SGIS:
case GL_PROXY_TEXTURE_CUBE_MAP:
case GL_PROXY_TEXTURE_RECTANGLE_ARB:
case GL_PROXY_HISTOGRAM:
case GL_PROXY_COLOR_TABLE:
case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
return 0;
}
if (width < 0 || height < 0 || depth < 0) {
return 0;
}
/*
** Zero is returned if either format or type are invalid.
*/
components = __glElementsPerGroup(format,type);
if (type == GL_BITMAP) {
if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
bytes_per_row = (width + 7) >> 3;
} else {
return 0;
}
} else {
bytes_per_row = __glBytesPerElement(type) * width;
}
return bytes_per_row * height * depth * components;
}
/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */
/*
* (C) Copyright IBM Corporation 2004
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* IBM,
* AND/OR THEIR SUPPLIERS 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.
*/
#if !defined( _INDIRECT_SIZE_H_ )
# define _INDIRECT_SIZE_H_
/**
* \file
* Prototypes for functions used to determine the number of data elements in
* various GLX protocol messages.
*
* \author Ian Romanick <idr@us.ibm.com>
*/
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define PURE __attribute__((pure))
# else
# define PURE
# endif
# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define FASTCALL __attribute__((fastcall))
# else
# define FASTCALL
# endif
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
# define INTERNAL __attribute__((visibility("internal")))
# else
# define INTERNAL
# endif
# if defined(__CYGWIN__) || defined(__MINGW32__)
# undef FASTCALL
# define FASTCALL
# undef INTERNAL
# define INTERNAL
# endif
extern INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glFogiv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glLightfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glLightiv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glLightModelfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glLightModeliv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMaterialfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMaterialiv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexEnvfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexEnviv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexGendv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexGenfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glTexGeniv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMap1d_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMap1f_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
# undef PURE
# undef FASTCALL
# undef INTERNAL
#endif /* !defined( _INDIRECT_SIZE_H_ ) */
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2002 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _AC_CONTEXT_H
#define _AC_CONTEXT_H
#include "glheader.h"
#include "mtypes.h"
#include "array_cache/acache.h"
/* These are used to make the ctx->Current values look like
* arrays (with zero StrideB).
*/
struct ac_arrays {
struct gl_client_array Vertex;
struct gl_client_array Normal;
struct gl_client_array Color;
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_pointers {
struct gl_client_array *Vertex;
struct gl_client_array *Normal;
struct gl_client_array *Color;
struct gl_client_array *SecondaryColor;
struct gl_client_array *FogCoord;
struct gl_client_array *Index;
struct gl_client_array *TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array *EdgeFlag;
struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
struct ac_array_flags {
GLboolean Vertex;
GLboolean Normal;
GLboolean Color;
GLboolean SecondaryColor;
GLboolean FogCoord;
GLboolean Index;
GLboolean TexCoord[MAX_TEXTURE_COORD_UNITS];
GLboolean EdgeFlag;
GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */
};
typedef struct {
GLuint NewState; /* not needed? */
GLuint NewArrayState;
/* Facility for importing and caching array data:
*/
struct ac_arrays Fallback;
struct ac_arrays Cache;
struct ac_arrays Raw;
struct ac_array_flags IsCached;
GLuint start;
GLuint count;
/* Facility for importing element lists:
*/
GLuint *Elts;
GLuint elt_size;
} ACcontext;
#define AC_CONTEXT(ctx) ((ACcontext *)ctx->acache_context)
#endif
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
#ifndef _ARRAYCACHE_H
#define _ARRAYCACHE_H
#include "mtypes.h"
extern GLboolean
_ac_CreateContext( GLcontext *ctx );
extern void
_ac_DestroyContext( GLcontext *ctx );
extern void
_ac_InvalidateState( GLcontext *ctx, GLuint new_state );
extern struct gl_client_array *
_ac_import_vertex( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_normal( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_color( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_index( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_secondarycolor( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_fogcoord( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_edgeflag( GLcontext *ctx,
GLenum type,
GLuint reqstride,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_texcoord( GLcontext *ctx,
GLuint unit,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
extern struct gl_client_array *
_ac_import_attrib( GLcontext *ctx,
GLuint index,
GLenum type,
GLuint reqstride,
GLuint reqsize,
GLboolean reqwritable,
GLboolean *writable );
/* Clients must call this function to validate state and set bounds
* before importing any data:
*/
extern void
_ac_import_range( GLcontext *ctx, GLuint start, GLuint count );
/* Additional convenience function:
*/
extern CONST void *
_ac_import_elements( GLcontext *ctx,
GLenum new_type,
GLuint count,
GLenum old_type,
CONST void *indices );
#endif
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "glheader.h"
#include "imports.h"
#include "buffers.h"
#include "context.h"
#include "framebuffer.h"
#include "program.h"
#include "renderbuffer.h"
#include "texcompress.h"
#include "texformat.h"
#include "teximage.h"
#include "texobj.h"
#include "texstore.h"
#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
#endif
#if FEATURE_EXT_framebuffer_object
#include "fbobject.h"
#include "texrender.h"
#endif
#include "driverfuncs.h"
#include "swrast/swrast.h"
#include "tnl/tnl.h"
/**
* Plug in default functions for all pointers in the dd_function_table
* structure.
* Device drivers should call this function and then plug in any
* functions which it wants to override.
* Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
*
* \param table the dd_function_table to initialize
*/
void
_mesa_init_driver_functions(struct dd_function_table *driver)
{
_mesa_bzero(driver, sizeof(*driver));
driver->GetString = NULL; /* REQUIRED! */
driver->UpdateState = NULL; /* REQUIRED! */
driver->GetBufferSize = NULL; /* REQUIRED! */
driver->ResizeBuffers = _mesa_resize_framebuffer;
driver->Error = NULL;
driver->Finish = NULL;
driver->Flush = NULL;
/* framebuffer/image functions */
driver->Clear = _swrast_Clear;
driver->Accum = _swrast_Accum;
driver->DrawPixels = _swrast_DrawPixels;
driver->ReadPixels = _swrast_ReadPixels;
driver->CopyPixels = _swrast_CopyPixels;
driver->Bitmap = _swrast_Bitmap;
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
driver->TexImage1D = _mesa_store_teximage1d;
driver->TexImage2D = _mesa_store_teximage2d;
driver->TexImage3D = _mesa_store_teximage3d;
driver->TexSubImage1D = _mesa_store_texsubimage1d;
driver->TexSubImage2D = _mesa_store_texsubimage2d;
driver->TexSubImage3D = _mesa_store_texsubimage3d;
driver->GetTexImage = _mesa_get_teximage;
driver->CopyTexImage1D = _swrast_copy_teximage1d;
driver->CopyTexImage2D = _swrast_copy_teximage2d;
driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
driver->CompressedTextureSize = _mesa_compressed_texture_size;
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;
driver->DeleteTexture = _mesa_delete_texture_object;
driver->NewTextureImage = _mesa_new_texture_image;
driver->FreeTexImageData = _mesa_free_texture_image_data;
driver->TextureMemCpy = _mesa_memcpy;
driver->IsTextureResident = NULL;
driver->PrioritizeTexture = NULL;
driver->ActiveTexture = NULL;
driver->UpdateTexturePalette = NULL;
/* imaging */
driver->CopyColorTable = _swrast_CopyColorTable;
driver->CopyColorSubTable = _swrast_CopyColorSubTable;
driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
/* Vertex/fragment programs */
driver->BindProgram = NULL;
driver->NewProgram = _mesa_new_program;
driver->DeleteProgram = _mesa_delete_program;
/* simple state commands */
driver->AlphaFunc = NULL;
driver->BlendColor = NULL;
driver->BlendEquationSeparate = NULL;
driver->BlendFuncSeparate = NULL;
driver->ClearColor = NULL;
driver->ClearDepth = NULL;
driver->ClearIndex = NULL;
driver->ClearStencil = NULL;
driver->ClipPlane = NULL;
driver->ColorMask = NULL;
driver->ColorMaterial = NULL;
driver->CullFace = NULL;
driver->DrawBuffer = _swrast_DrawBuffer;
driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/
driver->FrontFace = NULL;
driver->DepthFunc = NULL;
driver->DepthMask = NULL;
driver->DepthRange = NULL;
driver->Enable = NULL;
driver->Fogfv = NULL;
driver->Hint = NULL;
driver->IndexMask = NULL;
driver->Lightfv = NULL;
driver->LightModelfv = NULL;
driver->LineStipple = NULL;
driver->LineWidth = NULL;
driver->LogicOpcode = NULL;
driver->PointParameterfv = NULL;
driver->PointSize = NULL;
driver->PolygonMode = NULL;
driver->PolygonOffset = NULL;
driver->PolygonStipple = NULL;
driver->ReadBuffer = NULL;
driver->RenderMode = NULL;
driver->Scissor = NULL;
driver->ShadeModel = NULL;
driver->StencilFunc = NULL;
driver->StencilMask = NULL;
driver->StencilOp = NULL;
driver->ActiveStencilFace = NULL;
driver->TexGen = NULL;
driver->TexEnv = NULL;
driver->TexParameter = NULL;
driver->TextureMatrix = NULL;
driver->Viewport = NULL;
/* vertex arrays */
driver->VertexPointer = NULL;
driver->NormalPointer = NULL;
driver->ColorPointer = NULL;
driver->FogCoordPointer = NULL;
driver->IndexPointer = NULL;
driver->SecondaryColorPointer = NULL;
driver->TexCoordPointer = NULL;
driver->EdgeFlagPointer = NULL;
driver->VertexAttribPointer = NULL;
driver->LockArraysEXT = NULL;
driver->UnlockArraysEXT = NULL;
/* state queries */
driver->GetBooleanv = NULL;
driver->GetDoublev = NULL;
driver->GetFloatv = NULL;
driver->GetIntegerv = NULL;
driver->GetPointerv = NULL;
#if FEATURE_ARB_vertex_buffer_object
driver->NewBufferObject = _mesa_new_buffer_object;
driver->DeleteBuffer = _mesa_delete_buffer_object;
driver->BindBuffer = NULL;
driver->BufferData = _mesa_buffer_data;
driver->BufferSubData = _mesa_buffer_subdata;
driver->GetBufferSubData = _mesa_buffer_get_subdata;
driver->MapBuffer = _mesa_buffer_map;
driver->UnmapBuffer = _mesa_buffer_unmap;
#endif
#if FEATURE_EXT_framebuffer_object
driver->NewFramebuffer = _mesa_new_framebuffer;
driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
driver->RenderbufferTexture = _mesa_renderbuffer_texture;
driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
#endif
/* T&L stuff */
driver->NeedValidate = GL_FALSE;
driver->ValidateTnlModule = NULL;
driver->CurrentExecPrimitive = 0;
driver->CurrentSavePrimitive = 0;
driver->NeedFlush = 0;
driver->SaveNeedFlush = 0;
driver->FlushVertices = NULL;
driver->SaveFlushVertices = NULL;
driver->NotifySaveBegin = NULL;
driver->LightingSpaceChange = NULL;
driver->MakeCurrent = NULL;
driver->ProgramStringNotify = _tnl_program_string;
/* display list */
driver->NewList = NULL;
driver->EndList = NULL;
driver->BeginCallList = NULL;
driver->EndCallList = NULL;
}
/*
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef DRIVERFUNCS_H
#define DRIVERFUNCS_H
extern void
_mesa_init_driver_functions(struct dd_function_table *driver);
#endif
/*
* (C) Copyright IBM Corporation 2003
* 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"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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.
*/
/**
* \file glcontextmodes.h
* \author Ian Romanick <idr@us.ibm.com>
*/
#ifndef GLCONTEXTMODES_H
#define GLCONTEXTMODES_H
#include "GL/internal/glcore.h"
#if !defined(IN_MINI_GLX)
extern GLint _gl_convert_from_x_visual_type( int visualType );
extern GLint _gl_convert_to_x_visual_type( int visualType );
extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
const __GLXvisualConfig * config );
extern int _gl_get_context_mode_data( const __GLcontextModes *mode,
int attribute, int *value_return );
#endif /* !defined(IN_MINI_GLX) */
extern __GLcontextModes * _gl_context_modes_create( unsigned count,
size_t minimum_size );
extern void _gl_context_modes_destroy( __GLcontextModes * modes );
extern __GLcontextModes * _gl_context_modes_find_visual(
__GLcontextModes * modes, int vid );
extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a,
const __GLcontextModes * b );
#endif /* GLCONTEXTMODES_H */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef GLX_HEADER_H
#define GLX_HEADER_H
#ifdef __VMS
#include <GL/vms_x_fix.h>
#endif
#include "glheader.h"
#ifdef XFree86Server
# include "resource.h"
# include "windowstr.h"
# include "gcstruct.h"
# include "xf86glx_util.h"
#else
# include <nx-X11/Xlib.h>
# include <nx-X11/Xutil.h>
# ifdef USE_XSHM /* was SHM */
# include <sys/ipc.h>
# include <sys/shm.h>
# include <X11/extensions/XShm.h>
# endif
# include <GL/glx.h>
#endif
/* this silences a compiler warning on several systems */
struct timespec;
struct itimerspec;
#endif /*GLX_HEADER*/
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "glxheader.h"
#include "GL/xmesa.h"
#include "xmesaP.h"
#include "imports.h"
#include "renderbuffer.h"
static void
xmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
/* XXX Note: the ximage or Pixmap attached to this renderbuffer
* should probably get freed here, but that's currently done in
* XMesaDestroyBuffer().
*/
_mesa_free(rb);
}
/**
* Reallocate renderbuffer storage.
* This is called when the window's resized. It'll get called once for
* the front color renderbuffer and again for the back color renderbuffer.
*/
static GLboolean
xmesa_alloc_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;
if (xrb->ximage) {
/* Needed by PIXELADDR1 macro */
xrb->width1 = xrb->ximage->bytes_per_line;
xrb->origin1 = (GLubyte *) xrb->ximage->data + xrb->width1 * (height - 1);
/* Needed by PIXELADDR2 macro */
xrb->width2 = xrb->ximage->bytes_per_line / 2;
xrb->origin2 = (GLushort *) xrb->ximage->data + xrb->width2 * (height - 1);
/* Needed by PIXELADDR3 macro */
xrb->width3 = xrb->ximage->bytes_per_line;
xrb->origin3 = (GLubyte *) xrb->ximage->data + xrb->width3 * (height - 1);
/* Needed by PIXELADDR4 macro */
xrb->width4 = xrb->ximage->width;
xrb->origin4 = (GLuint *) xrb->ximage->data + xrb->width4 * (height - 1);
}
else {
assert(xrb->pixmap);
}
/* for the FLIP macro: */
xrb->bottom = height - 1;
rb->Width = width;
rb->Height = height;
rb->InternalFormat = internalFormat;
return GL_TRUE;
}
struct xmesa_renderbuffer *
xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, GLboolean rgbMode)
{
struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer);
if (xrb) {
GLuint name = 0;
_mesa_init_renderbuffer(&xrb->Base, name);
xrb->Base.Delete = xmesa_delete_renderbuffer;
xrb->Base.AllocStorage = xmesa_alloc_storage;
if (rgbMode) {
xrb->Base.InternalFormat = GL_RGBA;
xrb->Base._BaseFormat = GL_RGBA;
xrb->Base.DataType = GL_UNSIGNED_BYTE;
}
else {
xrb->Base.InternalFormat = GL_COLOR_INDEX;
xrb->Base._BaseFormat = GL_COLOR_INDEX;
xrb->Base.DataType = GL_UNSIGNED_INT;
}
xrb->Base.ComponentSizes[0] = 0; /* XXX fix? */
}
return xrb;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
/**
* \mainpage Mesa GL API Module
*
* \section GLAPIIntroduction Introduction
*
* The Mesa GL API module is responsible for dispatching all the
* gl*() functions. All GL functions are dispatched by jumping through
* the current dispatch table (basically a struct full of function
* pointers.)
*
* A per-thread current dispatch table and per-thread current context
* pointer are managed by this module too.
*
* This module is intended to be non-Mesa-specific so it can be used
* with the X/DRI libGL also.
*/
#ifndef _GLAPI_H
#define _GLAPI_H
#include "GL/gl.h"
#include "glapitable.h"
typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
#if defined (GLX_USE_TLS)
const extern void *_glapi_Context;
const extern struct _glapi_table *_glapi_Dispatch;
extern __thread void * _glapi_tls_Context
__attribute__((tls_model("initial-exec")));
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
#else
extern void *_glapi_Context;
extern struct _glapi_table *_glapi_Dispatch;
/**
* Macro for declaration and fetching the current context.
*
* \param C local variable which will hold the current context.
*
* It should be used in the variable declaration area of a function:
* \code
* ...
* {
* GET_CURRENT_CONTEXT(ctx);
* ...
* \endcode
*/
# ifdef THREADS
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) (_glapi_Context ? _glapi_Context : _glapi_get_context())
# else
# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
# endif
#endif /* defined (GLX_USE_TLS) */
extern void
_glapi_noop_enable_warnings(GLboolean enable);
extern void
_glapi_set_warning_func(_glapi_warning_func func);
extern void
_glapi_check_multithread(void);
extern void
_glapi_set_context(void *context);
extern void *
_glapi_get_context(void);
extern void
_glapi_set_dispatch(struct _glapi_table *dispatch);
extern struct _glapi_table *
_glapi_get_dispatch(void);
extern int
_glapi_begin_dispatch_override(struct _glapi_table *override);
extern void
_glapi_end_dispatch_override(int layer);
struct _glapi_table *
_glapi_get_override_dispatch(int layer);
extern GLuint
_glapi_get_dispatch_table_size(void);
extern void
_glapi_check_table(const struct _glapi_table *table);
extern int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature );
extern GLint
_glapi_get_proc_offset(const char *funcName);
extern _glapi_proc
_glapi_get_proc_address(const char *funcName);
extern const char *
_glapi_get_proc_name(GLuint offset);
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
/*
* XXX There's probably some work to do in order to make this file
* truly reusable outside of Mesa. First, the glheader.h include must go.
*/
#include "glheader.h"
#include "glthread.h"
/*
* This file should still compile even when THREADS is not defined.
* This is to make things easier to deal with on the makefile scene..
*/
#ifdef THREADS
#include <errno.h>
/*
* Error messages
*/
#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data"
#define GET_TSD_ERROR "_glthread_: failed to get thread specific data"
#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data"
/*
* Magic number to determine if a TSD object has been initialized.
* Kind of a hack but there doesn't appear to be a better cross-platform
* solution.
*/
#define INIT_MAGIC 0xff8adc98
/*
* POSIX Threads -- The best way to go if your platform supports them.
* Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly
* has them, and many of the free Unixes now have them.
* Be sure to use appropriate -mt or -D_REENTRANT type
* compile flags when building.
*/
#ifdef PTHREADS
unsigned long
_glthread_GetID(void)
{
return (unsigned long) pthread_self();
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror(INIT_TSD_ERROR);
exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
if (tsd->initMagic != (int) INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
return pthread_getspecific(tsd->key);
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
if (tsd->initMagic != (int) INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
if (pthread_setspecific(tsd->key, ptr) != 0) {
perror(SET_TSD_ERROR);
exit(-1);
}
}
#endif /* PTHREADS */
/*
* Solaris/Unix International Threads -- Use only if POSIX threads
* aren't available on your Unix platform. Solaris 2.[34] are examples
* of platforms where this is the case. Be sure to use -mt and/or
* -D_REENTRANT when compiling.
*/
#ifdef SOLARIS_THREADS
#define USE_LOCK_FOR_KEY /* undef this to try a version without
lock for the global key... */
unsigned long
_glthread_GetID(void)
{
abort(); /* XXX not implemented yet */
return (unsigned long) 0;
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
if ((errno = mutex_init(&tsd->keylock, 0, NULL)) != 0 ||
(errno = thr_keycreate(&(tsd->key), free)) != 0) {
perror(INIT_TSD_ERROR);
exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
void* ret;
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
#ifdef USE_LOCK_FOR_KEY
mutex_lock(&tsd->keylock);
thr_getspecific(tsd->key, &ret);
mutex_unlock(&tsd->keylock);
#else
if ((errno = thr_getspecific(tsd->key, &ret)) != 0) {
perror(GET_TSD_ERROR);
exit(-1);
}
#endif
return ret;
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
if ((errno = thr_setspecific(tsd->key, ptr)) != 0) {
perror(SET_TSD_ERROR);
exit(-1);
}
}
#undef USE_LOCK_FOR_KEY
#endif /* SOLARIS_THREADS */
/*
* Win32 Threads. The only available option for Windows 95/NT.
* Be sure that you compile using the Multithreaded runtime, otherwise
* bad things will happen.
*/
#ifdef WIN32_THREADS
unsigned long
_glthread_GetID(void)
{
abort(); /* XXX not implemented yet */
return (unsigned long) 0;
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
tsd->key = TlsAlloc();
if (tsd->key == 0xffffffff) {
/* Can Windows handle stderr messages for non-console
applications? Does Windows have perror? */
/* perror(SET_INIT_ERROR);*/
exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
return TlsGetValue(tsd->key);
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
/* the following code assumes that the _glthread_TSD has been initialized
to zero at creation */
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
if (TlsSetValue(tsd->key, ptr) == 0) {
/* Can Windows handle stderr messages for non-console
applications? Does Windows have perror? */
/* perror(SET_TSD_ERROR);*/
exit(-1);
}
}
#endif /* WIN32_THREADS */
/*
* XFree86 has its own thread wrapper, Xthreads.h
* We wrap it again for GL.
*/
#ifdef USE_XTHREADS
unsigned long
_glthread_GetID(void)
{
return (unsigned long) xthread_self();
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
if (xthread_key_create(&tsd->key, NULL) != 0) {
perror(INIT_TSD_ERROR);
exit(-1);
}
tsd->initMagic = INIT_MAGIC;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
void *ptr;
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
xthread_get_specific(tsd->key, &ptr);
return ptr;
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
if (tsd->initMagic != INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
xthread_set_specific(tsd->key, ptr);
}
#endif /* XTHREAD */
/*
* BeOS threads
*/
#ifdef BEOS_THREADS
unsigned long
_glthread_GetID(void)
{
return (unsigned long) find_thread(NULL);
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
tsd->key = tls_allocate();
tsd->initMagic = INIT_MAGIC;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
if (tsd->initMagic != (int) INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
return tls_get(tsd->key);
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
if (tsd->initMagic != (int) INIT_MAGIC) {
_glthread_InitTSD(tsd);
}
tls_set(tsd->key, ptr);
}
#endif /* BEOS_THREADS */
#else /* THREADS */
/*
* no-op functions
*/
unsigned long
_glthread_GetID(void)
{
return 0;
}
void
_glthread_InitTSD(_glthread_TSD *tsd)
{
(void) tsd;
}
void *
_glthread_GetTSD(_glthread_TSD *tsd)
{
(void) tsd;
return NULL;
}
void
_glthread_SetTSD(_glthread_TSD *tsd, void *ptr)
{
(void) tsd;
(void) ptr;
}
#endif /* THREADS */
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2003 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
/*
* Thread support for gl dispatch.
*
* Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu)
* and Christoph Poliwoda (poliwoda@volumegraphics.com)
* Revised by Keith Whitwell
* Adapted for new gl dispatcher by Brian Paul
*
*
*
* DOCUMENTATION
*
* This thread module exports the following types:
* _glthread_TSD Thread-specific data area
* _glthread_Thread Thread datatype
* _glthread_Mutex Mutual exclusion lock
*
* Macros:
* _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex
* _glthread_INIT_MUTEX(name) Initialize a mutex
* _glthread_LOCK_MUTEX(name) Lock a mutex
* _glthread_UNLOCK_MUTEX(name) Unlock a mutex
*
* Functions:
* _glthread_GetID(v) Get integer thread ID
* _glthread_InitTSD() Initialize thread-specific data
* _glthread_GetTSD() Get thread-specific data
* _glthread_SetTSD() Set thread-specific data
*
*/
/*
* If this file is accidentally included by a non-threaded build,
* it should not cause the build to fail, or otherwise cause problems.
* In general, it should only be included when needed however.
*/
#ifndef GLTHREAD_H
#define GLTHREAD_H
#if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\
defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \
&& !defined(THREADS)
# define THREADS
#endif
#ifdef VMS
#include <GL/vms_x_fix.h>
#endif
/*
* POSIX threads. This should be your choice in the Unix world
* whenever possible. When building with POSIX threads, be sure
* to enable any compiler flags which will cause the MT-safe
* libc (if one exists) to be used when linking, as well as any
* header macros for MT-safe errno, etc. For Solaris, this is the -mt
* compiler flag. On Solaris with gcc, use -D_REENTRANT to enable
* proper compiling for MT-safe libc etc.
*/
#if defined(PTHREADS)
#include <pthread.h> /* POSIX threads headers */
typedef struct {
pthread_key_t key;
int initMagic;
} _glthread_TSD;
typedef pthread_t _glthread_Thread;
typedef pthread_mutex_t _glthread_Mutex;
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER
#define _glthread_INIT_MUTEX(name) \
pthread_mutex_init(&(name), NULL)
#define _glthread_DESTROY_MUTEX(name) \
pthread_mutex_destroy(&(name))
#define _glthread_LOCK_MUTEX(name) \
(void) pthread_mutex_lock(&(name))
#define _glthread_UNLOCK_MUTEX(name) \
(void) pthread_mutex_unlock(&(name))
#endif /* PTHREADS */
/*
* Solaris threads. Use only up to Solaris 2.4.
* Solaris 2.5 and higher provide POSIX threads.
* Be sure to compile with -mt on the Solaris compilers, or
* use -D_REENTRANT if using gcc.
*/
#ifdef SOLARIS_THREADS
#include <thread.h>
typedef struct {
thread_key_t key;
mutex_t keylock;
int initMagic;
} _glthread_TSD;
typedef thread_t _glthread_Thread;
typedef mutex_t _glthread_Mutex;
/* XXX need to really implement mutex-related macros */
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
#endif /* SOLARIS_THREADS */
/*
* Windows threads. Should work with Windows NT and 95.
* IMPORTANT: Link with multithreaded runtime library when THREADS are
* used!
*/
#ifdef WIN32_THREADS
#include <windows.h>
typedef struct {
DWORD key;
int initMagic;
} _glthread_TSD;
typedef HANDLE _glthread_Thread;
typedef CRITICAL_SECTION _glthread_Mutex;
/* XXX need to really implement mutex-related macros */
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
#endif /* WIN32_THREADS */
/*
* XFree86 has its own thread wrapper, Xthreads.h
* We wrap it again for GL.
*/
#ifdef USE_XTHREADS
#include <nx-X11/Xthreads.h>
typedef struct {
xthread_key_t key;
int initMagic;
} _glthread_TSD;
typedef xthread_t _glthread_Thread;
typedef xmutex_rec _glthread_Mutex;
#ifdef XMUTEX_INITIALIZER
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name = XMUTEX_INITIALIZER
#else
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name
#endif
#define _glthread_INIT_MUTEX(name) \
xmutex_init(&(name))
#define _glthread_DESTROY_MUTEX(name) \
xmutex_clear(&(name))
#define _glthread_LOCK_MUTEX(name) \
(void) xmutex_lock(&(name))
#define _glthread_UNLOCK_MUTEX(name) \
(void) xmutex_unlock(&(name))
#endif /* USE_XTHREADS */
/*
* BeOS threads. R5.x required.
*/
#ifdef BEOS_THREADS
#include <kernel/OS.h>
#include <support/TLS.h>
typedef struct {
int32 key;
int initMagic;
} _glthread_TSD;
typedef thread_id _glthread_Thread;
/* Use Benaphore, aka speeder semaphore */
typedef struct {
int32 lock;
sem_id sem;
} benaphore;
typedef benaphore _glthread_Mutex;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 }
#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0
#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \
if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
#endif /* BEOS_THREADS */
#ifndef THREADS
/*
* THREADS not defined
*/
typedef GLuint _glthread_TSD;
typedef GLuint _glthread_Thread;
typedef GLuint _glthread_Mutex;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
#endif /* THREADS */
/*
* Platform independent thread specific data API.
*/
extern unsigned long
_glthread_GetID(void);
extern void
_glthread_InitTSD(_glthread_TSD *);
extern void *
_glthread_GetTSD(_glthread_TSD *);
extern void
_glthread_SetTSD(_glthread_TSD *, void *);
#if defined(GLX_USE_TLS)
extern __thread struct _glapi_table * _glapi_tls_Dispatch
__attribute__((tls_model("initial-exec")));
#define GET_DISPATCH() _glapi_tls_Dispatch
#elif !defined(GL_CALL)
# if defined(THREADS)
# define GET_DISPATCH() \
((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
? _glapi_Dispatch : _glapi_get_dispatch())
# else
# define GET_DISPATCH() _glapi_Dispatch
# endif /* defined(THREADS) */
#endif /* ndef GL_CALL */
#endif /* THREADS_H */
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of the aforementioned persons and companies. */
/* */
/* Redistribution and use of the present software is allowed according */
/* to terms specified in the file LICENSE which comes in the source */
/* distribution. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
typedef struct _WSDrawBufferRec {
GLframebuffer *DrawBuffer;
struct _WSDrawBufferRec *next;
} WSDrawBufferRec, *WSDrawBufferPtr;
WSDrawBufferPtr pWSDrawBuffer;
/*
* Mesa 3-D graphics library
* Version: 6.5
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "glheader.h"
#include "accum.h"
#include "context.h"
#include "imports.h"
#include "macros.h"
#include "state.h"
#include "mtypes.h"
void GLAPIENTRY
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
GLfloat tmp[4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
tmp[0] = CLAMP( red, -1.0F, 1.0F );
tmp[1] = CLAMP( green, -1.0F, 1.0F );
tmp[2] = CLAMP( blue, -1.0F, 1.0F );
tmp[3] = CLAMP( alpha, -1.0F, 1.0F );
if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor))
return;
FLUSH_VERTICES(ctx, _NEW_ACCUM);
COPY_4FV( ctx->Accum.ClearColor, tmp );
}
void GLAPIENTRY
_mesa_Accum( GLenum op, GLfloat value )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (op) {
case GL_ADD:
case GL_MULT:
case GL_ACCUM:
case GL_LOAD:
case GL_RETURN:
/* OK */
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glAccum(op)");
return;
}
if (ctx->DrawBuffer->Visual.haveAccumBuffer == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glAccum(no accum buffer)");
return;
}
if (ctx->DrawBuffer != ctx->ReadBuffer) {
/* See GLX_SGI_make_current_read or WGL_ARB_make_current_read */
_mesa_error(ctx, GL_INVALID_OPERATION,
"glAccum(different read/draw buffers)");
return;
}
if (ctx->NewState)
_mesa_update_state(ctx);
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
"glAccum(incomplete framebuffer)");
return;
}
if (ctx->RenderMode == GL_RENDER) {
GLint x = ctx->DrawBuffer->_Xmin;
GLint y = ctx->DrawBuffer->_Ymin;
GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
ctx->Driver.Accum(ctx, op, value, x, y, width, height);
}
}
void
_mesa_init_accum( GLcontext *ctx )
{
/* Accumulate buffer group */
ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 );
}
/**
* \file accum.h
* Accumulation buffer operations.
*
* \if subset
* (No-op)
*
* \endif
*/
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef ACCUM_H
#define ACCUM_H
#include "mtypes.h"
#if _HAVE_FULL_GL
extern void GLAPIENTRY
_mesa_Accum( GLenum op, GLfloat value );
extern void GLAPIENTRY
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
extern void
_mesa_init_accum( GLcontext *ctx );
#else
/** No-op */
#define _mesa_init_accum( c ) ((void)0)
#endif
#endif
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef API_ARRAYELT_H
#define API_ARRAYELT_H
#include "mtypes.h"
extern GLboolean _ae_create_context( GLcontext *ctx );
extern void _ae_destroy_context( GLcontext *ctx );
extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state );
extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt );
#endif
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef API_EVAL_H
#define API_EVAL_H
#include "mtypes.h"
extern void _mesa_EvalPoint1( GLint i );
extern void _mesa_EvalPoint2( GLint i, GLint j );
extern void _mesa_EvalCoord1f( GLfloat u );
extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v );
extern void _mesa_EvalCoord1fv( const GLfloat *u );
extern void _mesa_EvalCoord2fv( const GLfloat *u );
#endif
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef API_LOOPBACK_H
#define API_LOOPBACK_H
#include "glheader.h"
struct _glapi_table;
extern void _mesa_loopback_init_api_table( struct _glapi_table *dest );
#endif
/*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef _API_NOOP_H
#define _API_NOOP_H
#include "glheader.h"
#include "mtypes.h"
#include "context.h"
/* In states where certain vertex components are required for t&l or
* rasterization, we still need to keep track of the current values.
* These functions provide this service by keeping uptodate the
* 'ctx->Current' struct for all data elements not included in the
* currently enabled hardware vertex.
*
*/
extern void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b );
extern void GLAPIENTRY _mesa_noop_EdgeFlagv( const GLboolean *b );
extern void GLAPIENTRY _mesa_noop_FogCoordfEXT( GLfloat a );
extern void GLAPIENTRY _mesa_noop_FogCoordfvEXT( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Indexf( GLfloat i );
extern void GLAPIENTRY _mesa_noop_Indexfv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c );
extern void GLAPIENTRY _mesa_noop_Normal3fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param );
extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d );
extern void _mesa_noop_Color4ubv( const GLubyte *v );
extern void GLAPIENTRY _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
extern void GLAPIENTRY _mesa_noop_Color4fv( const GLfloat *v );
extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c );
extern void _mesa_noop_Color3ubv( const GLubyte *v );
extern void GLAPIENTRY _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c );
extern void GLAPIENTRY _mesa_noop_Color3fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c);
extern void GLAPIENTRY _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d );
extern void GLAPIENTRY _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c );
extern void GLAPIENTRY _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v );
extern void GLAPIENTRY _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c );
extern void GLAPIENTRY _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_TexCoord1f( GLfloat a );
extern void GLAPIENTRY _mesa_noop_TexCoord1fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_TexCoord2f( GLfloat a, GLfloat b );
extern void GLAPIENTRY _mesa_noop_TexCoord2fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c );
extern void GLAPIENTRY _mesa_noop_TexCoord3fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
extern void GLAPIENTRY _mesa_noop_TexCoord4fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Vertex2f( GLfloat a, GLfloat b );
extern void GLAPIENTRY _mesa_noop_Vertex2fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c );
extern void GLAPIENTRY _mesa_noop_Vertex3fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
extern void GLAPIENTRY _mesa_noop_Vertex4fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x );
extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y );
extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z );
extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x );
extern void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y );
extern void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z );
extern void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
extern void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_End( void );
extern void GLAPIENTRY _mesa_noop_Begin( GLenum mode );
extern void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b );
extern void GLAPIENTRY _mesa_noop_EvalPoint1( GLint a );
extern void GLAPIENTRY _mesa_noop_EvalCoord2fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_EvalCoord2f( GLfloat a, GLfloat b );
extern void GLAPIENTRY _mesa_noop_EvalCoord1fv( const GLfloat *v );
extern void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a );
extern void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt );
extern void GLAPIENTRY _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2,
GLint j1, GLint j2 );
extern void GLAPIENTRY _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
/* Not strictly a noop -- translate Rectf down to Begin/End and
* vertices. Closer to the loopback operations, but doesn't meet the
* criteria for inclusion there (cannot be used in the Save table).
*/
extern void GLAPIENTRY _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
extern void GLAPIENTRY _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count);
extern void GLAPIENTRY _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices);
extern void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices);
#endif
/*
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2003 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "glheader.h"
#include "api_validate.h"
#include "context.h"
#include "imports.h"
#include "mtypes.h"
#include "state.h"
GLboolean
_mesa_validate_DrawElements(GLcontext *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
return GL_FALSE;
}
if (mode > GL_POLYGON) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" );
return GL_FALSE;
}
if (type != GL_UNSIGNED_INT &&
type != GL_UNSIGNED_BYTE &&
type != GL_UNSIGNED_SHORT)
{
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
return GL_FALSE;
}
if (ctx->NewState)
_mesa_update_state(ctx);
/* Always need vertex positions */
if (!ctx->Array.Vertex.Enabled
&& !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
return GL_FALSE;
/* Vertex buffer object tests */
if (ctx->Array.ElementArrayBufferObj->Name) {
GLuint indexBytes;
/* use indices in the buffer object */
if (!ctx->Array.ElementArrayBufferObj->Data) {
_mesa_warning(ctx, "DrawElements with empty vertex elements buffer!");
return GL_FALSE;
}
/* make sure count doesn't go outside buffer bounds */
if (type == GL_UNSIGNED_INT) {
indexBytes = count * sizeof(GLuint);
}
else if (type == GL_UNSIGNED_BYTE) {
indexBytes = count * sizeof(GLubyte);
}
else {
ASSERT(type == GL_UNSIGNED_SHORT);
indexBytes = count * sizeof(GLushort);
}
if ((GLubyte *) indices + indexBytes >
ctx->Array.ElementArrayBufferObj->Data +
ctx->Array.ElementArrayBufferObj->Size) {
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
return GL_FALSE;
}
/* Actual address is the sum of pointers. Indices may be used below. */
if (ctx->Const.CheckArrayBounds) {
indices = (const GLvoid *)
ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data,
(const GLubyte *) indices);
}
}
if (ctx->Const.CheckArrayBounds) {
/* find max array index */
GLuint max = 0;
GLint i;
if (type == GL_UNSIGNED_INT) {
for (i = 0; i < count; i++)
if (((GLuint *) indices)[i] > max)
max = ((GLuint *) indices)[i];
}
else if (type == GL_UNSIGNED_SHORT) {
for (i = 0; i < count; i++)
if (((GLushort *) indices)[i] > max)
max = ((GLushort *) indices)[i];
}
else {
ASSERT(type == GL_UNSIGNED_BYTE);
for (i = 0; i < count; i++)
if (((GLubyte *) indices)[i] > max)
max = ((GLubyte *) indices)[i];
}
if (max >= ctx->Array._MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
}
}
return GL_TRUE;
}
GLboolean
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
return GL_FALSE;
}
if (mode > GL_POLYGON) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
return GL_FALSE;
}
if (end < start) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)");
return GL_FALSE;
}
if (type != GL_UNSIGNED_INT &&
type != GL_UNSIGNED_BYTE &&
type != GL_UNSIGNED_SHORT) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)" );
return GL_FALSE;
}
if (ctx->NewState)
_mesa_update_state(ctx);
/* Always need vertex positions */
if (!ctx->Array.Vertex.Enabled
&& !(ctx->VertexProgram._Enabled && ctx->Array.VertexAttrib[0].Enabled))
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
/* Find max array index.
* We don't trust the user's start and end values.
*/
GLuint max = 0;
GLint i;
if (type == GL_UNSIGNED_INT) {
for (i = 0; i < count; i++)
if (((GLuint *) indices)[i] > max)
max = ((GLuint *) indices)[i];
}
else if (type == GL_UNSIGNED_SHORT) {
for (i = 0; i < count; i++)
if (((GLushort *) indices)[i] > max)
max = ((GLushort *) indices)[i];
}
else {
ASSERT(type == GL_UNSIGNED_BYTE);
for (i = 0; i < count; i++)
if (((GLubyte *) indices)[i] > max)
max = ((GLubyte *) indices)[i];
}
if (max >= ctx->Array._MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
return GL_FALSE;
}
}
return GL_TRUE;
}
/**
* Called from the tnl module to error check the function parameters and
* verify that we really can draw something.
*/
GLboolean
_mesa_validate_DrawArrays(GLcontext *ctx,
GLenum mode, GLint start, GLsizei count)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (count < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
return GL_FALSE;
}
if (mode > GL_POLYGON) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
return GL_FALSE;
}
if (ctx->NewState)
_mesa_update_state(ctx);
/* Always need vertex positions */
if (!ctx->Array.Vertex.Enabled && !ctx->Array.VertexAttrib[0].Enabled)
return GL_FALSE;
if (ctx->Const.CheckArrayBounds) {
if (start + count > (GLint) ctx->Array._MaxElement)
return GL_FALSE;
}
return GL_TRUE;
}
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef API_VALIDATE_H
#define API_VALIDATE_H
#include "mtypes.h"
extern GLboolean
_mesa_validate_DrawArrays(GLcontext *ctx,
GLenum mode, GLint start, GLsizei count);
extern GLboolean
_mesa_validate_DrawElements(GLcontext *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices);
extern GLboolean
_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices);
#endif
/**
* \file attrib.h
* Attribute stacks.
*
* \if subset
* (No-op)
*
* \endif
*/
/*
* Mesa 3-D graphics library
* Version: 5.1
*
* Copyright (C) 1999-2003 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef ATTRIB_H
#define ATTRIB_H
#include "mtypes.h"
#if _HAVE_FULL_GL
extern void GLAPIENTRY
_mesa_PushAttrib( GLbitfield mask );
extern void GLAPIENTRY
_mesa_PopAttrib( void );
extern void GLAPIENTRY
_mesa_PushClientAttrib( GLbitfield mask );
extern void GLAPIENTRY
_mesa_PopClientAttrib( void );
extern void
_mesa_init_attrib( GLcontext *ctx );
#else
/** No-op */
#define _mesa_init_attrib( c ) ((void)0)
#endif
#endif
/**
* \file blend.h
* Blending functions operations.
*/
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef BLEND_H
#define BLEND_H
#include "mtypes.h"
extern void GLAPIENTRY
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor );
extern void GLAPIENTRY
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA );
extern void GLAPIENTRY
_mesa_BlendEquation( GLenum mode );
extern void GLAPIENTRY
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA );
extern void GLAPIENTRY
_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
extern void GLAPIENTRY
_mesa_AlphaFunc( GLenum func, GLclampf ref );
extern void GLAPIENTRY
_mesa_LogicOp( GLenum opcode );
extern void GLAPIENTRY
_mesa_IndexMask( GLuint mask );
extern void GLAPIENTRY
_mesa_ColorMask( GLboolean red, GLboolean green,
GLboolean blue, GLboolean alpha );
extern void
_mesa_init_color( GLcontext * ctx );
#endif
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef BUFFEROBJ_H
#define BUFFEROBJ_H
#include "context.h"
/*
* Internal functions
*/
extern void
_mesa_init_buffer_objects( GLcontext *ctx );
extern struct gl_buffer_object *
_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target );
extern void
_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
extern void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target );
extern void
_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj );
extern void
_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj );
extern void
_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
const GLvoid * data, GLenum usage,
struct gl_buffer_object * bufObj );
extern void
_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data,
struct gl_buffer_object * bufObj );
extern void
_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, GLvoid * data,
struct gl_buffer_object * bufObj );
extern void *
_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
struct gl_buffer_object * bufObj );
extern GLboolean
_mesa_buffer_unmap( GLcontext *ctx, GLenum target,
struct gl_buffer_object * bufObj );
extern GLboolean
_mesa_validate_pbo_access(GLuint dimensions,
const struct gl_pixelstore_attrib *pack,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *ptr);
/*
* API functions
*/
extern void GLAPIENTRY
_mesa_BindBufferARB(GLenum target, GLuint buffer);
extern void GLAPIENTRY
_mesa_DeleteBuffersARB(GLsizei n, const GLuint * buffer);
extern void GLAPIENTRY
_mesa_GenBuffersARB(GLsizei n, GLuint * buffer);
extern GLboolean GLAPIENTRY
_mesa_IsBufferARB(GLuint buffer);
extern void GLAPIENTRY
_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
extern void GLAPIENTRY
_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
extern void GLAPIENTRY
_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data);
extern void * GLAPIENTRY
_mesa_MapBufferARB(GLenum target, GLenum access);
extern GLboolean GLAPIENTRY
_mesa_UnmapBufferARB(GLenum target);
extern void GLAPIENTRY
_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params);
extern void GLAPIENTRY
_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params);
#endif
/**
* \file buffers.h
* Frame buffer management functions declarations.
*/
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef BUFFERS_H
#define BUFFERS_H
#include "mtypes.h"
extern void GLAPIENTRY
_mesa_ClearIndex( GLfloat c );
extern void GLAPIENTRY
_mesa_ClearColor( GLclampf red, GLclampf green,
GLclampf blue, GLclampf alpha );
extern void GLAPIENTRY
_mesa_Clear( GLbitfield mask );
extern void GLAPIENTRY
_mesa_DrawBuffer( GLenum mode );
extern void GLAPIENTRY
_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers);
extern void
_mesa_drawbuffers(GLcontext *ctx, GLsizei n, const GLenum *buffers,
const GLuint *destMask);
extern void GLAPIENTRY
_mesa_ReadBuffer( GLenum mode );
extern void GLAPIENTRY
_mesa_ResizeBuffersMESA( void );
extern void GLAPIENTRY
_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height );
extern void GLAPIENTRY
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
extern void
_mesa_init_scissor(GLcontext *ctx);
extern void
_mesa_init_multisample(GLcontext *ctx);
#endif
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "glheader.h"
#include "clip.h"
#include "context.h"
#include "macros.h"
#include "mtypes.h"
#include "math/m_xform.h"
#include "math/m_matrix.h"
/**********************************************************************/
/* Get/Set User clip-planes. */
/**********************************************************************/
void GLAPIENTRY
_mesa_ClipPlane( GLenum plane, const GLdouble *eq )
{
GET_CURRENT_CONTEXT(ctx);
GLint p;
GLfloat equation[4];
ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
_mesa_error( ctx, GL_INVALID_ENUM, "glClipPlane" );
return;
}
equation[0] = (GLfloat) eq[0];
equation[1] = (GLfloat) eq[1];
equation[2] = (GLfloat) eq[2];
equation[3] = (GLfloat) eq[3];
/*
* The equation is transformed by the transpose of the inverse of the
* current modelview matrix and stored in the resulting eye coordinates.
*
* KW: Eqn is then transformed to the current clip space, where user
* clipping now takes place. The clip-space equations are recalculated
* whenever the projection matrix changes.
*/
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top))
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
_mesa_transform_vector( equation, equation,
ctx->ModelviewMatrixStack.Top->inv );
if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation))
return;
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
COPY_4FV(ctx->Transform.EyeUserPlane[p], equation);
/* Update derived state. This state also depends on the projection
* matrix, and is recalculated on changes to the projection matrix by
* code in _mesa_update_state().
*/
if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
if (_math_matrix_is_dirty(ctx->ProjectionMatrixStack.Top))
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
_mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
ctx->Transform.EyeUserPlane[p],
ctx->ProjectionMatrixStack.Top->inv );
}
if (ctx->Driver.ClipPlane)
ctx->Driver.ClipPlane( ctx, plane, equation );
}
void GLAPIENTRY
_mesa_GetClipPlane( GLenum plane, GLdouble *equation )
{
GET_CURRENT_CONTEXT(ctx);
GLint p;
ASSERT_OUTSIDE_BEGIN_END(ctx);
p = (GLint) (plane - GL_CLIP_PLANE0);
if (p < 0 || p >= (GLint) ctx->Const.MaxClipPlanes) {
_mesa_error( ctx, GL_INVALID_ENUM, "glGetClipPlane" );
return;
}
equation[0] = (GLdouble) ctx->Transform.EyeUserPlane[p][0];
equation[1] = (GLdouble) ctx->Transform.EyeUserPlane[p][1];
equation[2] = (GLdouble) ctx->Transform.EyeUserPlane[p][2];
equation[3] = (GLdouble) ctx->Transform.EyeUserPlane[p][3];
}
void GLAPIENTRY
_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v)
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (cap) {
case GL_CULL_VERTEX_EYE_POSITION_EXT:
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
COPY_4FV(ctx->Transform.CullEyePos, v);
_mesa_transform_vector( ctx->Transform.CullObjPos,
ctx->Transform.CullEyePos,
ctx->ModelviewMatrixStack.Top->inv );
break;
case GL_CULL_VERTEX_OBJECT_POSITION_EXT:
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
COPY_4FV(ctx->Transform.CullObjPos, v);
_mesa_transform_vector( ctx->Transform.CullEyePos,
ctx->Transform.CullObjPos,
ctx->ModelviewMatrixStack.Top->m );
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glCullParameterfvEXT" );
}
}
void GLAPIENTRY
_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v)
{
GLfloat f[4];
f[0] = (GLfloat)v[0];
f[1] = (GLfloat)v[1];
f[2] = (GLfloat)v[2];
f[3] = (GLfloat)v[3];
_mesa_CullParameterfvEXT(cap, f);
}
/**
* \file clip.h
*/
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef CLIP_H
#define CLIP_H
#include "mtypes.h"
extern void GLAPIENTRY
_mesa_ClipPlane( GLenum plane, const GLdouble *equation );
extern void GLAPIENTRY
_mesa_GetClipPlane( GLenum plane, GLdouble *equation );
extern void GLAPIENTRY
_mesa_CullParameterfvEXT (GLenum cap, GLfloat *v);
extern void GLAPIENTRY
_mesa_CullParameterdvEXT (GLenum cap, GLdouble *v);
#endif
/*
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
/**
* \file colormac.h
* Color-related macros
*/
#ifndef COLORMAC_H
#define COLORMAC_H
#include "imports.h"
#include "config.h"
#include "macros.h"
/** \def BYTE_TO_CHAN
* Convert from GLbyte to GLchan */
/** \def UBYTE_TO_CHAN
* Convert from GLubyte to GLchan */
/** \def SHORT_TO_CHAN
* Convert from GLshort to GLchan */
/** \def USHORT_TO_CHAN
* Convert from GLushort to GLchan */
/** \def INT_TO_CHAN
* Convert from GLint to GLchan */
/** \def UINT_TO_CHAN
* Convert from GLuint to GLchan */
/** \def CHAN_TO_UBYTE
* Convert from GLchan to GLubyte */
/** \def CHAN_TO_FLOAT
* Convert from GLchan to GLfloat */
/** \def CLAMPED_FLOAT_TO_CHAN
* Convert from GLclampf to GLchan */
/** \def UNCLAMPED_FLOAT_TO_CHAN
* Convert from GLfloat to GLchan */
/** \def COPY_CHAN4
* Copy a GLchan[4] array */
/** \def CHAN_PRODUCT
* Scaled product (usually approximated) between two GLchan arguments */
#if CHAN_BITS == 8
#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b))
#define UBYTE_TO_CHAN(b) (b)
#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7))
#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8))
#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23))
#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24))
#define CHAN_TO_UBYTE(c) (c)
#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c)
#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f)
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f)
#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
#define CHAN_PRODUCT(a, b) ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8))
#elif CHAN_BITS == 16
#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516))
#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b)))
#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s))
#define USHORT_TO_CHAN(s) (s)
#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15))
#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16))
#define CHAN_TO_UBYTE(c) ((c) >> 8)
#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF)))
#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f)
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f)
#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535))
#elif CHAN_BITS == 32
/* XXX floating-point color channels not fully thought-out */
#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F)))
#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F)))
#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F)))
#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F)))
#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F)))
#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F)))
#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c)
#define CHAN_TO_FLOAT(c) (c)
#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
#define CHAN_PRODUCT(a, b) ((a) * (b))
#else
#error unexpected CHAN_BITS size
#endif
/**
* Convert 3 channels at once.
*
* \param dst pointer to destination GLchan[3] array.
* \param f pointer to source GLfloat[3] array.
*
* \sa #UNCLAMPED_FLOAT_TO_CHAN.
*/
#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \
do { \
UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \
UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \
UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \
} while (0)
/**
* Convert 4 channels at once.
*
* \param dst pointer to destination GLchan[4] array.
* \param f pointer to source GLfloat[4] array.
*
* \sa #UNCLAMPED_FLOAT_TO_CHAN.
*/
#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \
do { \
UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \
UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \
UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \
UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \
} while (0)
/**
* \name Generic color packing macros. All inputs should be GLubytes.
*
* \todo We may move these into texstore.h at some point.
*/
/*@{*/
#define PACK_COLOR_8888( R, G, B, A ) \
(((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
#define PACK_COLOR_8888_REV( R, G, B, A ) \
(((A) << 24) | ((B) << 16) | ((G) << 8) | (R))
#define PACK_COLOR_888( R, G, B ) \
(((R) << 16) | ((G) << 8) | (B))
#define PACK_COLOR_565( R, G, B ) \
((((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | (((B) & 0xf8) >> 3))
#define PACK_COLOR_565_REV( R, G, B ) \
(((R) & 0xf8) | ((G) & 0xe0) >> 5 | (((G) & 0x1c) << 11) | (((B) & 0xf8) << 5))
#define PACK_COLOR_1555( A, B, G, R ) \
((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \
((A) ? 0x8000 : 0))
#define PACK_COLOR_1555_REV( A, B, G, R ) \
((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \
((A) ? 0x80 : 0))
#define PACK_COLOR_4444( R, G, B, A ) \
((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4))
#define PACK_COLOR_4444_REV( R, G, B, A ) \
((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4))
#define PACK_COLOR_88( L, A ) \
(((L) << 8) | (A))
#define PACK_COLOR_88_REV( L, A ) \
(((A) << 8) | (L))
#define PACK_COLOR_332( R, G, B ) \
(((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
#define PACK_COLOR_233( B, G, R ) \
(((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5))
/*@}*/
#endif /* COLORMAC_H */
/**
* \file colortab.h
* Color tables.
*
* \if subset
* (No-op)
*
* \endif
*/
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef COLORTAB_H
#define COLORTAB_H
#include "mtypes.h"
#if _HAVE_FULL_GL
extern void GLAPIENTRY
_mesa_ColorTable( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
const GLvoid *table );
extern void GLAPIENTRY
_mesa_ColorSubTable( GLenum target, GLsizei start,
GLsizei count, GLenum format, GLenum type,
const GLvoid *table );
extern void GLAPIENTRY
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width);
extern void GLAPIENTRY
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width);
extern void GLAPIENTRY
_mesa_GetColorTable( GLenum target, GLenum format,
GLenum type, GLvoid *table );
extern void GLAPIENTRY
_mesa_ColorTableParameterfv(GLenum target, GLenum pname,
const GLfloat *params);
extern void GLAPIENTRY
_mesa_ColorTableParameteriv(GLenum target, GLenum pname,
const GLint *params);
extern void GLAPIENTRY
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params );
extern void GLAPIENTRY
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params );
extern void
_mesa_init_colortable( struct gl_color_table *table );
extern void
_mesa_free_colortable_data( struct gl_color_table *table );
extern void
_mesa_init_colortables( GLcontext *ctx );
extern void
_mesa_free_colortables_data( GLcontext *ctx );
#else
/** No-op */
#define _mesa_init_colortable( p ) ((void) 0)
/** No-op */
#define _mesa_free_colortable_data( p ) ((void) 0)
/** No-op */
#define _mesa_init_colortables( p ) ((void)0)
/** No-op */
#define _mesa_free_colortables_data( p ) ((void)0)
#endif
#endif
/**
* \file config.h
* Tunable configuration parameters.
*/
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef CONFIG_H
#define CONFIG_H
/**
* \name OpenGL implementation limits
*/
/*@{*/
/** Maximum modelview matrix stack depth */
#define MAX_MODELVIEW_STACK_DEPTH 32
/** Maximum projection matrix stack depth */
#define MAX_PROJECTION_STACK_DEPTH 32
/** Maximum texture matrix stack depth */
#define MAX_TEXTURE_STACK_DEPTH 10
/** Maximum color matrix stack depth */
#define MAX_COLOR_STACK_DEPTH 4
/** Maximum attribute stack depth */
#define MAX_ATTRIB_STACK_DEPTH 16
/** Maximum client attribute stack depth */
#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16
/** Maximum recursion depth of display list calls */
#define MAX_LIST_NESTING 64
/** Maximum number of lights */
#define MAX_LIGHTS 8
/** Maximum user-defined clipping planes */
#define MAX_CLIP_PLANES 6
/** Maximum pixel map lookup table size */
#define MAX_PIXEL_MAP_TABLE 256
/** Maximum number of auxillary color buffers */
#define MAX_AUX_BUFFERS 4
/** Maximum order (degree) of curves */
#ifdef AMIGA
# define MAX_EVAL_ORDER 12
#else
# define MAX_EVAL_ORDER 30
#endif
/** Maximum Name stack depth */
#define MAX_NAME_STACK_DEPTH 64
/** Minimum point size */
#define MIN_POINT_SIZE 1.0
/** Maximum point size */
#define MAX_POINT_SIZE 20.0
/** Point size granularity */
#define POINT_SIZE_GRANULARITY 0.1
/** Minimum line width */
#define MIN_LINE_WIDTH 1.0
/** Maximum line width */
#define MAX_LINE_WIDTH 10.0
/** Line width granularity */
#define LINE_WIDTH_GRANULARITY 0.1
/** Max texture palette / color table size */
#define MAX_COLOR_TABLE_SIZE 256
/** Number of 1D/2D texture mipmap levels */
#define MAX_TEXTURE_LEVELS 12
/** Number of 3D texture mipmap levels */
#define MAX_3D_TEXTURE_LEVELS 9
/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
#define MAX_CUBE_TEXTURE_LEVELS 12
/** Maximum rectangular texture size - GL_NV_texture_rectangle */
#define MAX_TEXTURE_RECT_SIZE 2048
/** Number of texture units - GL_ARB_multitexture */
#define MAX_TEXTURE_UNITS 8
/*@}*/
/**
* \name Separate numbers of texture coordinates and texture image units.
*
* These values will eventually replace most instances of MAX_TEXTURE_UNITS.
* We should always have MAX_TEXTURE_COORD_UNITS <= MAX_TEXTURE_IMAGE_UNITS.
* And, GL_MAX_TEXTURE_UNITS <= MAX_TEXTURE_COORD_UNITS.
*/
/*@{*/
#define MAX_TEXTURE_COORD_UNITS 8
#define MAX_TEXTURE_IMAGE_UNITS 8
/*@}*/
/**
* Maximum viewport/image width. Must accomodate all texture sizes too.
*/
#define MAX_WIDTH 4096
/** Maximum viewport/image height */
#define MAX_HEIGHT 4096
/** Maxmimum size for CVA. May be overridden by the drivers. */
#define MAX_ARRAY_LOCK_SIZE 3000
/** Subpixel precision for antialiasing, window coordinate snapping */
#define SUB_PIXEL_BITS 4
/** Size of histogram tables */
#define HISTOGRAM_TABLE_SIZE 256
/** Max convolution filter width */
#define MAX_CONVOLUTION_WIDTH 9
/** Max convolution filter height */
#define MAX_CONVOLUTION_HEIGHT 9
/** For GL_ARB_texture_compression */
#define MAX_COMPRESSED_TEXTURE_FORMATS 25
/** For GL_EXT_texture_filter_anisotropic */
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
#define MAX_TEXTURE_LOD_BIAS 11.0
/** For GL_NV_vertex_program */
/*@{*/
#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
#define MAX_NV_VERTEX_PROGRAM_PARAMS 128 /* KW: power of two */
#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
/*@}*/
/** For GL_NV_fragment_program */
/*@{*/
#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 128
#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
/*@}*/
/** For GL_ARB_vertex_program */
/*@{*/
#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
#define MAX_VERTEX_PROGRAM_ATTRIBS 16
/*@}*/
/** For GL_ARB_fragment_program */
/*@{*/
#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 1
#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48
#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24
#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4
/*@}*/
/** For any program target/extension */
/*@{*/
#define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */
#define MAX_PROGRAM_MATRICES 8
#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
/*@}*/
/** For GL_ARB_fragment_shader */
/*@{*/
#define MAX_FRAGMENT_UNIFORM_COMPONENTS 64
/*@}*/
/** For GL_ARB_vertex_shader */
/*@{*/
#define MAX_VERTEX_UNIFORM_COMPONENTS 512
#define MAX_VARYING_FLOATS 32
#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0
#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS)
/*@}*/
/** For GL_ARB_draw_buffers */
/*@{*/
#define MAX_DRAW_BUFFERS 1
/*@}*/
/** For GL_EXT_framebuffer_object */
/*@{*/
#define MAX_COLOR_ATTACHMENTS 8
/*@}*/
/**
* \name Mesa-specific parameters
*/
/*@{*/
/**
* If non-zero use GLdouble for walking triangle edges, for better accuracy.
*/
#define TRIANGLE_WALK_DOUBLE 0
/**
* Bits per accumulation buffer color component: 8, 16 or 32
*/
#define ACCUM_BITS 16
/**
* Bits per depth buffer value.
*
* Any reasonable value up to 31 will work. 32 doesn't work because of integer
* overflow problems in the rasterizer code.
*/
#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
#define DEFAULT_SOFTWARE_DEPTH_BITS 16
#endif
/** Depth buffer data type */
#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16
#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
#else
#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint
#endif
/**
* Bits per stencil value: 8
*/
#define STENCIL_BITS 8
/**
* Bits per color channel: 8, 16 or 32
*/
#ifndef CHAN_BITS
#define CHAN_BITS 8
#endif
/*
* Color channel component order
*
* \note Changes will almost certainly cause problems at this time.
*/
#define RCOMP 0
#define GCOMP 1
#define BCOMP 2
#define ACOMP 3
/*
* Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1.
*/
#ifndef _HAVE_FULL_GL
#define _HAVE_FULL_GL 1
#endif
#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
#define FEATURE_MESA_program_debug _HAVE_FULL_GL
#define FEATURE_NV_fence _HAVE_FULL_GL
#define FEATURE_NV_fragment_program _HAVE_FULL_GL
#define FEATURE_NV_vertex_program _HAVE_FULL_GL
#define FEATURE_userclip _HAVE_FULL_GL
#define FEATURE_texgen _HAVE_FULL_GL
#define FEATURE_windowpos _HAVE_FULL_GL
#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
/*@}*/
/**
* Maximum number of temporary vertices required for clipping.
*
* Used in array_cache and tnl modules.
*/
#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
/* XXX everything marked with OLD_RENDERBUFFER will be going away... */
#define OLD_RENDERBUFFER 1
#endif /* CONFIG_H */
/**
* \file context.h
* Mesa context/visual/framebuffer management functions.
*
* There are three Mesa data types which are meant to be used by device
* drivers:
* - GLcontext: this contains the Mesa rendering state
* - GLvisual: this describes the color buffer (RGB vs. ci), whether or not
* there's a depth buffer, stencil buffer, etc.
* - GLframebuffer: contains pointers to the depth buffer, stencil buffer,
* accum buffer and alpha buffers.
*
* These types should be encapsulated by corresponding device driver
* data types. See xmesa.h and xmesaP.h for an example.
*
* In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
* which the device driver must derive from.
*
* The following functions create and destroy these data types.
*/
/*
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef CONTEXT_H
#define CONTEXT_H
#include "glapi.h"
#include "imports.h"
#include "mtypes.h"
/**********************************************************************/
/** \name Create/destroy a GLvisual. */
/*@{*/
extern GLvisual *
_mesa_create_visual( GLboolean rgbFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits,
GLint indexBits,
GLint depthBits,
GLint stencilBits,
GLint accumRedBits,
GLint accumGreenBits,
GLint accumBlueBits,
GLint accumAlphaBits,
GLint numSamples );
extern GLboolean
_mesa_initialize_visual( GLvisual *v,
GLboolean rgbFlag,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint greenBits,
GLint blueBits,
GLint alphaBits,
GLint indexBits,
GLint depthBits,
GLint stencilBits,
GLint accumRedBits,
GLint accumGreenBits,
GLint accumBlueBits,
GLint accumAlphaBits,
GLint numSamples );
extern void
_mesa_destroy_visual( GLvisual *vis );
/*@}*/
/**********************************************************************/
/** \name Create/destroy a GLcontext. */
/*@{*/
extern GLcontext *
_mesa_create_context( const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern GLboolean
_mesa_initialize_context( GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern void
_mesa_free_context_data( GLcontext *ctx );
extern void
_mesa_destroy_context( GLcontext *ctx );
extern void
_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
extern void
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer );
extern GLboolean
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
extern GLcontext *
_mesa_get_current_context(void);
/*@}*/
/**********************************************************************/
/** \name OpenGL SI-style export functions. */
/*@{*/
extern GLboolean
_mesa_destroyContext(__GLcontext *gc);
extern GLboolean
_mesa_loseCurrent(__GLcontext *gc);
extern GLboolean
_mesa_makeCurrent(__GLcontext *gc);
extern GLboolean
_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare);
extern GLboolean
_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask);
extern GLboolean
_mesa_forceCurrent(__GLcontext *gc);
extern GLboolean
_mesa_notifyResize(__GLcontext *gc);
extern void
_mesa_notifyDestroy(__GLcontext *gc);
extern void
_mesa_notifySwapBuffers(__GLcontext *gc);
extern struct __GLdispatchStateRec *
_mesa_dispatchExec(__GLcontext *gc);
extern void
_mesa_beginDispatchOverride(__GLcontext *gc);
extern void
_mesa_endDispatchOverride(__GLcontext *gc);
/*@}*/
extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx);
/**********************************************************************/
/** \name Miscellaneous */
/*@{*/
extern void
_mesa_record_error( GLcontext *ctx, GLenum error );
extern void GLAPIENTRY
_mesa_Finish( void );
extern void GLAPIENTRY
_mesa_Flush( void );
/*@}*/
/**********************************************************************/
/** \name Macros for contexts/flushing. */
/*@{*/
/**
* Flush vertices.
*
* \param ctx GL context.
* \param newstate new state.
*
* Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
* and calls dd_function_table::FlushVertices if so. Marks
* __GLcontextRec::NewState with \p newstate.
*/
#define FLUSH_VERTICES(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
ctx->NewState |= newstate; \
} while (0)
/**
* Flush current state.
*
* \param ctx GL context.
* \param newstate new state.
*
* Checks if dd_function_table::NeedFlush is marked to flush current state,
* and calls dd_function_table::FlushVertices if so. Marks
* __GLcontextRec::NewState with \p newstate.
*/
#define FLUSH_CURRENT(ctx, newstate) \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
/**
* Macro to assert that the API call was made outside the
* glBegin()/glEnd() pair, with return value.
*
* \param ctx GL context.
* \param retval value to return value in case the assertion fails.
*/
#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
return retval; \
} \
} while (0)
/**
* Macro to assert that the API call was made outside the
* glBegin()/glEnd() pair.
*
* \param ctx GL context.
*/
#define ASSERT_OUTSIDE_BEGIN_END(ctx) \
do { \
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { \
_mesa_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
return; \
} \
} while (0)
/**
* Macro to assert that the API call was made outside the
* glBegin()/glEnd() pair and flush the vertices.
*
* \param ctx GL context.
*/
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \
do { \
ASSERT_OUTSIDE_BEGIN_END(ctx); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
/**
* Macro to assert that the API call was made outside the
* glBegin()/glEnd() pair and flush the vertices, with return value.
*
* \param ctx GL context.
* \param retval value to return value in case the assertion fails.
*/
#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \
do { \
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \
FLUSH_VERTICES(ctx, 0); \
} while (0)
/*@}*/
/**
* Macros to help evaluate current state conditions
*/
/*@{*/
/**
* Is the secondary color needed?
*/
#define NEED_SECONDARY_COLOR(CTX) \
(((CTX)->Light.Enabled && \
(CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
|| (CTX)->Fog.ColorSumEnabled \
|| ((CTX)->VertexProgram._Enabled && \
((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \
|| ((CTX)->FragmentProgram._Enabled && \
((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \
)
/**
* Is two-sided lighting in effect?
*/
#define NEED_TWO_SIDED_LIGHTING(CTX) \
(ctx->Light.Enabled && ctx->Light.Model.TwoSide)
/*@}*/
#endif
/*
* Mesa 3-D graphics library
* Version: 3.5
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#ifndef CONVOLVE_H
#define CONVOLVE_H
#include "mtypes.h"
#if _HAVE_FULL_GL
extern void GLAPIENTRY
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
GLenum format, GLenum type, const GLvoid *image);
extern void GLAPIENTRY
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width,
GLsizei height, GLenum format, GLenum type,
const GLvoid *image);
extern void GLAPIENTRY
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params);
extern void GLAPIENTRY
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname,
const GLfloat *params);
extern void GLAPIENTRY
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params);
extern void GLAPIENTRY
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params);
extern void GLAPIENTRY
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width);
extern void GLAPIENTRY
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height);
extern void GLAPIENTRY
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
GLvoid *image);
extern void GLAPIENTRY
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params);
extern void GLAPIENTRY
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params);
extern void GLAPIENTRY
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
GLvoid *row, GLvoid *column, GLvoid *span);
extern void GLAPIENTRY
_mesa_SeparableFilter2D(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *row, const GLvoid *column);
extern void
_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width,
const GLfloat *srcImage, GLfloat *dstImage);
extern void
_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height,
const GLfloat *srcImage, GLfloat *dstImage);
extern void
_mesa_convolve_sep_image(const GLcontext *ctx,
GLsizei *width, GLsizei *height,
const GLfloat *srcImage, GLfloat *dstImage);
extern void
_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
GLsizei *width, GLsizei *height);
#else
#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0)
#define _mesa_convolve_1d_image(c,w,s,d) ((void)0)
#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0)
#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0)
#endif
#endif
/*
* Mesa 3-D graphics library
* Version: 6.1
*
* Copyright (C) 1999-2004 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of 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.
*/
#include "mtypes.h"
#include "context.h"
#include "imports.h"
#include "debug.h"
#include "get.h"
/**
* Primitive names
*/
const char *_mesa_prim_name[GL_POLYGON+4] = {
"GL_POINTS",
"GL_LINES",
"GL_LINE_LOOP",
"GL_LINE_STRIP",
"GL_TRIANGLES",
"GL_TRIANGLE_STRIP",
"GL_TRIANGLE_FAN",
"GL_QUADS",
"GL_QUAD_STRIP",
"GL_POLYGON",
"outside begin/end",
"inside unknown primitive",
"unknown state"
};
void
_mesa_print_state( const char *msg, GLuint state )
{
_mesa_debug(NULL,
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
state,
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
(state & _NEW_PROJECTION) ? "ctx->Projection, " : "",
(state & _NEW_TEXTURE_MATRIX) ? "ctx->TextureMatrix, " : "",
(state & _NEW_COLOR_MATRIX) ? "ctx->ColorMatrix, " : "",
(state & _NEW_ACCUM) ? "ctx->Accum, " : "",
(state & _NEW_COLOR) ? "ctx->Color, " : "",
(state & _NEW_DEPTH) ? "ctx->Depth, " : "",
(state & _NEW_EVAL) ? "ctx->Eval/EvalMap, " : "",
(state & _NEW_FOG) ? "ctx->Fog, " : "",
(state & _NEW_HINT) ? "ctx->Hint, " : "",
(state & _NEW_LIGHT) ? "ctx->Light, " : "",
(state & _NEW_LINE) ? "ctx->Line, " : "",
(state & _NEW_PIXEL) ? "ctx->Pixel, " : "",
(state & _NEW_POINT) ? "ctx->Point, " : "",
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
(state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
(state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
(state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
(state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
(state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
(state & _NEW_PACKUNPACK) ? "ctx->Pack/Unpack, " : "",
(state & _NEW_ARRAY) ? "ctx->Array, " : "",
(state & _NEW_RENDERMODE) ? "ctx->RenderMode, " : "",
(state & _NEW_BUFFERS) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
}
void
_mesa_print_tri_caps( const char *name, GLuint flags )
{
_mesa_debug(NULL,
"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
name,
flags,
(flags & DD_FLATSHADE) ? "flat-shade, " : "",
(flags & DD_SEPARATE_SPECULAR) ? "separate-specular, " : "",
(flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "",
(flags & DD_TRI_TWOSTENCIL) ? "tri-twostencil, " : "",
(flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "",
(flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
(flags & DD_TRI_OFFSET) ? "tri-offset, " : "",
(flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "",
(flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
(flags & DD_LINE_STIPPLE) ? "line-stipple, " : "",
(flags & DD_LINE_WIDTH) ? "line-wide, " : "",
(flags & DD_POINT_SMOOTH) ? "point-smooth, " : "",
(flags & DD_POINT_SIZE) ? "point-size, " : "",
(flags & DD_POINT_ATTEN) ? "point-atten, " : "",
(flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : ""
);
}
/**
* Print information about this Mesa version and build options.
*/
void _mesa_print_info( void )
{
_mesa_debug(NULL, "Mesa GL_VERSION = %s\n",
(char *) _mesa_GetString(GL_VERSION));
_mesa_debug(NULL, "Mesa GL_RENDERER = %s\n",
(char *) _mesa_GetString(GL_RENDERER));
_mesa_debug(NULL, "Mesa GL_VENDOR = %s\n",
(char *) _mesa_GetString(GL_VENDOR));
_mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n",
(char *) _mesa_GetString(GL_EXTENSIONS));
#if defined(THREADS)
_mesa_debug(NULL, "Mesa thread-safe: YES\n");
#else
_mesa_debug(NULL, "Mesa thread-safe: NO\n");
#endif
#if defined(USE_X86_ASM)
_mesa_debug(NULL, "Mesa x86-optimized: YES\n");
#else
_mesa_debug(NULL, "Mesa x86-optimized: NO\n");
#endif
#if defined(USE_SPARC_ASM)
_mesa_debug(NULL, "Mesa sparc-optimized: YES\n");
#else
_mesa_debug(NULL, "Mesa sparc-optimized: NO\n");
#endif
}
/**
* Set the debugging flags.
*
* \param debug debug string
*
* If compiled with debugging support then search for keywords in \p debug and
* enables the verbose debug output of the respective feature.
*/
static void add_debug_flags( const char *debug )
{
#ifdef MESA_DEBUG
if (_mesa_strstr(debug, "varray"))
MESA_VERBOSE |= VERBOSE_VARRAY;
if (_mesa_strstr(debug, "tex"))
MESA_VERBOSE |= VERBOSE_TEXTURE;
if (_mesa_strstr(debug, "imm"))
MESA_VERBOSE |= VERBOSE_IMMEDIATE;
if (_mesa_strstr(debug, "pipe"))
MESA_VERBOSE |= VERBOSE_PIPELINE;
if (_mesa_strstr(debug, "driver"))
MESA_VERBOSE |= VERBOSE_DRIVER;
if (_mesa_strstr(debug, "state"))
MESA_VERBOSE |= VERBOSE_STATE;
if (_mesa_strstr(debug, "api"))
MESA_VERBOSE |= VERBOSE_API;
if (_mesa_strstr(debug, "list"))
MESA_VERBOSE |= VERBOSE_DISPLAY_LIST;
if (_mesa_strstr(debug, "lighting"))
MESA_VERBOSE |= VERBOSE_LIGHTING;
if (_mesa_strstr(debug, "disassem"))
MESA_VERBOSE |= VERBOSE_DISASSEM;
/* Debug flag:
*/
if (_mesa_strstr(debug, "flush"))
MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
#else
(void) debug;
#endif
}
void
_mesa_init_debug( GLcontext *ctx )
{
char *c;
/* For debug/development only */
ctx->FirstTimeCurrent = GL_TRUE;
/* Dither disable */
ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
if (ctx->NoDither) {
if (_mesa_getenv("MESA_DEBUG")) {
_mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n");
}
ctx->Color.DitherFlag = GL_FALSE;
}
c = _mesa_getenv("MESA_DEBUG");
if (c)
add_debug_flags(c);
c = _mesa_getenv("MESA_VERBOSE");
if (c)
add_debug_flags(c);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment