mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
Doxygenization of the existing documentation.
This commit is contained in:
parent
ad79ba8208
commit
7067815785
9 changed files with 1813 additions and 1163 deletions
|
|
@ -1,4 +1,6 @@
|
|||
/* $Id: glapi.h,v 1.20 2002/06/29 19:48:16 brianp Exp $ */
|
||||
/**
|
||||
* \file glapi.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,6 +26,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: glapi.h,v 1.20.6.1 2003/03/02 00:27:35 jrfonseca Exp $ */
|
||||
|
||||
#ifndef _GLAPI_H
|
||||
#define _GLAPI_H
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
/* $Id: context.c,v 1.188.2.1.2.3 2003/02/21 21:14:08 keithw Exp $ */
|
||||
/**
|
||||
* \file context.c
|
||||
* \brief Mesa context/visual/framebuffer management functions.
|
||||
* \author Brian Paul
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,7 +28,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* $Id: context.c,v 1.188.2.1.2.4 2003/03/02 00:27:31 jrfonseca Exp $ */
|
||||
|
||||
/**
|
||||
* \mainpage Mesa Core Module
|
||||
|
|
@ -68,13 +72,6 @@
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file context.c
|
||||
* \brief Mesa context/visual/framebuffer management functions.
|
||||
* \author Brian Paul
|
||||
*/
|
||||
|
||||
|
||||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "buffers.h"
|
||||
|
|
@ -132,10 +129,12 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss );
|
|||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** OpenGL SI-style interface (new in Mesa 3.5) *****/
|
||||
/** \name OpenGL SI-style interface (new in Mesa 3.5) */
|
||||
/**********************************************************************/
|
||||
/*@{*/
|
||||
|
||||
/* Called by window system/device driver (via gc->exports.destroyCurrent())
|
||||
/**
|
||||
* Called by window system/device driver (via gc->exports.destroyCurrent())
|
||||
* when the rendering context is to be destroyed.
|
||||
*/
|
||||
GLboolean
|
||||
|
|
@ -148,7 +147,8 @@ _mesa_destroyContext(__GLcontext *gc)
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Called by window system/device driver (via gc->exports.loseCurrent())
|
||||
/**
|
||||
* Called by window system/device driver (via gc->exports.loseCurrent())
|
||||
* when the rendering context is made non-current.
|
||||
*/
|
||||
GLboolean
|
||||
|
|
@ -158,7 +158,8 @@ _mesa_loseCurrent(__GLcontext *gc)
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Called by window system/device driver (via gc->exports.makeCurrent())
|
||||
/**
|
||||
* Called by window system/device driver (via gc->exports.makeCurrent())
|
||||
* when the rendering context is made current.
|
||||
*/
|
||||
GLboolean
|
||||
|
|
@ -168,7 +169,8 @@ _mesa_makeCurrent(__GLcontext *gc)
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* Called by window system/device driver - yadda, yadda, yadda.
|
||||
/**
|
||||
* Called by window system/device driver - yadda, yadda, yadda.
|
||||
* See above comments.
|
||||
*/
|
||||
GLboolean
|
||||
|
|
@ -219,14 +221,17 @@ _mesa_notifyResize(__GLcontext *gc)
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the context's window/buffer is going to be destroyed.
|
||||
*/
|
||||
void
|
||||
_mesa_notifyDestroy(__GLcontext *gc)
|
||||
{
|
||||
/* Called when the context's window/buffer is going to be destroyed. */
|
||||
/* Unbind from it. */
|
||||
}
|
||||
|
||||
/* Called by window system just before swapping buffers.
|
||||
/**
|
||||
* Called by window system just before swapping buffers.
|
||||
* We have to finish any pending rendering.
|
||||
*/
|
||||
void
|
||||
|
|
@ -251,9 +256,13 @@ _mesa_endDispatchOverride(__GLcontext *gc)
|
|||
{
|
||||
}
|
||||
|
||||
/* Setup the exports. The window system will call these functions
|
||||
* when it needs Mesa to do something.
|
||||
* NOTE: Device drivers should override these functions! For example,
|
||||
/**
|
||||
* \brief Setup the exports.
|
||||
*
|
||||
* The window system will call these functions when it needs Mesa to do
|
||||
* something.
|
||||
*
|
||||
* \note Device drivers should override these functions! For example,
|
||||
* the Xlib driver should plug in the XMesa*-style functions into this
|
||||
* structure. The XMesa-style functions should then call the _mesa_*
|
||||
* version of these functions. This is an approximation to OO design
|
||||
|
|
@ -276,9 +285,9 @@ _mesa_init_default_exports(__GLexports *exports)
|
|||
exports->endDispatchOverride = _mesa_endDispatchOverride;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* exported OpenGL SI interface */
|
||||
/**
|
||||
* \brief Exported OpenGL SI interface.
|
||||
*/
|
||||
__GLcontext *
|
||||
__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes)
|
||||
{
|
||||
|
|
@ -295,8 +304,9 @@ __glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
/* exported OpenGL SI interface */
|
||||
/**
|
||||
* \brief Exported OpenGL SI interface.
|
||||
*/
|
||||
void
|
||||
__glCoreNopDispatch(void)
|
||||
{
|
||||
|
|
@ -309,28 +319,34 @@ __glCoreNopDispatch(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** GL Visual allocation/destruction *****/
|
||||
/** \name GL Visual allocation/destruction */
|
||||
/**********************************************************************/
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*
|
||||
* Allocate a new GLvisual object.
|
||||
* Input: rgbFlag - GL_TRUE=RGB(A) mode, GL_FALSE=Color Index mode
|
||||
* dbFlag - double buffering?
|
||||
* stereoFlag - stereo buffer?
|
||||
* depthBits - requested bits per depth buffer value
|
||||
* Any value in [0, 32] is acceptable but the actual
|
||||
* depth type will be GLushort or GLuint as needed.
|
||||
* stencilBits - requested minimum bits per stencil buffer value
|
||||
* accumBits - requested minimum bits per accum buffer component
|
||||
* indexBits - number of bits per pixel if rgbFlag==GL_FALSE
|
||||
* red/green/blue/alphaBits - number of bits per color component
|
||||
* in frame buffer for RGB(A) mode.
|
||||
* We always use 8 in core Mesa though.
|
||||
* Return: pointer to new GLvisual or NULL if requested parameters can't
|
||||
* be met.
|
||||
/**
|
||||
* \brief Allocate a new GLvisual object.
|
||||
*
|
||||
* \param rgbFlag GL_TRUE=RGB(A) mode, GL_FALSE=Color Index mode
|
||||
* \param dbFlag double buffering?
|
||||
* \param stereoFlag stereo buffer?
|
||||
* \param depthBits requested bits per depth buffer value. Any value in [0, 32]
|
||||
* is acceptable but the actual depth type will be GLushort or GLuint as
|
||||
* needed.
|
||||
* \param stencilBits requested minimum bits per stencil buffer value
|
||||
* \param accumBits requested minimum bits per accum buffer component
|
||||
* \param indexBits number of bits per pixel if rgbFlag==GL_FALSE
|
||||
* \param red number of bits per color component in frame buffer for RGB(A)
|
||||
* mode. We always use 8 in core Mesa though.
|
||||
* \param green same as above.
|
||||
* \param blue same as above.
|
||||
* \param alphaBits same as above.
|
||||
*
|
||||
* \return pointer to new GLvisual or NULL if requested parameters can't be
|
||||
* met.
|
||||
*/
|
||||
GLvisual *
|
||||
_mesa_create_visual( GLboolean rgbFlag,
|
||||
|
|
@ -364,12 +380,12 @@ _mesa_create_visual( GLboolean rgbFlag,
|
|||
return vis;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the fields of the given GLvisual.
|
||||
* Input: see _mesa_create_visual() above.
|
||||
* Return: GL_TRUE = success
|
||||
* GL_FALSE = failure.
|
||||
/**
|
||||
* \brief Initialize the fields of the given GLvisual.
|
||||
*
|
||||
* \return GL_TRUE on success, or GL_FALSE on failure.
|
||||
*
|
||||
* \sa see _mesa_create_visual() above.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_initialize_visual( GLvisual *vis,
|
||||
|
|
@ -446,29 +462,33 @@ _mesa_initialize_visual( GLvisual *vis,
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_destroy_visual( GLvisual *vis )
|
||||
{
|
||||
FREE(vis);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** GL Framebuffer allocation/destruction *****/
|
||||
/** \name GL Framebuffer allocation/destruction */
|
||||
/**********************************************************************/
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*
|
||||
* Create a new framebuffer. A GLframebuffer is a struct which
|
||||
* encapsulates the depth, stencil and accum buffers and related
|
||||
* parameters.
|
||||
* Input: visual - a GLvisual pointer (we copy the struct contents)
|
||||
* softwareDepth - create/use a software depth buffer?
|
||||
* softwareStencil - create/use a software stencil buffer?
|
||||
* softwareAccum - create/use a software accum buffer?
|
||||
* softwareAlpha - create/use a software alpha buffer?
|
||||
* Return: pointer to new GLframebuffer struct or NULL if error.
|
||||
/**
|
||||
* \brief Create a new framebuffer.
|
||||
*
|
||||
* A GLframebuffer is a struct which encapsulates the depth, stencil and accum
|
||||
* buffers and related parameters.
|
||||
*
|
||||
* \param visual a GLvisual pointer (we copy the struct contents)
|
||||
* \param softwareDepth create/use a software depth buffer?
|
||||
* \param softwareStencil create/use a software stencil buffer?
|
||||
* \param softwareAccum create/use a software accum buffer?
|
||||
* \param softwareAlpha create/use a software alpha buffer?
|
||||
*
|
||||
* \return pointer to new GLframebuffer struct or NULL if error.
|
||||
*/
|
||||
GLframebuffer *
|
||||
_mesa_create_framebuffer( const GLvisual *visual,
|
||||
|
|
@ -487,10 +507,10 @@ _mesa_create_framebuffer( const GLvisual *visual,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a GLframebuffer object.
|
||||
* Input: See _mesa_create_framebuffer() above.
|
||||
/**
|
||||
* \brief Initialize a GLframebuffer object.
|
||||
*
|
||||
* \sa _mesa_create_framebuffer() above.
|
||||
*/
|
||||
void
|
||||
_mesa_initialize_framebuffer( GLframebuffer *buffer,
|
||||
|
|
@ -531,8 +551,8 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free a framebuffer struct and its buffers.
|
||||
/**
|
||||
* \brief Free a framebuffer struct and its buffers.
|
||||
*/
|
||||
void
|
||||
_mesa_destroy_framebuffer( GLframebuffer *buffer )
|
||||
|
|
@ -544,8 +564,8 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free the data hanging off of <buffer>, but not <buffer> itself.
|
||||
/**
|
||||
* \brief Free the data hanging off of \p buffer, but not \p buffer itself.
|
||||
*/
|
||||
void
|
||||
_mesa_free_framebuffer_data( GLframebuffer *buffer )
|
||||
|
|
@ -583,18 +603,18 @@ _mesa_free_framebuffer_data( GLframebuffer *buffer )
|
|||
}
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** Context allocation, initialization, destroying *****/
|
||||
/** \name Context allocation, initialization, destroying *****/
|
||||
/**********************************************************************/
|
||||
|
||||
/*@{*/
|
||||
|
||||
_glthread_DECLARE_STATIC_MUTEX(OneTimeLock);
|
||||
|
||||
|
||||
/*
|
||||
* This function just calls all the various one-time-init functions in Mesa.
|
||||
/**
|
||||
* \brief This function just calls all the various one-time-init functions in Mesa.
|
||||
*/
|
||||
static void
|
||||
one_time_init( GLcontext *ctx )
|
||||
|
|
@ -641,7 +661,6 @@ one_time_init( GLcontext *ctx )
|
|||
_glthread_UNLOCK_MUTEX(OneTimeLock);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_matrix_stack( struct matrix_stack *stack,
|
||||
GLuint maxDepth, GLuint dirtyFlag )
|
||||
|
|
@ -660,7 +679,6 @@ init_matrix_stack( struct matrix_stack *stack,
|
|||
stack->Top = stack->Stack;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_matrix_stack( struct matrix_stack *stack )
|
||||
{
|
||||
|
|
@ -672,9 +690,8 @@ free_matrix_stack( struct matrix_stack *stack )
|
|||
stack->Stack = stack->Top = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allocate and initialize a shared context state structure.
|
||||
/**
|
||||
* \brief Allocate and initialize a shared context state structure.
|
||||
*/
|
||||
static struct gl_shared_state *
|
||||
alloc_shared_state( void )
|
||||
|
|
@ -754,9 +771,8 @@ alloc_shared_state( void )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Deallocate a shared state context and all children structures.
|
||||
/**
|
||||
* \brief Deallocate a shared state context and all children structures.
|
||||
*/
|
||||
static void
|
||||
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
|
||||
|
|
@ -799,11 +815,10 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
|
|||
FREE(ss);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the nth light. Note that the defaults for light 0 are
|
||||
* different than the other lights.
|
||||
/**
|
||||
* \brief Initialize the n-th light.
|
||||
*
|
||||
* Note that the defaults for light 0 are different than the other lights.
|
||||
*/
|
||||
static void
|
||||
init_light( struct gl_light *l, GLuint n )
|
||||
|
|
@ -831,8 +846,6 @@ init_light( struct gl_light *l, GLuint n )
|
|||
l->Enabled = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init_lightmodel( struct gl_lightmodel *lm )
|
||||
{
|
||||
|
|
@ -842,7 +855,6 @@ init_lightmodel( struct gl_lightmodel *lm )
|
|||
lm->ColorControl = GL_SINGLE_COLOR;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_material( struct gl_material *m )
|
||||
{
|
||||
|
|
@ -856,8 +868,6 @@ init_material( struct gl_material *m )
|
|||
m->SpecularIndex = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init_texture_unit( GLcontext *ctx, GLuint unit )
|
||||
{
|
||||
|
|
@ -910,9 +920,9 @@ init_texture_unit( GLcontext *ctx, GLuint unit )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Initialize a 1-D evaluator map */
|
||||
/**
|
||||
* \brief Initialize a 1-D evaluator map.
|
||||
*/
|
||||
static void
|
||||
init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
||||
{
|
||||
|
|
@ -928,7 +938,9 @@ init_1d_map( struct gl_1d_map *map, int n, const float *initial )
|
|||
}
|
||||
|
||||
|
||||
/* Initialize a 2-D evaluator map */
|
||||
/**
|
||||
* \brief Initialize a 2-D evaluator map
|
||||
*/
|
||||
static void
|
||||
init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
||||
{
|
||||
|
|
@ -946,9 +958,8 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the attribute groups in a GLcontext.
|
||||
/**
|
||||
* \brief Initialize the attribute groups in a GLcontext.
|
||||
*/
|
||||
static void
|
||||
init_attrib_groups( GLcontext *ctx )
|
||||
|
|
@ -1547,13 +1558,13 @@ init_attrib_groups( GLcontext *ctx )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Allocate the proxy textures. If we run out of memory part way through
|
||||
* the allocations clean up and return GL_FALSE.
|
||||
* Return: GL_TRUE=success, GL_FALSE=failure
|
||||
/**
|
||||
* \brief Allocate the proxy textures.
|
||||
*
|
||||
* If we run out of memory part way through the allocations clean up and return
|
||||
* GL_FALSE.
|
||||
*
|
||||
* \return GL_TRUE on success, or GL_FALSE on failure
|
||||
*/
|
||||
static GLboolean
|
||||
alloc_proxy_textures( GLcontext *ctx )
|
||||
|
|
@ -1645,7 +1656,6 @@ alloc_proxy_textures( GLcontext *ctx )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void add_debug_flags( const char *debug )
|
||||
{
|
||||
#ifdef MESA_DEBUG
|
||||
|
|
@ -1683,10 +1693,11 @@ static void add_debug_flags( const char *debug )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize a GLcontext struct. This includes allocating all the
|
||||
* other structs and arrays which hang off of the context by pointers.
|
||||
/**
|
||||
* \brief Initialize a GLcontext struct.
|
||||
*
|
||||
* This includes allocating all the other structs and arrays which hang off of
|
||||
* the context by pointers.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_initialize_context( GLcontext *ctx,
|
||||
|
|
@ -1920,15 +1931,15 @@ _mesa_initialize_context( GLcontext *ctx,
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allocate and initialize a GLcontext structure.
|
||||
* Input: visual - a GLvisual pointer (we copy the struct contents)
|
||||
* sharelist - another context to share display lists with or NULL
|
||||
* driver_ctx - pointer to device driver's context state struct
|
||||
* direct - direct rendering?
|
||||
* Return: pointer to a new __GLcontextRec or NULL if error.
|
||||
* \brief Allocate and initialize a GLcontext structure.
|
||||
*
|
||||
* \param visual a GLvisual pointer (we copy the struct contents)
|
||||
* \param sharelist another context to share display lists with or NULL
|
||||
* \param driver_ctx pointer to device driver's context state struct
|
||||
* \param direct direct rendering?
|
||||
*
|
||||
* \return pointer to a new __GLcontextRec or NULL if error.
|
||||
*/
|
||||
GLcontext *
|
||||
_mesa_create_context( const GLvisual *visual,
|
||||
|
|
@ -1955,10 +1966,9 @@ _mesa_create_context( const GLvisual *visual,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Free the data associated with the given context.
|
||||
* \brief Free the data associated with the given context.
|
||||
*
|
||||
* But don't free() the GLcontext struct itself!
|
||||
*/
|
||||
void
|
||||
|
|
@ -2073,10 +2083,8 @@ _mesa_free_context_data( GLcontext *ctx )
|
|||
FREE(ctx->Save);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Destroy a GLcontext structure.
|
||||
* \brief Destroy a GLcontext structure.
|
||||
*/
|
||||
void
|
||||
_mesa_destroy_context( GLcontext *ctx )
|
||||
|
|
@ -2087,13 +2095,12 @@ _mesa_destroy_context( GLcontext *ctx )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Copy attribute groups from one context to another.
|
||||
* Input: src - source context
|
||||
* dst - destination context
|
||||
* mask - bitwise OR of GL_*_BIT flags
|
||||
/**
|
||||
* \brief Copy attribute groups from one context to another.
|
||||
*
|
||||
* \param src source context
|
||||
* \param dst destination context
|
||||
* \param mask bitwise OR of GL_*_BIT flags
|
||||
*/
|
||||
void
|
||||
_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
|
||||
|
|
@ -2202,8 +2209,6 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
|
|||
dst->NewState = _NEW_ALL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void print_info( void )
|
||||
{
|
||||
_mesa_debug(NULL, "Mesa GL_VERSION = %s\n",
|
||||
|
|
@ -2231,9 +2236,8 @@ static void print_info( void )
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the current context, binding the given frame buffer to the context.
|
||||
/**
|
||||
* \brief Set the current context, binding the given frame buffer to the context.
|
||||
*/
|
||||
void
|
||||
_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
|
||||
|
|
@ -2242,9 +2246,9 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Bind the given context to the given draw-buffer and read-buffer
|
||||
* and make it the current context for this thread.
|
||||
/**
|
||||
* \brief Bind the given context to the given draw-buffer and read-buffer and
|
||||
* make it the current context for this thread.
|
||||
*/
|
||||
void
|
||||
_mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
||||
|
|
@ -2345,10 +2349,9 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return current context handle for the calling thread.
|
||||
/**
|
||||
* \brief Return current context handle for the calling thread.
|
||||
*
|
||||
* This isn't the fastest way to get the current context.
|
||||
* If you need speed, see the GET_CURRENT_CONTEXT() macro in context.h
|
||||
*/
|
||||
|
|
@ -2358,11 +2361,11 @@ _mesa_get_current_context( void )
|
|||
return (GLcontext *) _glapi_get_context();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return pointer to this context's current API dispatch table.
|
||||
* It'll either be the immediate-mode execute dispatcher or the
|
||||
* display list compile dispatcher.
|
||||
/**
|
||||
* \brief Return pointer to this context's current API dispatch table.
|
||||
*
|
||||
* It'll either be the immediate-mode execute dispatcher or the display list
|
||||
* compile dispatcher.
|
||||
*/
|
||||
struct _glapi_table *
|
||||
_mesa_get_dispatch(GLcontext *ctx)
|
||||
|
|
@ -2370,15 +2373,17 @@ _mesa_get_dispatch(GLcontext *ctx)
|
|||
return ctx->CurrentDispatch;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/***** Miscellaneous functions *****/
|
||||
/** \name Miscellaneous functions *****/
|
||||
/**********************************************************************/
|
||||
/*@{*/
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Record the given error code and call the driver's Error function if defined.
|
||||
*
|
||||
* This is called via _mesa_error().
|
||||
*/
|
||||
void
|
||||
|
|
@ -2397,7 +2402,6 @@ _mesa_record_error( GLcontext *ctx, GLenum error )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_Finish( void )
|
||||
{
|
||||
|
|
@ -2408,8 +2412,6 @@ _mesa_Finish( void )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_mesa_Flush( void )
|
||||
{
|
||||
|
|
@ -2420,8 +2422,9 @@ _mesa_Flush( void )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Primitive names
|
||||
*/
|
||||
const char *_mesa_prim_name[GL_POLYGON+4] = {
|
||||
"GL_POINTS",
|
||||
"GL_LINES",
|
||||
|
|
@ -2437,3 +2440,5 @@ const char *_mesa_prim_name[GL_POLYGON+4] = {
|
|||
"inside unkown primitive",
|
||||
"unknown state"
|
||||
};
|
||||
|
||||
/*@{*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,23 @@
|
|||
/* $Id: context.h,v 1.35 2002/10/24 23:57:20 brianp Exp $ */
|
||||
/**
|
||||
* \file context.h
|
||||
* \brief Context.
|
||||
*
|
||||
* There are three Mesa datatypes 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
|
||||
* datatypes. 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 datatypes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,6 +43,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: context.h,v 1.35.4.1 2003/03/02 00:27:32 jrfonseca Exp $ */
|
||||
|
||||
#ifndef CONTEXT_H
|
||||
#define CONTEXT_H
|
||||
|
|
@ -33,28 +53,10 @@
|
|||
#include "mtypes.h"
|
||||
|
||||
|
||||
/*
|
||||
* There are three Mesa datatypes 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
|
||||
* datatypes. 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 datatypes.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Create/destroy a GLvisual.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
/** \name Create/destroy a GLvisual. */
|
||||
/*@{*/
|
||||
|
||||
extern GLvisual *
|
||||
_mesa_create_visual( GLboolean rgbFlag,
|
||||
GLboolean dbFlag,
|
||||
|
|
@ -93,11 +95,13 @@ _mesa_initialize_visual( GLvisual *v,
|
|||
extern void
|
||||
_mesa_destroy_visual( GLvisual *vis );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
* Create/destroy a GLframebuffer.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
/** \name Create/destroy a GLframebuffer. */
|
||||
/*@{*/
|
||||
|
||||
extern GLframebuffer *
|
||||
_mesa_create_framebuffer( const GLvisual *visual,
|
||||
GLboolean softwareDepth,
|
||||
|
|
@ -119,11 +123,13 @@ _mesa_free_framebuffer_data( GLframebuffer *buffer );
|
|||
extern void
|
||||
_mesa_destroy_framebuffer( GLframebuffer *buffer );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
* Create/destroy a GLcontext.
|
||||
*/
|
||||
/**********************************************************************/
|
||||
/** \name Create/destroy a GLcontext. */
|
||||
/*@{*/
|
||||
|
||||
extern GLcontext *
|
||||
_mesa_create_context( const GLvisual *visual,
|
||||
GLcontext *share_list,
|
||||
|
|
@ -160,10 +166,13 @@ _mesa_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer,
|
|||
extern GLcontext *
|
||||
_mesa_get_current_context(void);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*
|
||||
* Macros for fetching current context.
|
||||
/**
|
||||
* \brief Macro for fetching the current context.
|
||||
*
|
||||
* It should be used in the variable declaration area of a function.
|
||||
*/
|
||||
#ifdef THREADS
|
||||
|
||||
|
|
@ -177,7 +186,9 @@ _mesa_get_current_context(void);
|
|||
|
||||
|
||||
|
||||
/* OpenGL SI-style export functions. */
|
||||
/**********************************************************************/
|
||||
/** \name OpenGL SI-style export functions. */
|
||||
/*@{*/
|
||||
|
||||
extern GLboolean
|
||||
_mesa_destroyContext(__GLcontext *gc);
|
||||
|
|
@ -215,6 +226,7 @@ _mesa_beginDispatchOverride(__GLcontext *gc);
|
|||
extern void
|
||||
_mesa_endDispatchOverride(__GLcontext *gc);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
extern struct _glapi_table *
|
||||
|
|
@ -222,9 +234,9 @@ _mesa_get_dispatch(GLcontext *ctx);
|
|||
|
||||
|
||||
|
||||
/*
|
||||
* Miscellaneous
|
||||
*/
|
||||
/**********************************************************************/
|
||||
/** \name Miscellaneous */
|
||||
/*@{*/
|
||||
|
||||
extern void
|
||||
_mesa_record_error( GLcontext *ctx, GLenum error );
|
||||
|
|
@ -236,5 +248,6 @@ _mesa_Finish( void );
|
|||
extern void
|
||||
_mesa_Flush( void );
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
/* $Id: dd.h,v 1.74 2002/10/11 17:41:04 brianp Exp $ */
|
||||
/**
|
||||
* \file dd.h
|
||||
* \brief Device driver interfaces.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,6 +27,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dd.h,v 1.74.6.1 2003/03/02 00:27:33 jrfonseca Exp $ */
|
||||
|
||||
|
||||
#ifndef DD_INCLUDED
|
||||
|
|
@ -47,136 +51,181 @@ struct gl_pixelstore_attrib;
|
|||
#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */
|
||||
|
||||
|
||||
/*
|
||||
* Device Driver function table.
|
||||
/**
|
||||
* \brief Device driver function table.
|
||||
*/
|
||||
struct dd_function_table {
|
||||
|
||||
/**
|
||||
* \brief Return a string as needed by glGetString().
|
||||
*
|
||||
* Only the GL_RENDERER token must be implemented. Otherwise, NULL can be
|
||||
* returned.
|
||||
*/
|
||||
const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
|
||||
/* Return a string as needed by glGetString().
|
||||
* Only the GL_RENDERER token must be implemented. Otherwise,
|
||||
* NULL can be returned.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Notify the driver after Mesa has made some internal state changes.
|
||||
*
|
||||
* This is in addition to any statechange callbacks Mesa may already have
|
||||
* made.
|
||||
*/
|
||||
void (*UpdateState)( GLcontext *ctx, GLuint new_state );
|
||||
/*
|
||||
* UpdateState() is called to notify the driver after Mesa has made
|
||||
* some internal state changes. This is in addition to any
|
||||
* statechange callbacks Mesa may already have made.
|
||||
*/
|
||||
|
||||
void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
GLint x, GLint y, GLint width, GLint height );
|
||||
/* Clear the color/depth/stencil/accum buffer(s).
|
||||
* 'mask' is a bitmask of the DD_*_BIT values defined above that indicates
|
||||
/**
|
||||
* \brief Clear the color/depth/stencil/accum buffer(s).
|
||||
*
|
||||
* \p mask is a bitmask of the DD_*_BIT values defined above that indicates
|
||||
* which buffers need to be cleared.
|
||||
* If 'all' is true then the clear the whole buffer, else clear only the
|
||||
* region defined by (x,y,width,height).
|
||||
* This function must obey the glColorMask, glIndexMask and glStencilMask
|
||||
* If \p all is true then clear the whole buffer, else clear only the
|
||||
* region defined by \c (x, y, width, height).
|
||||
* This function must obey the glColorMask(), glIndexMask() and glStencilMask()
|
||||
* settings!
|
||||
* Software Mesa can do masked clears if the device driver can't.
|
||||
*/
|
||||
void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
GLint x, GLint y, GLint width, GLint height );
|
||||
|
||||
/**
|
||||
* \brief Specify the current buffer for writing.
|
||||
*
|
||||
* Called via glDrawBuffer(). Note the driver must organize fallbacks (e.g.
|
||||
* with swrast) if it cannot implement the requested mode.
|
||||
*/
|
||||
void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
|
||||
/*
|
||||
* Specifies the current buffer for writing. Called via glDrawBuffer().
|
||||
* Note the driver must organize fallbacks (eg with swrast) if it
|
||||
* cannot implement the requested mode.
|
||||
|
||||
/**
|
||||
* \brief Specifies the current buffer for reading.
|
||||
*
|
||||
* Called via glReadBuffer().
|
||||
*/
|
||||
|
||||
|
||||
void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
|
||||
/*
|
||||
* Specifies the current buffer for reading. Called via glReadBuffer().
|
||||
*/
|
||||
|
||||
void (*GetBufferSize)( GLframebuffer *buffer,
|
||||
GLuint *width, GLuint *height );
|
||||
/*
|
||||
* Returns the width and height of the named buffer/window.
|
||||
/**
|
||||
* \brief Get the width and height of the named buffer/window.
|
||||
*
|
||||
* Mesa uses this to determine when the driver's window size has changed.
|
||||
*/
|
||||
void (*GetBufferSize)( GLframebuffer *buffer,
|
||||
GLuint *width, GLuint *height );
|
||||
|
||||
/**
|
||||
* \brief Resize the driver's depth/stencil/accum/back buffers to match the
|
||||
* size given in the GLframebuffer struct.
|
||||
*
|
||||
* This is typically called when Mesa detects that a window size has changed.
|
||||
*/
|
||||
void (*ResizeBuffers)( GLframebuffer *buffer );
|
||||
/*
|
||||
* Resize the driver's depth/stencil/accum/back buffers to match the
|
||||
* size given in the GLframebuffer struct. This is typically called
|
||||
* when Mesa detects that a window size has changed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief This is called whenever glFinish() is called.
|
||||
*/
|
||||
void (*Finish)( GLcontext *ctx );
|
||||
/*
|
||||
* This is called whenever glFinish() is called.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief This is called whenever glFlush() is called.
|
||||
*/
|
||||
void (*Flush)( GLcontext *ctx );
|
||||
/*
|
||||
* This is called whenever glFlush() is called.
|
||||
*/
|
||||
|
||||
void (*Error)( GLcontext *ctx );
|
||||
/*
|
||||
* Called whenever an error is generated. ctx->ErrorValue contains
|
||||
/**
|
||||
* \brief Called whenever an error is generated. ctx->ErrorValue contains
|
||||
* the error value.
|
||||
*/
|
||||
void (*Error)( GLcontext *ctx );
|
||||
|
||||
|
||||
/***
|
||||
*** For hardware accumulation buffer:
|
||||
***/
|
||||
/**
|
||||
* \name For hardware accumulation buffer
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* \brief Execute glAccum command within the given scissor region.
|
||||
*/
|
||||
void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value,
|
||||
GLint xpos, GLint ypos, GLint width, GLint height );
|
||||
/* Execute glAccum command within the given scissor region.
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name glDraw(), glRead(), glCopyPixels() and glBitmap() functions
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
|
||||
/***
|
||||
*** glDraw/Read/CopyPixels and glBitmap functions:
|
||||
***/
|
||||
|
||||
/**
|
||||
* \brief This is called by glDrawPixels().
|
||||
*
|
||||
* \p unpack describes how to unpack the source image data.
|
||||
*/
|
||||
void (*DrawPixels)( GLcontext *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLvoid *pixels );
|
||||
/* This is called by glDrawPixels.
|
||||
* 'unpack' describes how to unpack the source image data.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glReadPixels().
|
||||
*/
|
||||
void (*ReadPixels)( GLcontext *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
GLvoid *dest );
|
||||
/* Called by glReadPixels.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Do a glCopyPixels().
|
||||
*
|
||||
* This function must respect all rasterization state, glPixelTransfer(),
|
||||
* glPixelZoom(), etc.
|
||||
*/
|
||||
void (*CopyPixels)( GLcontext *ctx,
|
||||
GLint srcx, GLint srcy,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstx, GLint dsty, GLenum type );
|
||||
/* Do a glCopyPixels. This function must respect all rasterization
|
||||
* state, glPixelTransfer, glPixelZoom, etc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief This is called by glBitmap().
|
||||
*
|
||||
* Works the same as dd_function_table::DrawPixels, above.
|
||||
*/
|
||||
void (*Bitmap)( GLcontext *ctx,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
const struct gl_pixelstore_attrib *unpack,
|
||||
const GLubyte *bitmap );
|
||||
/* This is called by glBitmap. Works the same as DrawPixels, above.
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
/***
|
||||
*** Texture image functions:
|
||||
***/
|
||||
|
||||
/**
|
||||
* \name Texture image functions
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* \brief Choose texture format.
|
||||
*
|
||||
* This is called by the \c _mesa_store_tex[sub]image[123]d() fallback
|
||||
* functions. The driver should examine \p internalFormat and return a
|
||||
* pointer to an appropriate gl_texture_format.
|
||||
*/
|
||||
const struct gl_texture_format *
|
||||
(*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
|
||||
GLenum srcFormat, GLenum srcType );
|
||||
/* This is called by the _mesa_store_tex[sub]image[123]d() fallback
|
||||
* functions. The driver should examine <internalFormat> and return a
|
||||
* pointer to an appropriate gl_texture_format.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glTexImage1D().
|
||||
*
|
||||
* \param target user specified.
|
||||
* \param format user specified.
|
||||
* \param type user specified.
|
||||
* \param pixels user specified.
|
||||
* \param packing indicates the image packing of pixels.
|
||||
* \param texObj is the target texture object.
|
||||
* \param texImage is the target texture image. It will have the texture \p
|
||||
* width, \p height, \p depth, \p border and \p internalFormat information.
|
||||
*
|
||||
* \p retainInternalCopy is returned by this function and indicates whether
|
||||
* core Mesa should keep an internal copy of the texture image.
|
||||
*
|
||||
* Drivers should call a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint border,
|
||||
|
|
@ -184,6 +233,12 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
/**
|
||||
* \brief Called by glTexImage2D().
|
||||
*
|
||||
* \sa dd_function_table::TexImage1D.
|
||||
*/
|
||||
void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint height, GLint border,
|
||||
|
|
@ -191,6 +246,12 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
/**
|
||||
* \brief Called by glTexImage3D().
|
||||
*
|
||||
* \sa dd_function_table::TexImage1D.
|
||||
*/
|
||||
void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint height, GLint depth, GLint border,
|
||||
|
|
@ -198,18 +259,28 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
/* Called by glTexImage1/2/3D.
|
||||
* Arguments:
|
||||
* <target>, <level>, <format>, <type> and <pixels> are user specified.
|
||||
* <packing> indicates the image packing of pixels.
|
||||
* <texObj> is the target texture object.
|
||||
* <texImage> is the target texture image. It will have the texture
|
||||
* width, height, depth, border and internalFormat information.
|
||||
* <retainInternalCopy> is returned by this function and indicates whether
|
||||
* core Mesa should keep an internal copy of the texture image.
|
||||
* Drivers should call a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glTexSubImage1D().
|
||||
*
|
||||
* \param target user specified.
|
||||
* \param level user specified.
|
||||
* \param xoffset user specified.
|
||||
* \param yoffset user specified.
|
||||
* \param zoffset user specified.
|
||||
* \param width user specified.
|
||||
* \param height user specified.
|
||||
* \param depth user specified.
|
||||
* \param format user specified.
|
||||
* \param type user specified.
|
||||
* \param pixels user specified.
|
||||
* \param packing indicates the image packing of pixels.
|
||||
* \param texObj is the target texture object.
|
||||
* \param texImage is the target texture image. It will have the texture \p
|
||||
* width, \p height, \p border and \p internalFormat information.
|
||||
*
|
||||
* The driver should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLsizei width,
|
||||
GLenum format, GLenum type,
|
||||
|
|
@ -217,6 +288,12 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
/**
|
||||
* \brief Called by glTexSubImage2D().
|
||||
*
|
||||
* \sa dd_function_table::TexSubImage1D.
|
||||
*/
|
||||
void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height,
|
||||
|
|
@ -225,6 +302,12 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
|
||||
/**
|
||||
* \brief Called by glTexSubImage3D().
|
||||
*
|
||||
* \sa dd_function_table::TexSubImage1D.
|
||||
*/
|
||||
void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLint depth,
|
||||
|
|
@ -233,68 +316,108 @@ struct dd_function_table {
|
|||
const struct gl_pixelstore_attrib *packing,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
/* Called by glTexSubImage1/2/3D.
|
||||
* Arguments:
|
||||
* <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>,
|
||||
* <depth>, <format>, <type> and <pixels> are user specified.
|
||||
* <packing> indicates the image packing of pixels.
|
||||
* <texObj> is the target texture object.
|
||||
* <texImage> is the target texture image. It will have the texture
|
||||
* width, height, border and internalFormat information.
|
||||
* The driver should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glCopyTexImage1D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLint border );
|
||||
|
||||
/**
|
||||
* \brief Called by glCopyTexImage2D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height, GLint border );
|
||||
/* Called by glCopyTexImage1D and glCopyTexImage2D.
|
||||
|
||||
/**
|
||||
* \brief Called by glCopyTexSubImage1D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
|
||||
void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset,
|
||||
GLint x, GLint y, GLsizei width );
|
||||
/**
|
||||
* \brief Called by glCopyTexSubImage2D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height );
|
||||
/**
|
||||
* \brief Called by glCopyTexSubImage3D().
|
||||
*
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height );
|
||||
/* Called by glCopyTexSubImage1/2/3D.
|
||||
* Drivers should use a fallback routine from texstore.c if needed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glTexImage[123]D when user specifies a proxy texture
|
||||
* target.
|
||||
*
|
||||
* \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
|
||||
*/
|
||||
GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
|
||||
GLint level, GLint internalFormat,
|
||||
GLenum format, GLenum type,
|
||||
GLint width, GLint height,
|
||||
GLint depth, GLint border);
|
||||
/* Called by glTexImage[123]D when user specifies a proxy texture
|
||||
* target. Return GL_TRUE if the proxy test passes, return GL_FALSE
|
||||
* if the test fails.
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Compressed texture functions
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/***
|
||||
*** Compressed texture functions:
|
||||
***/
|
||||
|
||||
/**
|
||||
* \brief Called by glCompressedTexImage1D().
|
||||
*
|
||||
* \param target user specified.
|
||||
* \param format user specified.
|
||||
* \param type user specified.
|
||||
* \param pixels user specified.
|
||||
* \param packing indicates the image packing of pixels.
|
||||
* \param texObj is the target texture object.
|
||||
* \param texImage is the target texture image. It will have the texture \p
|
||||
* width, \p height, \p depth, \p border and \p internalFormat information.
|
||||
*
|
||||
* \a retainInternalCopy is returned by this function and indicates whether
|
||||
* core Mesa should keep an internal copy of the texture image.
|
||||
*/
|
||||
void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
|
||||
GLint level, GLint internalFormat,
|
||||
GLsizei width, GLint border,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
/**
|
||||
* \brief Called by glCompressedTexImage2D().
|
||||
*
|
||||
* \sa dd_function_table::glCompressedTexImage1D.
|
||||
*/
|
||||
void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
|
||||
GLint level, GLint internalFormat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
/**
|
||||
* \brief Called by glCompressedTexImage3D().
|
||||
*
|
||||
* \sa dd_function_table::glCompressedTexImage3D.
|
||||
*/
|
||||
void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
|
||||
GLint level, GLint internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
|
|
@ -302,24 +425,35 @@ struct dd_function_table {
|
|||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage );
|
||||
/* Called by glCompressedTexImage1/2/3D.
|
||||
* Arguments:
|
||||
* <target>, <level>, <internalFormat>, <data> are user specified.
|
||||
* <texObj> is the target texture object.
|
||||
* <texImage> is the target texture image. It will have the texture
|
||||
* width, height, depth, border and internalFormat information.
|
||||
* <retainInternalCopy> is returned by this function and indicates whether
|
||||
* core Mesa should keep an internal copy of the texture image.
|
||||
* Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
|
||||
* should do the job.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glCompressedTexSubImage1D().
|
||||
*
|
||||
* \param target user specified.
|
||||
* \param level user specified.
|
||||
* \param xoffset user specified.
|
||||
* \param yoffset user specified.
|
||||
* \param zoffset user specified.
|
||||
* \param width user specified.
|
||||
* \param height user specified.
|
||||
* \param depth user specified.
|
||||
* \param imageSize user specified.
|
||||
* \param data user specified.
|
||||
* \param texObj is the target texture object.
|
||||
* \param texImage is the target texture image. It will have the texture \p
|
||||
* width, \p height, \p depth, \p border and \p internalFormat information.
|
||||
*/
|
||||
void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLsizei width,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
/**
|
||||
* \brief Called by glCompressedTexSubImage2D().
|
||||
*
|
||||
* \sa dd_function_table::glCompressedTexImage3D.
|
||||
*/
|
||||
void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLint height,
|
||||
|
|
@ -327,6 +461,11 @@ struct dd_function_table {
|
|||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
/**
|
||||
* \brief Called by glCompressedTexSubImage3D().
|
||||
*
|
||||
* \sa dd_function_table::glCompressedTexImage3D.
|
||||
*/
|
||||
void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLint height, GLint depth,
|
||||
|
|
@ -334,59 +473,64 @@ struct dd_function_table {
|
|||
GLsizei imageSize, const GLvoid *data,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage);
|
||||
/* Called by glCompressedTexSubImage1/2/3D.
|
||||
* Arguments:
|
||||
* <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>,
|
||||
* <imageSize>, and <data> are user specified.
|
||||
* <texObj> is the target texture object.
|
||||
* <texImage> is the target texture image. It will have the texture
|
||||
* width, height, depth, border and internalFormat information.
|
||||
* Return GL_TRUE if operation completed, return GL_FALSE if core Mesa
|
||||
* should do the job.
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Texture object functions
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/***
|
||||
*** Texture object functions:
|
||||
***/
|
||||
|
||||
/**
|
||||
* \brief Called by glBindTexture().
|
||||
*/
|
||||
void (*BindTexture)( GLcontext *ctx, GLenum target,
|
||||
struct gl_texture_object *tObj );
|
||||
/* Called by glBindTexture().
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called when a texture object is created.
|
||||
*/
|
||||
void (*CreateTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
|
||||
/* Called when a texture object is created.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called when a texture object is about to be deallocated.
|
||||
*
|
||||
* Driver should free anything attached to the DriverData pointers.
|
||||
*/
|
||||
void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
|
||||
/* Called when a texture object is about to be deallocated. Driver
|
||||
* should free anything attached to the DriverData pointers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glAreTextureResident().
|
||||
*/
|
||||
GLboolean (*IsTextureResident)( GLcontext *ctx,
|
||||
struct gl_texture_object *t );
|
||||
/* Called by glAreTextureResident().
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glPrioritizeTextures().
|
||||
*/
|
||||
void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t,
|
||||
GLclampf priority );
|
||||
/* Called by glPrioritizeTextures().
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Called by glActiveTextureARB() to set current texture unit.
|
||||
*/
|
||||
void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber );
|
||||
/* Called by glActiveTextureARB to set current texture unit.
|
||||
*/
|
||||
|
||||
void (*UpdateTexturePalette)( GLcontext *ctx,
|
||||
struct gl_texture_object *tObj );
|
||||
/* Called when the texture's color lookup table is changed.
|
||||
* If tObj is NULL then the shared texture palette ctx->Texture.Palette
|
||||
/**
|
||||
* \brief Called when the texture's color lookup table is changed.
|
||||
*
|
||||
* If \p tObj is NULL then the shared texture palette ctx->Texture.Palette
|
||||
* is to be updated.
|
||||
*/
|
||||
void (*UpdateTexturePalette)( GLcontext *ctx,
|
||||
struct gl_texture_object *tObj );
|
||||
/*@}*/
|
||||
|
||||
/***
|
||||
*** Imaging functionality:
|
||||
***/
|
||||
|
||||
/**
|
||||
* \name Imaging functionality
|
||||
* .
|
||||
*/
|
||||
/*@{*/
|
||||
void (*CopyColorTable)( GLcontext *ctx,
|
||||
GLenum target, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width );
|
||||
|
|
@ -403,16 +547,19 @@ struct dd_function_table {
|
|||
GLenum internalFormat,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height );
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*** State-changing functions (drawing functions are above)
|
||||
***
|
||||
*** These functions are called by their corresponding OpenGL API functions.
|
||||
*** They're ALSO called by the gl_PopAttrib() function!!!
|
||||
*** May add more functions like these to the device driver in the future.
|
||||
***/
|
||||
/**
|
||||
* \name State-changing functions.
|
||||
*
|
||||
* \note drawing functions are above.
|
||||
*
|
||||
* These functions are called by their corresponding OpenGL API functions.
|
||||
* They're \e also called by the gl_PopAttrib() function!!!
|
||||
* May add more functions like these to the device driver in the future.
|
||||
*/
|
||||
/*@{*/
|
||||
void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
|
||||
void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
|
||||
void (*BlendEquation)(GLcontext *ctx, GLenum mode);
|
||||
|
|
@ -465,12 +612,15 @@ struct dd_function_table {
|
|||
GLenum pname, const GLfloat *params);
|
||||
void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
|
||||
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
|
||||
/*@}*/
|
||||
|
||||
/***
|
||||
*** Vertex array functions
|
||||
***
|
||||
*** Called by the corresponding OpenGL functions.
|
||||
***/
|
||||
|
||||
/**
|
||||
* \name Vertex array functions
|
||||
*
|
||||
* Called by the corresponding OpenGL functions.
|
||||
*/
|
||||
/*@{*/
|
||||
void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *ptr);
|
||||
void (*NormalPointer)(GLcontext *ctx, GLenum type,
|
||||
|
|
@ -488,111 +638,164 @@ struct dd_function_table {
|
|||
void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
|
||||
void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size,
|
||||
GLenum type, GLsizei stride, const GLvoid *ptr);
|
||||
/*@}*/
|
||||
|
||||
|
||||
/*** State-query functions
|
||||
***
|
||||
*** Return GL_TRUE if query was completed, GL_FALSE otherwise.
|
||||
***/
|
||||
/**
|
||||
* \name State-query functions
|
||||
*
|
||||
* Return GL_TRUE if query was completed, GL_FALSE otherwise.
|
||||
*/
|
||||
/*@{*/
|
||||
GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
|
||||
GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
|
||||
GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
|
||||
GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
|
||||
GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
|
||||
/*@}*/
|
||||
|
||||
|
||||
/***
|
||||
*** Support for multiple t&l engines
|
||||
***/
|
||||
/**
|
||||
* \name Support for multiple T&L engines
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
GLuint NeedValidate;
|
||||
/* Bitmask of state changes that require the current tnl module to be
|
||||
/**
|
||||
* \brief Bitmask of state changes that require the current T&L module to be
|
||||
* validated, using ValidateTnlModule() below.
|
||||
*/
|
||||
GLuint NeedValidate;
|
||||
|
||||
void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
|
||||
/* Validate the current tnl module. This is called directly after
|
||||
* UpdateState() when a state change that has occured matches the
|
||||
* NeedValidate bitmask above. This ensures all computed values are
|
||||
* up to date, thus allowing the driver to decide if the current tnl
|
||||
* module needs to be swapped out.
|
||||
/**
|
||||
* \brief Validate the current T&L module.
|
||||
*
|
||||
* This must be non-NULL if a driver installs a custom tnl module and
|
||||
* sets the NeedValidate bitmask, but may be NULL otherwise.
|
||||
* This is called directly after UpdateState() when a state change that has
|
||||
* occured matches the dd_function_table::NeedValidate bitmask above. This
|
||||
* ensures all computed values are up to date, thus allowing the driver to
|
||||
* decide if the current T&L module needs to be swapped out.
|
||||
*
|
||||
* This must be non-NULL if a driver installs a custom T&L module and sets
|
||||
* the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
|
||||
*/
|
||||
void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
|
||||
|
||||
|
||||
#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1
|
||||
#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2
|
||||
#define PRIM_UNKNOWN GL_POLYGON+3
|
||||
|
||||
/**
|
||||
* \brief Set by the driver-supplied T&L engine.
|
||||
*
|
||||
* Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
|
||||
*/
|
||||
GLuint CurrentExecPrimitive;
|
||||
/* Set by the driver-supplied t&l engine. Set to
|
||||
* PRIM_OUTSIDE_BEGIN_END when outside begin/end.
|
||||
*/
|
||||
|
||||
GLuint CurrentSavePrimitive;
|
||||
/* Current state of an in-progress compilation. May take on any of
|
||||
* the additional values defined above.
|
||||
/**
|
||||
* Current state of an in-progress compilation.
|
||||
*
|
||||
* May take on any of the additional values PRIM_OUTSIDE_BEGIN_END,
|
||||
* PRIM_INSIDE_UNKNOWN_PRIM or PRIM_UNKNOWN defined above.
|
||||
*/
|
||||
GLuint CurrentSavePrimitive;
|
||||
|
||||
|
||||
#define FLUSH_STORED_VERTICES 0x1
|
||||
#define FLUSH_UPDATE_CURRENT 0x2
|
||||
GLuint NeedFlush;
|
||||
/* Set by the driver-supplied t&l engine whenever vertices are
|
||||
* buffered between begin/end objects or ctx->Current is not uptodate.
|
||||
/**
|
||||
* Set by the driver-supplied T&L engine whenever vertices are
|
||||
* buffered between glBegin()/glEnd() objects or ctx->Current is not uptodate.
|
||||
*
|
||||
* The FlushVertices() call below may be used to resolve
|
||||
* The dd_function_table::FlushVertices call below may be used to resolve
|
||||
* these conditions.
|
||||
*/
|
||||
GLuint NeedFlush;
|
||||
|
||||
void (*FlushVertices)( GLcontext *ctx, GLuint flags );
|
||||
/* If inside begin/end, ASSERT(0).
|
||||
* Otherwise,
|
||||
* if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices,
|
||||
* if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current
|
||||
* and ctx->Light.Material
|
||||
/**
|
||||
* If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
|
||||
* FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
|
||||
* vertices, if FLUSH_UPDATE_CURRENT bit is set updates ctx->Current and
|
||||
* ctx->Light.Material
|
||||
*
|
||||
* Note that the default t&l engine never clears the
|
||||
* Note that the default T&L engine never clears the
|
||||
* FLUSH_UPDATE_CURRENT bit, even after performing the update.
|
||||
*/
|
||||
void (*FlushVertices)( GLcontext *ctx, GLuint flags );
|
||||
|
||||
void (*LightingSpaceChange)( GLcontext *ctx );
|
||||
/* Notify driver that the special derived value _NeedEyeCoords has
|
||||
/**
|
||||
* \brief Notify driver that the special derived value _NeedEyeCoords has
|
||||
* changed.
|
||||
*/
|
||||
void (*LightingSpaceChange)( GLcontext *ctx );
|
||||
|
||||
void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
|
||||
void (*EndList)( GLcontext *ctx );
|
||||
/* Let the t&l component know what is going on with display lists
|
||||
/**
|
||||
* \brief Called by glNewList().
|
||||
*
|
||||
* Let the T&L component know what is going on with display lists
|
||||
* in time to make changes to dispatch tables, etc.
|
||||
* Called by glNewList() and glEndList(), respectively.
|
||||
*/
|
||||
void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
|
||||
/**
|
||||
* \brief Called by glEndList().
|
||||
*
|
||||
* \sa dd_function_table::NewList.
|
||||
*/
|
||||
void (*EndList)( GLcontext *ctx );
|
||||
|
||||
void (*BeginCallList)( GLcontext *ctx, GLuint list );
|
||||
void (*EndCallList)( GLcontext *ctx );
|
||||
/* Notify the t&l component before and after calling a display list.
|
||||
/**
|
||||
* \brief Called by glCallList(s), but not recursively.
|
||||
*
|
||||
* Notify the T&L component before and after calling a display list.
|
||||
* Called by glCallList(s), but not recursively.
|
||||
*/
|
||||
void (*BeginCallList)( GLcontext *ctx, GLuint list );
|
||||
/**
|
||||
* \brief Called by glEndCallList().
|
||||
*
|
||||
* \sa dd_function_table::BeginCallList.
|
||||
*/
|
||||
void (*EndCallList)( GLcontext *ctx );
|
||||
|
||||
/**
|
||||
* \brief Let the T&L component know when the context becomes current.
|
||||
*/
|
||||
void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer );
|
||||
/* Let the t&l component know when the context becomes current.
|
||||
|
||||
/**
|
||||
* \brief Called by glLockArraysEXT().
|
||||
*/
|
||||
|
||||
|
||||
void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count );
|
||||
void (*UnlockArraysEXT)( GLcontext *ctx );
|
||||
/* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
|
||||
/**
|
||||
* \brief Called by UnlockArraysEXT().
|
||||
*/
|
||||
void (*UnlockArraysEXT)( GLcontext *ctx );
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Transform/Clip/Lighting interface
|
||||
/**
|
||||
* \brief Transform/Clip/Lighting interface
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* Drivers present a reduced set of the functions possible in
|
||||
* glBegin()/glEnd() objects. Core mesa provides translation stubs for the
|
||||
* remaining functions to map down to these entrypoints.
|
||||
*
|
||||
* These are the initial values to be installed into dispatch by
|
||||
* mesa. If the T&L driver wants to modify the dispatch table
|
||||
* while installed, it must do so itself. It would be possible for
|
||||
* the vertexformat to install it's own initial values for these
|
||||
* functions, but this way there is an obvious list of what is
|
||||
* expected of the driver.
|
||||
*
|
||||
* If the driver wants to hook in entrypoints other than those
|
||||
* listed, it must restore them to their original values in
|
||||
* the disable() callback, below.
|
||||
*/
|
||||
/*@{*/
|
||||
void (*ArrayElement)( GLint ); /* NOTE */
|
||||
void (*Color3f)( GLfloat, GLfloat, GLfloat );
|
||||
void (*Color3fv)( const GLfloat * );
|
||||
|
|
@ -648,52 +851,44 @@ typedef struct {
|
|||
void (*End)( void );
|
||||
void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
|
||||
void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v );
|
||||
/*@}*/
|
||||
|
||||
/* Drivers present a reduced set of the functions possible in
|
||||
* begin/end objects. Core mesa provides translation stubs for the
|
||||
* remaining functions to map down to these entrypoints.
|
||||
*
|
||||
* These are the initial values to be installed into dispatch by
|
||||
* mesa. If the t&l driver wants to modify the dispatch table
|
||||
* while installed, it must do so itself. It would be possible for
|
||||
* the vertexformat to install it's own initial values for these
|
||||
* functions, but this way there is an obvious list of what is
|
||||
* expected of the driver.
|
||||
*
|
||||
* If the driver wants to hook in entrypoints other than those
|
||||
* listed above, it must restore them to their original values in
|
||||
* the disable() callback, below.
|
||||
*/
|
||||
|
||||
void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
|
||||
/*
|
||||
*/
|
||||
void (*Rectf)( GLfloat, GLfloat, GLfloat, GLfloat );
|
||||
|
||||
/**
|
||||
* These may or may not belong here. Heuristic: if an array is
|
||||
* enabled, the installed vertex format should support that array and
|
||||
* it's current size natively.
|
||||
*/
|
||||
/*@{*/
|
||||
void (*DrawArrays)( GLenum mode, GLint start, GLsizei count );
|
||||
void (*DrawElements)( GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices );
|
||||
void (*DrawRangeElements)( GLenum mode, GLuint start,
|
||||
GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices );
|
||||
/* These may or may not belong here. Heuristic: If an array is
|
||||
* enabled, the installed vertex format should support that array and
|
||||
* it's current size natively.
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
|
||||
void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
|
||||
/* If you don't support eval, fallback to the default vertex format
|
||||
/**
|
||||
* If you don't support eval, fallback to the default vertex format
|
||||
* on receiving an eval call and use the pipeline mechanism to
|
||||
* provide partial t&l acceleration.
|
||||
* provide partial T&L acceleration.
|
||||
*
|
||||
* Mesa will provide a set of helper functions to do eval within
|
||||
* accelerated vertex formats, eventually...
|
||||
*/
|
||||
/*@{*/
|
||||
void (*EvalMesh1)( GLenum mode, GLint i1, GLint i2 );
|
||||
void (*EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
|
||||
/*@}*/
|
||||
|
||||
GLboolean prefer_float_colors;
|
||||
/* Should core try to send colors to glColor4f or glColor4chan,
|
||||
/**
|
||||
* Should core try to send colors to glColor4f or glColor4chan,
|
||||
* where it has a choice?
|
||||
*/
|
||||
GLboolean prefer_float_colors;
|
||||
} GLvertexformat;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
/* $Id: dlist.c,v 1.100 2002/11/06 15:16:23 brianp Exp $ */
|
||||
/**
|
||||
* \file dlist.c
|
||||
* \brief Display lists management functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,6 +27,8 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dlist.c,v 1.100.4.1 2003/03/02 00:27:34 jrfonseca Exp $ */
|
||||
|
||||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "api_loopback.h"
|
||||
|
|
@ -70,47 +75,48 @@
|
|||
|
||||
|
||||
|
||||
/*
|
||||
Functions which aren't compiled but executed immediately:
|
||||
glIsList
|
||||
glGenLists
|
||||
glDeleteLists
|
||||
glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
|
||||
glFeedbackBuffer
|
||||
glSelectBuffer
|
||||
glRenderMode
|
||||
glReadPixels
|
||||
glPixelStore
|
||||
glFlush
|
||||
glFinish
|
||||
glIsEnabled
|
||||
glGet*
|
||||
|
||||
Functions which cause errors if called while compiling a display list:
|
||||
glNewList
|
||||
*/
|
||||
/**
|
||||
* Functions which aren't compiled but executed immediately:
|
||||
* - glIsList
|
||||
* - glGenLists
|
||||
* - glDeleteLists
|
||||
* - glEndList --- BUT: call ctx->Driver.EndList at end of list execution?
|
||||
* - glFeedbackBuffer
|
||||
* - glSelectBuffer
|
||||
* - glRenderMode
|
||||
* - glReadPixels
|
||||
* - glPixelStore
|
||||
* - glFlush
|
||||
* - glFinish
|
||||
* - glIsEnabled
|
||||
* - glGet*
|
||||
*
|
||||
* Functions which cause errors if called while compiling a display list:
|
||||
* - glNewList
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Display list instructions are stored as sequences of "nodes". Nodes
|
||||
* are allocated in blocks. Each block has BLOCK_SIZE nodes. Blocks
|
||||
* are linked together with a pointer.
|
||||
*/
|
||||
|
||||
|
||||
/* How many nodes to allocate at a time:
|
||||
* - reduced now that we hold vertices etc. elsewhere.
|
||||
/**
|
||||
* \brief How many nodes to allocate at a time.
|
||||
*
|
||||
* \note Reduced now that we hold vertices etc. elsewhere.
|
||||
*/
|
||||
#define BLOCK_SIZE 256
|
||||
|
||||
|
||||
/*
|
||||
* Display list opcodes.
|
||||
/**
|
||||
* \brief Display list opcodes.
|
||||
*
|
||||
* The fact that these identifiers are assigned consecutive
|
||||
* integer values starting at 0 is very important, see InstSize array usage)
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
OPCODE_ACCUM,
|
||||
|
|
@ -258,7 +264,9 @@ typedef enum {
|
|||
} OpCode;
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Display list node.
|
||||
*
|
||||
* Each instruction in the display list is stored as a sequence of
|
||||
* contiguous nodes in memory.
|
||||
* Each node is the union of a variety of datatypes.
|
||||
|
|
@ -279,9 +287,9 @@ union node {
|
|||
};
|
||||
|
||||
|
||||
|
||||
/* Number of nodes of storage needed for each instruction. Sizes for
|
||||
* dynamically allocated opcodes are stored in the context struct.
|
||||
/**
|
||||
* \brief Number of nodes of storage needed for each instruction.
|
||||
* Sizes for dynamically allocated opcodes are stored in the context struct.
|
||||
*/
|
||||
static GLuint InstSize[ OPCODE_END_OF_LIST+1 ];
|
||||
|
||||
|
|
@ -292,10 +300,6 @@ void mesa_print_display_list( GLuint list );
|
|||
/***** Private *****/
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Make an empty display list. This is used by glGenLists() to
|
||||
* reserver display list IDs.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,20 @@
|
|||
/* $Id: glheader.h,v 1.29 2002/10/30 19:44:41 brianp Exp $ */
|
||||
/**
|
||||
* \file glheader.h
|
||||
* \brief Top-most include file.
|
||||
*
|
||||
* This is the top-most include file of the Mesa sources.
|
||||
* It includes gl.h and all system headers which are needed.
|
||||
* Other Mesa source files should _not_ directly include any system
|
||||
* headers. This allows Mesa to be integrated into XFree86 and
|
||||
* allows system-dependent hacks/work-arounds to be collected in one place.
|
||||
*
|
||||
* If you touch this file, everything gets recompiled!
|
||||
*
|
||||
* This file should be included before any other header in the .c files.
|
||||
*
|
||||
* Put compiler/OS/assembly pragmas and macros here to avoid
|
||||
* cluttering other source files.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,26 +40,13 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: glheader.h,v 1.29.4.1 2003/03/02 00:27:35 jrfonseca Exp $ */
|
||||
|
||||
|
||||
#ifndef GLHEADER_H
|
||||
#define GLHEADER_H
|
||||
|
||||
|
||||
/*
|
||||
* This is the top-most include file of the Mesa sources.
|
||||
* It includes gl.h and all system headers which are needed.
|
||||
* Other Mesa source files should _not_ directly include any system
|
||||
* headers. This allows Mesa to be integrated into XFree86 and
|
||||
* allows system-dependent hacks/work-arounds to be collected in one place.
|
||||
*
|
||||
* If you touch this file, everything gets recompiled!
|
||||
*
|
||||
* This file should be included before any other header in the .c files.
|
||||
*
|
||||
* Put compiler/OS/assembly pragmas and macros here to avoid
|
||||
* cluttering other source files.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if defined(XFree86LOADER) && defined(IN_MODULE)
|
||||
|
|
@ -282,7 +285,7 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
|
||||
* as a int (thereby using integer registers instead of fp registers) is
|
||||
* a performance win. Typically, this can be done with ordinary casts.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,12 @@
|
|||
/* $Id: m_matrix.c,v 1.14 2002/10/24 23:57:24 brianp Exp $ */
|
||||
/**
|
||||
* \file m_matrix.c
|
||||
* \brief Matrix operations.
|
||||
*
|
||||
* \note
|
||||
* -# 4x4 transformation matrices are stored in memory in column major order.
|
||||
* -# Points/vertices are to be thought of as column vectors.
|
||||
* -# Transformation of a point p by a matrix M is: p' = M * p
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,15 +32,8 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: m_matrix.c,v 1.14.4.1 2003/03/02 00:27:36 jrfonseca Exp $ */
|
||||
|
||||
/*
|
||||
* Matrix operations
|
||||
*
|
||||
* NOTES:
|
||||
* 1. 4x4 transformation matrices are stored in memory in column major order.
|
||||
* 2. Points/vertices are to be thought of as column vectors.
|
||||
* 3. Transformation of a point p by a matrix M is: p' = M * p
|
||||
*/
|
||||
|
||||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
|
|
@ -43,6 +44,9 @@
|
|||
#include "m_matrix.h"
|
||||
|
||||
|
||||
/**
|
||||
* \brief Names of the corresponding GLmatrixtype values.
|
||||
*/
|
||||
static const char *types[] = {
|
||||
"MATRIX_GENERAL",
|
||||
"MATRIX_IDENTITY",
|
||||
|
|
@ -54,6 +58,9 @@ static const char *types[] = {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Identity matrix.
|
||||
*/
|
||||
static GLfloat Identity[16] = {
|
||||
1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
|
|
@ -63,22 +70,27 @@ static GLfloat Identity[16] = {
|
|||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix multiplication */
|
||||
/*@{*/
|
||||
|
||||
/*
|
||||
* This matmul was contributed by Thomas Malik
|
||||
*
|
||||
* Perform a 4x4 matrix multiplication (product = a x b).
|
||||
* Input: a, b - matrices to multiply
|
||||
* Output: product - product of a and b
|
||||
* WARNING: (product != b) assumed
|
||||
* NOTE: (product == a) allowed
|
||||
*
|
||||
* KW: 4*16 = 64 muls
|
||||
*/
|
||||
#define A(row,col) a[(col<<2)+row]
|
||||
#define B(row,col) b[(col<<2)+row]
|
||||
#define P(row,col) product[(col<<2)+row]
|
||||
|
||||
/**
|
||||
* \brief Perform a full 4x4 matrix multiplication.
|
||||
*
|
||||
* \param a matrix.
|
||||
* \param b matrix.
|
||||
* \param product will receive the product of \p a and \p b.
|
||||
*
|
||||
* \warning Is assumed that \p product != \p b. \p product == \p a is allowed.
|
||||
*
|
||||
* \note KW: 4*16 = 64 multiplications
|
||||
*
|
||||
* \author This \c matmul was contributed by Thomas Malik
|
||||
*/
|
||||
static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b )
|
||||
{
|
||||
GLint i;
|
||||
|
|
@ -91,9 +103,13 @@ static void matmul4( GLfloat *product, const GLfloat *a, const GLfloat *b )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Multiply two matrices known to occupy only the top three rows, such
|
||||
/**
|
||||
* \brief Multiply two matrices known to occupy only the top three rows, such
|
||||
* as typical model matrices, and ortho matrices.
|
||||
*
|
||||
* \param a matrix.
|
||||
* \param b matrix.
|
||||
* \param product will receive the product of \p a and \p b.
|
||||
*/
|
||||
static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b )
|
||||
{
|
||||
|
|
@ -111,14 +127,20 @@ static void matmul34( GLfloat *product, const GLfloat *a, const GLfloat *b )
|
|||
P(3,3) = 1;
|
||||
}
|
||||
|
||||
|
||||
#undef A
|
||||
#undef B
|
||||
#undef P
|
||||
|
||||
|
||||
/*
|
||||
* Multiply a matrix by an array of floats with known properties.
|
||||
/**
|
||||
* \brief Multiply a matrix by an array of floats with known properties.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure containing the left mutiplication
|
||||
* matrix, and that will receive the product result.
|
||||
* \param m right multiplication matrix array.
|
||||
* \param flags flags of the matrix \p m.
|
||||
*
|
||||
* Joins both flags and marks the type and inverse as drity. Calls matmul34()
|
||||
* if both matrices are 3D, or matmul4() otherwise.
|
||||
*/
|
||||
static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags )
|
||||
{
|
||||
|
|
@ -130,7 +152,49 @@ static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags )
|
|||
matmul4( mat->m, mat->m, m );
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Matrix multiplication.
|
||||
*
|
||||
*/
|
||||
void
|
||||
_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b )
|
||||
{
|
||||
dest->flags = (a->flags |
|
||||
b->flags |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
|
||||
if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D))
|
||||
matmul34( dest->m, a->m, b->m );
|
||||
else
|
||||
matmul4( dest->m, a->m, b->m );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m )
|
||||
{
|
||||
dest->flags |= (MAT_FLAG_GENERAL |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
|
||||
matmul4( dest->m, dest->m, m );
|
||||
}
|
||||
|
||||
/*@{*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix output */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* \brief Print a matrix array.
|
||||
*
|
||||
* \param m matrix array.
|
||||
*
|
||||
* Called by _math_matrix_print() to print a matrix or its inverse.
|
||||
*/
|
||||
static void print_matrix_floats( const GLfloat m[16] )
|
||||
{
|
||||
int i;
|
||||
|
|
@ -139,6 +203,11 @@ static void print_matrix_floats( const GLfloat m[16] )
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Dumps the contents of a GLmatrix structure.
|
||||
*
|
||||
* \param m pointer to the GLmatrix strucure.
|
||||
*/
|
||||
void
|
||||
_math_matrix_print( const GLmatrix *m )
|
||||
{
|
||||
|
|
@ -157,16 +226,48 @@ _math_matrix_print( const GLmatrix *m )
|
|||
}
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
||||
#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; }
|
||||
/**
|
||||
* \brief References an element of 4x4 matrix.
|
||||
*
|
||||
* \param m matrix array.
|
||||
* \param c column of the desired element.
|
||||
* \param r row of the desired element.
|
||||
*
|
||||
* \return value of the desired element.
|
||||
*
|
||||
* Calculate the linear storage index of the element and references it.
|
||||
*/
|
||||
#define MAT(m,r,c) (m)[(c)*4+(r)]
|
||||
|
||||
/*
|
||||
* Compute inverse of 4x4 transformation matrix.
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix inversion */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* \brief Swaps the values of two floating pointer variables.
|
||||
*
|
||||
* Used by invert_matrix_general() to swap the row pointers.
|
||||
*/
|
||||
#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; }
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of 4x4 transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* \author
|
||||
* Code contributed by Jacques Leroy jle@star.be
|
||||
* Return GL_TRUE for success, GL_FALSE for failure (singular matrix)
|
||||
*
|
||||
* Calculates the inverse matrix by performing the gaussian matrix reduction
|
||||
* with partial pivoting folloed by back/substitution with the loops manually
|
||||
* unrolled.
|
||||
*/
|
||||
static GLboolean invert_matrix_general( GLmatrix *mat )
|
||||
{
|
||||
|
|
@ -281,8 +382,20 @@ static GLboolean invert_matrix_general( GLmatrix *mat )
|
|||
}
|
||||
#undef SWAP_ROWS
|
||||
|
||||
|
||||
/* Adapted from graphics gems II.
|
||||
/**
|
||||
* \brief Compute inverse of a general 3d transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* \author Adapted from graphics gems II.
|
||||
*
|
||||
* Calculates the inverse of the upper left by first calculating its
|
||||
* determinant and multiplying it to the simetric adjust matrix of each
|
||||
* element. Finally deals with the translation part by transforming the
|
||||
* original translation vector using by the calculated submatrix inverse.
|
||||
*/
|
||||
static GLboolean invert_matrix_3d_general( GLmatrix *mat )
|
||||
{
|
||||
|
|
@ -343,7 +456,19 @@ static GLboolean invert_matrix_3d_general( GLmatrix *mat )
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of a 3d transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* If the matrix is not an angle preserving matrix then calls
|
||||
* invert_matrix_3d_general for the actual calculation. Otherwise calculates
|
||||
* the inverse matrix analyzing and inverting each of the scaling, rotation and
|
||||
* translation parts.
|
||||
*/
|
||||
static GLboolean invert_matrix_3d( GLmatrix *mat )
|
||||
{
|
||||
const GLfloat *in = mat->m;
|
||||
|
|
@ -414,15 +539,32 @@ static GLboolean invert_matrix_3d( GLmatrix *mat )
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of an identity transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return always GL_TRUE.
|
||||
*
|
||||
* Simply copies Identity into GLmatrix::inv.
|
||||
*/
|
||||
static GLboolean invert_matrix_identity( GLmatrix *mat )
|
||||
{
|
||||
MEMCPY( mat->inv, Identity, sizeof(Identity) );
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of a no-rotation 3d transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* Calculates the
|
||||
*/
|
||||
static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat )
|
||||
{
|
||||
const GLfloat *in = mat->m;
|
||||
|
|
@ -445,7 +587,17 @@ static GLboolean invert_matrix_3d_no_rot( GLmatrix *mat )
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of a no-rotation 2d transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* Calculates the inverse matrix by applying the inverse scaling and
|
||||
* translation to the identity matrix.
|
||||
*/
|
||||
static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat )
|
||||
{
|
||||
const GLfloat *in = mat->m;
|
||||
|
|
@ -466,7 +618,6 @@ static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat )
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* broken */
|
||||
static GLboolean invert_matrix_perspective( GLmatrix *mat )
|
||||
|
|
@ -495,10 +646,14 @@ static GLboolean invert_matrix_perspective( GLmatrix *mat )
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \brief Matrix inversion function pointer type.
|
||||
*/
|
||||
typedef GLboolean (*inv_mat_func)( GLmatrix *mat );
|
||||
|
||||
|
||||
/**
|
||||
* \brief Table of the matrix inversion functions according to the matrix type.
|
||||
*/
|
||||
static inv_mat_func inv_mat_tab[7] = {
|
||||
invert_matrix_general,
|
||||
invert_matrix_identity,
|
||||
|
|
@ -516,7 +671,18 @@ static inv_mat_func inv_mat_tab[7] = {
|
|||
invert_matrix_3d
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Compute inverse of a transformation matrix.
|
||||
*
|
||||
* \param mat pointer to a GLmatrix structure. The matrix inverse will be
|
||||
* stored in the GLmatrix::inv attribute.
|
||||
*
|
||||
* \return GL_TRUE for success, GL_FALSE for failure (\p singular matrix).
|
||||
*
|
||||
* Calls the matrix inversion function in inv_mat_tab corresponding to the
|
||||
* given matrix type. In case of failure, updates the MAT_FLAG_SINGULAR flag,
|
||||
* and copies the identity matrix into GLmatrix::inv.
|
||||
*/
|
||||
static GLboolean matrix_invert( GLmatrix *mat )
|
||||
{
|
||||
if (inv_mat_tab[mat->type](mat)) {
|
||||
|
|
@ -529,16 +695,20 @@ static GLboolean matrix_invert( GLmatrix *mat )
|
|||
}
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix generation */
|
||||
/*@{*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Generate a 4x4 transformation matrix from glRotate parameters, and
|
||||
* postmultiply the input matrix by it.
|
||||
* This function contributed by Erich Boleyn (erich@uruk.org).
|
||||
* Optimizatios contributed by Rudolf Opalla (rudi@khm.de).
|
||||
/**
|
||||
* \brief Generate a 4x4 transformation matrix from glRotate parameters, and
|
||||
* post-multiply the input matrix by it.
|
||||
*
|
||||
* \author
|
||||
* This function was contributed by Erich Boleyn (erich@uruk.org).
|
||||
* Optimizations contributed by Rudolf Opalla (rudi@khm.de).
|
||||
*/
|
||||
void
|
||||
_math_matrix_rotate( GLmatrix *mat,
|
||||
|
|
@ -710,8 +880,6 @@ _math_matrix_rotate( GLmatrix *mat,
|
|||
matrix_multf( mat, m, MAT_FLAG_ROTATION );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_frustum( GLmatrix *mat,
|
||||
GLfloat left, GLfloat right,
|
||||
|
|
@ -765,6 +933,58 @@ _math_matrix_ortho( GLmatrix *mat,
|
|||
matrix_multf( mat, m, (MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION));
|
||||
}
|
||||
|
||||
void
|
||||
_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
|
||||
{
|
||||
GLfloat *m = mat->m;
|
||||
m[0] *= x; m[4] *= y; m[8] *= z;
|
||||
m[1] *= x; m[5] *= y; m[9] *= z;
|
||||
m[2] *= x; m[6] *= y; m[10] *= z;
|
||||
m[3] *= x; m[7] *= y; m[11] *= z;
|
||||
|
||||
if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8)
|
||||
mat->flags |= MAT_FLAG_UNIFORM_SCALE;
|
||||
else
|
||||
mat->flags |= MAT_FLAG_GENERAL_SCALE;
|
||||
|
||||
mat->flags |= (MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
void
|
||||
_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
|
||||
{
|
||||
GLfloat *m = mat->m;
|
||||
m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
||||
m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
||||
m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
||||
m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
|
||||
|
||||
mat->flags |= (MAT_FLAG_TRANSLATION |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
void
|
||||
_math_matrix_set_identity( GLmatrix *mat )
|
||||
{
|
||||
MEMCPY( mat->m, Identity, 16*sizeof(GLfloat) );
|
||||
|
||||
if (mat->inv)
|
||||
MEMCPY( mat->inv, Identity, 16*sizeof(GLfloat) );
|
||||
|
||||
mat->type = MATRIX_IDENTITY;
|
||||
mat->flags &= ~(MAT_DIRTY_FLAGS|
|
||||
MAT_DIRTY_TYPE|
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix analysis */
|
||||
/*@{*/
|
||||
|
||||
#define ZERO(x) (1<<x)
|
||||
#define ONE(x) (1<<(x+16))
|
||||
|
|
@ -917,7 +1137,6 @@ static void analyse_from_scratch( GLmatrix *mat )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Analyse a matrix given that its flags are accurate - this is the
|
||||
* more common operation, hopefully.
|
||||
*/
|
||||
|
|
@ -959,7 +1178,6 @@ static void analyse_from_flags( GLmatrix *mat )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_analyse( GLmatrix *mat )
|
||||
{
|
||||
|
|
@ -979,6 +1197,12 @@ _math_matrix_analyse( GLmatrix *mat )
|
|||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix setup */
|
||||
/*@{*/
|
||||
|
||||
void
|
||||
_math_matrix_copy( GLmatrix *to, const GLmatrix *from )
|
||||
|
|
@ -998,40 +1222,6 @@ _math_matrix_copy( GLmatrix *to, const GLmatrix *from )
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_scale( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
|
||||
{
|
||||
GLfloat *m = mat->m;
|
||||
m[0] *= x; m[4] *= y; m[8] *= z;
|
||||
m[1] *= x; m[5] *= y; m[9] *= z;
|
||||
m[2] *= x; m[6] *= y; m[10] *= z;
|
||||
m[3] *= x; m[7] *= y; m[11] *= z;
|
||||
|
||||
if (fabs(x - y) < 1e-8 && fabs(x - z) < 1e-8)
|
||||
mat->flags |= MAT_FLAG_UNIFORM_SCALE;
|
||||
else
|
||||
mat->flags |= MAT_FLAG_GENERAL_SCALE;
|
||||
|
||||
mat->flags |= (MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
|
||||
{
|
||||
GLfloat *m = mat->m;
|
||||
m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
|
||||
m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
|
||||
m[14] = m[2] * x + m[6] * y + m[10] * z + m[14];
|
||||
m[15] = m[3] * x + m[7] * y + m[11] * z + m[15];
|
||||
|
||||
mat->flags |= (MAT_FLAG_TRANSLATION |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_loadf( GLmatrix *mat, const GLfloat *m )
|
||||
{
|
||||
|
|
@ -1063,7 +1253,6 @@ _math_matrix_dtr( GLmatrix *m )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_alloc_inv( GLmatrix *m )
|
||||
{
|
||||
|
|
@ -1074,47 +1263,12 @@ _math_matrix_alloc_inv( GLmatrix *m )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b )
|
||||
{
|
||||
dest->flags = (a->flags |
|
||||
b->flags |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
|
||||
if (TEST_MAT_FLAGS(dest, MAT_FLAGS_3D))
|
||||
matmul34( dest->m, a->m, b->m );
|
||||
else
|
||||
matmul4( dest->m, a->m, b->m );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_matrix_mul_floats( GLmatrix *dest, const GLfloat *m )
|
||||
{
|
||||
dest->flags |= (MAT_FLAG_GENERAL |
|
||||
MAT_DIRTY_TYPE |
|
||||
MAT_DIRTY_INVERSE);
|
||||
|
||||
matmul4( dest->m, dest->m, m );
|
||||
}
|
||||
|
||||
void
|
||||
_math_matrix_set_identity( GLmatrix *mat )
|
||||
{
|
||||
MEMCPY( mat->m, Identity, 16*sizeof(GLfloat) );
|
||||
|
||||
if (mat->inv)
|
||||
MEMCPY( mat->inv, Identity, 16*sizeof(GLfloat) );
|
||||
|
||||
mat->type = MATRIX_IDENTITY;
|
||||
mat->flags &= ~(MAT_DIRTY_FLAGS|
|
||||
MAT_DIRTY_TYPE|
|
||||
MAT_DIRTY_INVERSE);
|
||||
}
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** \name Matrix transpose */
|
||||
/*@{*/
|
||||
|
||||
void
|
||||
_math_transposef( GLfloat to[16], const GLfloat from[16] )
|
||||
|
|
@ -1137,7 +1291,6 @@ _math_transposef( GLfloat to[16], const GLfloat from[16] )
|
|||
to[15] = from[15];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_math_transposed( GLdouble to[16], const GLdouble from[16] )
|
||||
{
|
||||
|
|
@ -1179,3 +1332,6 @@ _math_transposefd( GLfloat to[16], const GLdouble from[16] )
|
|||
to[14] = (GLfloat) from[11];
|
||||
to[15] = (GLfloat) from[15];
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
/* $Id: m_matrix.h,v 1.4 2001/03/12 00:48:41 gareth Exp $ */
|
||||
/**
|
||||
* \file m_matrix.h
|
||||
* \brief Matrix operations.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -24,13 +27,15 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: m_matrix.h,v 1.4.8.1 2003/03/02 00:27:36 jrfonseca Exp $ */
|
||||
|
||||
#ifndef _M_MATRIX_H
|
||||
#define _M_MATRIX_H
|
||||
|
||||
|
||||
|
||||
/* Give symbolic names to some of the entries in the matrix to help
|
||||
/**
|
||||
* Give symbolic names to some of the entries in the matrix to help
|
||||
* out with the rework of the viewport_map as a matrix transform.
|
||||
*/
|
||||
#define MAT_SX 0
|
||||
|
|
@ -40,43 +45,52 @@
|
|||
#define MAT_TY 13
|
||||
#define MAT_TZ 14
|
||||
|
||||
/*
|
||||
* Different kinds of 4x4 transformation matrices:
|
||||
/**
|
||||
* \brief Different kinds of 4x4 transformation matrices.
|
||||
*/
|
||||
#define MATRIX_GENERAL 0 /* general 4x4 matrix */
|
||||
#define MATRIX_IDENTITY 1 /* identity matrix */
|
||||
#define MATRIX_3D_NO_ROT 2 /* ortho projection and others... */
|
||||
#define MATRIX_PERSPECTIVE 3 /* perspective projection matrix */
|
||||
#define MATRIX_2D 4 /* 2-D transformation */
|
||||
#define MATRIX_2D_NO_ROT 5 /* 2-D scale & translate only */
|
||||
#define MATRIX_3D 6 /* 3-D transformation */
|
||||
enum GLmatrixtype {
|
||||
MATRIX_GENERAL = 0, /**< \brief general 4x4 matrix */
|
||||
MATRIX_IDENTITY = 1, /**< \brief identity matrix */
|
||||
MATRIX_3D_NO_ROT = 2, /**< \brief ortho projection and others... */
|
||||
MATRIX_PERSPECTIVE = 3, /**< \brief perspective projection matrix */
|
||||
MATRIX_2D = 4, /**< \brief 2-D transformation */
|
||||
MATRIX_2D_NO_ROT = 5, /**< \brief 2-D scale & translate only */
|
||||
MATRIX_3D = 6, /**< \brief 3-D transformation */
|
||||
} ;
|
||||
|
||||
#define MAT_FLAG_IDENTITY 0
|
||||
#define MAT_FLAG_GENERAL 0x1
|
||||
#define MAT_FLAG_ROTATION 0x2
|
||||
#define MAT_FLAG_TRANSLATION 0x4
|
||||
#define MAT_FLAG_UNIFORM_SCALE 0x8
|
||||
#define MAT_FLAG_GENERAL_SCALE 0x10
|
||||
#define MAT_FLAG_GENERAL_3D 0x20
|
||||
#define MAT_FLAG_PERSPECTIVE 0x40
|
||||
#define MAT_FLAG_SINGULAR 0x80
|
||||
#define MAT_DIRTY_TYPE 0x100
|
||||
#define MAT_DIRTY_FLAGS 0x200
|
||||
#define MAT_DIRTY_INVERSE 0x400
|
||||
#define MAT_FLAG_IDENTITY 0 /**< \brief is an identity matrix flag.
|
||||
* (Not actualy used - the identity
|
||||
* matrix is identified by the abcense
|
||||
/ of all other flags.) */
|
||||
#define MAT_FLAG_GENERAL 0x1 /**< \brief is a general matrix flag */
|
||||
#define MAT_FLAG_ROTATION 0x2 /**< \brief is a rotation matrix flag */
|
||||
#define MAT_FLAG_TRANSLATION 0x4 /**< \brief is a translation matrix flag */
|
||||
#define MAT_FLAG_UNIFORM_SCALE 0x8 /**< \brief is an uniform scaling matrix flag */
|
||||
#define MAT_FLAG_GENERAL_SCALE 0x10 /**< \brief is a general scaling matrix flag */
|
||||
#define MAT_FLAG_GENERAL_3D 0x20 /**< \brief general 3D matrix flag */
|
||||
#define MAT_FLAG_PERSPECTIVE 0x40 /**< \brief is a perspective projection matrix flag */
|
||||
#define MAT_FLAG_SINGULAR 0x80 /**< \brief is a singular matrix flag */
|
||||
#define MAT_DIRTY_TYPE 0x100 /**< \brief matrix type is dirty */
|
||||
#define MAT_DIRTY_FLAGS 0x200 /**< \brief matrix flags are dirty */
|
||||
#define MAT_DIRTY_INVERSE 0x400 /**< \brief matrix inverse is dirty */
|
||||
|
||||
/** \brief angle preserving matrix flags mask */
|
||||
#define MAT_FLAGS_ANGLE_PRESERVING (MAT_FLAG_ROTATION | \
|
||||
MAT_FLAG_TRANSLATION | \
|
||||
MAT_FLAG_UNIFORM_SCALE)
|
||||
|
||||
/** \brief length preserving matrix flags mask */
|
||||
#define MAT_FLAGS_LENGTH_PRESERVING (MAT_FLAG_ROTATION | \
|
||||
MAT_FLAG_TRANSLATION)
|
||||
|
||||
/** \brief 3D (non-perspective) matrix flags mask */
|
||||
#define MAT_FLAGS_3D (MAT_FLAG_ROTATION | \
|
||||
MAT_FLAG_TRANSLATION | \
|
||||
MAT_FLAG_UNIFORM_SCALE | \
|
||||
MAT_FLAG_GENERAL_SCALE | \
|
||||
MAT_FLAG_GENERAL_3D)
|
||||
|
||||
/** \brief geometry related matrix flags mask */
|
||||
#define MAT_FLAGS_GEOMETRY (MAT_FLAG_GENERAL | \
|
||||
MAT_FLAG_ROTATION | \
|
||||
MAT_FLAG_TRANSLATION | \
|
||||
|
|
@ -86,19 +100,32 @@
|
|||
MAT_FLAG_PERSPECTIVE | \
|
||||
MAT_FLAG_SINGULAR)
|
||||
|
||||
/** \brief dirty matrix flags mask */
|
||||
#define MAT_DIRTY (MAT_DIRTY_TYPE | \
|
||||
MAT_DIRTY_FLAGS | \
|
||||
MAT_DIRTY_INVERSE)
|
||||
|
||||
/**
|
||||
* \brief Test geometry related matrix flags.
|
||||
*
|
||||
* \param mat a pointer to a GLmatrix structure.
|
||||
* \param a flags mask.
|
||||
*
|
||||
* \returns non-zero if all geometry related matrix flags are contained within
|
||||
* the mask, or zero otherwise.
|
||||
*/
|
||||
#define TEST_MAT_FLAGS(mat, a) \
|
||||
((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Matrix.
|
||||
*/
|
||||
typedef struct {
|
||||
GLfloat *m; /* 16-byte aligned */
|
||||
GLfloat *inv; /* optional, 16-byte aligned */
|
||||
GLuint flags;
|
||||
GLuint type; /* one of the MATRIX_* values */
|
||||
GLfloat *m; /**< \brief matrix, 16-byte aligned */
|
||||
GLfloat *inv; /**< \brief optional inverse, 16-byte aligned */
|
||||
GLuint flags; /**< \brief property flags */
|
||||
GLuint type; /**< \brief one of the GLmatrixtype values */
|
||||
} GLmatrix;
|
||||
|
||||
|
||||
|
|
@ -158,9 +185,11 @@ _math_matrix_print( const GLmatrix *m );
|
|||
|
||||
|
||||
|
||||
|
||||
/* Related functions that don't actually operate on GLmatrix structs:
|
||||
/**
|
||||
* \name Related functions that don't actually operate on GLmatrix structs
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
extern void
|
||||
_math_transposef( GLfloat to[16], const GLfloat from[16] );
|
||||
|
||||
|
|
@ -170,7 +199,7 @@ _math_transposed( GLdouble to[16], const GLdouble from[16] );
|
|||
extern void
|
||||
_math_transposefd( GLfloat to[16], const GLdouble from[16] );
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue